From: Jonathan Cameron <jic23@kernel.org>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-iio@vger.kernel.org, lars@metafoo.de
Subject: Re: [PATCH 02/32] iio: accel: kxsd9: Use devm_iio_device_register
Date: Wed, 25 Sep 2013 21:45:19 +0100 [thread overview]
Message-ID: <52434B5F.4020303@kernel.org> (raw)
In-Reply-To: <1380106208-6948-3-git-send-email-sachin.kamat@linaro.org>
On 09/25/13 11:49, Sachin Kamat wrote:
> devm_iio_device_register simplifies the code.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Saddly what this really shows is that this driver is not doing some
cleanup that it ideally would be. The device has a low power mode.
At the very least, one would expect the device to be put into that state
when the kernel calls the remove.
Can't really blame anyone else for this thought can I :)
For reference, ctrl reg B bit 6 is the device enable. Set it to 0 and it goes
into a low power mode.
This is particularly ugly given there is a perfectly good defined
constant for the ctrl reg that isn't even used in the power up function.
I was young and ignorant ;)
I suspect it is a rare device where there is nothing that 'should' be done
after the unregister has occured.
Note that we have even started seeing the power supply of devices being controlled
by optional regulators for boards where they may not necessarily be getting any
power at all. I suspect this will become more common as time goes on.
> ---
> drivers/iio/accel/kxsd9.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
> index 709c132..3048686 100644
> --- a/drivers/iio/accel/kxsd9.c
> +++ b/drivers/iio/accel/kxsd9.c
> @@ -244,20 +244,13 @@ static int kxsd9_probe(struct spi_device *spi)
> spi_setup(spi);
> kxsd9_power_up(st);
>
> - ret = iio_device_register(indio_dev);
> + ret = devm_iio_device_register(&spi->dev, indio_dev);
> if (ret)
> return ret;
>
> return 0;
> }
>
> -static int kxsd9_remove(struct spi_device *spi)
> -{
> - iio_device_unregister(spi_get_drvdata(spi));
> -
> - return 0;
> -}
> -
> static const struct spi_device_id kxsd9_id[] = {
> {"kxsd9", 0},
> { },
> @@ -270,7 +263,6 @@ static struct spi_driver kxsd9_driver = {
> .owner = THIS_MODULE,
> },
> .probe = kxsd9_probe,
> - .remove = kxsd9_remove,
> .id_table = kxsd9_id,
> };
> module_spi_driver(kxsd9_driver);
>
next prev parent reply other threads:[~2013-09-25 19:44 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 10:49 [PATCH Resend 00/32] iio: Introduce devm_iio_device_{register,unregister} Sachin Kamat
2013-09-25 10:49 ` [PATCH 01/32] iio: core: Implement devm_iio_device_{register,unregister} Sachin Kamat
2013-09-26 20:31 ` Lars-Peter Clausen
2013-09-27 3:07 ` Sachin Kamat
2013-09-25 10:49 ` [PATCH 02/32] iio: accel: kxsd9: Use devm_iio_device_register Sachin Kamat
2013-09-25 20:45 ` Jonathan Cameron [this message]
2013-09-25 10:49 ` [PATCH 03/32] iio: adc: mcp3422: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 04/32] iio: adc: twl6030-gpadc: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 05/32] iio: adc: viperboard: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 06/32] iio: dac: ad5421: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 07/32] iio: dac: ad5755: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 08/32] iio: dac: max517: " Sachin Kamat
2013-09-25 21:00 ` Jonathan Cameron
2013-09-25 10:49 ` [PATCH 09/32] iio: dac: mcp4725: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 10/32] iio: gyro: adis16130: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 11/32] iio: gyro: adxrs450: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 12/32] iio: light: vcnl4000: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 13/32] staging: iio: adis16220: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 14/32] staging: iio: ad7816: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 15/32] staging: iio: lpc32xx_adc: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 16/32] staging: iio: addac: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 17/32] staging: iio: ad7150: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 18/32] staging: iio: ad7746: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 19/32] staging: iio: ad5930: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 20/32] staging: iio: ad9850: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 21/32] staging: iio: ad9852: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 22/32] staging: iio: ad9910: " Sachin Kamat
2013-09-25 10:49 ` [PATCH 23/32] staging: iio: ad9951: " Sachin Kamat
2013-09-25 10:50 ` [PATCH 24/32] staging: iio: adis16060: " Sachin Kamat
2013-09-25 10:50 ` [PATCH 25/32] staging: iio: isl29018: " Sachin Kamat
2013-09-25 10:50 ` [PATCH 26/32] staging: iio: isl29028: " Sachin Kamat
2013-09-25 10:50 ` [PATCH 27/32] staging: iio: tsl2583: " Sachin Kamat
2013-09-25 10:50 ` [PATCH 28/32] staging: iio: tsl2x7x_core: " Sachin Kamat
2013-09-25 16:32 ` Jonathan Cameron
2013-09-25 10:50 ` [PATCH 29/32] staging: iio: ade7854: " Sachin Kamat
2013-09-25 10:50 ` [PATCH 30/32] staging: iio: ad2s1200: " Sachin Kamat
2013-09-25 10:50 ` [PATCH 31/32] staging: iio: ad2s90: " Sachin Kamat
2013-09-25 10:50 ` [PATCH 32/32] staging: iio: ad7152: " Sachin Kamat
2013-09-25 16:24 ` [PATCH Resend 00/32] iio: Introduce devm_iio_device_{register,unregister} Jonathan Cameron
2013-09-25 16:30 ` Lars-Peter Clausen
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=52434B5F.4020303@kernel.org \
--to=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=sachin.kamat@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).