Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1602327 > unrolled thread

[PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2017-03-16 15:30 +0100
Last post2017-03-27 14:50 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-03-16 15:30 +0100
    Re: [PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE Lee Jones <lee.jones@linaro.org> - 2017-03-23 12:30 +0100
      Re: [PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-03-23 14:20 +0100
        Re: [PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE Lee Jones <lee.jones@linaro.org> - 2017-03-24 12:40 +0100
          Re: [PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-03-26 15:00 +0200
            Re: [PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE Lee Jones <lee.jones@linaro.org> - 2017-03-27 14:50 +0200

#1602327 — [PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2017-03-16 15:30 +0100
Subject[PATCH v1] mfd: core: Preserve PLATFORM_DEVID_NONE
Message-ID<tlEzD-80N-13@gated-at.bofh.it>
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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 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;
-- 
2.11.0

[toc] | [next] | [standalone]


#1607379

FromLee Jones <lee.jones@linaro.org>
Date2017-03-23 12:30 +0100
Message-ID<to96h-1uL-13@gated-at.bofh.it>
In reply to#1602327
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.

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  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;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [next] | [standalone]


#1607475

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2017-03-23 14:20 +0100
Message-ID<toaOK-2Hz-27@gated-at.bofh.it>
In reply to#1607379
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"

Is it by design?

> 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  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@linux.intel.com>
Intel Finland Oy

[toc] | [prev] | [next] | [standalone]


#1608345

FromLee Jones <lee.jones@linaro.org>
Date2017-03-24 12:40 +0100
Message-ID<tovJv-Sg-7@gated-at.bofh.it>
In reply to#1607475
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?

> Is it by design?
> 
> > 
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > ---
> > >  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;
> > 
> > 
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [next] | [standalone]


#1609326

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2017-03-26 15:00 +0200
Message-ID<tpfW1-8tD-1@gated-at.bofh.it>
In reply to#1608345
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@linux.intel.co
> > > > 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@linux.intel.com>
Intel Finland Oy

[toc] | [prev] | [next] | [standalone]


#1609794

FromLee Jones <lee.jones@linaro.org>
Date2017-03-27 14:50 +0200
Message-ID<tpCfU-87G-5@gated-at.bofh.it>
In reply to#1609326
On Sun, 26 Mar 2017, Andy Shevchenko wrote:

> 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.

I'd be happy to review any proposal you put forward. :)

> > > Is it by design?
> > > 
> > > > 
> > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.co
> > > > > 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;
> > > > 
> > > > 
> > 
> > 
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web