[PATCH v2 4/6] Input: mouse - use usb_make_subpath()
From: Shihuang Liu
Date: Wed Oct 21 2026 - 08:39:05 EST
The appletouch, bcm5974 and synaptics_usb drivers build their input
device physical paths by appending "/input0" with strlcat() after
usb_make_path().
In preparation for removing the deprecated strlcat() API [1],
replace each pair of calls with usb_make_subpath(). The
helper formats the USB path and the "input0" subpath 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@xxxxxxxxx>
---
drivers/input/mouse/appletouch.c | 3 +--
drivers/input/mouse/bcm5974.c | 3 +--
drivers/input/mouse/synaptics_usb.c | 3 +--
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index eebeb57515e1c..b536dfae427de 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -874,8 +874,7 @@ static int atp_probe(struct usb_interface *iface,
if (error)
goto err_free_buffer;
- 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");
input_dev->name = "appletouch";
input_dev->phys = dev->phys;
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index e772bac3b64c0..0732bf3a97adc 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -989,8 +989,7 @@ static int bcm5974_probe(struct usb_interface *iface,
dev->tp_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
/* create bcm5974 device */
- 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");
input_dev->name = "bcm5974";
input_dev->phys = dev->phys;
diff --git a/drivers/input/mouse/synaptics_usb.c b/drivers/input/mouse/synaptics_usb.c
index 880a0c79148cd..7da22118ce576 100644
--- a/drivers/input/mouse/synaptics_usb.c
+++ b/drivers/input/mouse/synaptics_usb.c
@@ -353,8 +353,7 @@ static int synusb_probe(struct usb_interface *intf,
if (synusb->flags & SYNUSB_STICK)
strlcat(synusb->name, " (Stick)", sizeof(synusb->name));
- usb_make_path(udev, synusb->phys, sizeof(synusb->phys));
- strlcat(synusb->phys, "/input0", sizeof(synusb->phys));
+ usb_make_subpath(udev, synusb->phys, sizeof(synusb->phys), "input0");
input_dev->name = synusb->name;
input_dev->phys = synusb->phys;
--
2.43.0