* [PATCH/RFC] mfd: Allow multiple MFD cells with the same name
@ 2009-07-02 16:06 Mark Brown
2009-07-13 11:30 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2009-07-02 16:06 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel, Mark Brown
Provide basic support for MFDs having multiple cells of a given
type with different IDs by adding an id to the mfd_cell structure
and then adding that to the id passed in to mfd_add_devices().
As it stands this approach requires that MFDs using this feature
deal with ensuring that there aren't any ID collisions resulting
from multiple MFDs of the same type being instantiated. This needs
to happen with the existing code too, but with this approach there
is a knock on effect on the IDs for non-duplicated devices.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
I'm not 100% convinced that this is the best way to do this but I can't
think of anything better.
drivers/mfd/mfd-core.c | 2 +-
include/linux/mfd/core.h | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 54ddf37..ae15e49 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -25,7 +25,7 @@ static int mfd_add_device(struct device *parent, int id,
int ret = -ENOMEM;
int r;
- pdev = platform_device_alloc(cell->name, id);
+ pdev = platform_device_alloc(cell->name, id + cell->id);
if (!pdev)
goto fail_alloc;
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 49ef857..11d740b 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -23,6 +23,7 @@
*/
struct mfd_cell {
const char *name;
+ int id;
int (*enable)(struct platform_device *dev);
int (*disable)(struct platform_device *dev);
--
1.6.3.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH/RFC] mfd: Allow multiple MFD cells with the same name
2009-07-02 16:06 [PATCH/RFC] mfd: Allow multiple MFD cells with the same name Mark Brown
@ 2009-07-13 11:30 ` Mark Brown
2009-07-24 22:35 ` Samuel Ortiz
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2009-07-13 11:30 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel
On Thu, Jul 02, 2009 at 05:06:38PM +0100, Mark Brown wrote:
> Provide basic support for MFDs having multiple cells of a given
> type with different IDs by adding an id to the mfd_cell structure
> and then adding that to the id passed in to mfd_add_devices().
>
> As it stands this approach requires that MFDs using this feature
> deal with ensuring that there aren't any ID collisions resulting
> from multiple MFDs of the same type being instantiated. This needs
> to happen with the existing code too, but with this approach there
> is a knock on effect on the IDs for non-duplicated devices.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Samuel, do you have any thoughts on this patch? As I said...
> I'm not 100% convinced that this is the best way to do this but I can't
> think of anything better
...but it'd be really helpful to get some idea if this approach is going
to be viable for some code I'm currently working on.
>
> drivers/mfd/mfd-core.c | 2 +-
> include/linux/mfd/core.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> index 54ddf37..ae15e49 100644
> --- a/drivers/mfd/mfd-core.c
> +++ b/drivers/mfd/mfd-core.c
> @@ -25,7 +25,7 @@ static int mfd_add_device(struct device *parent, int id,
> int ret = -ENOMEM;
> int r;
>
> - pdev = platform_device_alloc(cell->name, id);
> + pdev = platform_device_alloc(cell->name, id + cell->id);
> if (!pdev)
> goto fail_alloc;
>
> diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
> index 49ef857..11d740b 100644
> --- a/include/linux/mfd/core.h
> +++ b/include/linux/mfd/core.h
> @@ -23,6 +23,7 @@
> */
> struct mfd_cell {
> const char *name;
> + int id;
>
> int (*enable)(struct platform_device *dev);
> int (*disable)(struct platform_device *dev);
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
"You grabbed my hand and we fell into it, like a daydream - or a fever."
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH/RFC] mfd: Allow multiple MFD cells with the same name
2009-07-13 11:30 ` Mark Brown
@ 2009-07-24 22:35 ` Samuel Ortiz
2009-07-25 11:23 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Samuel Ortiz @ 2009-07-24 22:35 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-kernel
Hi Mark,
On Mon, Jul 13, 2009 at 12:30:18PM +0100, Mark Brown wrote:
> On Thu, Jul 02, 2009 at 05:06:38PM +0100, Mark Brown wrote:
> > Provide basic support for MFDs having multiple cells of a given
> > type with different IDs by adding an id to the mfd_cell structure
> > and then adding that to the id passed in to mfd_add_devices().
> >
> > As it stands this approach requires that MFDs using this feature
> > deal with ensuring that there aren't any ID collisions resulting
> > from multiple MFDs of the same type being instantiated. This needs
> > to happen with the existing code too, but with this approach there
> > is a knock on effect on the IDs for non-duplicated devices.
> >
> > Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
>
> Samuel, do you have any thoughts on this patch? As I said...
I think it's safe to expect people that decide they need this feature will be
careful enough to make sure they dont get ID collisions.
> > I'm not 100% convinced that this is the best way to do this but I can't
> > think of anything better
>
> ...but it'd be really helpful to get some idea if this approach is going
> to be viable for some code I'm currently working on.
I'm ok with this patch, but I'd like the new cell->id field to be more
documented. In particular we should mention that one should leave it to 0
unless trying to add several cells of the same type.
I'll push this patch once I'll be back from vacation, thanks.
Cheers,
Samuel.
>
> >
> > drivers/mfd/mfd-core.c | 2 +-
> > include/linux/mfd/core.h | 1 +
> > 2 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> > index 54ddf37..ae15e49 100644
> > --- a/drivers/mfd/mfd-core.c
> > +++ b/drivers/mfd/mfd-core.c
> > @@ -25,7 +25,7 @@ static int mfd_add_device(struct device *parent, int id,
> > int ret = -ENOMEM;
> > int r;
> >
> > - pdev = platform_device_alloc(cell->name, id);
> > + pdev = platform_device_alloc(cell->name, id + cell->id);
> > if (!pdev)
> > goto fail_alloc;
> >
> > diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
> > index 49ef857..11d740b 100644
> > --- a/include/linux/mfd/core.h
> > +++ b/include/linux/mfd/core.h
> > @@ -23,6 +23,7 @@
> > */
> > struct mfd_cell {
> > const char *name;
> > + int id;
> >
> > int (*enable)(struct platform_device *dev);
> > int (*disable)(struct platform_device *dev);
> > --
> > 1.6.3.3
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
> >
>
> --
> "You grabbed my hand and we fell into it, like a daydream - or a fever."
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH/RFC] mfd: Allow multiple MFD cells with the same name
2009-07-24 22:35 ` Samuel Ortiz
@ 2009-07-25 11:23 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2009-07-25 11:23 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: linux-kernel
On Sat, Jul 25, 2009 at 12:35:55AM +0200, Samuel Ortiz wrote:
> On Mon, Jul 13, 2009 at 12:30:18PM +0100, Mark Brown wrote:
> > Samuel, do you have any thoughts on this patch? As I said...
> I think it's safe to expect people that decide they need this feature will be
> careful enough to make sure they dont get ID collisions.
Yes, and it should be fairly easy to work out what's gone wrong if there
are any problems.
> > ...but it'd be really helpful to get some idea if this approach is going
> > to be viable for some code I'm currently working on.
> I'm ok with this patch, but I'd like the new cell->id field to be more
> documented. In particular we should mention that one should leave it to 0
> unless trying to add several cells of the same type.
> I'll push this patch once I'll be back from vacation, thanks.
OK, thanks. I'm not sure when you're back from your vacation but early
next week I should be releasing the code which I was mentioning above -
if you've not applied it before then I'll try to include a revised
version with more documentation in that series.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-25 11:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-02 16:06 [PATCH/RFC] mfd: Allow multiple MFD cells with the same name Mark Brown
2009-07-13 11:30 ` Mark Brown
2009-07-24 22:35 ` Samuel Ortiz
2009-07-25 11:23 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox