Merge tag 'staging-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 Jul 2012 18:14:49 +0000 (11:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 Jul 2012 18:14:49 +0000 (11:14 -0700)
Pull staging tree patches from Greg Kroah-Hartman:
 "Here's the big staging tree merge for the 3.6-rc1 merge window.

  There are some patches in here outside of drivers/staging/, notibly
  the iio code (which is still stradeling the staging / not staging
  boundry), the pstore code, and the tracing code.  All of these have
  gotten acks from the various subsystem maintainers to be included in
  this tree.  The pstore and tracing patches are related, and are coming
  here as they replace one of the android staging drivers.

  Otherwise, the normal staging mess.  Lots of cleanups and a few new
  drivers (some iio drivers, and the large csr wireless driver
  abomination.)

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
Fixed up trivial conflicts in drivers/staging/comedi/drivers/s626.h and
drivers/staging/gdm72xx/netlink_k.c

* tag 'staging-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1108 commits)
  staging: csr: delete a bunch of unused library functions
  staging: csr: remove csr_utf16.c
  staging: csr: remove csr_pmem.h
  staging: csr: remove CsrPmemAlloc
  staging: csr: remove CsrPmemFree()
  staging: csr: remove CsrMemAllocDma()
  staging: csr: remove CsrMemCalloc()
  staging: csr: remove CsrMemAlloc()
  staging: csr: remove CsrMemFree() and CsrMemFreeDma()
  staging: csr: remove csr_util.h
  staging: csr: remove CsrOffSetOf()
  stating: csr: remove unneeded #includes in csr_util.c
  staging: csr: make CsrUInt16ToHex static
  staging: csr: remove CsrMemCpy()
  staging: csr: remove CsrStrLen()
  staging: csr: remove CsrVsnprintf()
  staging: csr: remove CsrStrDup
  staging: csr: remove CsrStrChr()
  staging: csr: remove CsrStrNCmp
  staging: csr: remove CsrStrCmp
  ...

1  2 
drivers/staging/comedi/drivers/s626.h
drivers/staging/gdm72xx/netlink_k.c
drivers/staging/nvec/nvec.c
include/linux/Kbuild
kernel/trace/trace.c

     comedi_do_insn(cf,&insn); // executing configuration
  */
  
- #ifdef _DEBUG_
- #define DEBUG(...);        printk(__VA_ARGS__);
- #else
- #define DEBUG(...)
- #endif
  #if !defined(TRUE)
  #define TRUE    (1)
  #endif
  #define FALSE   (0)
  #endif
  
- #if !defined(INLINE)
- #define INLINE static __inline
- #endif
 -#include<linux/slab.h>
 +#include <linux/slab.h>
  
  #define S626_SIZE 0x0200
  #define SIZEOF_ADDRESS_SPACE          0x0200
@@@ -11,7 -11,6 +11,6 @@@
   * GNU General Public License for more details.
   */
  
- #include <linux/version.h>
  #include <linux/module.h>
  #include <linux/etherdevice.h>
  #include <linux/netlink.h>
@@@ -88,15 -87,13 +87,15 @@@ struct sock *netlink_init(int unit, voi
                                                void *msg, int len))
  {
        struct sock *sock;
 +      struct netlink_kernel_cfg cfg = {
 +              .input  = netlink_rcv,
 +      };
  
  #if !defined(DEFINE_MUTEX)
        init_MUTEX(&netlink_mutex);
  #endif
  
 -      sock = netlink_kernel_create(&init_net, unit, 0, netlink_rcv, NULL,
 -                                      THIS_MODULE);
 +      sock = netlink_kernel_create(&init_net, unit, THIS_MODULE, &cfg);
  
        if (sock)
                rcv_cb = cb;
@@@ -134,6 -131,7 +133,6 @@@ int netlink_send(struct sock *sock, in
                kfree_skb(skb);
                return -EMSGSIZE;
        }
 -
        memcpy(nlmsg_data(nlh), msg, len);
  
        NETLINK_CB(skb).pid = 0;
                }
                ret = 0;
        }
 -
        return ret;
  }
@@@ -97,7 -97,7 +97,7 @@@ static struct mfd_cell nvec_devices[] 
                .id = 2,
        },
        {
-               .name = "nvec-leds",
+               .name = "nvec-paz00",
                .id = 1,
        },
  };
@@@ -127,12 -127,14 +127,14 @@@ EXPORT_SYMBOL_GPL(nvec_register_notifie
  static int nvec_status_notifier(struct notifier_block *nb,
                                unsigned long event_type, void *data)
  {
+       struct nvec_chip *nvec = container_of(nb, struct nvec_chip,
+                                               nvec_status_notifier);
        unsigned char *msg = (unsigned char *)data;
  
        if (event_type != NVEC_CNTL)
                return NOTIFY_DONE;
  
-       printk(KERN_WARNING "unhandled msg type %ld\n", event_type);
+       dev_warn(nvec->dev, "unhandled msg type %ld\n", event_type);
        print_hex_dump(KERN_WARNING, "payload: ", DUMP_PREFIX_NONE, 16, 1,
                msg, msg[1] + 2, true);
  
@@@ -675,7 -677,7 +677,7 @@@ static void tegra_init_i2c_slave(struc
  {
        u32 val;
  
 -      clk_enable(nvec->i2c_clk);
 +      clk_prepare_enable(nvec->i2c_clk);
  
        tegra_periph_reset_assert(nvec->i2c_clk);
        udelay(2);
  
        enable_irq(nvec->irq);
  
 -      clk_disable(nvec->i2c_clk);
 +      clk_disable_unprepare(nvec->i2c_clk);
  }
  
+ #ifdef CONFIG_PM_SLEEP
  static void nvec_disable_i2c_slave(struct nvec_chip *nvec)
  {
        disable_irq(nvec->irq);
        writel(I2C_SL_NEWSL | I2C_SL_NACK, nvec->base + I2C_SL_CNFG);
 -      clk_disable(nvec->i2c_clk);
 +      clk_disable_unprepare(nvec->i2c_clk);
  }
+ #endif
  
  static void nvec_power_off(void)
  {
@@@ -719,10 -723,9 +723,9 @@@ static int __devinit tegra_nvec_probe(s
        struct nvec_chip *nvec;
        struct nvec_msg *msg;
        struct resource *res;
-       struct resource *iomem;
        void __iomem *base;
  
-       nvec = kzalloc(sizeof(struct nvec_chip), GFP_KERNEL);
+       nvec = devm_kzalloc(&pdev->dev, sizeof(struct nvec_chip), GFP_KERNEL);
        if (nvec == NULL) {
                dev_err(&pdev->dev, "failed to reserve memory\n");
                return -ENOMEM;
                nvec->gpio = of_get_named_gpio(nvec->dev->of_node, "request-gpios", 0);
                if (nvec->gpio < 0) {
                        dev_err(&pdev->dev, "no gpio specified");
-                       goto failed;
+                       return -ENODEV;
                }
                if (of_property_read_u32(nvec->dev->of_node, "slave-addr", &nvec->i2c_addr)) {
                        dev_err(&pdev->dev, "no i2c address specified");
-                       goto failed;
+                       return -ENODEV;
                }
        } else {
                dev_err(&pdev->dev, "no platform data\n");
-               goto failed;
+               return -ENODEV;
        }
  
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
                return -ENODEV;
        }
  
-       iomem = request_mem_region(res->start, resource_size(res), pdev->name);
-       if (!iomem) {
-               dev_err(&pdev->dev, "I2C region already claimed\n");
-               return -EBUSY;
-       }
-       base = ioremap(iomem->start, resource_size(iomem));
+       base = devm_request_and_ioremap(&pdev->dev, res);
        if (!base) {
                dev_err(&pdev->dev, "Can't ioremap I2C region\n");
                return -ENOMEM;
        res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
        if (!res) {
                dev_err(&pdev->dev, "no irq resource?\n");
-               ret = -ENODEV;
-               goto err_iounmap;
+               return -ENODEV;
        }
  
        i2c_clk = clk_get_sys("tegra-i2c.2", NULL);
        if (IS_ERR(i2c_clk)) {
                dev_err(nvec->dev, "failed to get controller clock\n");
-               goto err_iounmap;
+               return -ENODEV;
        }
  
        nvec->base = base;
        INIT_WORK(&nvec->tx_work, nvec_request_master);
        nvec->wq = alloc_workqueue("nvec", WQ_NON_REENTRANT, 2);
  
-       err = gpio_request_one(nvec->gpio, GPIOF_OUT_INIT_HIGH, "nvec gpio");
+       err = devm_gpio_request_one(&pdev->dev, nvec->gpio, GPIOF_OUT_INIT_HIGH,
+                                       "nvec gpio");
        if (err < 0) {
                dev_err(nvec->dev, "couldn't request gpio\n");
-               goto failed;
+               destroy_workqueue(nvec->wq);
+               return -ENODEV;
        }
  
-       err = request_irq(nvec->irq, nvec_interrupt, 0, "nvec", nvec);
+       err = devm_request_irq(&pdev->dev, nvec->irq, nvec_interrupt, 0,
+                               "nvec", nvec);
        if (err) {
                dev_err(nvec->dev, "couldn't request irq\n");
-               goto failed;
+               destroy_workqueue(nvec->wq);
+               return -ENODEV;
        }
        disable_irq(nvec->irq);
  
        tegra_init_i2c_slave(nvec);
  
 -      clk_enable(i2c_clk);
 +      clk_prepare_enable(i2c_clk);
  
  
        /* enable event reporting */
        nvec_write_async(nvec, "\x01\x01\x01\x00\x00\x80\x00", 7);
  
        return 0;
- err_iounmap:
-       iounmap(base);
- failed:
-       kfree(nvec);
-       return -ENOMEM;
  }
  
  static int __devexit tegra_nvec_remove(struct platform_device *pdev)
  
        nvec_write_async(nvec, EC_DISABLE_EVENT_REPORTING, 3);
        mfd_remove_devices(nvec->dev);
-       free_irq(nvec->irq, &nvec_interrupt);
-       iounmap(nvec->base);
-       gpio_free(nvec->gpio);
        destroy_workqueue(nvec->wq);
-       kfree(nvec);
  
        return 0;
  }
  
- #ifdef CONFIG_PM
- static int tegra_nvec_suspend(struct platform_device *pdev, pm_message_t state)
+ #ifdef CONFIG_PM_SLEEP
+ static int nvec_suspend(struct device *dev)
  {
+       struct platform_device *pdev = to_platform_device(dev);
        struct nvec_chip *nvec = platform_get_drvdata(pdev);
        struct nvec_msg *msg;
  
        return 0;
  }
  
- static int tegra_nvec_resume(struct platform_device *pdev)
+ static int nvec_resume(struct device *dev)
  {
+       struct platform_device *pdev = to_platform_device(dev);
        struct nvec_chip *nvec = platform_get_drvdata(pdev);
  
        dev_dbg(nvec->dev, "resuming\n");
  
        return 0;
  }
- #else
- #define tegra_nvec_suspend NULL
- #define tegra_nvec_resume NULL
  #endif
  
+ static const SIMPLE_DEV_PM_OPS(nvec_pm_ops, nvec_suspend, nvec_resume);
  /* Match table for of_platform binding */
  static const struct of_device_id nvidia_nvec_of_match[] __devinitconst = {
        { .compatible = "nvidia,nvec", },
@@@ -920,21 -909,15 +909,15 @@@ MODULE_DEVICE_TABLE(of, nvidia_nvec_of_
  static struct platform_driver nvec_device_driver = {
        .probe   = tegra_nvec_probe,
        .remove  = __devexit_p(tegra_nvec_remove),
-       .suspend = tegra_nvec_suspend,
-       .resume  = tegra_nvec_resume,
        .driver  = {
                .name = "nvec",
                .owner = THIS_MODULE,
+               .pm = &nvec_pm_ops,
                .of_match_table = nvidia_nvec_of_match,
        }
  };
  
- static int __init tegra_nvec_init(void)
- {
-       return platform_driver_register(&nvec_device_driver);
- }
- module_init(tegra_nvec_init);
+ module_platform_driver(nvec_device_driver);
  
  MODULE_ALIAS("platform:nvec");
  MODULE_DESCRIPTION("NVIDIA compliant embedded controller interface");
diff --combined include/linux/Kbuild
@@@ -183,7 -183,6 +183,6 @@@ header-y += if_ppp.
  header-y += if_pppol2tp.h
  header-y += if_pppox.h
  header-y += if_slip.h
- header-y += if_strip.h
  header-y += if_team.h
  header-y += if_tun.h
  header-y += if_tunnel.h
@@@ -376,7 -375,6 +375,7 @@@ header-y += tty.
  header-y += types.h
  header-y += udf_fs_i.h
  header-y += udp.h
 +header-y += uhid.h
  header-y += uinput.h
  header-y += uio.h
  header-y += ultrasound.h
diff --combined kernel/trace/trace.c
@@@ -830,8 -830,6 +830,8 @@@ int register_tracer(struct tracer *type
                current_trace = saved_tracer;
                if (ret) {
                        printk(KERN_CONT "FAILED!\n");
 +                      /* Add the warning after printing 'FAILED' */
 +                      WARN_ON(1);
                        goto out;
                }
                /* Only reset on passing, to avoid touching corrupted buffers */
@@@ -1710,11 -1708,9 +1710,11 @@@ EXPORT_SYMBOL_GPL(trace_vprintk)
  
  static void trace_iterator_increment(struct trace_iterator *iter)
  {
 +      struct ring_buffer_iter *buf_iter = trace_buffer_iter(iter, iter->cpu);
 +
        iter->idx++;
 -      if (iter->buffer_iter[iter->cpu])
 -              ring_buffer_read(iter->buffer_iter[iter->cpu], NULL);
 +      if (buf_iter)
 +              ring_buffer_read(buf_iter, NULL);
  }
  
  static struct trace_entry *
@@@ -1722,7 -1718,7 +1722,7 @@@ peek_next_entry(struct trace_iterator *
                unsigned long *lost_events)
  {
        struct ring_buffer_event *event;
 -      struct ring_buffer_iter *buf_iter = iter->buffer_iter[cpu];
 +      struct ring_buffer_iter *buf_iter = trace_buffer_iter(iter, cpu);
  
        if (buf_iter)
                event = ring_buffer_iter_peek(buf_iter, ts);
@@@ -1860,10 -1856,10 +1860,10 @@@ void tracing_iter_reset(struct trace_it
  
        tr->data[cpu]->skipped_entries = 0;
  
 -      if (!iter->buffer_iter[cpu])
 +      buf_iter = trace_buffer_iter(iter, cpu);
 +      if (!buf_iter)
                return;
  
 -      buf_iter = iter->buffer_iter[cpu];
        ring_buffer_iter_reset(buf_iter);
  
        /*
@@@ -2209,15 -2205,13 +2209,15 @@@ static enum print_line_t print_bin_fmt(
  
  int trace_empty(struct trace_iterator *iter)
  {
 +      struct ring_buffer_iter *buf_iter;
        int cpu;
  
        /* If we are looking at one CPU buffer, only check that one */
        if (iter->cpu_file != TRACE_PIPE_ALL_CPU) {
                cpu = iter->cpu_file;
 -              if (iter->buffer_iter[cpu]) {
 -                      if (!ring_buffer_iter_empty(iter->buffer_iter[cpu]))
 +              buf_iter = trace_buffer_iter(iter, cpu);
 +              if (buf_iter) {
 +                      if (!ring_buffer_iter_empty(buf_iter))
                                return 0;
                } else {
                        if (!ring_buffer_empty_cpu(iter->tr->buffer, cpu))
        }
  
        for_each_tracing_cpu(cpu) {
 -              if (iter->buffer_iter[cpu]) {
 -                      if (!ring_buffer_iter_empty(iter->buffer_iter[cpu]))
 +              buf_iter = trace_buffer_iter(iter, cpu);
 +              if (buf_iter) {
 +                      if (!ring_buffer_iter_empty(buf_iter))
                                return 0;
                } else {
                        if (!ring_buffer_empty_cpu(iter->tr->buffer, cpu))
@@@ -2388,11 -2381,6 +2388,11 @@@ __tracing_open(struct inode *inode, str
        if (!iter)
                return ERR_PTR(-ENOMEM);
  
 +      iter->buffer_iter = kzalloc(sizeof(*iter->buffer_iter) * num_possible_cpus(),
 +                                  GFP_KERNEL);
 +      if (!iter->buffer_iter)
 +              goto release;
 +
        /*
         * We make a copy of the current tracer to avoid concurrent
         * changes on it while we are reading.
   fail:
        mutex_unlock(&trace_types_lock);
        kfree(iter->trace);
 +      kfree(iter->buffer_iter);
 +release:
        seq_release_private(inode, file);
        return ERR_PTR(-ENOMEM);
  }
@@@ -2495,7 -2481,6 +2495,7 @@@ static int tracing_release(struct inod
        mutex_destroy(&iter->mutex);
        free_cpumask_var(iter->started);
        kfree(iter->trace);
 +      kfree(iter->buffer_iter);
        seq_release_private(inode, file);
        return 0;
  }
@@@ -3187,10 -3172,10 +3187,10 @@@ static int tracing_set_tracer(const cha
        }
        destroy_trace_option_files(topts);
  
-       current_trace = t;
+       current_trace = &nop_trace;
  
-       topts = create_trace_option_files(current_trace);
-       if (current_trace->use_max_tr) {
+       topts = create_trace_option_files(t);
+       if (t->use_max_tr) {
                int cpu;
                /* we need to make per cpu buffer sizes equivalent */
                for_each_tracing_cpu(cpu) {
                        goto out;
        }
  
+       current_trace = t;
        trace_branch_enable(tr);
   out:
        mutex_unlock(&trace_types_lock);
@@@ -3624,7 -3610,6 +3625,7 @@@ static ssize_t tracing_splice_read_pipe
                .pages          = pages_def,
                .partial        = partial_def,
                .nr_pages       = 0, /* This gets updated below. */
 +              .nr_pages_max   = PIPE_DEF_BUFFERS,
                .flags          = flags,
                .ops            = &tracing_pipe_buf_ops,
                .spd_release    = tracing_spd_release_pipe,
  
        ret = splice_to_pipe(pipe, &spd);
  out:
 -      splice_shrink_spd(pipe, &spd);
 +      splice_shrink_spd(&spd);
        return ret;
  
  out_err:
@@@ -4247,7 -4232,6 +4248,7 @@@ tracing_buffers_splice_read(struct fil
        struct splice_pipe_desc spd = {
                .pages          = pages_def,
                .partial        = partial_def,
 +              .nr_pages_max   = PIPE_DEF_BUFFERS,
                .flags          = flags,
                .ops            = &buffer_pipe_buf_ops,
                .spd_release    = buffer_spd_release,
        }
  
        ret = splice_to_pipe(pipe, &spd);
 -      splice_shrink_spd(pipe, &spd);
 +      splice_shrink_spd(&spd);
  out:
        return ret;
  }