[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <21d72661-a4f1-d51f-ddf0-f8cebb984029@roeck-us.net>
Date: Tue, 22 Oct 2019 06:38:57 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Arnd Bergmann <arnd@...db.de>
Cc: Daniel Mack <daniel@...que.org>,
Haojian Zhuang <haojian.zhuang@...il.com>,
Robert Jarzmik <robert.jarzmik@...e.fr>,
Linus Walleij <linus.walleij@...aro.org>,
Wim Van Sebroeck <wim@...ux-watchdog.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
LINUXWATCHDOG <linux-watchdog@...r.kernel.org>
Subject: Re: [PATCH 09/46] watchdog: sa1100: use platform device registration
On 10/22/19 2:44 AM, Arnd Bergmann wrote:
> On Sat, Oct 19, 2019 at 4:07 PM Guenter Roeck <linux@...ck-us.net> wrote:
>
>>> @@ -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
Powered by blists - more mailing lists