From: Greg KH <greg@kroah.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
linux-kernel@vger.kernel.org, kernel@pengutronix.de,
Greg Kroah-Hartman <gregkh@suse.de>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] Driver core: convert platform_{get,set}_drvdata to static inline functions
Date: Fri, 18 Feb 2011 08:15:16 -0800 [thread overview]
Message-ID: <20110218161516.GA16713@kroah.com> (raw)
In-Reply-To: <20110217084705.GA7435@pengutronix.de>
On Thu, Feb 17, 2011 at 09:47:05AM +0100, Uwe Kleine-König wrote:
> Hello,
>
> On Wed, Feb 16, 2011 at 11:23:27PM +0100, Marc Kleine-Budde wrote:
> > This patch converts the macros for platform_{get,set}_drvdata to
> > static inline functions to add typechecking.
> >
> > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> > ---
> > Changes since v1:
> > - remove ugly macro magic, use static inline functions instead
> >
> > include/linux/platform_device.h | 11 +++++++++--
> > 1 files changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
> > index 2e700ec..d96db98 100644
> > --- a/include/linux/platform_device.h
> > +++ b/include/linux/platform_device.h
> > @@ -130,8 +130,15 @@ extern void platform_driver_unregister(struct platform_driver *);
> > extern int platform_driver_probe(struct platform_driver *driver,
> > int (*probe)(struct platform_device *));
> >
> > -#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
> > -#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data))
> > +static inline void *platform_get_drvdata(const struct platform_device *pdev)
> > +{
> > + return dev_get_drvdata(&pdev->dev);
> > +}
> > +
> > +static inline void platform_set_drvdata(struct platform_device *pdev, void *data)
> > +{
> > + dev_set_drvdata(&pdev->dev, data);
> > +}
> Another improvement would be to make dev_set_drvdata and
> platform_set_drvdata return an int (as dev_set_drvdata can fail) (and
> then maybe mark it __must_check).
But dev_set_drvdata() does not return anything, so you would also have
to change that function first.
thanks,
greg k-h
prev parent reply other threads:[~2011-02-18 16:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-16 22:23 Marc Kleine-Budde
2011-02-16 22:56 ` Greg KH
2011-02-17 8:47 ` Uwe Kleine-König
2011-02-18 16:15 ` Greg KH [this message]
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=20110218161516.GA16713@kroah.com \
--to=greg@kroah.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=u.kleine-koenig@pengutronix.de \
/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
Powered by JetHome