lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110218161516.GA16713@kroah.com>
Date:	Fri, 18 Feb 2011 08:15:16 -0800
From:	Greg KH <greg@...ah.com>
To:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>
Cc:	Marc Kleine-Budde <mkl@...gutronix.de>,
	linux-kernel@...r.kernel.org, kernel@...gutronix.de,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v2] Driver core: convert platform_{get,set}_drvdata to
 static inline functions

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@...gutronix.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ