mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brian Masney <bmasney@redhat.com>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	 Krzysztof Kozlowski <krzk@kernel.org>,
	 MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: linux-kernel@vger.kernel.org,
	 Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>,
	 Brian Masney <bmasney@redhat.com>
Subject: [PATCH v2] extcon: max77843: convert to module_platform_driver()
Date: Mon, 09 Nov 2026 12:47:19 -0500	[thread overview]
Message-ID: <20261109-extcon-subsys-v2-1-118a58a851c0@redhat.com> (raw)

This driver is currently registered at the subsys_initcall level,
however this driver shouldn't be needed for early boot, and can be
converted to use the standard module_init().

This driver already has the standard MODULE_DEVICE_TABLE(), is
configured in the Kconfig to be a tristate, and the driver doesn't
have suppress_bind_attrs set, so let's go ahead and reduce boilerplate
code in this driver and convert it over to use the macro
module_platform_driver().

Note that currently there is no __exit function defined and this change
will add an __exit function that unregisters the platform driver.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Brian Masney <bmasney@redhat.com>
---
Changes in v2:
- Change from module_platform_driver() to subsys_platform_driver() (Krzk)
- Link to v1: https://patch.msgid.link/20261106-extcon-subsys-v1-1-6a781b323d6f@redhat.com
---
 drivers/extcon/extcon-max77843.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c
index 2ae9f7f1a67f..7fa42e3cf848 100644
--- a/drivers/extcon/extcon-max77843.c
+++ b/drivers/extcon/extcon-max77843.c
@@ -960,11 +960,7 @@ static struct platform_driver max77843_muic_driver = {
 	.id_table	= max77843_muic_id,
 };
 
-static int __init max77843_muic_init(void)
-{
-	return platform_driver_register(&max77843_muic_driver);
-}
-subsys_initcall(max77843_muic_init);
+module_platform_driver(max77843_muic_driver);
 
 MODULE_DESCRIPTION("Maxim MAX77843 Extcon driver");
 MODULE_AUTHOR("Jaewon Kim <jaewon02.kim@samsung.com>");

---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
change-id: 20261106-extcon-subsys-24280aaba499

Best regards,
--  
Brian Masney <bmasney@redhat.com>


                 reply	other threads:[~2026-11-09 17:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261109-extcon-subsys-v2-1-118a58a851c0@redhat.com \
    --to=bmasney@redhat.com \
    --cc=cw00.choi@samsung.com \
    --cc=krzk@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®