From: Greg KH <gregkh@suse.de>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: linuxppc-dev@ozlabs.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] driver core: Add ability for arch code to setup pdev_archdata
Date: Thu, 5 Aug 2010 11:02:11 -0700 [thread overview]
Message-ID: <20100805180211.GA12687@suse.de> (raw)
In-Reply-To: <20100806014351.a3bddf08.sfr@canb.auug.org.au>
On Fri, Aug 06, 2010 at 01:43:51AM +1000, Stephen Rothwell wrote:
> Hi Kumar,
>
> On Thu, 5 Aug 2010 10:15:45 -0500 Kumar Gala <galak@kernel.crashing.org> wrote:
> >
> > --- a/drivers/base/platform.c
> > +++ b/drivers/base/platform.c
> > @@ -19,6 +19,7 @@
> > #include <linux/err.h>
> > #include <linux/slab.h>
> > #include <linux/pm_runtime.h>
> > +#include <asm/platform_device.h>
> >
> > #include "base.h"
> >
> > @@ -170,6 +171,9 @@ struct platform_device *platform_device_alloc(const char *name, int id)
> > pa->pdev.id = id;
> > device_initialize(&pa->pdev.dev);
> > pa->pdev.dev.release = platform_device_release;
> > +#ifdef ARCH_HAS_PDEV_ARCHDATA_SETUP
> > + arch_setup_pdev_archdata(&pa->pdev);
> > +#endif
> > }
> >
> > return pa ? &pa->pdev : NULL;
> > diff --git a/include/asm-generic/platform_device.h b/include/asm-generic/platform_device.h
> > new file mode 100644
> > index 0000000..64806dc
> > --- /dev/null
> > +++ b/include/asm-generic/platform_device.h
> > @@ -0,0 +1,7 @@
> > +#ifndef __ASM_GENERIC_PLATFORM_DEVICE_H_
> > +#define __ASM_GENERIC_PLATFORM_DEVICE_H_
> > +/*
> > + * an architecture can override to define arch_setup_pdev_archdata
> > + */
> > +
> > +#endif /* __ASM_GENERIC_PLATFORM_DEVICE_H_ */
>
> Why not do:
>
> #include <linux/platform_device.h>
>
> #ifndef arch_setup_pdev_archdata
> static inline void arch_setup_pdev_archdata(struct platform_device *pdev) { }
> #endif
>
> in asm-generic/platform-device.h
>
> and the the call in platform_device_alloc() can be unconditional. If the arch wants to override arch_setup_pdev_archdata, it defines the function and then does
>
> #define arch_setup_pdev_archdata arch_setup_pdev_archdata
>
> before still including asm-generic/platform_device.h
Yes, I'd prefer that method as well.
thanks,
greg k-h
next prev parent reply other threads:[~2010-08-05 18:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 15:15 [PATCH 0/3] driver core: Add ability for arch code to setup pdev_archdata Kumar Gala
2010-08-05 15:15 ` [PATCH 1/3] " Kumar Gala
2010-08-05 15:15 ` [PATCH 2/3] powerpc: implement arch_setup_pdev_archdata Kumar Gala
2010-08-05 15:15 ` [PATCH 3/3] powerpc: Dont require a dma_ops struct to set dma mask Kumar Gala
2010-08-05 15:44 ` [PATCH 2/3] powerpc: implement arch_setup_pdev_archdata Stephen Rothwell
2010-08-05 16:14 ` Kumar Gala
2010-08-05 15:43 ` [PATCH 1/3] driver core: Add ability for arch code to setup pdev_archdata Stephen Rothwell
2010-08-05 16:14 ` Kumar Gala
2010-08-05 18:02 ` Greg KH [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-06-22 12:02 Kumar Gala
2011-06-22 14:37 ` Mike Frysinger
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=20100805180211.GA12687@suse.de \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=sfr@canb.auug.org.au \
/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).