From: Shihuang Liu <shlomojune6@gmail.com>
To: linux-input@vger.kernel.org, linux-hardening@vger.kernel.org
Cc: Marcus Folkesson <marcus.folkesson@gmail.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Ville Syrjala <syrjala@sci.fi>,
Henk Vergonet <Henk.Vergonet@gmail.com>,
Henrik Rydberg <rydberg@bitmath.org>,
linux-kernel@vger.kernel.org,
Shihuang Liu <shlomojune6@gmail.com>
Subject: [PATCH v2 3/6] Input: misc - use usb_make_subpath()
Date: Wed, 21 Oct 2026 20:31:43 +0800 [thread overview]
Message-ID: <20261021123146.17202-4-shlomojune6@gmail.com> (raw)
In-Reply-To: <20261021123146.17202-1-shlomojune6@gmail.com>
The ati_remote2, cm109, ims-pcu, keyspan_remote, powermate and yealink
drivers build their input device physical paths by appending a subpath
with strlcat() after usb_make_path(). Most use "/input0"; ims-pcu also
uses "/input1" for its gamepad interface.
In preparation for removing the deprecated strlcat() API [1], replace
these pairs of calls with usb_make_subpath(). Pass "input0" or "input1"
as appropriate so the helper constructs each physical path in one call,
avoiding a separate buffer scan and append operation.
Link: https://github.com/KSPP/linux/issues/370 [1]
Signed-off-by: Shihuang Liu <shlomojune6@gmail.com>
---
drivers/input/misc/ati_remote2.c | 3 +--
drivers/input/misc/cm109.c | 3 +--
drivers/input/misc/ims-pcu.c | 6 ++----
drivers/input/misc/keyspan_remote.c | 3 +--
drivers/input/misc/powermate.c | 3 +--
drivers/input/misc/yealink.c | 3 +--
6 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index 8db2dca84975c..20cb7b8efcc0b 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -822,8 +822,7 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
if (r)
goto fail3;
- usb_make_path(udev, ar2->phys, sizeof(ar2->phys));
- strlcat(ar2->phys, "/input0", sizeof(ar2->phys));
+ usb_make_subpath(udev, ar2->phys, sizeof(ar2->phys), "input0");
strlcat(ar2->name, "ATI Remote Wonder II", sizeof(ar2->name));
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
index 353d3c1d347d5..06d8f0dab4b37 100644
--- a/drivers/input/misc/cm109.c
+++ b/drivers/input/misc/cm109.c
@@ -765,8 +765,7 @@ static int cm109_usb_probe(struct usb_interface *intf,
dev->urb_ctl->dev = udev;
/* find out the physical bus location */
- usb_make_path(udev, dev->phys, sizeof(dev->phys));
- strlcat(dev->phys, "/input0", sizeof(dev->phys));
+ usb_make_subpath(udev, dev->phys, sizeof(dev->phys), "input0");
/* register settings for the input device */
input_dev->name = nfo->name;
diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index b1a0edcc49b4e..e629a327fdd76 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -215,8 +215,7 @@ static int ims_pcu_setup_buttons(struct ims_pcu *pcu,
snprintf(buttons->name, sizeof(buttons->name),
"IMS PCU#%d Button Interface", pcu->device_no);
- usb_make_path(pcu->udev, buttons->phys, sizeof(buttons->phys));
- strlcat(buttons->phys, "/input0", sizeof(buttons->phys));
+ usb_make_subpath(pcu->udev, buttons->phys, sizeof(buttons->phys), "input0");
memcpy(buttons->keymap, keymap, sizeof(*keymap) * keymap_len);
@@ -301,8 +300,7 @@ static int ims_pcu_setup_gamepad(struct ims_pcu *pcu)
snprintf(gamepad->name, sizeof(gamepad->name),
"IMS PCU#%d Gamepad Interface", pcu->device_no);
- usb_make_path(pcu->udev, gamepad->phys, sizeof(gamepad->phys));
- strlcat(gamepad->phys, "/input1", sizeof(gamepad->phys));
+ usb_make_subpath(pcu->udev, gamepad->phys, sizeof(gamepad->phys), "input1");
input->name = gamepad->name;
input->phys = gamepad->phys;
diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
index 70cd6586459ef..68c969657806d 100644
--- a/drivers/input/misc/keyspan_remote.c
+++ b/drivers/input/misc/keyspan_remote.c
@@ -481,8 +481,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
le16_to_cpu(udev->descriptor.idVendor),
le16_to_cpu(udev->descriptor.idProduct));
- usb_make_path(udev, remote->phys, sizeof(remote->phys));
- strlcat(remote->phys, "/input0", sizeof(remote->phys));
+ usb_make_subpath(udev, remote->phys, sizeof(remote->phys), "input0");
memcpy(remote->keymap, keyspan_key_table, sizeof(remote->keymap));
input_dev->name = remote->name;
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index 754379d2625cf..f004cfca795ec 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -333,8 +333,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
pm->intf = intf;
pm->input = input_dev;
- usb_make_path(udev, pm->phys, sizeof(pm->phys));
- strlcat(pm->phys, "/input0", sizeof(pm->phys));
+ usb_make_subpath(udev, pm->phys, sizeof(pm->phys), "input0");
spin_lock_init(&pm->lock);
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index 560f895a00cda..9a8ee7a586f44 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -890,8 +890,7 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
yld->urb_ctl->dev = udev;
/* find out the physical bus location */
- usb_make_path(udev, yld->phys, sizeof(yld->phys));
- strlcat(yld->phys, "/input0", sizeof(yld->phys));
+ usb_make_subpath(udev, yld->phys, sizeof(yld->phys), "input0");
/* register settings for the input device */
input_dev->name = nfo->name;
--
2.43.0
next prev parent reply other threads:[~2026-10-21 12:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 12:31 [PATCH v2 0/6] USB: add usb_make_subpath() to replace strlcat() in input drivers Shihuang Liu
2026-10-21 12:31 ` [PATCH v2 1/6] USB: add usb_make_subpath() for formatted device subpaths Shihuang Liu
2026-10-21 13:17 ` Alejandro Colomar
2026-10-21 12:31 ` [PATCH v2 2/6] Input: joystick - use usb_make_subpath() Shihuang Liu
2026-10-21 13:21 ` Alejandro Colomar
2026-10-21 12:31 ` Shihuang Liu [this message]
2026-10-21 12:31 ` [PATCH v2 4/6] Input: mouse " Shihuang Liu
2026-10-21 12:31 ` [PATCH v2 5/6] Input: tablet " Shihuang Liu
2026-10-21 12:31 ` [PATCH v2 6/6] Input: touchscreen " Shihuang Liu
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=20261021123146.17202-4-shlomojune6@gmail.com \
--to=shlomojune6@gmail.com \
--cc=Henk.Vergonet@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcus.folkesson@gmail.com \
--cc=rydberg@bitmath.org \
--cc=syrjala@sci.fi \
/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®