lkml.org 
[lkml]   [2017]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH 02/62] watchdog: aspeed_wdt: Convert to use device managed functions
    On Wed, Jan 11, 2017 at 10:34 AM, Guenter Roeck <linux@roeck-us.net> wrote:
    > Use device managed functions to simplify error handling, reduce
    > source code size, improve readability, and reduce the likelyhood of bugs.
    >
    > The conversion was done automatically with coccinelle using the
    > following semantic patches. The semantic patches and the scripts used
    > to generate this commit log are available at
    > https://github.com/groeck/coccinelle-patches
    >
    > - Drop assignments to otherwise unused variables
    > - Drop remove function
    > - Drop platform_set_drvdata()
    > - Use devm_watchdog_register_driver() to register watchdog device
    >
    > Cc: Joel Stanley <joel@jms.id.au>
    > Signed-off-by: Guenter Roeck <linux@roeck-us.net>

    Acked-by: Joel Stanley <joel@jms.id.au>

    Cheers,

    Joel

    > ---
    > drivers/watchdog/aspeed_wdt.c | 14 +-------------
    > 1 file changed, 1 insertion(+), 13 deletions(-)
    >
    > diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
    > index f5ad8023c2e6..1c652582de40 100644
    > --- a/drivers/watchdog/aspeed_wdt.c
    > +++ b/drivers/watchdog/aspeed_wdt.c
    > @@ -136,15 +136,6 @@ static const struct watchdog_info aspeed_wdt_info = {
    > .identity = KBUILD_MODNAME,
    > };
    >
    > -static int aspeed_wdt_remove(struct platform_device *pdev)
    > -{
    > - struct aspeed_wdt *wdt = platform_get_drvdata(pdev);
    > -
    > - watchdog_unregister_device(&wdt->wdd);
    > -
    > - return 0;
    > -}
    > -
    > static int aspeed_wdt_probe(struct platform_device *pdev)
    > {
    > struct aspeed_wdt *wdt;
    > @@ -187,20 +178,17 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
    > set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
    > }
    >
    > - ret = watchdog_register_device(&wdt->wdd);
    > + ret = devm_watchdog_register_device(&pdev->dev, &wdt->wdd);
    > if (ret) {
    > dev_err(&pdev->dev, "failed to register\n");
    > return ret;
    > }
    >
    > - platform_set_drvdata(pdev, wdt);
    > -
    > return 0;
    > }
    >
    > static struct platform_driver aspeed_watchdog_driver = {
    > .probe = aspeed_wdt_probe,
    > - .remove = aspeed_wdt_remove,
    > .driver = {
    > .name = KBUILD_MODNAME,
    > .of_match_table = of_match_ptr(aspeed_wdt_of_table),
    > --
    > 2.7.4
    >

    \
     
     \ /
      Last update: 2017-01-11 06:19    [W:0.024 / U:3.672 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site