* [PATCH] rtc: mt6397: Add platform device ID table @ 2016-02-09 11:08 Javier Martinez Canillas 2016-02-15 1:58 ` Eddie Huang 0 siblings, 1 reply; 7+ messages in thread From: Javier Martinez Canillas @ 2016-02-09 11:08 UTC (permalink / raw) To: linux-kernel Cc: Javier Martinez Canillas, Alessandro Zummo, rtc-linux, Alexandre Belloni, linux-mediatek, Eddie Huang, linux-arm-kernel The platform bus_type .match callback attempts to match the platform device name with an entry on the .id_table if provided and fallbacks to match with the driver's name if a table is not provided. Using a platform device ID to match is more explicit, allows the driver to support more than one device and also the MODULE_DEVICE_TABLE macro can be used to export the module aliases information instead of the MODULE_ALIAS. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> --- drivers/rtc/rtc-mt6397.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index 06a5c52b292f..46533f11f7fc 100644 --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -404,6 +404,12 @@ static const struct of_device_id mt6397_rtc_of_match[] = { }; MODULE_DEVICE_TABLE(of, mt6397_rtc_of_match); +static const struct platform_device_id mt6397_rtc_id[] = { + {"mt6397-rtc", 0}, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(platform, mt6397_rtc_id); + static struct platform_driver mtk_rtc_driver = { .driver = { .name = "mt6397-rtc", @@ -412,6 +418,7 @@ static struct platform_driver mtk_rtc_driver = { }, .probe = mtk_rtc_probe, .remove = mtk_rtc_remove, + .id_table = mt6397_rtc_id, }; module_platform_driver(mtk_rtc_driver); @@ -419,4 +426,3 @@ module_platform_driver(mtk_rtc_driver); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Tianping Fang <tianping.fang@mediatek.com>"); MODULE_DESCRIPTION("RTC Driver for MediaTek MT6397 PMIC"); -MODULE_ALIAS("platform:mt6397-rtc"); -- 2.5.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] rtc: mt6397: Add platform device ID table 2016-02-09 11:08 [PATCH] rtc: mt6397: Add platform device ID table Javier Martinez Canillas @ 2016-02-15 1:58 ` Eddie Huang 2016-02-15 14:50 ` Javier Martinez Canillas 0 siblings, 1 reply; 7+ messages in thread From: Eddie Huang @ 2016-02-15 1:58 UTC (permalink / raw) To: Javier Martinez Canillas Cc: linux-kernel, Alessandro Zummo, rtc-linux, Alexandre Belloni, linux-mediatek, linux-arm-kernel On Tue, 2016-02-09 at 08:08 -0300, Javier Martinez Canillas wrote: > The platform bus_type .match callback attempts to match the platform device > name with an entry on the .id_table if provided and fallbacks to match with > the driver's name if a table is not provided. > > Using a platform device ID to match is more explicit, allows the driver to > support more than one device and also the MODULE_DEVICE_TABLE macro can be > used to export the module aliases information instead of the MODULE_ALIAS. > > Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> > > --- > > drivers/rtc/rtc-mt6397.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c > index 06a5c52b292f..46533f11f7fc 100644 > --- a/drivers/rtc/rtc-mt6397.c > +++ b/drivers/rtc/rtc-mt6397.c > @@ -404,6 +404,12 @@ static const struct of_device_id mt6397_rtc_of_match[] = { > }; > MODULE_DEVICE_TABLE(of, mt6397_rtc_of_match); > > +static const struct platform_device_id mt6397_rtc_id[] = { > + {"mt6397-rtc", 0}, > + { /* sentinel */ }, > +}; > +MODULE_DEVICE_TABLE(platform, mt6397_rtc_id); > + > static struct platform_driver mtk_rtc_driver = { > .driver = { > .name = "mt6397-rtc", > @@ -412,6 +418,7 @@ static struct platform_driver mtk_rtc_driver = { > }, > .probe = mtk_rtc_probe, > .remove = mtk_rtc_remove, > + .id_table = mt6397_rtc_id, > }; > > module_platform_driver(mtk_rtc_driver); > @@ -419,4 +426,3 @@ module_platform_driver(mtk_rtc_driver); > MODULE_LICENSE("GPL v2"); > MODULE_AUTHOR("Tianping Fang <tianping.fang@mediatek.com>"); > MODULE_DESCRIPTION("RTC Driver for MediaTek MT6397 PMIC"); > -MODULE_ALIAS("platform:mt6397-rtc"); This patch looks good to me, but I am wondering, since we tend to use device tree method to match driver, do we still need support platform device ID ? Eddie ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] rtc: mt6397: Add platform device ID table 2016-02-15 1:58 ` Eddie Huang @ 2016-02-15 14:50 ` Javier Martinez Canillas [not found] ` <56C1E5C8.6040007-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Javier Martinez Canillas @ 2016-02-15 14:50 UTC (permalink / raw) To: Eddie Huang Cc: linux-kernel, Alessandro Zummo, rtc-linux, Alexandre Belloni, linux-mediatek, linux-arm-kernel Hello Eddie, On 02/14/2016 10:58 PM, Eddie Huang wrote: [snip] >> @@ -412,6 +418,7 @@ static struct platform_driver mtk_rtc_driver = { >> }, >> .probe = mtk_rtc_probe, >> .remove = mtk_rtc_remove, >> + .id_table = mt6397_rtc_id, >> }; >> >> module_platform_driver(mtk_rtc_driver); >> @@ -419,4 +426,3 @@ module_platform_driver(mtk_rtc_driver); >> MODULE_LICENSE("GPL v2"); >> MODULE_AUTHOR("Tianping Fang <tianping.fang@mediatek.com>"); >> MODULE_DESCRIPTION("RTC Driver for MediaTek MT6397 PMIC"); >> -MODULE_ALIAS("platform:mt6397-rtc"); > > This patch looks good to me, but I am wondering, since we tend to use > device tree method to match driver, do we still need support platform > device ID ? > I'm not familiar with neither this IP block nor the SoC so it is up to you. I just noticed this issue when reviewing a regulator driver for a similar PMIC posted by someone from mediatek. I thought platform device was needed since the driver has a MODULE_ALIAS() but please let me know what you prefer and I can re-spin the patch and just remove the MODULE_ALIAS() if that makes more sense for this platform. > Eddie > > Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <56C1E5C8.6040007-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>]
* Re: [PATCH] rtc: mt6397: Add platform device ID table [not found] ` <56C1E5C8.6040007-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org> @ 2016-02-16 11:37 ` Arnd Bergmann 2016-02-16 13:19 ` Eddie Huang 0 siblings, 1 reply; 7+ messages in thread From: Arnd Bergmann @ 2016-02-16 11:37 UTC (permalink / raw) To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Cc: Alessandro Zummo, rtc-linux-/JYPxA39Uh5TLH3MbocFFw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Javier Martinez Canillas, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Alexandre Belloni, Eddie Huang On Monday 15 February 2016 11:50:48 Javier Martinez Canillas wrote: > > On 02/14/2016 10:58 PM, Eddie Huang wrote: > > [snip] > > >> @@ -412,6 +418,7 @@ static struct platform_driver mtk_rtc_driver = { > >> }, > >> .probe = mtk_rtc_probe, > >> .remove = mtk_rtc_remove, > >> + .id_table = mt6397_rtc_id, > >> }; > >> > >> module_platform_driver(mtk_rtc_driver); > >> @@ -419,4 +426,3 @@ module_platform_driver(mtk_rtc_driver); > >> MODULE_LICENSE("GPL v2"); > >> MODULE_AUTHOR("Tianping Fang <tianping.fang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>"); > >> MODULE_DESCRIPTION("RTC Driver for MediaTek MT6397 PMIC"); > >> -MODULE_ALIAS("platform:mt6397-rtc"); > > > > This patch looks good to me, but I am wondering, since we tend to use > > device tree method to match driver, do we still need support platform > > device ID ? > > > > I'm not familiar with neither this IP block nor the SoC so it is up to > you. I just noticed this issue when reviewing a regulator driver for a > similar PMIC posted by someone from mediatek. > > I thought platform device was needed since the driver has a MODULE_ALIAS() > but please let me know what you prefer and I can re-spin the patch and > just remove the MODULE_ALIAS() if that makes more sense for this platform. > > I agree. We can alway add a MODULE_DEVICE_TABLE() if we get multiple users of this driver on architectures that don't use devicetree yet. Arnd ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] rtc: mt6397: Add platform device ID table 2016-02-16 11:37 ` Arnd Bergmann @ 2016-02-16 13:19 ` Eddie Huang 2016-02-24 16:56 ` Arnd Bergmann 0 siblings, 1 reply; 7+ messages in thread From: Eddie Huang @ 2016-02-16 13:19 UTC (permalink / raw) To: Arnd Bergmann Cc: linux-arm-kernel, Javier Martinez Canillas, Alessandro Zummo, rtc-linux, linux-kernel, linux-mediatek, Alexandre Belloni On Tue, 2016-02-16 at 12:37 +0100, Arnd Bergmann wrote: > On Monday 15 February 2016 11:50:48 Javier Martinez Canillas wrote: > > > > On 02/14/2016 10:58 PM, Eddie Huang wrote: > > > > [snip] > > > > >> @@ -412,6 +418,7 @@ static struct platform_driver mtk_rtc_driver = { > > >> }, > > >> .probe = mtk_rtc_probe, > > >> .remove = mtk_rtc_remove, > > >> + .id_table = mt6397_rtc_id, > > >> }; > > >> > > >> module_platform_driver(mtk_rtc_driver); > > >> @@ -419,4 +426,3 @@ module_platform_driver(mtk_rtc_driver); > > >> MODULE_LICENSE("GPL v2"); > > >> MODULE_AUTHOR("Tianping Fang <tianping.fang@mediatek.com>"); > > >> MODULE_DESCRIPTION("RTC Driver for MediaTek MT6397 PMIC"); > > >> -MODULE_ALIAS("platform:mt6397-rtc"); > > > > > > This patch looks good to me, but I am wondering, since we tend to use > > > device tree method to match driver, do we still need support platform > > > device ID ? > > > > > > > I'm not familiar with neither this IP block nor the SoC so it is up to > > you. I just noticed this issue when reviewing a regulator driver for a > > similar PMIC posted by someone from mediatek. > > > > I thought platform device was needed since the driver has a MODULE_ALIAS() > > but please let me know what you prefer and I can re-spin the patch and > > just remove the MODULE_ALIAS() if that makes more sense for this platform. > > > > > > I agree. We can alway add a MODULE_DEVICE_TABLE() if we get multiple > users of this driver on architectures that don't use devicetree yet. > Sure. Thanks the patch to add expandability to this driver. Acked-by: Eddie Huang <eddie.huang@mediatek.com> Eddie ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] rtc: mt6397: Add platform device ID table 2016-02-16 13:19 ` Eddie Huang @ 2016-02-24 16:56 ` Arnd Bergmann 2016-02-24 17:02 ` Javier Martinez Canillas 0 siblings, 1 reply; 7+ messages in thread From: Arnd Bergmann @ 2016-02-24 16:56 UTC (permalink / raw) To: linux-arm-kernel Cc: Eddie Huang, Alessandro Zummo, rtc-linux, linux-kernel, Javier Martinez Canillas, linux-mediatek, Alexandre Belloni On Tuesday 16 February 2016 21:19:07 Eddie Huang wrote: > On Tue, 2016-02-16 at 12:37 +0100, Arnd Bergmann wrote: > > On Monday 15 February 2016 11:50:48 Javier Martinez Canillas wrote: > > > > > > On 02/14/2016 10:58 PM, Eddie Huang wrote: > > > > > > [snip] > > > > > > >> @@ -412,6 +418,7 @@ static struct platform_driver mtk_rtc_driver = { > > > >> }, > > > >> .probe = mtk_rtc_probe, > > > >> .remove = mtk_rtc_remove, > > > >> + .id_table = mt6397_rtc_id, > > > >> }; > > > >> > > > >> module_platform_driver(mtk_rtc_driver); > > > >> @@ -419,4 +426,3 @@ module_platform_driver(mtk_rtc_driver); > > > >> MODULE_LICENSE("GPL v2"); > > > >> MODULE_AUTHOR("Tianping Fang <tianping.fang@mediatek.com>"); > > > >> MODULE_DESCRIPTION("RTC Driver for MediaTek MT6397 PMIC"); > > > >> -MODULE_ALIAS("platform:mt6397-rtc"); > > > > > > > > This patch looks good to me, but I am wondering, since we tend to use > > > > device tree method to match driver, do we still need support platform > > > > device ID ? > > > > > > > > > > I'm not familiar with neither this IP block nor the SoC so it is up to > > > you. I just noticed this issue when reviewing a regulator driver for a > > > similar PMIC posted by someone from mediatek. > > > > > > I thought platform device was needed since the driver has a MODULE_ALIAS() > > > but please let me know what you prefer and I can re-spin the patch and > > > just remove the MODULE_ALIAS() if that makes more sense for this platform. > > > > > > > > > > I agree. We can alway add a MODULE_DEVICE_TABLE() if we get multiple > > users of this driver on architectures that don't use devicetree yet. > > > > Sure. Thanks the patch to add expandability to this driver. > > Acked-by: Eddie Huang <eddie.huang@mediatek.com> I think we misunderstood one another. I think we can drop both the MODULE_DEVICE_TABLE and the MODULE_ALIAS: there is no need for another driver ID when it is always probed using DT. Arnd ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] rtc: mt6397: Add platform device ID table 2016-02-24 16:56 ` Arnd Bergmann @ 2016-02-24 17:02 ` Javier Martinez Canillas 0 siblings, 0 replies; 7+ messages in thread From: Javier Martinez Canillas @ 2016-02-24 17:02 UTC (permalink / raw) To: Arnd Bergmann, linux-arm-kernel Cc: Eddie Huang, Alessandro Zummo, rtc-linux, linux-kernel, linux-mediatek, Alexandre Belloni Hello Arnd, On 02/24/2016 01:56 PM, Arnd Bergmann wrote: > On Tuesday 16 February 2016 21:19:07 Eddie Huang wrote: >> On Tue, 2016-02-16 at 12:37 +0100, Arnd Bergmann wrote: >>> On Monday 15 February 2016 11:50:48 Javier Martinez Canillas wrote: >>>> >>>> On 02/14/2016 10:58 PM, Eddie Huang wrote: >>>> >>>> [snip] >>>> >>>>>> @@ -412,6 +418,7 @@ static struct platform_driver mtk_rtc_driver = { >>>>>> }, >>>>>> .probe = mtk_rtc_probe, >>>>>> .remove = mtk_rtc_remove, >>>>>> + .id_table = mt6397_rtc_id, >>>>>> }; >>>>>> >>>>>> module_platform_driver(mtk_rtc_driver); >>>>>> @@ -419,4 +426,3 @@ module_platform_driver(mtk_rtc_driver); >>>>>> MODULE_LICENSE("GPL v2"); >>>>>> MODULE_AUTHOR("Tianping Fang <tianping.fang@mediatek.com>"); >>>>>> MODULE_DESCRIPTION("RTC Driver for MediaTek MT6397 PMIC"); >>>>>> -MODULE_ALIAS("platform:mt6397-rtc"); >>>>> >>>>> This patch looks good to me, but I am wondering, since we tend to use >>>>> device tree method to match driver, do we still need support platform >>>>> device ID ? >>>>> >>>> >>>> I'm not familiar with neither this IP block nor the SoC so it is up to >>>> you. I just noticed this issue when reviewing a regulator driver for a >>>> similar PMIC posted by someone from mediatek. >>>> >>>> I thought platform device was needed since the driver has a MODULE_ALIAS() >>>> but please let me know what you prefer and I can re-spin the patch and >>>> just remove the MODULE_ALIAS() if that makes more sense for this platform. >>>> >>>> >>> >>> I agree. We can alway add a MODULE_DEVICE_TABLE() if we get multiple >>> users of this driver on architectures that don't use devicetree yet. >>> >> >> Sure. Thanks the patch to add expandability to this driver. >> >> Acked-by: Eddie Huang <eddie.huang@mediatek.com> > > I think we misunderstood one another. I think we can drop both the MODULE_DEVICE_TABLE and the MODULE_ALIAS: there is no need for another > driver ID when it is always probed using DT. > That's how I understood but then Eddie said the opposite so I got confused and was waiting for your clarification. I'll re-spin and remove the alias. > Arnd > Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-02-24 17:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-09 11:08 [PATCH] rtc: mt6397: Add platform device ID table Javier Martinez Canillas
2016-02-15 1:58 ` Eddie Huang
2016-02-15 14:50 ` Javier Martinez Canillas
[not found] ` <56C1E5C8.6040007-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2016-02-16 11:37 ` Arnd Bergmann
2016-02-16 13:19 ` Eddie Huang
2016-02-24 16:56 ` Arnd Bergmann
2016-02-24 17:02 ` Javier Martinez Canillas
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox