Re: [PATCH 09/46] watchdog: sa1100: use platform device registration
From: Guenter Roeck <linux@roeck-us.net>
Date: 2019-10-22 13:39:02
Also in:
linux-watchdog, lkml
From: Guenter Roeck <linux@roeck-us.net>
Date: 2019-10-22 13:39:02
Also in:
linux-watchdog, lkml
On 10/22/19 2:44 AM, Arnd Bergmann wrote:
On Sat, Oct 19, 2019 at 4:07 PM Guenter Roeck [off-list ref] wrote:quoted
quoted
@@ -319,10 +316,13 @@ static struct platform_device *sa11x0_devices[] __initdata = { static int __init sa1100_init(void) { + struct resource wdt_res = DEFINE_RES_MEM(0x90000000, 0x20); pm_power_off = sa1100_power_off; regulator_has_full_constraints(); + platform_device_register_simple("sa1100_wdt", -1, &wdt_res, 1); + return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));Wouldn't it be better to add the watchdog device to sa11x0_devices ?Generally speaking, platform_device_register_simple() is better than platform_add_devices(), it does the same thing with fewer source lines and smaller object code, and it doesn't have the problem of lifetime rules for statically allocated reference-counted devices. One day we may want to replace all static platform_device instances with platform_device_info instead, but right now there are too many of those. I can change this one to a platform_device for consistency though if you think it's worth it.
No, I was just wondering. Thanks for the explanation. Guenter _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel