From: Jonathan Cameron <jic23@cam.ac.uk>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 2/2] iio:trigger: Use to_iio_trigger() instead of dev_get_drvdata()
Date: Thu, 21 Jun 2012 15:20:00 +0100 [thread overview]
Message-ID: <4FE32D90.3000907@cam.ac.uk> (raw)
In-Reply-To: <1340037978-16915-2-git-send-email-lars@metafoo.de>
On 6/18/2012 5:46 PM, Lars-Peter Clausen wrote:
> Use to_iio_trigger(dev) instead of dev_get_drvdata(dev). Both will return the
> trigger which belongs to the device, but the the first on is a bit more
> lightweight.
>
> Since this is the last location where we used dev_get_drvdata() for retrieving
> the trigger there is no need anymore to assign the the trigger to the devices
> drvdata, so we can remove that as well.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/iio/industrialio-trigger.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> index 0f582df..ec653fb 100644
> --- a/drivers/iio/industrialio-trigger.c
> +++ b/drivers/iio/industrialio-trigger.c
> @@ -45,7 +45,7 @@ static ssize_t iio_trigger_read_name(struct device *dev,
> struct device_attribute *attr,
> char *buf)
> {
> - struct iio_trigger *trig = dev_get_drvdata(dev);
> + struct iio_trigger *trig = to_iio_trigger(dev);
> return sprintf(buf, "%s\n", trig->name);
> }
>
> @@ -436,7 +436,6 @@ struct iio_trigger *iio_trigger_alloc(const char *fmt, ...)
> trig->dev.type = &iio_trig_type;
> trig->dev.bus = &iio_bus_type;
> device_initialize(&trig->dev);
> - dev_set_drvdata(&trig->dev, (void *)trig);
>
> mutex_init(&trig->pool_lock);
> trig->subirq_base
>
next prev parent reply other threads:[~2012-06-21 14:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 16:46 [PATCH 1/2] staging:iio:trigger: Use to_iio_trigger() instead of dev_get_drvdata() Lars-Peter Clausen
2012-06-18 16:46 ` [PATCH 2/2] iio:trigger: " Lars-Peter Clausen
2012-06-21 14:20 ` Jonathan Cameron [this message]
2012-06-21 14:19 ` [PATCH 1/2] staging:iio:trigger: " Jonathan Cameron
-- strict thread matches above, loose matches on Subject: below --
2012-06-21 17:10 Lars-Peter Clausen
2012-06-21 17:11 ` [PATCH 2/2] iio:trigger: " 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=4FE32D90.3000907@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.