All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Claudiu Beznea <claudiu.beznea@tuxon.dev>,
	Bartosz Golaszewski <brgl@kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>, Vignesh R <vigneshr@ti.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	Janusz Krzysztofik <jmkrzyszt@gmail.com>,
	Tony Lindgren <tony@atomide.com>,
	Andreas Kemnade <andreas@kemnade.info>,
	Kevin Hilman <khilman@baylibre.com>,
	Roger Quadros <rogerq@kernel.org>,
	Vladimir Zapolskiy <vz@mleia.com>,
	Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Peter Griffin <peter.griffin@linaro.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Linus Walleij <linusw@kernel.org>,
	linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, imx@lists.linux.dev,
	linux-omap@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH] i2c: Convert to subsys_platform_driver()
Date: Wed, 4 Nov 2026 13:54:58 +0200	[thread overview]
Message-ID: <ausdEofHrBQMLiEO@shikoro> (raw)
In-Reply-To: <20261104113316.1634141-1-peng.fan@oss.nxp.com>

Hi,

> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -896,19 +896,7 @@ static struct platform_driver davinci_i2c_driver = {
>  		.of_match_table = davinci_i2c_of_match,
>  	},
>  };
> -
> -/* I2C may be needed to bring up other drivers */
> -static int __init davinci_i2c_init_driver(void)

I'd vote to keep this comment.

> -{
> -	return platform_driver_register(&davinci_i2c_driver);
> -}
> -subsys_initcall(davinci_i2c_init_driver);
> -
> -static void __exit davinci_i2c_exit_driver(void)
> -{
> -	platform_driver_unregister(&davinci_i2c_driver);
> -}
> -module_exit(davinci_i2c_exit_driver);
> +subsys_platform_driver(davinci_i2c_driver);

...

> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index bd659dfa702f..cd4d6d6b32c6 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1611,20 +1611,7 @@ static struct platform_driver omap_i2c_driver = {
>  		.of_match_table = of_match_ptr(omap_i2c_of_match),
>  	},
>  };
> -
> -/* I2C may be needed to bring up other drivers */

Ditto.

> -static int __init
> -omap_i2c_init_driver(void)
> -{
> -	return platform_driver_register(&omap_i2c_driver);
> -}
> -subsys_initcall(omap_i2c_init_driver);
> -
> -static void __exit omap_i2c_exit_driver(void)
> -{
> -	platform_driver_unregister(&omap_i2c_driver);
> -}
> -module_exit(omap_i2c_exit_driver);
> +subsys_platform_driver(omap_i2c_driver);
>  
>  MODULE_AUTHOR("MontaVista Software, Inc. (and others)");
>  MODULE_DESCRIPTION("TI OMAP I2C bus adapter");
> diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
> index e1cc2b2bd628..9a9a12b7e981 100644
> --- a/drivers/i2c/busses/i2c-pnx.c
> +++ b/drivers/i2c/busses/i2c-pnx.c
> @@ -735,16 +735,6 @@ static struct platform_driver i2c_pnx_driver = {
>  	.remove = i2c_pnx_remove,
>  };
>  
> -static int __init i2c_adap_pnx_init(void)
> -{
> -	return platform_driver_register(&i2c_pnx_driver);
> -}
> -
> -static void __exit i2c_adap_pnx_exit(void)
> -{
> -	platform_driver_unregister(&i2c_pnx_driver);
> -}
> -
>  MODULE_AUTHOR("Vitaly Wool");
>  MODULE_AUTHOR("Dennis Kovalev <source@mvista.com>");
>  MODULE_DESCRIPTION("I2C driver for Philips IP3204-based I2C busses");
> @@ -752,5 +742,4 @@ MODULE_LICENSE("GPL");
>  MODULE_ALIAS("platform:pnx-i2c");
>  
>  /* We need to make sure I2C is initialized before USB */
> -subsys_initcall(i2c_adap_pnx_init);
> -module_exit(i2c_adap_pnx_exit);
> +subsys_platform_driver(i2c_pnx_driver);

Use this occasion to move the comment and your code upwards right below
the driver struct?

> diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
> index 3a55f803e4f1..1ecf14890209 100644
> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c
> @@ -986,18 +986,7 @@ static struct platform_driver sh_mobile_i2c_driver = {
>  	.probe		= sh_mobile_i2c_probe,
>  	.remove		= sh_mobile_i2c_remove,
>  };
> -
> -static int __init sh_mobile_i2c_adap_init(void)
> -{
> -	return platform_driver_register(&sh_mobile_i2c_driver);
> -}
> -subsys_initcall(sh_mobile_i2c_adap_init);
> -
> -static void __exit sh_mobile_i2c_adap_exit(void)
> -{
> -	platform_driver_unregister(&sh_mobile_i2c_driver);
> -}
> -module_exit(sh_mobile_i2c_adap_exit);
> +subsys_platform_driver(sh_mobile_i2c_driver);

Here you have no empty line after the driver struct...

>  
>  MODULE_DESCRIPTION("SuperH Mobile I2C Bus Controller driver");
>  MODULE_AUTHOR("Magnus Damm");
> diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
> index a1ab6ef6f071..152ab19f272a 100644
> --- a/drivers/i2c/busses/i2c-versatile.c
> +++ b/drivers/i2c/busses/i2c-versatile.c
> @@ -116,18 +116,7 @@ static struct platform_driver i2c_versatile_driver = {
>  	},
>  };
>  
> -static int __init i2c_versatile_init(void)
> -{
> -	return platform_driver_register(&i2c_versatile_driver);
> -}
> -
> -static void __exit i2c_versatile_exit(void)
> -{
> -	platform_driver_unregister(&i2c_versatile_driver);
> -}
> -
> -subsys_initcall(i2c_versatile_init);
> -module_exit(i2c_versatile_exit);
> +subsys_platform_driver(i2c_versatile_driver);

... while you have one here. Please make it consistent to no empty line.

Other than that, looks good.

Happy hacking,

   Wolfram

  parent reply	other threads:[~2026-11-04 11:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 11:33 [PATCH] i2c: Convert to subsys_platform_driver() Peng Fan (OSS)
2026-11-04 11:45 ` Vladimir Zapolskiy
2026-11-04 11:54 ` Wolfram Sang [this message]
2026-11-04 14:18 ` Bartosz Golaszewski
2026-11-04 17:38 ` Krzysztof Kozlowski
2026-11-04 20:37   ` Andy Shevchenko
2026-11-05  8:16     ` Krzysztof Kozlowski
2026-11-05  8:17       ` Wolfram Sang
2026-11-05  8:20         ` Krzysztof Kozlowski

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=ausdEofHrBQMLiEO@shikoro \
    --to=wsa+renesas@sang-engineering.com \
    --cc=Frank.Li@nxp.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alim.akhtar@samsung.com \
    --cc=andi.shyti@kernel.org \
    --cc=andreas@kemnade.info \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@kernel.org \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=codrin.ciubotariu@microchip.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=jmkrzyszt@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=khilman@baylibre.com \
    --cc=krzk@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=o.rempel@pengutronix.de \
    --cc=peng.fan@oss.nxp.com \
    --cc=peter.griffin@linaro.org \
    --cc=piotr.wojtaszczyk@timesys.com \
    --cc=rogerq@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.com \
    --cc=vz@mleia.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.