Re: [PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE
From: Andy Shevchenko
Date: Sun Mar 26 2017 - 08:54:32 EST
On Fri, 2017-03-24 at 11:35 +0000, Lee Jones wrote:
> On Thu, 23 Mar 2017, Andy Shevchenko wrote:
>
> > On Thu, 2017-03-23 at 11:21 +0000, Lee Jones wrote:
> > > On Thu, 16 Mar 2017, Andy Shevchenko wrote:
> > >
> > > > There is a potential flaw if cell has id > 0 and is going to be
> > > > registered with PLATFORM_DEVID_NONE.
> > > >
> > > > Ignore if PLATFORM_DEVID_NONE is supplied.
> > >
> > > This is a substantial change to a pretty tried and tested piece of
> > > sub-system code.ÂÂCan you put some more meat on the bones in the
> > > commit log, and include examples.
> >
> > Example in pseudo code:
> >
> > cells = {
> > Â[0] = { .id = 0, .name = "moduleX", },
> > Â[1] = { .id = 1, .name = "moduleY", },
> > Â[2] = { .id = 2, .name = "moduleZ", },
> > Â...
> > };
> >
> > mfd_add_devices(..., PLATFORM_DEVID_NONE, cells, ARRAY_SIZE(cells),
> > ...);
> >
> > Output (names of the devices in the drivers):
> > "moduleX"
> > "moduleY.0"
> > "moduleX.1"
> >
> > Desired output:
> > "moduleX"
> > "moduleY"
> > "moduleZ"
>
> Then what would be your reason for populating the 'id' attribute?
That's a gray area. If I remember correctly I come to above patch
through looking some incremental change.
I'm fine with no patch applied if this is documented somewhere,
otherwise we might update documentation to cover such cases explicitly.
>
> > Is it by design?
> >
> > >
> > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxx
> > > > m>
> > > > ---
> > > > Âdrivers/mfd/mfd-core.c | 2 +-
> > > > Â1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> > > > index c57e407020f1..c9583f895058 100644
> > > > --- a/drivers/mfd/mfd-core.c
> > > > +++ b/drivers/mfd/mfd-core.c
> > > > @@ -149,7 +149,7 @@ static int mfd_add_device(struct device
> > > > *parent,
> > > > int id,
> > > > Â int platform_id;
> > > > Â int r;
> > > > Â
> > > > - if (id == PLATFORM_DEVID_AUTO)
> > > > + if (id < 0)
> > > > Â platform_id = id;
> > > > Â else
> > > > Â platform_id = id + cell->id;
> > >
> > >
>
>
--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy