Merge tag 'iio-for-3.17b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Jun 2014 16:49:28 +0000 (09:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 29 Jun 2014 16:49:28 +0000 (09:49 -0700)
Jonathan writes:

Second round of new drivers and cleanups for IIO in the 3.17 cycle.

New drivers
* mcp4902, mcp4912 and mcp4922 SPI DAC driver.
* max1027, max1029 and max1031 SPI ADC driver.

Cleanups
* cm32181 - use devm APIs to simplify error paths.
* ak8975 - use devm APIs to simplify error paths.
* ad9850 - drop some unused defines and an unnecessary goto.
* hmc5843 - add missing devices to the device id table and the documentation.
* ad9832 - small formatting cleanups.
* sca3000 - hide direct use of the stufftoread element by adding a
    data_available function.  This is a precursor for the addition of buffer
    watermarks to the subsystem but stands as a good cleanup on its own.

1  2 
drivers/iio/adc/Kconfig
drivers/iio/magnetometer/ak8975.c

diff --combined drivers/iio/adc/Kconfig
index a80d23628f1425efaa391e92962c2913b5b863b5,de6d2f41291d6580e9c236bacbb3ba1622758a0b..20a7073f1dd681a9387e378fa4e00c13636b0872
@@@ -118,7 -118,7 +118,7 @@@ config AT91_AD
          Say yes here to build support for Atmel AT91 ADC.
  
  config EXYNOS_ADC
 -      bool "Exynos ADC driver support"
 +      tristate "Exynos ADC driver support"
        depends on ARCH_EXYNOS || (OF && COMPILE_TEST)
        help
          Core support for the ADC block found in the Samsung EXYNOS series
          this resource.
  
  config LP8788_ADC
 -      bool "LP8788 ADC driver"
 +      tristate "LP8788 ADC driver"
        depends on MFD_LP8788
        help
          Say yes here to build support for TI LP8788 ADC.
  
+ config MAX1027
+       tristate "Maxim max1027 ADC driver"
+       depends on SPI
+       select IIO_BUFFER
+       select IIO_TRIGGERED_BUFFER
+       help
+         Say yes here to build support for Maxim SPI ADC models
+         max1027, max1029 and max1031.
  config MAX1363
        tristate "Maxim max1363 ADC driver"
        depends on I2C
index ea08313af0d2f5eeccf654e4081ad1bd5427df6e,a29592cae301403bb4d3b1bd8652429d2b930b5c..a2357921d7618ce30e2320c6327dab9c7c7f1177
@@@ -165,7 -165,7 +165,7 @@@ static int ak8975_setup_irq(struct ak89
        else
                irq = gpio_to_irq(data->eoc_gpio);
  
-       rc = request_irq(irq, ak8975_irq_handler,
+       rc = devm_request_irq(&client->dev, irq, ak8975_irq_handler,
                         IRQF_TRIGGER_RISING | IRQF_ONESHOT,
                         dev_name(&client->dev), data);
        if (rc < 0) {
@@@ -373,6 -373,8 +373,6 @@@ static int ak8975_read_axis(struct iio_
  {
        struct ak8975_data *data = iio_priv(indio_dev);
        struct i2c_client *client = data->client;
 -      u16 meas_reg;
 -      s16 raw;
        int ret;
  
        mutex_lock(&data->lock);
                dev_err(&client->dev, "Read axis data fails\n");
                goto exit;
        }
 -      meas_reg = ret;
  
        mutex_unlock(&data->lock);
  
 -      /* Endian conversion of the measured values. */
 -      raw = (s16) (le16_to_cpu(meas_reg));
 -
        /* Clamp to valid range. */
 -      raw = clamp_t(s16, raw, -4096, 4095);
 -      *val = raw;
 +      *val = clamp_t(s16, ret, -4096, 4095);
        return IIO_VAL_INT;
  
  exit:
@@@ -513,21 -520,21 +513,21 @@@ static int ak8975_probe(struct i2c_clie
        /* We may not have a GPIO based IRQ to scan, that is fine, we will
           poll if so */
        if (gpio_is_valid(eoc_gpio)) {
-               err = gpio_request_one(eoc_gpio, GPIOF_IN, "ak_8975");
+               err = devm_gpio_request_one(&client->dev, eoc_gpio,
+                                                       GPIOF_IN, "ak_8975");
                if (err < 0) {
                        dev_err(&client->dev,
                                "failed to request GPIO %d, error %d\n",
                                                        eoc_gpio, err);
-                       goto exit;
+                       return err;
                }
        }
  
        /* Register with IIO */
-       indio_dev = iio_device_alloc(sizeof(*data));
-       if (indio_dev == NULL) {
-               err = -ENOMEM;
-               goto exit_gpio;
-       }
+       indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
+       if (indio_dev == NULL)
+               return -ENOMEM;
        data = iio_priv(indio_dev);
        i2c_set_clientdata(client, indio_dev);
  
                name = (char *) id->name;
        } else if (ACPI_HANDLE(&client->dev))
                name = ak8975_match_acpi_device(&client->dev, &data->chipset);
-       else {
-               err = -ENOSYS;
-               goto exit_free_iio;
-       }
+       else
+               return -ENOSYS;
        dev_dbg(&client->dev, "Asahi compass chip %s\n", name);
  
        /* Perform some basic start-of-day setup of the device. */
        err = ak8975_setup(client);
        if (err < 0) {
                dev_err(&client->dev, "AK8975 initialization fails\n");
-               goto exit_free_iio;
+               return err;
        }
  
        data->client = client;
        indio_dev->info = &ak8975_info;
        indio_dev->modes = INDIO_DIRECT_MODE;
        indio_dev->name = name;
-       err = iio_device_register(indio_dev);
+       err = devm_iio_device_register(&client->dev, indio_dev);
        if (err < 0)
-               goto exit_free_iio;
-       return 0;
- exit_free_iio:
-       iio_device_free(indio_dev);
-       if (data->eoc_irq)
-               free_irq(data->eoc_irq, data);
- exit_gpio:
-       if (gpio_is_valid(eoc_gpio))
-               gpio_free(eoc_gpio);
- exit:
-       return err;
- }
- static int ak8975_remove(struct i2c_client *client)
- {
-       struct iio_dev *indio_dev = i2c_get_clientdata(client);
-       struct ak8975_data *data = iio_priv(indio_dev);
-       iio_device_unregister(indio_dev);
-       if (data->eoc_irq)
-               free_irq(data->eoc_irq, data);
-       if (gpio_is_valid(data->eoc_gpio))
-               gpio_free(data->eoc_gpio);
-       iio_device_free(indio_dev);
+               return err;
  
        return 0;
  }
@@@ -621,7 -599,6 +592,6 @@@ static struct i2c_driver ak8975_driver 
                .acpi_match_table = ACPI_PTR(ak_acpi_match),
        },
        .probe          = ak8975_probe,
-       .remove         = ak8975_remove,
        .id_table       = ak8975_id,
  };
  module_i2c_driver(ak8975_driver);