Title: [8588] trunk/drivers/staging/iio/adc/ad7416.c: Task[#5912] Add GPIO request for convert pin in ad7417/8 driver.
- Revision
- 8588
- Author
- sonicz
- Date
- 2010-04-01 06:58:34 -0400 (Thu, 01 Apr 2010)
Log Message
Task[#5912] Add GPIO request for convert pin in ad7417/8 driver.
Modified Paths
Diff
Modified: trunk/drivers/staging/iio/adc/ad7416.c (8587 => 8588)
--- trunk/drivers/staging/iio/adc/ad7416.c 2010-04-01 10:52:57 UTC (rev 8587)
+++ trunk/drivers/staging/iio/adc/ad7416.c 2010-04-01 10:58:34 UTC (rev 8588)
@@ -633,14 +633,20 @@
if (strcmp(chip->name, "ad7418") == 0) {
chip->channel_mask = AD7418_CHANNEL_MASK;
if (convert_pin) {
- chip->convert_pin = (u16)convert_pin;
- gpio_set_value(chip->convert_pin, 0);
+ ret = gpio_request(convert_pin, chip->name);
+ if (!ret) {
+ chip->convert_pin = (u16)convert_pin;
+ gpio_set_value(chip->convert_pin, 0);
+ }
}
} else if (strcmp(chip->name, "ad7417") == 0) {
chip->channel_mask = AD7417_CHANNEL_MASK;
if (convert_pin) {
- chip->convert_pin = (u16)convert_pin;
- gpio_set_value(chip->convert_pin, 0);
+ ret = gpio_request(convert_pin, chip->name);
+ if (!ret) {
+ chip->convert_pin = (u16)convert_pin;
+ gpio_set_value(chip->convert_pin, 0);
+ }
}
} else
chip->channel_mask = AD7416_CHANNEL_MASK;
@@ -731,6 +737,8 @@
iio_unregister_interrupt_line(indio_dev, 0);
iio_device_unregister(indio_dev);
iio_free_device(chip->indio_dev);
+ if (chip->convert_pin)
+ gpio_free(chip->convert_pin);
kfree(chip);
return 0;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits