[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a0GPVs+PqUwsL2H8VJqLh=MJnMTwPu9nhX+Nq-xiMS1yQ@mail.gmail.com>
Date: Tue, 22 Oct 2019 11:44:33 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Guenter Roeck <linux@...ck-us.net>
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 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.
Arnd
Powered by blists - more mailing lists