public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform: fall-back to driver name check if there is no id found
@ 2013-02-08 15:24 Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2013-02-08 15:24 UTC (permalink / raw)
  To: Mika Westerberg, linux-kernel
  Cc: Andy Shevchenko, Eric Miao, Greg Kroah-Hartman

Some of the platform devices rely on the name of their driver to match with. In
the current implementation, if platform id table is needed, they have to add
the name to the platform id table which sounds alogical. The patch adjustes the
logic of the id table matching to make sure we will fall-back to match by the
driver name. This will make it similar to the DT or ACPI cases.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reported-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Eric Miao <eric.miao@marvell.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/base/platform.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index c0b8df3..452ba4b 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -732,8 +732,8 @@ static int platform_match(struct device *dev, struct device_driver *drv)
 		return 1;
 
 	/* Then try to match against the id table */
-	if (pdrv->id_table)
-		return platform_match_id(pdrv->id_table, pdev) != NULL;
+	if (pdrv->id_table && platform_match_id(pdrv->id_table, pdev))
+		return 1;
 
 	/* fall-back to driver name match */
 	return (strcmp(pdev->name, drv->name) == 0);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH] platform: fall-back to driver name check if there is no id found
@ 2013-04-19 12:35 Hein Tibosch
  2013-04-19 13:17 ` Eric Miao
  2013-04-19 13:20 ` Eric Miao
  0 siblings, 2 replies; 5+ messages in thread
From: Hein Tibosch @ 2013-04-19 12:35 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mika Westerberg, Greg KH, Eric Miao, Linux Kernel Mailing List

Hi Andy, Mika,

On 8 Feb 2013, Andy Shevchenko wrote:

> Some of the platform devices rely on the name of their driver to match with. In
> the current implementation, if platform id table is needed, they have to add
> the name to the platform id table which sounds alogical. The patch adjustes the
> logic of the id table matching to make sure we will fall-back to match by the
> driver name. This will make it similar to the DT or ACPI cases.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Reported-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> Cc: Eric Miao <eric.miao@xxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
> ---
>  drivers/base/platform.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index c0b8df3..452ba4b 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -732,8 +732,8 @@ static int platform_match(struct device *dev, struct device_driver *drv)
>  		return 1;
>  
>  	/* Then try to match against the id table */
> -	if (pdrv->id_table)
> -		return platform_match_id(pdrv->id_table, pdev) != NULL;
> +	if (pdrv->id_table && platform_match_id(pdrv->id_table, pdev))
> +		return 1;
>  
>  	/* fall-back to driver name match */
>  	return (strcmp(pdev->name, drv->name) == 0);

When I upgraded an avr32 system from 3.8 to a recent next release, I found it was
broken: DMA was not available because the dw_dma driver did not get probed anymore.

The dw_dma driver does have a id_table, but the boards in arch/avr32 are still expecting
driver identification by name.

As long as we want to support this simple identification-by-name, I'd say Andy's patch
should get quickly into stable release.


Hein

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] platform: fall-back to driver name check if there is no id found
  2013-04-19 12:35 [PATCH] platform: fall-back to driver name check if there is no id found Hein Tibosch
@ 2013-04-19 13:17 ` Eric Miao
  2013-04-19 13:20 ` Eric Miao
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Miao @ 2013-04-19 13:17 UTC (permalink / raw)
  To: Hein Tibosch
  Cc: Andy Shevchenko, Mika Westerberg, Greg KH,
	Linux Kernel Mailing List

On Fri, Apr 19, 2013 at 8:35 PM, Hein Tibosch <hein_tibosch@yahoo.es> wrote:
> Hi Andy, Mika,
>
> On 8 Feb 2013, Andy Shevchenko wrote:
>
>> Some of the platform devices rely on the name of their driver to match with. In
>> the current implementation, if platform id table is needed, they have to add
>> the name to the platform id table which sounds alogical. The patch adjustes the
>> logic of the id table matching to make sure we will fall-back to match by the
>> driver name. This will make it similar to the DT or ACPI cases.
>>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>> Reported-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
>> Cc: Eric Miao <eric.miao@xxxxxxxxxxx>
>> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
>> ---
>>  drivers/base/platform.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
>> index c0b8df3..452ba4b 100644
>> --- a/drivers/base/platform.c
>> +++ b/drivers/base/platform.c
>> @@ -732,8 +732,8 @@ static int platform_match(struct device *dev, struct device_driver *drv)
>>               return 1;
>>
>>       /* Then try to match against the id table */
>> -     if (pdrv->id_table)
>> -             return platform_match_id(pdrv->id_table, pdev) != NULL;
>> +     if (pdrv->id_table && platform_match_id(pdrv->id_table, pdev))
>> +             return 1;
>>
>>       /* fall-back to driver name match */
>>       return (strcmp(pdev->name, drv->name) == 0);
>
> When I upgraded an avr32 system from 3.8 to a recent next release, I found it was
> broken: DMA was not available because the dw_dma driver did not get probed anymore.
>
> The dw_dma driver does have a id_table, but the boards in arch/avr32 are still expecting
> driver identification by name.

I think this is a different philosophy here. I'm actually fine with either. The
questions are really:

1. will it be a bit inconsistent if the driver is using id_table,
while the device
is still using a legacy way?

2. instead of introducing a different logic in the platform driver core code,
is it possible this could be fixed at the board level?

>
> As long as we want to support this simple identification-by-name, I'd say Andy's patch
> should get quickly into stable release.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] platform: fall-back to driver name check if there is no id found
  2013-04-19 12:35 [PATCH] platform: fall-back to driver name check if there is no id found Hein Tibosch
  2013-04-19 13:17 ` Eric Miao
@ 2013-04-19 13:20 ` Eric Miao
  2013-04-19 14:44   ` Andy Shevchenko
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Miao @ 2013-04-19 13:20 UTC (permalink / raw)
  To: Hein Tibosch
  Cc: Andy Shevchenko, Mika Westerberg, Greg KH,
	Linux Kernel Mailing List

On Fri, Apr 19, 2013 at 8:35 PM, Hein Tibosch <hein_tibosch@yahoo.es> wrote:
> Hi Andy, Mika,
>
> On 8 Feb 2013, Andy Shevchenko wrote:
>
>> Some of the platform devices rely on the name of their driver to match with. In
>> the current implementation, if platform id table is needed, they have to add
>> the name to the platform id table which sounds alogical. The patch adjustes the
>> logic of the id table matching to make sure we will fall-back to match by the
>> driver name. This will make it similar to the DT or ACPI cases.
>>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>> Reported-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
>> Cc: Eric Miao <eric.miao@xxxxxxxxxxx>
>> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
>> ---
>>  drivers/base/platform.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
>> index c0b8df3..452ba4b 100644
>> --- a/drivers/base/platform.c
>> +++ b/drivers/base/platform.c
>> @@ -732,8 +732,8 @@ static int platform_match(struct device *dev, struct device_driver *drv)
>>               return 1;
>>
>>       /* Then try to match against the id table */
>> -     if (pdrv->id_table)
>> -             return platform_match_id(pdrv->id_table, pdev) != NULL;
>> +     if (pdrv->id_table && platform_match_id(pdrv->id_table, pdev))
>> +             return 1;
>>
>>       /* fall-back to driver name match */
>>       return (strcmp(pdev->name, drv->name) == 0);
>
> When I upgraded an avr32 system from 3.8 to a recent next release, I found it was
> broken: DMA was not available because the dw_dma driver did not get probed anymore.
>
> The dw_dma driver does have a id_table, but the boards in arch/avr32 are still expecting
> driver identification by name.

I think this is a different philosophy here. I'm actually fine with either. The
questions are really:

1. will it be a bit inconsistent if the driver is using id_table,
while the device
is still using a legacy way?

2. instead of introducing a different logic in the platform driver core code,
is it possible this could be fixed at the board level?

>
> As long as we want to support this simple identification-by-name, I'd say Andy's patch
> should get quickly into stable release.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] platform: fall-back to driver name check if there is no id found
  2013-04-19 13:20 ` Eric Miao
@ 2013-04-19 14:44   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2013-04-19 14:44 UTC (permalink / raw)
  To: Eric Miao
  Cc: Hein Tibosch, Mika Westerberg, Greg KH, Linux Kernel Mailing List

On Fri, 2013-04-19 at 21:20 +0800, Eric Miao wrote: 
> On Fri, Apr 19, 2013 at 8:35 PM, Hein Tibosch <hein_tibosch@yahoo.es> wrote:
> > Hi Andy, Mika,
> >
> > On 8 Feb 2013, Andy Shevchenko wrote:
> >
> >> Some of the platform devices rely on the name of their driver to match with. In
> >> the current implementation, if platform id table is needed, they have to add
> >> the name to the platform id table which sounds alogical. The patch adjustes the
> >> logic of the id table matching to make sure we will fall-back to match by the
> >> driver name. This will make it similar to the DT or ACPI cases.
> >>
> >> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> >> Reported-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> >> Cc: Eric Miao <eric.miao@xxxxxxxxxxx>
> >> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
> >> ---
> >>  drivers/base/platform.c |    4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> >> index c0b8df3..452ba4b 100644
> >> --- a/drivers/base/platform.c
> >> +++ b/drivers/base/platform.c
> >> @@ -732,8 +732,8 @@ static int platform_match(struct device *dev, struct device_driver *drv)
> >>               return 1;
> >>
> >>       /* Then try to match against the id table */
> >> -     if (pdrv->id_table)
> >> -             return platform_match_id(pdrv->id_table, pdev) != NULL;
> >> +     if (pdrv->id_table && platform_match_id(pdrv->id_table, pdev))
> >> +             return 1;
> >>
> >>       /* fall-back to driver name match */
> >>       return (strcmp(pdev->name, drv->name) == 0);
> >
> > When I upgraded an avr32 system from 3.8 to a recent next release, I found it was
> > broken: DMA was not available because the dw_dma driver did not get probed anymore.
> >
> > The dw_dma driver does have a id_table, but the boards in arch/avr32 are still expecting
> > driver identification by name.
> 
> I think this is a different philosophy here. I'm actually fine with either. The
> questions are really:
> 
> 1. will it be a bit inconsistent if the driver is using id_table,
> while the device
> is still using a legacy way?

Legacy way may be considered as a fall-back.

> 2. instead of introducing a different logic in the platform driver core code,
> is it possible this could be fixed at the board level?

It might be fixed in the driver, though I think that is ugly approach,
by adding name of the driver into its id_table.

P.S. There are actually a few drivers in current mainline that uses
mentioned approach, but with this patch it will be not needed anymore.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-19 14:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-19 12:35 [PATCH] platform: fall-back to driver name check if there is no id found Hein Tibosch
2013-04-19 13:17 ` Eric Miao
2013-04-19 13:20 ` Eric Miao
2013-04-19 14:44   ` Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2013-02-08 15:24 Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox