Re: [resend][PATCH 01/16] dw_dmac: call .probe after we have a devicein place

From: Andy Shevchenko
Date: Wed Jan 09 2013 - 09:56:34 EST


On Wed, Jan 9, 2013 at 3:47 PM, Vinod Koul <vinod.koul@xxxxxxxxx> wrote:
> On Wed, Jan 09, 2013 at 10:17:00AM +0200, Andy Shevchenko wrote:
>> If we don't yet have the platform device for the driver when it is being loaded
>> we fail to probe the driver. So instead of calling probe() directly we call
>> platform_driver_register(). It will call the probe() immediately if we have the
>> device but also makes the driver to work on platforms where the platform device
>> is created later.
> Why wont you have the platform device?

It's still the same device as before. The only difference is in
boot/initialization sequence.

> Is this only due to your approach of
> creating the device in PCI probe?

No. We had an issue when driver was initialized (and with old version
immediately probed)
just before it happened in the platform devices. In such case .probe() fails.
Above patch makes sure that platform devices are already in the
internal structures and we could match them safely.

>>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>> Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
>> ---
>> drivers/dma/dw_dmac.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
>> index 476e9c8..b5f21ba 100644
>> --- a/drivers/dma/dw_dmac.c
>> +++ b/drivers/dma/dw_dmac.c
>> @@ -1829,6 +1829,7 @@ MODULE_DEVICE_TABLE(of, dw_dma_id_table);
>> #endif
>>
>> static struct platform_driver dw_driver = {
>> + .probe = dw_probe,
>> .remove = dw_remove,
>> .shutdown = dw_shutdown,
>> .driver = {
>> @@ -1840,7 +1841,7 @@ static struct platform_driver dw_driver = {
>>
>> static int __init dw_init(void)
>> {
>> - return platform_driver_probe(&dw_driver, dw_probe);
>> + return platform_driver_register(&dw_driver);
>> }
>> subsys_initcall(dw_init);
>>
>> --
>> 1.7.10.4
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/



--
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/