diff options
author | Jason Gerecke <jason.gerecke@wacom.com> | 2024-05-30 22:51:32 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-05-30 22:55:48 +0200 |
commit | 6c7cc1a29d1e679be4a98b01141f1ba491e5775e (patch) | |
tree | 9815f83f41a55fed99d8c174d464310e58b6cd4e /drivers/input/touchscreen/wacom_w8001.c | |
parent | Merge tag 'v6.9' into next (diff) | |
download | linux-6c7cc1a29d1e679be4a98b01141f1ba491e5775e.tar.xz linux-6c7cc1a29d1e679be4a98b01141f1ba491e5775e.zip |
Input: wacom_w8001 - simplify device name generation
Replace pairs of strscpy/strlcat calls with snprintf.
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Link: https://lore.kernel.org/r/CANRwn3SuTjdCCK4YH1ObvsC_gZuythAQ7kSHJP-CiAFw9h5Qcw@mail.gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/wacom_w8001.c')
-rw-r--r-- | drivers/input/touchscreen/wacom_w8001.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index 928c5ee3ac36..c61908518afe 100644 --- a/drivers/input/touchscreen/wacom_w8001.c +++ b/drivers/input/touchscreen/wacom_w8001.c @@ -595,7 +595,7 @@ static int w8001_connect(struct serio *serio, struct serio_driver *drv) struct w8001 *w8001; struct input_dev *input_dev_pen; struct input_dev *input_dev_touch; - char basename[64]; + char basename[64] = "Wacom Serial"; int err, err_pen, err_touch; w8001 = kzalloc(sizeof(struct w8001), GFP_KERNEL); @@ -625,8 +625,6 @@ static int w8001_connect(struct serio *serio, struct serio_driver *drv) /* For backwards-compatibility we compose the basename based on * capabilities and then just append the tool type */ - strscpy(basename, "Wacom Serial", sizeof(basename)); - err_pen = w8001_setup_pen(w8001, basename, sizeof(basename)); err_touch = w8001_setup_touch(w8001, basename, sizeof(basename)); if (err_pen && err_touch) { @@ -635,8 +633,8 @@ static int w8001_connect(struct serio *serio, struct serio_driver *drv) } if (!err_pen) { - strscpy(w8001->pen_name, basename, sizeof(w8001->pen_name)); - strlcat(w8001->pen_name, " Pen", sizeof(w8001->pen_name)); + snprintf(w8001->pen_name, sizeof(w8001->pen_name), + "%s Pen", basename); input_dev_pen->name = w8001->pen_name; w8001_set_devdata(input_dev_pen, w8001, serio); @@ -651,9 +649,8 @@ static int w8001_connect(struct serio *serio, struct serio_driver *drv) } if (!err_touch) { - strscpy(w8001->touch_name, basename, sizeof(w8001->touch_name)); - strlcat(w8001->touch_name, " Finger", - sizeof(w8001->touch_name)); + snprintf(w8001->pen_name, sizeof(w8001->pen_name), + "%s Finger", basename); input_dev_touch->name = w8001->touch_name; w8001_set_devdata(input_dev_touch, w8001, serio); |