From: Manivannan Sadhasivam via B4 Relay <devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org>
To: "Rob Herring" <robh@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nicolas.schier@linux.dev>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Mark Pearson" <mpearson-lenovo@squebb.ca>,
"Derek J. Clark" <derekjohn.clark@gmail.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Marcel Holtmann" <marcel@holtmann.org>,
"Luiz Augusto von Dentz" <luiz.dentz@gmail.com>,
"Bartosz Golaszewski" <brgl@bgdev.pl>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kbuild@vger.kernel.org,
platform-driver-x86@vger.kernel.org, linux-pci@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-bluetooth@vger.kernel.org, linux-pm@vger.kernel.org,
Stephan Gerhold <stephan.gerhold@linaro.org>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Subject: [PATCH 5/9] serdev: Add modalias support for serdev client devices
Date: Wed, 12 Nov 2025 20:15:17 +0530 [thread overview]
Message-ID: <20251112-pci-m2-e-v1-5-97413d6bf824@oss.qualcomm.com> (raw)
In-Reply-To: <20251112-pci-m2-e-v1-0-97413d6bf824@oss.qualcomm.com>
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Add modlias support to serdev so that the serdev client driver can be
autoloaded by udev when the serdev client device gets created.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/tty/serdev/core.c | 15 +++++++++++----
include/linux/mod_devicetable.h | 1 +
scripts/mod/file2alias.c | 8 ++++++++
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index f90095cb778f2374303f98809d1639a000e0d9e0..8c2a40a537d93f4b9353a2f128cdf51b521929b1 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -34,7 +34,11 @@ static ssize_t modalias_show(struct device *dev,
if (len != -ENODEV)
return len;
- return of_device_modalias(dev, buf, PAGE_SIZE);
+ len = of_device_modalias(dev, buf, PAGE_SIZE);
+ if (len != -ENODEV)
+ return len;
+
+ return sysfs_emit(buf, SERDEV_DEVICE_MODALIAS_FMT "\n", dev_name(dev));
}
static DEVICE_ATTR_RO(modalias);
@@ -48,13 +52,16 @@ static int serdev_device_uevent(const struct device *dev, struct kobj_uevent_env
{
int rc;
- /* TODO: platform modalias */
-
rc = acpi_device_uevent_modalias(dev, env);
if (rc != -ENODEV)
return rc;
- return of_device_uevent_modalias(dev, env);
+ rc = of_device_uevent_modalias(dev, env);
+ if (rc != -ENODEV)
+ return rc;
+
+ return add_uevent_var(env, "MODALIAS=" SERDEV_DEVICE_MODALIAS_FMT,
+ dev_name(dev));
}
static void serdev_device_release(struct device *dev)
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 70c54c4bedba2fcb8f5eb37c2d9ede05d5d91188..dad9637cf28552c3423affc4eb249efa6ba05514 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -976,6 +976,7 @@ struct coreboot_device_id {
kernel_ulong_t driver_data;
};
+#define SERDEV_DEVICE_MODALIAS_FMT "serdev:%s"
#define SERDEV_NAME_SIZE 32
struct serdev_device_id {
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index b3333560b95ee998fbe5bdc9ed380847962d1bd1..27e9f7c718c4d48ca5dbd5538490529119df9509 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1371,6 +1371,13 @@ static void do_coreboot_entry(struct module *mod, void *symval)
module_alias_printf(mod, false, "coreboot:t%08X", tag);
}
+/* Looks like: serdev:S */
+static void do_serdev_entry(struct module *mod, void *symval)
+{
+ DEF_FIELD_ADDR(symval, serdev_device_id, name);
+ module_alias_printf(mod, false, SERDEV_DEVICE_MODALIAS_FMT, *name);
+}
+
/* Does namelen bytes of name exactly match the symbol? */
static bool sym_is(const char *name, unsigned namelen, const char *symbol)
{
@@ -1467,6 +1474,7 @@ static const struct devtable devtable[] = {
{"usb", SIZE_usb_device_id, do_usb_entry_multi},
{"pnp", SIZE_pnp_device_id, do_pnp_device_entry},
{"pnp_card", SIZE_pnp_card_device_id, do_pnp_card_entry},
+ {"serdev", SIZE_serdev_device_id, do_serdev_entry},
};
/* Create MODULE_ALIAS() statements.
--
2.48.1
next prev parent reply other threads:[~2025-11-12 14:45 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 14:45 [PATCH 0/9] Add support for handling PCIe M.2 Key E connectors in devicetree Manivannan Sadhasivam via B4 Relay
2025-11-12 14:45 ` [PATCH 1/9] serdev: Convert to_serdev_device() and to_serdev_controller() helpers to macros Manivannan Sadhasivam via B4 Relay
2025-11-12 21:13 ` Rob Herring
2025-11-13 5:15 ` Manivannan Sadhasivam
2025-11-12 14:45 ` [PATCH 2/9] serdev: Add serdev device based driver match support Manivannan Sadhasivam via B4 Relay
2025-11-12 14:45 ` [PATCH 3/9] serdev: Allow passing the serdev device name to serdev_device_add() Manivannan Sadhasivam via B4 Relay
2025-11-18 9:41 ` Ilpo Järvinen
2025-11-12 14:45 ` [PATCH 4/9] serdev: Add an API to find the serdev controller associated with the devicetree node Manivannan Sadhasivam via B4 Relay
2025-11-12 14:45 ` Manivannan Sadhasivam via B4 Relay [this message]
2025-11-12 14:45 ` [PATCH 6/9] serdev: Skip registering serdev devices from DT is external connector is used Manivannan Sadhasivam via B4 Relay
2025-11-18 13:03 ` Rob Herring
2025-11-19 13:32 ` Manivannan Sadhasivam
2025-11-20 16:22 ` Rob Herring
2025-11-20 16:54 ` Manivannan Sadhasivam
2025-11-12 14:45 ` [PATCH 7/9] dt-bindings: connector: Add PCIe M.2 Mechanical Key E connector Manivannan Sadhasivam via B4 Relay
2025-11-12 17:11 ` Frank Li
2025-11-13 5:00 ` Manivannan Sadhasivam
2025-11-19 23:59 ` Rob Herring
2025-11-20 12:57 ` Manivannan Sadhasivam
2025-11-12 20:08 ` Dmitry Baryshkov
2025-11-13 5:05 ` Manivannan Sadhasivam
2025-11-12 14:45 ` [PATCH 8/9] Bluetooth: hci_qca: Add support for WCN7850 PCIe M.2 card Manivannan Sadhasivam via B4 Relay
2025-11-18 14:29 ` Bartosz Golaszewski
2025-11-19 13:36 ` Manivannan Sadhasivam
2025-11-12 14:45 ` [PATCH 9/9] power: sequencing: pcie-m2: Add support for PCIe M.2 Key E connectors Manivannan Sadhasivam via B4 Relay
2025-11-19 13:28 ` Bartosz Golaszewski
2025-11-19 13:54 ` Manivannan Sadhasivam
2025-11-12 21:07 ` [PATCH 0/9] Add support for handling PCIe M.2 Key E connectors in devicetree Rob Herring
2025-11-13 5:13 ` Manivannan Sadhasivam
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=20251112-pci-m2-e-v1-5-97413d6bf824@oss.qualcomm.com \
--to=devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=derekjohn.clark@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jirislaby@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=mani@kernel.org \
--cc=manivannan.sadhasivam@oss.qualcomm.com \
--cc=marcel@holtmann.org \
--cc=mpearson-lenovo@squebb.ca \
--cc=nathan@kernel.org \
--cc=nicolas.schier@linux.dev \
--cc=platform-driver-x86@vger.kernel.org \
--cc=robh@kernel.org \
--cc=stephan.gerhold@linaro.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;
as well as URLs for NNTP newsgroup(s).