Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
To: John Crispin <blogic@openwrt.org>
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Re: [PATCH 3/3] MIPS: lantiq: make use of module_platform_driver()
Date: Sat, 18 Feb 2012 00:02:49 +0100	[thread overview]
Message-ID: <4F3EDC99.2070106@googlemail.com> (raw)
In-Reply-To: <1329474832-21095-3-git-send-email-blogic@openwrt.org>

Am 17.02.2012 11:33, schrieb John Crispin:
> Reduce boilerplate code.
>
> Signed-off-by: John Crispin<blogic@openwrt.org>
> ---
>   drivers/mtd/maps/lantiq-flash.c    |   20 ++------------------
>   drivers/net/ethernet/lantiq_etop.c |   20 ++------------------
>   drivers/watchdog/lantiq_wdt.c      |   17 ++---------------
>   3 files changed, 6 insertions(+), 51 deletions(-)
>
> diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
> index 7b889de..e22436d 100644
> --- a/drivers/mtd/maps/lantiq-flash.c
> +++ b/drivers/mtd/maps/lantiq-flash.c
> @@ -203,6 +203,7 @@ ltq_mtd_remove(struct platform_device *pdev)
>   }
>
>   static struct platform_driver ltq_mtd_driver = {
> +	.probe = ltq_mtd_probe,

you also need to change __init to __devinit at ltq_mtd_probe. Compiling 
with CONFIG_DEBUG_SECTION_MISMATCH shows following warning:

WARNING: drivers/mtd/maps/built-in.o(.data+0x0): Section mismatch in 
reference from the variable ltq_mtd_driver to the function 
.init.text:ltq_mtd_probe()
     The variable ltq_mtd_driver references
     the function __init ltq_mtd_probe()
     If the reference is valid then annotate the
     variable with __init* or __refdata (see linux/init.h) or name the 
variable:
     *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console


>   	.remove = __devexit_p(ltq_mtd_remove),
>   	.driver = {
>   		.name = "ltq_nor",
> @@ -210,24 +211,7 @@ static struct platform_driver ltq_mtd_driver = {
>   	},
>   };
>
> -static int __init
> -init_ltq_mtd(void)
> -{
> -	int ret = platform_driver_probe(&ltq_mtd_driver, ltq_mtd_probe);
> -
> -	if (ret)
> -		pr_err("ltq_nor: error registering platform driver");
> -	return ret;
> -}
> -
> -static void __exit
> -exit_ltq_mtd(void)
> -{
> -	platform_driver_unregister(&ltq_mtd_driver);
> -}
> -
> -module_init(init_ltq_mtd);
> -module_exit(exit_ltq_mtd);
> +module_platform_driver(ltq_mtd_driver);
>
>   MODULE_LICENSE("GPL");
>   MODULE_AUTHOR("John Crispin<blogic@openwrt.org>");
> diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
> index fa2580b..4cfc314 100644
> --- a/drivers/net/ethernet/lantiq_etop.c
> +++ b/drivers/net/ethernet/lantiq_etop.c
> @@ -943,6 +943,7 @@ ltq_etop_remove(struct platform_device *pdev)
>   }
>
>   static struct platform_driver ltq_mii_driver = {
> +	.probe = ltq_etop_probe,

dito

>   	.remove = __devexit_p(ltq_etop_remove),
>   	.driver = {
>   		.name = "ltq_etop",
> @@ -950,24 +951,7 @@ static struct platform_driver ltq_mii_driver = {
>   	},
>   };
>
> -int __init
> -init_ltq_etop(void)
> -{
> -	int ret = platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
> -
> -	if (ret)
> -		pr_err("ltq_etop: Error registering platfom driver!");
> -	return ret;
> -}
> -
> -static void __exit
> -exit_ltq_etop(void)
> -{
> -	platform_driver_unregister(&ltq_mii_driver);
> -}
> -
> -module_init(init_ltq_etop);
> -module_exit(exit_ltq_etop);
> +module_platform_driver(ltq_mii_driver);
>
>   MODULE_AUTHOR("John Crispin<blogic@openwrt.org>");
>   MODULE_DESCRIPTION("Lantiq SoC ETOP");
> diff --git a/drivers/watchdog/lantiq_wdt.c b/drivers/watchdog/lantiq_wdt.c
> index 05646b8..572ac60 100644
> --- a/drivers/watchdog/lantiq_wdt.c
> +++ b/drivers/watchdog/lantiq_wdt.c
> @@ -227,6 +227,7 @@ ltq_wdt_remove(struct platform_device *pdev)
>
>
>   static struct platform_driver ltq_wdt_driver = {
> +	.probe = ltq_wdt_probe,

dito

>   	.remove = __devexit_p(ltq_wdt_remove),
>   	.driver = {
>   		.name = "ltq_wdt",
> @@ -234,21 +235,7 @@ static struct platform_driver ltq_wdt_driver = {
>   	},
>   };
>
> -static int __init
> -init_ltq_wdt(void)
> -{
> -	return platform_driver_probe(&ltq_wdt_driver, ltq_wdt_probe);
> -}
> -
> -static void __exit
> -exit_ltq_wdt(void)
> -{
> -	return platform_driver_unregister(&ltq_wdt_driver);
> -}
> -
> -module_init(init_ltq_wdt);
> -module_exit(exit_ltq_wdt);
> -
> +module_platform_driver(ltq_wdt_driver);
>   module_param(nowayout, int, 0);
>   MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
>


-- 
Best regards,
Daniel

      reply	other threads:[~2012-02-17 23:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-17 10:33 [PATCH 1/3] MIPS: lantiq: unify xway prom code John Crispin
2012-02-17 10:33 ` [PATCH 2/3] MIPS: lantiq: add vr9 support John Crispin
2012-02-17 17:43   ` Sergei Shtylyov
2012-02-17 16:50     ` John Crispin
2012-02-17 10:33 ` [PATCH 3/3] MIPS: lantiq: make use of module_platform_driver() John Crispin
2012-02-17 23:02   ` Daniel Schwierzeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F3EDC99.2070106@googlemail.com \
    --to=daniel.schwierzeck@googlemail.com \
    --cc=blogic@openwrt.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox