Title: [9663] trunk/drivers/staging/iio/dac/max517.c: merge from upstream: Staging: iio: max517.c: Fix client obtainment by using iio_dev_get_devdata()
Revision
9663
Author
vapier
Date
2011-03-01 16:16:56 -0500 (Tue, 01 Mar 2011)

Log Message

merge from upstream: Staging: iio: max517.c: Fix client obtainment by using iio_dev_get_devdata()

From: Roland Stigge <[email protected]>

max517.c: Fix client obtainment by using iio_dev_get_devdata()

This patch uses dev_get_drvdata() and iio_dev_get_devdata() instead of
to_i2c_client() (broken!) to obtain i2c_client data.

Further, some minor typo fixes are included.

Signed-off-by: Roland Stigge <[email protected]>
Acked-by: Jonathan Cameron <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Modified Paths

Diff

Modified: trunk/drivers/staging/iio/dac/max517.c (9662 => 9663)


--- trunk/drivers/staging/iio/dac/max517.c	2011-03-01 21:16:52 UTC (rev 9662)
+++ trunk/drivers/staging/iio/dac/max517.c	2011-03-01 21:16:56 UTC (rev 9663)
@@ -45,6 +45,7 @@
 
 struct max517_data {
 	struct iio_dev		*indio_dev;
+	struct i2c_client	*client;
 	unsigned short		vref_mv[2];
 };
 
@@ -57,7 +58,9 @@
 				 struct device_attribute *attr,
 				 const char *buf, size_t count, int channel)
 {
-	struct i2c_client *client = to_i2c_client(dev);
+	struct iio_dev *dev_info = dev_get_drvdata(dev);
+	struct max517_data *data = ""
+	struct i2c_client *client = data->client;
 	u8 outbuf[4]; /* 1x or 2x command + value */
 	int outbuf_size = 0;
 	int res;
@@ -147,7 +150,7 @@
 }
 static IIO_DEVICE_ATTR(out2_scale, S_IRUGO, max517_show_scale2, NULL, 0);
 
-/* On MAX517 variant, we have two outputs */
+/* On MAX517 variant, we have one output */
 static struct attribute *max517_attributes[] = {
 	&iio_dev_attr_out1_raw.dev_attr.attr,
 	&iio_dev_attr_out1_scale.dev_attr.attr,
@@ -158,7 +161,7 @@
 	.attrs = max517_attributes,
 };
 
-/* On MAX518 and MAX518 variant, we have two outputs */
+/* On MAX518 and MAX519 variant, we have two outputs */
 static struct attribute *max518_attributes[] = {
 	&iio_dev_attr_out1_raw.dev_attr.attr,
 	&iio_dev_attr_out1_scale.dev_attr.attr,
@@ -201,6 +204,8 @@
 
 	i2c_set_clientdata(client, data);
 
+	data->client = client;
+
 	data->indio_dev = iio_allocate_device();
 	if (data->indio_dev == NULL) {
 		err = -ENOMEM;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to