From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Marek Vasut <marex@denx.de>,
Fabio Estevam <fabio.estevam@nxp.com>,
Juergen Borleis <jbe@pengutronix.de>,
linux-iio@vger.kernel.org, linux-input@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH RFT V2 1/3] iio: mxs-lradc: simplify TS registration
Date: Thu, 21 Apr 2016 14:06:04 -0700 [thread overview]
Message-ID: <20160421210604.GB25466@dtor-ws> (raw)
In-Reply-To: <1461269478-449-2-git-send-email-stefan.wahren@i2se.com>
On Thu, Apr 21, 2016 at 08:11:16PM +0000, Stefan Wahren wrote:
> This patch simplifies the TS registration of mxs-lradc by
> using devm_input_allocate_device.
>
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> ---
> drivers/iio/adc/mxs-lradc.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c
> index ad26da1..223650b 100644
> --- a/drivers/iio/adc/mxs-lradc.c
> +++ b/drivers/iio/adc/mxs-lradc.c
> @@ -1120,12 +1120,11 @@ static int mxs_lradc_ts_register(struct mxs_lradc *lradc)
> {
> struct input_dev *input;
> struct device *dev = lradc->dev;
> - int ret;
>
> if (!lradc->use_touchscreen)
> return 0;
>
> - input = input_allocate_device();
> + input = devm_input_allocate_device(dev);
Also please drop "input->dev.parent = dev;" below.
> if (!input)
> return -ENOMEM;
>
> @@ -1146,11 +1145,8 @@ static int mxs_lradc_ts_register(struct mxs_lradc *lradc)
>
> lradc->ts_input = input;
> input_set_drvdata(input, lradc);
> - ret = input_register_device(input);
> - if (ret)
> - input_free_device(lradc->ts_input);
>
> - return ret;
> + return input_register_device(input);
> }
>
> static void mxs_lradc_ts_unregister(struct mxs_lradc *lradc)
> @@ -1159,7 +1155,6 @@ static void mxs_lradc_ts_unregister(struct mxs_lradc *lradc)
> return;
>
> mxs_lradc_disable_ts(lradc);
I do not think this is needed, since mxs_lradc_ts_close() does this for
us (and it will be called automatically if input device is open at
unregistration time), and if you remove this you can remove
mxs_lradc_ts_unregister() altogether.
> - input_unregister_device(lradc->ts_input);
> }
>
> /*
> --
> 1.7.9.5
>
Thanks.
--
Dmitry
next prev parent reply other threads:[~2016-04-21 21:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-21 20:11 [PATCH RFT V2 0/3] iio: mxs-lradc: implement PM ops Stefan Wahren
2016-04-21 20:11 ` [PATCH RFT V2 1/3] iio: mxs-lradc: simplify TS registration Stefan Wahren
[not found] ` <1461269478-449-2-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2016-04-21 20:39 ` Marek Vasut
2016-04-21 21:06 ` Dmitry Torokhov [this message]
[not found] ` <1461269478-449-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2016-04-21 20:11 ` [PATCH RFT V2 2/3] iio: mxs-lradc: disable only masked channels in mxs_lradc_hw_stop Stefan Wahren
[not found] ` <1461269478-449-3-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2016-04-21 20:44 ` Marek Vasut
2016-04-21 20:11 ` [PATCH RFT V2 3/3] iio: mxs-lradc: implement suspend/resume support Stefan Wahren
[not found] ` <1461269478-449-4-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2016-04-21 20:45 ` Marek Vasut
[not found] ` <57193C01.20709-ynQEQJNshbs@public.gmane.org>
2016-04-22 13:57 ` Stefan Wahren
2016-04-22 15:47 ` Marek Vasut
2016-04-21 21:08 ` Dmitry Torokhov
2016-04-22 13:32 ` Stefan Wahren
[not found] ` <571A27FC.4030301-eS4NqCHxEME@public.gmane.org>
2016-04-25 21:14 ` Dmitry Torokhov
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=20160421210604.GB25466@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=fabio.estevam@nxp.com \
--cc=jbe@pengutronix.de \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=marex@denx.de \
--cc=pmeerw@pmeerw.net \
--cc=stefan.wahren@i2se.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;
as well as URLs for NNTP newsgroup(s).