linux-mips
[Top] [All Lists]

Re: [PATCH 2/2] ar7_wdt: convert to become a platform driver

To: Florian Fainelli <florian@openwrt.org>
Subject: Re: [PATCH 2/2] ar7_wdt: convert to become a platform driver
From: Wim Van Sebroeck <wim@iguana.be>
Date: Sat, 18 Jul 2009 21:09:31 +0200
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
In-reply-to: <200907151210.20294.florian@openwrt.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <200907151210.20294.florian@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.18 (2008-05-17)
Hi Florian,

> This patch converts the ar7_wdt driver to become a platform
> driver. The AR7 SoC specific identification and base register
> calculation is performed by the board code, therefore we no
> longer need to have access to ar7_chip_id.

> @@ -298,22 +285,33 @@ static struct miscdevice ar7_wdt_miscdev = {
>       .fops           = &ar7_wdt_fops,
>  };
>  
> -static int __init ar7_wdt_init(void)
> +static int __init ar7_wdt_probe(struct platform_device *pdev)

Should be __devinit .

> +static struct platform_driver ar7_wdt_driver = {
> +     .driver.name = "ar7_wdt",
> +     .probe = ar7_wdt_probe,
> +     .remove = __devexit_p(ar7_wdt_remove),
> +};

I prefer to have it as follows (so that the driver.owner field is also set):
static struct platform_driver ar7_wdt_driver = {
        .probe = ar7_wdt_probe,
        .remove = __devexit_p(ar7_wdt_remove),
        .driver = {
                .owner = THIS_MODULE,
                .name = "ar7_wdt",
        },
};

I suggest to also change the reboot notifier code into a platform shutdown 
method.
You then get something like the attached patch (untested, uncompiled and I 
included above 2 remarks).
For the rest: code is OK for me. After the __init to __devinit fix you can add 
my signed-off-by.

Kind regards,
Wim.


<Prev in Thread] Current Thread [Next in Thread>