Chrome platform driver development
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: bleung@chromium.org, groeck@chromium.org,
	linus.walleij@linaro.org, brgl@bgdev.pl,
	hverkuil-cisco@xs4all.nl, mchehab@kernel.org, sre@kernel.org
Cc: tzungbi@kernel.org, chrome-platform@lists.linux.dev,
	pmalani@chromium.org, linux-gpio@vger.kernel.org,
	linux-media@vger.kernel.org, linux-pm@vger.kernel.org,
	krzk@kernel.org,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: [PATCH v2 2/6] gpio: cros-ec: provide ID table for avoiding fallback match
Date: Mon,  1 Apr 2024 11:00:48 +0800	[thread overview]
Message-ID: <20240401030052.2887845-3-tzungbi@kernel.org> (raw)
In-Reply-To: <20240401030052.2887845-1-tzungbi@kernel.org>

Instead of using fallback driver name match, provide ID table[1] for the
primary match.  Also allow automatic module loading by adding
MODULE_DEVICE_TABLE().

[1]: https://elixir.bootlin.com/linux/v6.8/source/drivers/base/platform.c#L1353

Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
Changes from v1:
- No code changes.
- Add R-b tags.

 drivers/gpio/gpio-cros-ec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpio/gpio-cros-ec.c b/drivers/gpio/gpio-cros-ec.c
index 842e1c060414..0c09bb54dc0c 100644
--- a/drivers/gpio/gpio-cros-ec.c
+++ b/drivers/gpio/gpio-cros-ec.c
@@ -12,6 +12,7 @@
 #include <linux/errno.h>
 #include <linux/gpio/driver.h>
 #include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/platform_data/cros_ec_commands.h>
 #include <linux/platform_data/cros_ec_proto.h>
@@ -197,11 +198,18 @@ static int cros_ec_gpio_probe(struct platform_device *pdev)
 	return devm_gpiochip_add_data(dev, gc, cros_ec);
 }
 
+static const struct platform_device_id cros_ec_gpio_id[] = {
+	{ "cros-ec-gpio", 0 },
+	{}
+};
+MODULE_DEVICE_TABLE(platform, cros_ec_gpio_id);
+
 static struct platform_driver cros_ec_gpio_driver = {
 	.probe = cros_ec_gpio_probe,
 	.driver = {
 		.name = "cros-ec-gpio",
 	},
+	.id_table = cros_ec_gpio_id,
 };
 module_platform_driver(cros_ec_gpio_driver);
 
-- 
2.44.0.478.gd926399ef9-goog


  parent reply	other threads:[~2024-04-01  3:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-01  3:00 [PATCH v2 0/6] provide ID table for avoiding fallback match Tzung-Bi Shih
2024-04-01  3:00 ` [PATCH v2 1/6] media: platform: cros-ec: " Tzung-Bi Shih
2024-04-08  7:36   ` Hans Verkuil
2024-04-01  3:00 ` Tzung-Bi Shih [this message]
2024-04-02  8:58   ` [PATCH v2 2/6] gpio: " Bartosz Golaszewski
2024-04-01  3:00 ` [PATCH v2 3/6] power: supply: cros_usbpd: " Tzung-Bi Shih
2024-04-01  3:00 ` [PATCH v2 4/6] power: supply: cros_pchg: " Tzung-Bi Shih
2024-04-01  3:00 ` [PATCH v2 5/6] platform/chrome: cros_kbd_led_backlight: shrink the driver name Tzung-Bi Shih
2024-04-01 10:02   ` Krzysztof Kozlowski
2024-04-01 10:19     ` Krzysztof Kozlowski
2024-04-01 10:42       ` Tzung-Bi Shih
2024-04-01  3:00 ` [PATCH v2 6/6] platform/chrome: cros_kbd_led_backlight: provide ID table for avoiding fallback match Tzung-Bi Shih
2024-04-01 10:03   ` Krzysztof Kozlowski
2024-04-01  9:45 ` (subset) [PATCH v2 0/6] " Sebastian Reichel
2024-05-27  2:55 ` patchwork-bot+chrome-platform
2024-05-27  3:07 ` patchwork-bot+chrome-platform

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=20240401030052.2887845-3-tzungbi@kernel.org \
    --to=tzungbi@kernel.org \
    --cc=bleung@chromium.org \
    --cc=brgl@bgdev.pl \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=krzk@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=pmalani@chromium.org \
    --cc=sre@kernel.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