aboutsummaryrefslogtreecommitdiff
path: root/drivers/iio/light/adjd_s311.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-03 11:37:57 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-03 11:37:57 -0700
commit751144271f4b63d5de9005ea4e5e6e5c7c6fd629 (patch)
tree2e5cb8223d4f6146f01f123a9f33cf6d468205c6 /drivers/iio/light/adjd_s311.c
parent542a086ac72fb193cbc1b996963a572269e57743 (diff)
parent91121c103ae93ef117e58712786864270d7f488e (diff)
Merge tag 'staging-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree merge from Greg KH: "Here's the bit staging tree pull request for 3.12-rc1. Lots of staging driver updates, and fixes. Lustre is finally enabled in the build, and lots of cleanup started happening in it. There's a new wireless driver in here, and 2 new TTY drivers, which cause the overall lines added/removed to be quite large on the "added" side. The IIO driver updates are also coming through here, as they are tied to the staging iio drivers" * tag 'staging-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (942 commits) staging: dwc2: make dwc2_core_params documentation more complete staging: dwc2: validate the value for phy_utmi_width staging: dwc2: interpret all hwcfg and related register at init time staging: dwc2: properly mask the GRXFSIZ register staging: dwc2: remove redundant register reads staging: dwc2: re-use hptxfsiz variable staging: dwc2: simplify debug output in dwc_hc_init staging: dwc2: add missing shift staging: dwc2: simplify register shift expressions staging: dwc2: only read the snpsid register once staging: dwc2: unshift non-bool register value constants staging: dwc2: fix off-by-one in check for max_packet_count parameter staging: dwc2: remove specific fifo size constants Staging:BCM:DDRInit.c:Renaming __FUNCTION__ staging: bcm: remove Version.h file. staging: rtl8188eu: off by one in rtw_set_802_11_add_wep() staging: r8188eu: copying one byte too much staging: rtl8188eu: || vs && typo staging: r8188eu: off by one bugs staging: crystalhd: Resolve sparse 'different base types' warnings. ...
Diffstat (limited to 'drivers/iio/light/adjd_s311.c')
-rw-r--r--drivers/iio/light/adjd_s311.c43
1 files changed, 15 insertions, 28 deletions
diff --git a/drivers/iio/light/adjd_s311.c b/drivers/iio/light/adjd_s311.c
index c1cd5698b8a..23cff798598 100644
--- a/drivers/iio/light/adjd_s311.c
+++ b/drivers/iio/light/adjd_s311.c
@@ -37,22 +37,14 @@
#define ADJD_S311_CAP_GREEN 0x07
#define ADJD_S311_CAP_BLUE 0x08
#define ADJD_S311_CAP_CLEAR 0x09
-#define ADJD_S311_INT_RED_LO 0x0a
-#define ADJD_S311_INT_RED_HI 0x0b
-#define ADJD_S311_INT_GREEN_LO 0x0c
-#define ADJD_S311_INT_GREEN_HI 0x0d
-#define ADJD_S311_INT_BLUE_LO 0x0e
-#define ADJD_S311_INT_BLUE_HI 0x0f
-#define ADJD_S311_INT_CLEAR_LO 0x10
-#define ADJD_S311_INT_CLEAR_HI 0x11
-#define ADJD_S311_DATA_RED_LO 0x40
-#define ADJD_S311_DATA_RED_HI 0x41
-#define ADJD_S311_DATA_GREEN_LO 0x42
-#define ADJD_S311_DATA_GREEN_HI 0x43
-#define ADJD_S311_DATA_BLUE_LO 0x44
-#define ADJD_S311_DATA_BLUE_HI 0x45
-#define ADJD_S311_DATA_CLEAR_LO 0x46
-#define ADJD_S311_DATA_CLEAR_HI 0x47
+#define ADJD_S311_INT_RED 0x0a
+#define ADJD_S311_INT_GREEN 0x0c
+#define ADJD_S311_INT_BLUE 0x0e
+#define ADJD_S311_INT_CLEAR 0x10
+#define ADJD_S311_DATA_RED 0x40
+#define ADJD_S311_DATA_GREEN 0x42
+#define ADJD_S311_DATA_BLUE 0x44
+#define ADJD_S311_DATA_CLEAR 0x46
#define ADJD_S311_OFFSET_RED 0x48
#define ADJD_S311_OFFSET_GREEN 0x49
#define ADJD_S311_OFFSET_BLUE 0x4a
@@ -73,8 +65,8 @@ enum adjd_s311_channel_idx {
IDX_RED, IDX_GREEN, IDX_BLUE, IDX_CLEAR
};
-#define ADJD_S311_DATA_REG(chan) (ADJD_S311_DATA_RED_LO + (chan) * 2)
-#define ADJD_S311_INT_REG(chan) (ADJD_S311_INT_RED_LO + (chan) * 2)
+#define ADJD_S311_DATA_REG(chan) (ADJD_S311_DATA_RED + (chan) * 2)
+#define ADJD_S311_INT_REG(chan) (ADJD_S311_INT_RED + (chan) * 2)
#define ADJD_S311_CAP_REG(chan) (ADJD_S311_CAP_RED + (chan))
static int adjd_s311_req_data(struct iio_dev *indio_dev)
@@ -294,11 +286,10 @@ static int adjd_s311_probe(struct i2c_client *client,
struct iio_dev *indio_dev;
int err;
- indio_dev = iio_device_alloc(sizeof(*data));
- if (indio_dev == NULL) {
- err = -ENOMEM;
- goto exit;
- }
+ 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);
data->client = client;
@@ -313,7 +304,7 @@ static int adjd_s311_probe(struct i2c_client *client,
err = iio_triggered_buffer_setup(indio_dev, NULL,
adjd_s311_trigger_handler, NULL);
if (err < 0)
- goto exit_free_device;
+ return err;
err = iio_device_register(indio_dev);
if (err)
@@ -325,9 +316,6 @@ static int adjd_s311_probe(struct i2c_client *client,
exit_unreg_buffer:
iio_triggered_buffer_cleanup(indio_dev);
-exit_free_device:
- iio_device_free(indio_dev);
-exit:
return err;
}
@@ -339,7 +327,6 @@ static int adjd_s311_remove(struct i2c_client *client)
iio_device_unregister(indio_dev);
iio_triggered_buffer_cleanup(indio_dev);
kfree(data->buffer);
- iio_device_free(indio_dev);
return 0;
}