From: Fabio Estevam <festevam@gmail.com>
To: jic23@kernel.org
Cc: linux-iio@vger.kernel.org, srinivas.pandruvada@linux.intel.com,
Fabio Estevam <fabio.estevam@freescale.com>
Subject: [PATCH 2/2] iio: light: hid-sensor-prox: Use devm_iio_device_register()
Date: Fri, 8 May 2015 15:54:01 -0300 [thread overview]
Message-ID: <1431111241-7472-2-git-send-email-festevam@gmail.com> (raw)
In-Reply-To: <1431111241-7472-1-git-send-email-festevam@gmail.com>
From: Fabio Estevam <fabio.estevam@freescale.com>
Using devm_iio_device_register() can make the code shorter and cleaner.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/iio/light/hid-sensor-prox.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 4ed42df..c9f804b 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -306,7 +306,7 @@ static int hid_prox_probe(struct platform_device *pdev)
goto error_unreg_buffer_funcs;
}
- ret = iio_device_register(indio_dev);
+ ret = devm_iio_device_register(&pdev->dev, indio_dev);
if (ret) {
dev_err(&pdev->dev, "device register failed\n");
goto error_remove_trigger;
@@ -319,13 +319,11 @@ static int hid_prox_probe(struct platform_device *pdev)
&prox_state->callbacks);
if (ret < 0) {
dev_err(&pdev->dev, "callback reg failed\n");
- goto error_iio_unreg;
+ return ret;
}
- return ret;
+ return 0;
-error_iio_unreg:
- iio_device_unregister(indio_dev);
error_remove_trigger:
hid_sensor_remove_trigger(&prox_state->common_attributes);
error_unreg_buffer_funcs:
@@ -343,7 +341,6 @@ static int hid_prox_remove(struct platform_device *pdev)
struct prox_state *prox_state = iio_priv(indio_dev);
sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PROX);
- iio_device_unregister(indio_dev);
hid_sensor_remove_trigger(&prox_state->common_attributes);
iio_triggered_buffer_cleanup(indio_dev);
kfree(indio_dev->channels);
--
1.9.1
next prev parent reply other threads:[~2015-05-08 18:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 18:54 [PATCH 1/2] iio: light: hid-sensor-prox: Fit assignment in one line Fabio Estevam
2015-05-08 18:54 ` Fabio Estevam [this message]
2015-05-10 19:31 ` [PATCH 2/2] iio: light: hid-sensor-prox: Use devm_iio_device_register() Jonathan Cameron
2015-05-10 19:34 ` [PATCH 1/2] iio: light: hid-sensor-prox: Fit assignment in one line Jonathan Cameron
2015-06-14 14:08 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431111241-7472-2-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=fabio.estevam@freescale.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox