* Re: [PATCH 4/6] input: serio.h: add SERIO_EXTRON_DA_HD_PLUS
From: Hans Verkuil @ 2024-08-28 11:25 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-media
In-Reply-To: <ccbb099a35cb788c7304795927f508cfc2342ff8.1723190258.git.hverkuil-cisco@xs4all.nl>
Hi Dmitry,
It's a trivial patch, but it would be great if you can give an Acked-by
or Reviewed-by.
Regards,
Hans
On 09/08/2024 09:57, Hans Verkuil wrote:
> Add a new serio ID for the Extron DA HD 4K Plus series of 4K HDMI
> Distribution Amplifiers. These devices support CEC over the serial
> port, so a new serio ID is needed to be able to associate the CEC
> driver.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
> include/uapi/linux/serio.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/uapi/linux/serio.h b/include/uapi/linux/serio.h
> index ed2a96f43ce4..5a2af0942c9f 100644
> --- a/include/uapi/linux/serio.h
> +++ b/include/uapi/linux/serio.h
> @@ -83,5 +83,6 @@
> #define SERIO_PULSE8_CEC 0x40
> #define SERIO_RAINSHADOW_CEC 0x41
> #define SERIO_FSIA6B 0x42
> +#define SERIO_EXTRON_DA_HD_4K_PLUS 0x43
>
> #endif /* _UAPI_SERIO_H */
^ permalink raw reply
* Re: [PATCH] Input: mt6779-keypad - use devm_clk_get_enabled()
From: Mattijs Korpershoek @ 2024-08-28 9:31 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Matthias Brugger, AngeloGioacchino Del Regno, linux-input,
linux-kernel, linux-arm-kernel, linux-mediatek
In-Reply-To: <Zs4UWGKt3hLjNmoP@google.com>
Hi Dmitry
Thank you for the patch.
On mar., août 27, 2024 at 11:00, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> Switch to using devm_clk_get_enable() helper instead of acquiring the
> clock with devm_clk_get(), enabling it, and defining and installing
> a custom devm action to call clk_disable().
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
> drivers/input/keyboard/mt6779-keypad.c | 18 +-----------------
> 1 file changed, 1 insertion(+), 17 deletions(-)
>
> diff --git a/drivers/input/keyboard/mt6779-keypad.c b/drivers/input/keyboard/mt6779-keypad.c
> index 19f69d167fbd..c13880103429 100644
> --- a/drivers/input/keyboard/mt6779-keypad.c
> +++ b/drivers/input/keyboard/mt6779-keypad.c
> @@ -92,11 +92,6 @@ static irqreturn_t mt6779_keypad_irq_handler(int irq, void *dev_id)
> return IRQ_HANDLED;
> }
>
> -static void mt6779_keypad_clk_disable(void *data)
> -{
> - clk_disable_unprepare(data);
> -}
> -
> static void mt6779_keypad_calc_row_col_single(unsigned int key,
> unsigned int *row,
> unsigned int *col)
> @@ -213,21 +208,10 @@ static int mt6779_keypad_pdrv_probe(struct platform_device *pdev)
> regmap_update_bits(keypad->regmap, MTK_KPD_SEL, MTK_KPD_SEL_COL,
> MTK_KPD_SEL_COLMASK(keypad->n_cols));
>
> - keypad->clk = devm_clk_get(&pdev->dev, "kpd");
> + keypad->clk = devm_clk_get_enabled(&pdev->dev, "kpd");
> if (IS_ERR(keypad->clk))
> return PTR_ERR(keypad->clk);
>
> - error = clk_prepare_enable(keypad->clk);
> - if (error) {
> - dev_err(&pdev->dev, "cannot prepare/enable keypad clock\n");
> - return error;
> - }
> -
> - error = devm_add_action_or_reset(&pdev->dev, mt6779_keypad_clk_disable,
> - keypad->clk);
> - if (error)
> - return error;
> -
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> return irq;
> --
> 2.46.0.295.g3b9ea8a38a-goog
>
>
> --
> Dmitry
^ permalink raw reply
* [PATCH 11/14] HID: sony: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-sony.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 8e2e914bd236..df29c614e490 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -99,7 +99,7 @@ static const char ghl_ps4_magic_data[] = {
};
/* PS/3 Motion controller */
-static u8 motion_rdesc[] = {
+static const u8 motion_rdesc[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -195,7 +195,7 @@ static u8 motion_rdesc[] = {
0xC0 /* End Collection */
};
-static u8 ps3remote_rdesc[] = {
+static const u8 ps3remote_rdesc[] = {
0x05, 0x01, /* GUsagePage Generic Desktop */
0x09, 0x05, /* LUsage 0x05 [Game Pad] */
0xA1, 0x01, /* MCollection Application (mouse, keyboard) */
@@ -599,15 +599,15 @@ static int guitar_mapping(struct hid_device *hdev, struct hid_input *hi,
return 0;
}
-static u8 *motion_fixup(struct hid_device *hdev, u8 *rdesc,
- unsigned int *rsize)
+static const u8 *motion_fixup(struct hid_device *hdev, u8 *rdesc,
+ unsigned int *rsize)
{
*rsize = sizeof(motion_rdesc);
return motion_rdesc;
}
-static u8 *ps3remote_fixup(struct hid_device *hdev, u8 *rdesc,
- unsigned int *rsize)
+static const u8 *ps3remote_fixup(struct hid_device *hdev, u8 *rdesc,
+ unsigned int *rsize)
{
*rsize = sizeof(ps3remote_rdesc);
return ps3remote_rdesc;
--
2.46.0
^ permalink raw reply related
* [PATCH 12/14] HID: waltop: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-waltop.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/hid/hid-waltop.c b/drivers/hid/hid-waltop.c
index 137a682ef5fb..be34be27d4d5 100644
--- a/drivers/hid/hid-waltop.c
+++ b/drivers/hid/hid-waltop.c
@@ -43,7 +43,7 @@
#define SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE 222
/* Fixed Slim Tablet 5.8 inch descriptor */
-static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
+static const __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -94,7 +94,7 @@ static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
#define SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE 269
/* Fixed Slim Tablet 12.1 inch descriptor */
-static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
+static const __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -145,7 +145,7 @@ static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
#define Q_PAD_RDESC_ORIG_SIZE 241
/* Fixed Q Pad descriptor */
-static __u8 q_pad_rdesc_fixed[] = {
+static const __u8 q_pad_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -198,7 +198,7 @@ static __u8 q_pad_rdesc_fixed[] = {
/*
* Fixed report descriptor for tablet with PID 0038.
*/
-static __u8 pid_0038_rdesc_fixed[] = {
+static const __u8 pid_0038_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -249,7 +249,7 @@ static __u8 pid_0038_rdesc_fixed[] = {
#define MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE 300
/* Fixed Media Tablet 10.6 inch descriptor */
-static __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
+static const __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -362,7 +362,7 @@ static __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
#define MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE 309
/* Fixed Media Tablet 14.1 inch descriptor */
-static __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
+static const __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -473,7 +473,7 @@ static __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
#define SIRIUS_BATTERY_FREE_TABLET_RDESC_ORIG_SIZE 335
/* Fixed Sirius Battery Free Tablet descriptor */
-static __u8 sirius_battery_free_tablet_rdesc_fixed[] = {
+static const __u8 sirius_battery_free_tablet_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x02, /* Usage (Pen), */
0xA1, 0x01, /* Collection (Application), */
@@ -605,44 +605,44 @@ static const __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc,
switch (hdev->product) {
case USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH:
if (*rsize == SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE) {
- rdesc = slim_tablet_5_8_inch_rdesc_fixed;
*rsize = sizeof(slim_tablet_5_8_inch_rdesc_fixed);
+ return slim_tablet_5_8_inch_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH:
if (*rsize == SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE) {
- rdesc = slim_tablet_12_1_inch_rdesc_fixed;
*rsize = sizeof(slim_tablet_12_1_inch_rdesc_fixed);
+ return slim_tablet_12_1_inch_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_Q_PAD:
if (*rsize == Q_PAD_RDESC_ORIG_SIZE) {
- rdesc = q_pad_rdesc_fixed;
*rsize = sizeof(q_pad_rdesc_fixed);
+ return q_pad_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_PID_0038:
if (*rsize == PID_0038_RDESC_ORIG_SIZE) {
- rdesc = pid_0038_rdesc_fixed;
*rsize = sizeof(pid_0038_rdesc_fixed);
+ return pid_0038_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH:
if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) {
- rdesc = media_tablet_10_6_inch_rdesc_fixed;
*rsize = sizeof(media_tablet_10_6_inch_rdesc_fixed);
+ return media_tablet_10_6_inch_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH:
if (*rsize == MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE) {
- rdesc = media_tablet_14_1_inch_rdesc_fixed;
*rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed);
+ return media_tablet_14_1_inch_rdesc_fixed;
}
break;
case USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET:
if (*rsize == SIRIUS_BATTERY_FREE_TABLET_RDESC_ORIG_SIZE) {
- rdesc = sirius_battery_free_tablet_rdesc_fixed;
*rsize = sizeof(sirius_battery_free_tablet_rdesc_fixed);
+ return sirius_battery_free_tablet_rdesc_fixed;
}
break;
}
--
2.46.0
^ permalink raw reply related
* [PATCH 13/14] HID: lg: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-lg.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index a9be918e2b5c..c1feeb1dd077 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -58,7 +58,7 @@
* These descriptors remove the combined Y axis and instead report
* separate throttle (Y) and brake (RZ).
*/
-static __u8 df_rdesc_fixed[] = {
+static const __u8 df_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -124,7 +124,7 @@ static __u8 df_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 dfp_rdesc_fixed[] = {
+static const __u8 dfp_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -172,7 +172,7 @@ static __u8 dfp_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 fv_rdesc_fixed[] = {
+static const __u8 fv_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -239,7 +239,7 @@ static __u8 fv_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 momo_rdesc_fixed[] = {
+static const __u8 momo_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -285,7 +285,7 @@ static __u8 momo_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 momo2_rdesc_fixed[] = {
+static const __u8 momo2_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -333,7 +333,7 @@ static __u8 momo2_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 ffg_rdesc_fixed[] = {
+static const __u8 ffg_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystik), */
0xA1, 0x01, /* Collection (Application), */
@@ -379,7 +379,7 @@ static __u8 ffg_rdesc_fixed[] = {
0xC0 /* End Collection */
};
-static __u8 fg_rdesc_fixed[] = {
+static const __u8 fg_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystik), */
0xA1, 0x01, /* Collection (Application), */
@@ -431,6 +431,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize)
{
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
+ const __u8 *ret = NULL;
if ((drv_data->quirks & LG_RDESC) && *rsize >= 91 && rdesc[83] == 0x26 &&
rdesc[84] == 0x8c && rdesc[85] == 0x02) {
@@ -453,7 +454,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == FG_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Wingman Formula GP report descriptor\n");
- rdesc = fg_rdesc_fixed;
+ ret = fg_rdesc_fixed;
*rsize = sizeof(fg_rdesc_fixed);
} else {
hid_info(hdev,
@@ -466,7 +467,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == FFG_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Wingman Formula Force GP report descriptor\n");
- rdesc = ffg_rdesc_fixed;
+ ret = ffg_rdesc_fixed;
*rsize = sizeof(ffg_rdesc_fixed);
}
break;
@@ -476,7 +477,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == DF_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Driving Force report descriptor\n");
- rdesc = df_rdesc_fixed;
+ ret = df_rdesc_fixed;
*rsize = sizeof(df_rdesc_fixed);
}
break;
@@ -485,7 +486,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == MOMO_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Momo Force (Red) report descriptor\n");
- rdesc = momo_rdesc_fixed;
+ ret = momo_rdesc_fixed;
*rsize = sizeof(momo_rdesc_fixed);
}
break;
@@ -494,7 +495,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == MOMO2_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Momo Racing Force (Black) report descriptor\n");
- rdesc = momo2_rdesc_fixed;
+ ret = momo2_rdesc_fixed;
*rsize = sizeof(momo2_rdesc_fixed);
}
break;
@@ -503,7 +504,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == FV_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Formula Vibration report descriptor\n");
- rdesc = fv_rdesc_fixed;
+ ret = fv_rdesc_fixed;
*rsize = sizeof(fv_rdesc_fixed);
}
break;
@@ -512,7 +513,7 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (*rsize == DFP_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Driving Force Pro report descriptor\n");
- rdesc = dfp_rdesc_fixed;
+ ret = dfp_rdesc_fixed;
*rsize = sizeof(dfp_rdesc_fixed);
}
break;
@@ -529,6 +530,8 @@ static const __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc,
break;
}
+ if (ret)
+ return ret;
return rdesc;
}
--
2.46.0
^ permalink raw reply related
* [PATCH 08/14] HID: viewsonic: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-viewsonic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-viewsonic.c b/drivers/hid/hid-viewsonic.c
index 86f41e3fcb95..532bed88bdf8 100644
--- a/drivers/hid/hid-viewsonic.c
+++ b/drivers/hid/hid-viewsonic.c
@@ -22,7 +22,7 @@
#define PD1011_RDESC_ORIG_SIZE 408
/* Fixed report descriptor of PD1011 signature pad */
-static __u8 pd1011_rdesc_fixed[] = {
+static const __u8 pd1011_rdesc_fixed[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -77,8 +77,8 @@ static const __u8 *viewsonic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
case USB_DEVICE_ID_VIEWSONIC_PD1011:
case USB_DEVICE_ID_SIGNOTEC_VIEWSONIC_PD1011:
if (*rsize == PD1011_RDESC_ORIG_SIZE) {
- rdesc = pd1011_rdesc_fixed;
*rsize = sizeof(pd1011_rdesc_fixed);
+ return pd1011_rdesc_fixed;
}
break;
}
--
2.46.0
^ permalink raw reply related
* [PATCH 04/14] HID: keytouch: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-keytouch.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/hid/hid-keytouch.c b/drivers/hid/hid-keytouch.c
index 6e3033bb80dd..b9abd53a5864 100644
--- a/drivers/hid/hid-keytouch.c
+++ b/drivers/hid/hid-keytouch.c
@@ -16,7 +16,7 @@
/* Replace the broken report descriptor of this device with rather
* a default one */
-static __u8 keytouch_fixed_rdesc[] = {
+static const __u8 keytouch_fixed_rdesc[] = {
0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15,
0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08,
0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91,
@@ -29,10 +29,8 @@ static const __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
{
hid_info(hdev, "fixing up Keytouch IEC report descriptor\n");
- rdesc = keytouch_fixed_rdesc;
*rsize = sizeof(keytouch_fixed_rdesc);
-
- return rdesc;
+ return keytouch_fixed_rdesc;
}
static const struct hid_device_id keytouch_devices[] = {
--
2.46.0
^ permalink raw reply related
* [PATCH 07/14] HID: vrc2: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-vrc2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-vrc2.c b/drivers/hid/hid-vrc2.c
index 9a4840b524ba..7dc41e92f488 100644
--- a/drivers/hid/hid-vrc2.c
+++ b/drivers/hid/hid-vrc2.c
@@ -16,7 +16,7 @@
#define USB_VENDOR_ID_VRC2 (0x07c0)
#define USB_DEVICE_ID_VRC2 (0x1125)
-static __u8 vrc2_rdesc_fixed[] = {
+static const __u8 vrc2_rdesc_fixed[] = {
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x04, // Usage (Joystick)
0xA1, 0x01, // Collection (Application)
--
2.46.0
^ permalink raw reply related
* [PATCH 05/14] HID: maltron: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-maltron.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-maltron.c b/drivers/hid/hid-maltron.c
index 374c64dd82c2..f0aad1ba2e6d 100644
--- a/drivers/hid/hid-maltron.c
+++ b/drivers/hid/hid-maltron.c
@@ -22,7 +22,7 @@
#include "hid-ids.h"
/* The original buggy USB descriptor */
-static u8 maltron_rdesc_o[] = {
+static const u8 maltron_rdesc_o[] = {
0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */
0x09, 0x80, /* Usage (Sys Control) */
0xA1, 0x01, /* Collection (Application) */
@@ -79,7 +79,7 @@ static u8 maltron_rdesc_o[] = {
};
/* The patched descriptor, allowing media key events to be accepted as valid */
-static u8 maltron_rdesc[] = {
+static const u8 maltron_rdesc[] = {
0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */
0x09, 0x80, /* Usage (Sys Control) */
0xA1, 0x01, /* Collection (Application) */
--
2.46.0
^ permalink raw reply related
* [PATCH 09/14] HID: steelseries: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-steelseries.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
index 895da49e8ead..7e83fee1ffa0 100644
--- a/drivers/hid/hid-steelseries.c
+++ b/drivers/hid/hid-steelseries.c
@@ -51,7 +51,7 @@ struct steelseries_srws1_data {
* appear in the 'Generic Desktop' usage.
*/
-static __u8 steelseries_srws1_rdesc_fixed[] = {
+static const __u8 steelseries_srws1_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop) */
0x09, 0x08, /* Usage (MultiAxis), Changed */
0xA1, 0x01, /* Collection (Application), */
@@ -580,8 +580,8 @@ static const __u8 *steelseries_srws1_report_fixup(struct hid_device *hdev,
if (*rsize >= 115 && rdesc[11] == 0x02 && rdesc[13] == 0xc8
&& rdesc[29] == 0xbb && rdesc[40] == 0xc5) {
hid_info(hdev, "Fixing up Steelseries SRW-S1 report descriptor\n");
- rdesc = steelseries_srws1_rdesc_fixed;
*rsize = sizeof(steelseries_srws1_rdesc_fixed);
+ return steelseries_srws1_rdesc_fixed;
}
return rdesc;
}
--
2.46.0
^ permalink raw reply related
* [PATCH 14/14] HID: uclogic: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-uclogic-core.c | 2 +-
drivers/hid/hid-uclogic-params.c | 4 ++--
drivers/hid/hid-uclogic-params.h | 10 +++++-----
drivers/hid/hid-uclogic-rdesc.c | 20 ++++++++++----------
drivers/hid/hid-uclogic-rdesc.h | 20 ++++++++++----------
5 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index f6a1572b3728..d8008933c052 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -56,8 +56,8 @@ static const __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
struct uclogic_drvdata *drvdata = hid_get_drvdata(hdev);
if (drvdata->desc_ptr != NULL) {
- rdesc = drvdata->desc_ptr;
*rsize = drvdata->desc_size;
+ return drvdata->desc_ptr;
}
return rdesc;
}
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c
index 5bab006ec165..87fd4eb76c70 100644
--- a/drivers/hid/hid-uclogic-params.c
+++ b/drivers/hid/hid-uclogic-params.c
@@ -681,7 +681,7 @@ void uclogic_params_cleanup(struct uclogic_params *params)
* -ENOMEM, if failed to allocate memory.
*/
int uclogic_params_get_desc(const struct uclogic_params *params,
- __u8 **pdesc,
+ const __u8 **pdesc,
unsigned int *psize)
{
int rc = -ENOMEM;
@@ -769,7 +769,7 @@ static void uclogic_params_init_invalid(struct uclogic_params *params)
static int uclogic_params_init_with_opt_desc(struct uclogic_params *params,
struct hid_device *hdev,
unsigned int orig_desc_size,
- __u8 *desc_ptr,
+ const __u8 *desc_ptr,
unsigned int desc_size)
{
__u8 *desc_copy_ptr = NULL;
diff --git a/drivers/hid/hid-uclogic-params.h b/drivers/hid/hid-uclogic-params.h
index d6ffadb2f601..35ff062d09b5 100644
--- a/drivers/hid/hid-uclogic-params.h
+++ b/drivers/hid/hid-uclogic-params.h
@@ -79,7 +79,7 @@ struct uclogic_params_pen {
* Pointer to report descriptor part describing the pen inputs.
* Allocated with kmalloc. NULL if the part is not specified.
*/
- __u8 *desc_ptr;
+ const __u8 *desc_ptr;
/*
* Size of the report descriptor.
* Only valid, if "desc_ptr" is not NULL.
@@ -118,7 +118,7 @@ struct uclogic_params_frame {
* Pointer to report descriptor part describing the frame inputs.
* Allocated with kmalloc. NULL if the part is not specified.
*/
- __u8 *desc_ptr;
+ const __u8 *desc_ptr;
/*
* Size of the report descriptor.
* Only valid, if "desc_ptr" is not NULL.
@@ -212,7 +212,7 @@ struct uclogic_params {
* allocated with kmalloc. NULL if no common part is needed.
* Only valid, if "invalid" is false.
*/
- __u8 *desc_ptr;
+ const __u8 *desc_ptr;
/*
* Size of the common part of the replacement report descriptor.
* Only valid, if "desc_ptr" is valid and not NULL.
@@ -239,7 +239,7 @@ struct uclogic_drvdata {
/* Interface parameters */
struct uclogic_params params;
/* Pointer to the replacement report descriptor. NULL if none. */
- __u8 *desc_ptr;
+ const __u8 *desc_ptr;
/*
* Size of the replacement report descriptor.
* Only valid if desc_ptr is not NULL
@@ -261,7 +261,7 @@ extern int uclogic_params_init(struct uclogic_params *params,
/* Get a replacement report descriptor for a tablet's interface. */
extern int uclogic_params_get_desc(const struct uclogic_params *params,
- __u8 **pdesc,
+ const __u8 **pdesc,
unsigned int *psize);
/* Free resources used by tablet interface's parameters */
diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c
index acfa591ab52f..964d17e08f26 100644
--- a/drivers/hid/hid-uclogic-rdesc.c
+++ b/drivers/hid/hid-uclogic-rdesc.c
@@ -20,7 +20,7 @@
#include <kunit/visibility.h>
/* Fixed WP4030U report descriptor */
-__u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -65,7 +65,7 @@ const size_t uclogic_rdesc_wp4030u_fixed_size =
sizeof(uclogic_rdesc_wp4030u_fixed_arr);
/* Fixed WP5540U report descriptor */
-__u8 uclogic_rdesc_wp5540u_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp5540u_fixed_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -142,7 +142,7 @@ const size_t uclogic_rdesc_wp5540u_fixed_size =
sizeof(uclogic_rdesc_wp5540u_fixed_arr);
/* Fixed WP8060U report descriptor */
-__u8 uclogic_rdesc_wp8060u_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp8060u_fixed_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -219,7 +219,7 @@ const size_t uclogic_rdesc_wp8060u_fixed_size =
sizeof(uclogic_rdesc_wp8060u_fixed_arr);
/* Fixed WP1062 report descriptor */
-__u8 uclogic_rdesc_wp1062_fixed_arr[] = {
+const __u8 uclogic_rdesc_wp1062_fixed_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -267,7 +267,7 @@ const size_t uclogic_rdesc_wp1062_fixed_size =
sizeof(uclogic_rdesc_wp1062_fixed_arr);
/* Fixed PF1209 report descriptor */
-__u8 uclogic_rdesc_pf1209_fixed_arr[] = {
+const __u8 uclogic_rdesc_pf1209_fixed_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -344,7 +344,7 @@ const size_t uclogic_rdesc_pf1209_fixed_size =
sizeof(uclogic_rdesc_pf1209_fixed_arr);
/* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
-__u8 uclogic_rdesc_twhl850_fixed0_arr[] = {
+const __u8 uclogic_rdesc_twhl850_fixed0_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -390,7 +390,7 @@ const size_t uclogic_rdesc_twhl850_fixed0_size =
sizeof(uclogic_rdesc_twhl850_fixed0_arr);
/* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
-__u8 uclogic_rdesc_twhl850_fixed1_arr[] = {
+const __u8 uclogic_rdesc_twhl850_fixed1_arr[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x02, /* Usage (Mouse), */
0xA1, 0x01, /* Collection (Application), */
@@ -430,7 +430,7 @@ const size_t uclogic_rdesc_twhl850_fixed1_size =
sizeof(uclogic_rdesc_twhl850_fixed1_arr);
/* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
-__u8 uclogic_rdesc_twhl850_fixed2_arr[] = {
+const __u8 uclogic_rdesc_twhl850_fixed2_arr[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x06, /* Usage (Keyboard), */
0xA1, 0x01, /* Collection (Application), */
@@ -456,7 +456,7 @@ const size_t uclogic_rdesc_twhl850_fixed2_size =
sizeof(uclogic_rdesc_twhl850_fixed2_arr);
/* Fixed TWHA60 report descriptor, interface 0 (stylus) */
-__u8 uclogic_rdesc_twha60_fixed0_arr[] = {
+const __u8 uclogic_rdesc_twha60_fixed0_arr[] = {
0x05, 0x0D, /* Usage Page (Digitizer), */
0x09, 0x01, /* Usage (Digitizer), */
0xA1, 0x01, /* Collection (Application), */
@@ -505,7 +505,7 @@ const size_t uclogic_rdesc_twha60_fixed0_size =
sizeof(uclogic_rdesc_twha60_fixed0_arr);
/* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
-__u8 uclogic_rdesc_twha60_fixed1_arr[] = {
+const __u8 uclogic_rdesc_twha60_fixed1_arr[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x06, /* Usage (Keyboard), */
0xA1, 0x01, /* Collection (Application), */
diff --git a/drivers/hid/hid-uclogic-rdesc.h b/drivers/hid/hid-uclogic-rdesc.h
index 906d068f50a9..3878a0e8c464 100644
--- a/drivers/hid/hid-uclogic-rdesc.h
+++ b/drivers/hid/hid-uclogic-rdesc.h
@@ -23,15 +23,15 @@
#define UCLOGIC_RDESC_WPXXXXU_ORIG_SIZE 212
/* Fixed WP4030U report descriptor */
-extern __u8 uclogic_rdesc_wp4030u_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp4030u_fixed_arr[];
extern const size_t uclogic_rdesc_wp4030u_fixed_size;
/* Fixed WP5540U report descriptor */
-extern __u8 uclogic_rdesc_wp5540u_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp5540u_fixed_arr[];
extern const size_t uclogic_rdesc_wp5540u_fixed_size;
/* Fixed WP8060U report descriptor */
-extern __u8 uclogic_rdesc_wp8060u_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp8060u_fixed_arr[];
extern const size_t uclogic_rdesc_wp8060u_fixed_size;
/* Size of the original descriptor of the new WP5540U tablet */
@@ -41,14 +41,14 @@ extern const size_t uclogic_rdesc_wp8060u_fixed_size;
#define UCLOGIC_RDESC_WP1062_ORIG_SIZE 254
/* Fixed WP1062 report descriptor */
-extern __u8 uclogic_rdesc_wp1062_fixed_arr[];
+extern const __u8 uclogic_rdesc_wp1062_fixed_arr[];
extern const size_t uclogic_rdesc_wp1062_fixed_size;
/* Size of the original descriptor of PF1209 tablet */
#define UCLOGIC_RDESC_PF1209_ORIG_SIZE 234
/* Fixed PF1209 report descriptor */
-extern __u8 uclogic_rdesc_pf1209_fixed_arr[];
+extern const __u8 uclogic_rdesc_pf1209_fixed_arr[];
extern const size_t uclogic_rdesc_pf1209_fixed_size;
/* Size of the original descriptors of TWHL850 tablet */
@@ -57,15 +57,15 @@ extern const size_t uclogic_rdesc_pf1209_fixed_size;
#define UCLOGIC_RDESC_TWHL850_ORIG2_SIZE 92
/* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
-extern __u8 uclogic_rdesc_twhl850_fixed0_arr[];
+extern const __u8 uclogic_rdesc_twhl850_fixed0_arr[];
extern const size_t uclogic_rdesc_twhl850_fixed0_size;
/* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
-extern __u8 uclogic_rdesc_twhl850_fixed1_arr[];
+extern const __u8 uclogic_rdesc_twhl850_fixed1_arr[];
extern const size_t uclogic_rdesc_twhl850_fixed1_size;
/* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
-extern __u8 uclogic_rdesc_twhl850_fixed2_arr[];
+extern const __u8 uclogic_rdesc_twhl850_fixed2_arr[];
extern const size_t uclogic_rdesc_twhl850_fixed2_size;
/* Size of the original descriptors of TWHA60 tablet */
@@ -73,11 +73,11 @@ extern const size_t uclogic_rdesc_twhl850_fixed2_size;
#define UCLOGIC_RDESC_TWHA60_ORIG1_SIZE 139
/* Fixed TWHA60 report descriptor, interface 0 (stylus) */
-extern __u8 uclogic_rdesc_twha60_fixed0_arr[];
+extern const __u8 uclogic_rdesc_twha60_fixed0_arr[];
extern const size_t uclogic_rdesc_twha60_fixed0_size;
/* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
-extern __u8 uclogic_rdesc_twha60_fixed1_arr[];
+extern const __u8 uclogic_rdesc_twha60_fixed1_arr[];
extern const size_t uclogic_rdesc_twha60_fixed1_size;
/* Report descriptor template placeholder head */
--
2.46.0
^ permalink raw reply related
* [PATCH 06/14] HID: xiaomi: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-xiaomi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-xiaomi.c b/drivers/hid/hid-xiaomi.c
index 035733fce2e1..ef6598550a40 100644
--- a/drivers/hid/hid-xiaomi.c
+++ b/drivers/hid/hid-xiaomi.c
@@ -14,7 +14,7 @@
/* Fixed Mi Silent Mouse report descriptor */
/* Button's Usage Maximum changed from 3 to 5 to make side buttons work */
#define MI_SILENT_MOUSE_ORIG_RDESC_LENGTH 87
-static __u8 mi_silent_mouse_rdesc_fixed[] = {
+static const __u8 mi_silent_mouse_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x02, /* Usage (Mouse), */
0xA1, 0x01, /* Collection (Application), */
@@ -68,8 +68,8 @@ static const __u8 *xiaomi_report_fixup(struct hid_device *hdev, __u8 *rdesc,
case USB_DEVICE_ID_MI_SILENT_MOUSE:
if (*rsize == MI_SILENT_MOUSE_ORIG_RDESC_LENGTH) {
hid_info(hdev, "fixing up Mi Silent Mouse report descriptor\n");
- rdesc = mi_silent_mouse_rdesc_fixed;
*rsize = sizeof(mi_silent_mouse_rdesc_fixed);
+ return mi_silent_mouse_rdesc_fixed;
}
break;
}
--
2.46.0
^ permalink raw reply related
* [PATCH 00/14] HID: constify fixed up report descriptors
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
Now that the HID core can handle const report descriptors,
constify them where possible.
This is based upon hid/for-6.12/constify-rdesc.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (14):
HID: bigbenff: constify fixed up report descriptor
HID: dr: constify fixed up report descriptor
HID: holtek-kbd: constify fixed up report descriptor
HID: keytouch: constify fixed up report descriptor
HID: maltron: constify fixed up report descriptor
HID: xiaomi: constify fixed up report descriptor
HID: vrc2: constify fixed up report descriptor
HID: viewsonic: constify fixed up report descriptor
HID: steelseries: constify fixed up report descriptor
HID: pxrc: constify fixed up report descriptor
HID: sony: constify fixed up report descriptor
HID: waltop: constify fixed up report descriptor
HID: lg: constify fixed up report descriptor
HID: uclogic: constify fixed up report descriptor
drivers/hid/hid-bigbenff.c | 4 ++--
drivers/hid/hid-dr.c | 4 ++--
drivers/hid/hid-holtek-kbd.c | 4 ++--
drivers/hid/hid-keytouch.c | 6 ++----
drivers/hid/hid-lg.c | 31 +++++++++++++++++--------------
drivers/hid/hid-maltron.c | 4 ++--
drivers/hid/hid-pxrc.c | 2 +-
drivers/hid/hid-sony.c | 12 ++++++------
drivers/hid/hid-steelseries.c | 4 ++--
drivers/hid/hid-uclogic-core.c | 2 +-
drivers/hid/hid-uclogic-params.c | 4 ++--
drivers/hid/hid-uclogic-params.h | 10 +++++-----
drivers/hid/hid-uclogic-rdesc.c | 20 ++++++++++----------
drivers/hid/hid-uclogic-rdesc.h | 20 ++++++++++----------
drivers/hid/hid-viewsonic.c | 4 ++--
drivers/hid/hid-vrc2.c | 2 +-
drivers/hid/hid-waltop.c | 28 ++++++++++++++--------------
drivers/hid/hid-xiaomi.c | 4 ++--
18 files changed, 83 insertions(+), 82 deletions(-)
---
base-commit: c1f9eff7b270861005c7ec8146b6ad398c40940b
change-id: 20240803-hid-const-fixup-2-7c60ac529531
prerequisite-change-id: 20240730-hid-const-fixup-8b01cbda1b49:v2
prerequisite-patch-id: 92216ced5d79ee5578fbe1c24c994b6fd550d1fb
prerequisite-patch-id: 4dd3e0fa6b0387f2a722c2bb924fc9c3b784f49d
prerequisite-patch-id: 7a5b42060b989b053d2bc71d52e0281815da542d
prerequisite-patch-id: 15809fd82225c2d44cdbed2d570d621ba7378cec
prerequisite-patch-id: baba272935e0f16c67170413cadb682b535b3a6d
prerequisite-patch-id: 4e6017ca6b8df87fe8270fffd43a585eddba88c7
prerequisite-patch-id: 06023fde4515232fdcc4044b252aa42ed9a47885
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply
* [PATCH 10/14] HID: pxrc: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-pxrc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-pxrc.c b/drivers/hid/hid-pxrc.c
index ef38730e78ab..71fe0c06ddcd 100644
--- a/drivers/hid/hid-pxrc.c
+++ b/drivers/hid/hid-pxrc.c
@@ -17,7 +17,7 @@ struct pxrc_priv {
bool alternate;
};
-static __u8 pxrc_rdesc_fixed[] = {
+static const __u8 pxrc_rdesc_fixed[] = {
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x04, // Usage (Joystick)
0xA1, 0x01, // Collection (Application)
--
2.46.0
^ permalink raw reply related
* [PATCH 01/14] HID: bigbenff: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-bigbenff.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-bigbenff.c b/drivers/hid/hid-bigbenff.c
index a2ff60dd834c..9f05465358d9 100644
--- a/drivers/hid/hid-bigbenff.c
+++ b/drivers/hid/hid-bigbenff.c
@@ -99,7 +99,7 @@
* - map previously unused analog trigger data to Z/RZ
* - simplify feature and output descriptor
*/
-static __u8 pid0902_rdesc_fixed[] = {
+static const __u8 pid0902_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */
0x09, 0x05, /* Usage (Game Pad) */
0xA1, 0x01, /* Collection (Application) */
@@ -468,8 +468,8 @@ static const __u8 *bigben_report_fixup(struct hid_device *hid, __u8 *rdesc,
unsigned int *rsize)
{
if (*rsize == PID0902_RDESC_ORIG_SIZE) {
- rdesc = pid0902_rdesc_fixed;
*rsize = sizeof(pid0902_rdesc_fixed);
+ return pid0902_rdesc_fixed;
} else
hid_warn(hid, "unexpected rdesc, please submit for review\n");
return rdesc;
--
2.46.0
^ permalink raw reply related
* [PATCH 03/14] HID: holtek-kbd: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-holtek-kbd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-holtek-kbd.c b/drivers/hid/hid-holtek-kbd.c
index 794d609c2e31..d13543517a6c 100644
--- a/drivers/hid/hid-holtek-kbd.c
+++ b/drivers/hid/hid-holtek-kbd.c
@@ -27,7 +27,7 @@
* to the boot interface.
*/
-static __u8 holtek_kbd_rdesc_fixed[] = {
+static const __u8 holtek_kbd_rdesc_fixed[] = {
/* Original report descriptor, with reduced number of consumer usages */
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x80, /* Usage (Sys Control), */
@@ -108,8 +108,8 @@ static const __u8 *holtek_kbd_report_fixup(struct hid_device *hdev, __u8 *rdesc,
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
- rdesc = holtek_kbd_rdesc_fixed;
*rsize = sizeof(holtek_kbd_rdesc_fixed);
+ return holtek_kbd_rdesc_fixed;
}
return rdesc;
}
--
2.46.0
^ permalink raw reply related
* [PATCH 02/14] HID: dr: constify fixed up report descriptor
From: Thomas Weißschuh @ 2024-08-28 7:33 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Marcus Folkesson
Cc: linux-input, linux-kernel, Thomas Weißschuh
In-Reply-To: <20240828-hid-const-fixup-2-v1-0-663b9210eb69@weissschuh.net>
Now that the HID core can handle const report descriptors,
constify them where possible.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/hid/hid-dr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-dr.c b/drivers/hid/hid-dr.c
index b24f9bc743e1..84e1e90a266b 100644
--- a/drivers/hid/hid-dr.c
+++ b/drivers/hid/hid-dr.c
@@ -199,7 +199,7 @@ static inline int drff_init(struct hid_device *hid)
#define PID0011_RDESC_ORIG_SIZE 101
/* Fixed report descriptor for PID 0x011 joystick */
-static __u8 pid0011_rdesc_fixed[] = {
+static const __u8 pid0011_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x04, /* Usage (Joystick), */
0xA1, 0x01, /* Collection (Application), */
@@ -234,8 +234,8 @@ static const __u8 *dr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
switch (hdev->product) {
case 0x0011:
if (*rsize == PID0011_RDESC_ORIG_SIZE) {
- rdesc = pid0011_rdesc_fixed;
*rsize = sizeof(pid0011_rdesc_fixed);
+ return pid0011_rdesc_fixed;
}
break;
}
--
2.46.0
^ permalink raw reply related
* [PATCH] Input: mt6779-keypad - use devm_clk_get_enabled()
From: Dmitry Torokhov @ 2024-08-27 18:00 UTC (permalink / raw)
To: Mattijs Korpershoek
Cc: Matthias Brugger, AngeloGioacchino Del Regno, linux-input,
linux-kernel, linux-arm-kernel, linux-mediatek
Switch to using devm_clk_get_enable() helper instead of acquiring the
clock with devm_clk_get(), enabling it, and defining and installing
a custom devm action to call clk_disable().
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/keyboard/mt6779-keypad.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/drivers/input/keyboard/mt6779-keypad.c b/drivers/input/keyboard/mt6779-keypad.c
index 19f69d167fbd..c13880103429 100644
--- a/drivers/input/keyboard/mt6779-keypad.c
+++ b/drivers/input/keyboard/mt6779-keypad.c
@@ -92,11 +92,6 @@ static irqreturn_t mt6779_keypad_irq_handler(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static void mt6779_keypad_clk_disable(void *data)
-{
- clk_disable_unprepare(data);
-}
-
static void mt6779_keypad_calc_row_col_single(unsigned int key,
unsigned int *row,
unsigned int *col)
@@ -213,21 +208,10 @@ static int mt6779_keypad_pdrv_probe(struct platform_device *pdev)
regmap_update_bits(keypad->regmap, MTK_KPD_SEL, MTK_KPD_SEL_COL,
MTK_KPD_SEL_COLMASK(keypad->n_cols));
- keypad->clk = devm_clk_get(&pdev->dev, "kpd");
+ keypad->clk = devm_clk_get_enabled(&pdev->dev, "kpd");
if (IS_ERR(keypad->clk))
return PTR_ERR(keypad->clk);
- error = clk_prepare_enable(keypad->clk);
- if (error) {
- dev_err(&pdev->dev, "cannot prepare/enable keypad clock\n");
- return error;
- }
-
- error = devm_add_action_or_reset(&pdev->dev, mt6779_keypad_clk_disable,
- keypad->clk);
- if (error)
- return error;
-
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
--
2.46.0.295.g3b9ea8a38a-goog
--
Dmitry
^ permalink raw reply related
* Re: [PATCH] input: tegra: Use of_property_read_variable_u32_array() and of_property_present()
From: Dmitry Torokhov @ 2024-08-27 17:53 UTC (permalink / raw)
To: Thierry Reding
Cc: Rob Herring (Arm), Laxman Dewangan, Jonathan Hunter, linux-input,
linux-tegra, linux-kernel
In-Reply-To: <Zs3yfc1pJDkAwhzc@google.com>
On Tue, Aug 27, 2024 at 08:36:29AM -0700, Dmitry Torokhov wrote:
> On Tue, Aug 27, 2024 at 04:23:48PM +0200, Thierry Reding wrote:
> > On Wed, Jul 31, 2024 at 02:14:01PM GMT, Rob Herring (Arm) wrote:
> > > There's no need to get the length of an DT array property before
> > > parsing the array. of_property_read_variable_u32_array() takes a
> > > minimum and maximum length and returns the actual length (or error
> > > code).
> > >
> > > This is part of a larger effort to remove callers of of_get_property()
> > > and similar functions. of_get_property() leaks the DT property data
> > > pointer which is a problem for dynamically allocated nodes which may
> > > be freed.
> > > ---
> > > drivers/input/keyboard/tegra-kbc.c | 72 +++++++++++-------------------
> > > 1 file changed, 27 insertions(+), 45 deletions(-)
> > >
> > > diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
> > > index a1765ed8c825..53f39fc155ea 100644
> > > --- a/drivers/input/keyboard/tegra-kbc.c
> > > +++ b/drivers/input/keyboard/tegra-kbc.c
> > > @@ -491,12 +491,10 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
> > > struct device_node *np = kbc->dev->of_node;
> > > u32 prop;
> > > int i;
> > > - u32 num_rows = 0;
> > > - u32 num_cols = 0;
> > > + int num_rows;
> > > + int num_cols;
> > > u32 cols_cfg[KBC_MAX_GPIO];
> > > u32 rows_cfg[KBC_MAX_GPIO];
> > > - int proplen;
> > > - int ret;
> > >
> > > if (!of_property_read_u32(np, "nvidia,debounce-delay-ms", &prop))
> > > kbc->debounce_cnt = prop;
> > > @@ -510,56 +508,23 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
> > > of_property_read_bool(np, "nvidia,wakeup-source")) /* legacy */
> > > kbc->wakeup = true;
> > >
> > > - if (!of_get_property(np, "nvidia,kbc-row-pins", &proplen)) {
> > > - dev_err(kbc->dev, "property nvidia,kbc-row-pins not found\n");
> > > - return -ENOENT;
> > > - }
> > > - num_rows = proplen / sizeof(u32);
> > > -
> > > - if (!of_get_property(np, "nvidia,kbc-col-pins", &proplen)) {
> > > - dev_err(kbc->dev, "property nvidia,kbc-col-pins not found\n");
> > > - return -ENOENT;
> > > - }
> > > - num_cols = proplen / sizeof(u32);
> > > -
> > > - if (num_rows > kbc->hw_support->max_rows) {
> > > - dev_err(kbc->dev,
> > > - "Number of rows is more than supported by hardware\n");
> > > - return -EINVAL;
> > > - }
> > > -
> > > - if (num_cols > kbc->hw_support->max_columns) {
> > > - dev_err(kbc->dev,
> > > - "Number of cols is more than supported by hardware\n");
> > > - return -EINVAL;
> > > - }
> > > -
> > > - if (!of_get_property(np, "linux,keymap", &proplen)) {
> > > + if (!of_property_present(np, "linux,keymap")) {
> > > dev_err(kbc->dev, "property linux,keymap not found\n");
> > > return -ENOENT;
> > > }
> > >
> > > - if (!num_rows || !num_cols || ((num_rows + num_cols) > KBC_MAX_GPIO)) {
> > > - dev_err(kbc->dev,
> > > - "keypad rows/columns not properly specified\n");
> > > - return -EINVAL;
> > > - }
> > > -
> > > /* Set all pins as non-configured */
> > > for (i = 0; i < kbc->num_rows_and_columns; i++)
> > > kbc->pin_cfg[i].type = PIN_CFG_IGNORE;
> > >
> > > - ret = of_property_read_u32_array(np, "nvidia,kbc-row-pins",
> > > - rows_cfg, num_rows);
> > > - if (ret < 0) {
> > > + num_rows = of_property_read_variable_u32_array(np, "nvidia,kbc-row-pins",
> > > + rows_cfg, 1, KBC_MAX_GPIO);
> > > + if (num_rows < 0) {
> > > dev_err(kbc->dev, "Rows configurations are not proper\n");
> > > - return -EINVAL;
> > > - }
> > > -
> > > - ret = of_property_read_u32_array(np, "nvidia,kbc-col-pins",
> > > - cols_cfg, num_cols);
> > > - if (ret < 0) {
> > > - dev_err(kbc->dev, "Cols configurations are not proper\n");
> > > + return num_rows;
> > > + } else if (num_rows > kbc->hw_support->max_rows) {
> > > + dev_err(kbc->dev,
> > > + "Number of rows is more than supported by hardware\n");
> > > return -EINVAL;
> > > }
> > >
> > > @@ -568,11 +533,28 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
> > > kbc->pin_cfg[rows_cfg[i]].num = i;
> > > }
> > >
> > > + num_cols = of_property_read_variable_u32_array(np, "nvidia,kbc-col-pins",
> > > + cols_cfg, 1, KBC_MAX_GPIO);
> > > + if (num_cols < 0) {
> > > + dev_err(kbc->dev, "Cols configurations are not proper\n");
> > > + return num_cols;
> > > + } else if (num_cols > kbc->hw_support->max_columns) {
> > > + dev_err(kbc->dev,
> > > + "Number of cols is more than supported by hardware\n");
> > > + return -EINVAL;
> > > + }
> > > +
> > > for (i = 0; i < num_cols; i++) {
> > > kbc->pin_cfg[cols_cfg[i]].type = PIN_CFG_COL;
> > > kbc->pin_cfg[cols_cfg[i]].num = i;
> > > }
> > >
> > > + if (!num_rows || !num_cols || ((num_rows + num_cols) > KBC_MAX_GPIO)) {
> > > + dev_err(kbc->dev,
> > > + "keypad rows/columns not properly specified\n");
> > > + return -EINVAL;
> > > + }
> >
> > Previously we wouldn't try to initialize the columns when the
> > rows/columns were invalid, so this block could move before the last for
> > loop above.
> >
> > But it doesn't really matter given that these are exceptions and really
> > shouldn't happen, so:
> >
> > Acked-by: Thierry Reding <treding@nvidia.com>
>
> I don't quite like of_property_read_variable_u32_array() because it is
> OF-specific. device_property_count_u32() will return the number of
> elements in an array. But I guess this driver will only be used on an OF
> system...
>
> Applied, thank you.
Oh, wait, can I get your SOB please?
--
Dmitry
^ permalink raw reply
* Re: [PATCH] HID: winwing: constify read-only structs
From: Benjamin Tissoires @ 2024-08-27 16:27 UTC (permalink / raw)
To: Jiri Kosina, Thomas Weißschuh
Cc: linux-input, linux-kernel, Ivan Gorinov
In-Reply-To: <20240804-hid-const-winwing-v1-1-5a6c714753b1@weissschuh.net>
On Sun, 04 Aug 2024 18:29:37 +0200, Thomas Weißschuh wrote:
> These structs are never modified, so mark them as const.
>
>
Applied to hid/hid.git (for-6.12/constify-rdesc), thanks!
[1/1] HID: winwing: constify read-only structs
https://git.kernel.org/hid/hid/c/c1f9eff7b270
Cheers,
--
Benjamin Tissoires <bentiss@kernel.org>
^ permalink raw reply
* Re: [PATCH v2 0/7] HID: constify report descriptors
From: Benjamin Tissoires @ 2024-08-27 16:24 UTC (permalink / raw)
To: Thomas Weißschuh; +Cc: Jiri Kosina, linux-input, linux-kernel
In-Reply-To: <20240803-hid-const-fixup-v2-0-f53d7a7b29d8@weissschuh.net>
On Aug 03 2024, Thomas Weißschuh wrote:
> report descriptors are not meant to be constified outside of the HID
> core. Enforce this invariant through the type system.
>
> In addition it also allows the constification of static report
> descriptors used by the report_fixup() callbacks.
> This makes it clear to driver authors that the HID core will not modify
> those reports and they can be reused for multiple devices.
> Furthermore security is slightly improved as those reports are protected
> against accidental or malicious modifications.
>
> Patches "HID: constify hid_device::dev_rdesc" and
> "HID: constify hid_device::rdesc" are very similar but the patch
> "HID: constify params and return value of fetch_item()" needs to be in
> between.
> It would however be possible to squash them together.
>
> Only the cmedia driver has their static report descriptor constified as
> a proof of concept as I'm the maintainer for that one, I didn't want to
> spam all driver maintainers at this point.
> I have patches for all other drivers that I'll submit after this series
> is merged.
>
> Note, this is only compile-tested.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Thanks. Sorry for the delay, I'm only coming back of three weeks of vacations.
I've now applied the series to for-6.12/constify-rdesc on hid.git after
amending the series for latest master (small conflict in hid-cougar.c
and hid-multitouch.c needed a new hunk).
Cheers,
Benjamin
> ---
> Changes in v2:
> - Drop RFC state
> - Constify more of the internals of HID
> - Drop now unnecessary patch introducing the variable "fixed_up"
> - Link to v1: https://lore.kernel.org/r/20240730-hid-const-fixup-v1-0-f667f9a653ba@weissschuh.net
>
> ---
> Thomas Weißschuh (7):
> HID: bpf: constify parameter rdesc of call_hid_bpf_rdesc_fixup()
> HID: constify parameter rdesc of hid_parse_report()
> HID: constify hid_device::rdesc
> HID: constify params and return value of fetch_item()
> HID: constify hid_device::dev_rdesc
> HID: change return type of report_fixup() to const
> HID: cmedia: constify fixed up report descriptor
>
> drivers/hid/bpf/hid_bpf_dispatch.c | 6 ++----
> drivers/hid/hid-apple.c | 2 +-
> drivers/hid/hid-asus.c | 2 +-
> drivers/hid/hid-aureal.c | 2 +-
> drivers/hid/hid-bigbenff.c | 2 +-
> drivers/hid/hid-cherry.c | 2 +-
> drivers/hid/hid-chicony.c | 4 ++--
> drivers/hid/hid-cmedia.c | 6 +++---
> drivers/hid/hid-core.c | 14 +++++++-------
> drivers/hid/hid-corsair.c | 4 ++--
> drivers/hid/hid-cougar.c | 4 ++--
> drivers/hid/hid-cypress.c | 2 +-
> drivers/hid/hid-dr.c | 4 ++--
> drivers/hid/hid-elecom.c | 2 +-
> drivers/hid/hid-gembird.c | 2 +-
> drivers/hid/hid-glorious.c | 2 +-
> drivers/hid/hid-holtek-kbd.c | 2 +-
> drivers/hid/hid-holtek-mouse.c | 4 ++--
> drivers/hid/hid-ite.c | 2 +-
> drivers/hid/hid-keytouch.c | 2 +-
> drivers/hid/hid-kye.c | 2 +-
> drivers/hid/hid-lenovo.c | 2 +-
> drivers/hid/hid-lg.c | 2 +-
> drivers/hid/hid-logitech-hidpp.c | 4 ++--
> drivers/hid/hid-macally.c | 4 ++--
> drivers/hid/hid-magicmouse.c | 4 ++--
> drivers/hid/hid-maltron.c | 4 ++--
> drivers/hid/hid-microsoft.c | 2 +-
> drivers/hid/hid-monterey.c | 2 +-
> drivers/hid/hid-nti.c | 2 +-
> drivers/hid/hid-ortek.c | 2 +-
> drivers/hid/hid-petalynx.c | 2 +-
> drivers/hid/hid-prodikeys.c | 2 +-
> drivers/hid/hid-pxrc.c | 4 ++--
> drivers/hid/hid-redragon.c | 2 +-
> drivers/hid/hid-saitek.c | 2 +-
> drivers/hid/hid-samsung.c | 2 +-
> drivers/hid/hid-semitek.c | 4 ++--
> drivers/hid/hid-sensor-hub.c | 2 +-
> drivers/hid/hid-sigmamicro.c | 4 ++--
> drivers/hid/hid-sony.c | 2 +-
> drivers/hid/hid-steelseries.c | 4 ++--
> drivers/hid/hid-sunplus.c | 2 +-
> drivers/hid/hid-topre.c | 4 ++--
> drivers/hid/hid-uclogic-core.c | 2 +-
> drivers/hid/hid-viewsonic.c | 4 ++--
> drivers/hid/hid-vrc2.c | 4 ++--
> drivers/hid/hid-waltop.c | 2 +-
> drivers/hid/hid-winwing.c | 2 +-
> drivers/hid/hid-xiaomi.c | 4 ++--
> drivers/hid/hid-zydacron.c | 2 +-
> include/linux/hid.h | 10 +++++-----
> include/linux/hid_bpf.h | 2 +-
> 53 files changed, 83 insertions(+), 85 deletions(-)
> ---
> base-commit: c0ecd6388360d930440cc5554026818895199923
> change-id: 20240730-hid-const-fixup-8b01cbda1b49
>
> Best regards,
> --
> Thomas Weißschuh <linux@weissschuh.net>
>
^ permalink raw reply
* Re: [PATCH] input: tegra: Use of_property_read_variable_u32_array() and of_property_present()
From: Dmitry Torokhov @ 2024-08-27 15:36 UTC (permalink / raw)
To: Thierry Reding
Cc: Rob Herring (Arm), Laxman Dewangan, Jonathan Hunter, linux-input,
linux-tegra, linux-kernel
In-Reply-To: <zyzygwdfncus7nhnu6sgbc2wzjpih3dntgdogorg3it4vc7r6v@aufrf6kwqun3>
On Tue, Aug 27, 2024 at 04:23:48PM +0200, Thierry Reding wrote:
> On Wed, Jul 31, 2024 at 02:14:01PM GMT, Rob Herring (Arm) wrote:
> > There's no need to get the length of an DT array property before
> > parsing the array. of_property_read_variable_u32_array() takes a
> > minimum and maximum length and returns the actual length (or error
> > code).
> >
> > This is part of a larger effort to remove callers of of_get_property()
> > and similar functions. of_get_property() leaks the DT property data
> > pointer which is a problem for dynamically allocated nodes which may
> > be freed.
> > ---
> > drivers/input/keyboard/tegra-kbc.c | 72 +++++++++++-------------------
> > 1 file changed, 27 insertions(+), 45 deletions(-)
> >
> > diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
> > index a1765ed8c825..53f39fc155ea 100644
> > --- a/drivers/input/keyboard/tegra-kbc.c
> > +++ b/drivers/input/keyboard/tegra-kbc.c
> > @@ -491,12 +491,10 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
> > struct device_node *np = kbc->dev->of_node;
> > u32 prop;
> > int i;
> > - u32 num_rows = 0;
> > - u32 num_cols = 0;
> > + int num_rows;
> > + int num_cols;
> > u32 cols_cfg[KBC_MAX_GPIO];
> > u32 rows_cfg[KBC_MAX_GPIO];
> > - int proplen;
> > - int ret;
> >
> > if (!of_property_read_u32(np, "nvidia,debounce-delay-ms", &prop))
> > kbc->debounce_cnt = prop;
> > @@ -510,56 +508,23 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
> > of_property_read_bool(np, "nvidia,wakeup-source")) /* legacy */
> > kbc->wakeup = true;
> >
> > - if (!of_get_property(np, "nvidia,kbc-row-pins", &proplen)) {
> > - dev_err(kbc->dev, "property nvidia,kbc-row-pins not found\n");
> > - return -ENOENT;
> > - }
> > - num_rows = proplen / sizeof(u32);
> > -
> > - if (!of_get_property(np, "nvidia,kbc-col-pins", &proplen)) {
> > - dev_err(kbc->dev, "property nvidia,kbc-col-pins not found\n");
> > - return -ENOENT;
> > - }
> > - num_cols = proplen / sizeof(u32);
> > -
> > - if (num_rows > kbc->hw_support->max_rows) {
> > - dev_err(kbc->dev,
> > - "Number of rows is more than supported by hardware\n");
> > - return -EINVAL;
> > - }
> > -
> > - if (num_cols > kbc->hw_support->max_columns) {
> > - dev_err(kbc->dev,
> > - "Number of cols is more than supported by hardware\n");
> > - return -EINVAL;
> > - }
> > -
> > - if (!of_get_property(np, "linux,keymap", &proplen)) {
> > + if (!of_property_present(np, "linux,keymap")) {
> > dev_err(kbc->dev, "property linux,keymap not found\n");
> > return -ENOENT;
> > }
> >
> > - if (!num_rows || !num_cols || ((num_rows + num_cols) > KBC_MAX_GPIO)) {
> > - dev_err(kbc->dev,
> > - "keypad rows/columns not properly specified\n");
> > - return -EINVAL;
> > - }
> > -
> > /* Set all pins as non-configured */
> > for (i = 0; i < kbc->num_rows_and_columns; i++)
> > kbc->pin_cfg[i].type = PIN_CFG_IGNORE;
> >
> > - ret = of_property_read_u32_array(np, "nvidia,kbc-row-pins",
> > - rows_cfg, num_rows);
> > - if (ret < 0) {
> > + num_rows = of_property_read_variable_u32_array(np, "nvidia,kbc-row-pins",
> > + rows_cfg, 1, KBC_MAX_GPIO);
> > + if (num_rows < 0) {
> > dev_err(kbc->dev, "Rows configurations are not proper\n");
> > - return -EINVAL;
> > - }
> > -
> > - ret = of_property_read_u32_array(np, "nvidia,kbc-col-pins",
> > - cols_cfg, num_cols);
> > - if (ret < 0) {
> > - dev_err(kbc->dev, "Cols configurations are not proper\n");
> > + return num_rows;
> > + } else if (num_rows > kbc->hw_support->max_rows) {
> > + dev_err(kbc->dev,
> > + "Number of rows is more than supported by hardware\n");
> > return -EINVAL;
> > }
> >
> > @@ -568,11 +533,28 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
> > kbc->pin_cfg[rows_cfg[i]].num = i;
> > }
> >
> > + num_cols = of_property_read_variable_u32_array(np, "nvidia,kbc-col-pins",
> > + cols_cfg, 1, KBC_MAX_GPIO);
> > + if (num_cols < 0) {
> > + dev_err(kbc->dev, "Cols configurations are not proper\n");
> > + return num_cols;
> > + } else if (num_cols > kbc->hw_support->max_columns) {
> > + dev_err(kbc->dev,
> > + "Number of cols is more than supported by hardware\n");
> > + return -EINVAL;
> > + }
> > +
> > for (i = 0; i < num_cols; i++) {
> > kbc->pin_cfg[cols_cfg[i]].type = PIN_CFG_COL;
> > kbc->pin_cfg[cols_cfg[i]].num = i;
> > }
> >
> > + if (!num_rows || !num_cols || ((num_rows + num_cols) > KBC_MAX_GPIO)) {
> > + dev_err(kbc->dev,
> > + "keypad rows/columns not properly specified\n");
> > + return -EINVAL;
> > + }
>
> Previously we wouldn't try to initialize the columns when the
> rows/columns were invalid, so this block could move before the last for
> loop above.
>
> But it doesn't really matter given that these are exceptions and really
> shouldn't happen, so:
>
> Acked-by: Thierry Reding <treding@nvidia.com>
I don't quite like of_property_read_variable_u32_array() because it is
OF-specific. device_property_count_u32() will return the number of
elements in an array. But I guess this driver will only be used on an OF
system...
Applied, thank you.
--
Dmitry
^ permalink raw reply
* Re: [PATCH -next] Input: mt6779-keypad - fix module autoloading
From: Dmitry Torokhov @ 2024-08-27 15:27 UTC (permalink / raw)
To: Liao Chen
Cc: linux-input, linux-kernel, linux-arm-kernel, linux-mediatek,
mkorpershoek, matthias.bgg, angelogioacchino.delregno
In-Reply-To: <20240827123411.431388-1-liaochen4@huawei.com>
On Tue, Aug 27, 2024 at 12:34:11PM +0000, Liao Chen wrote:
> Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
> based on the alias from of_device_id table.
>
> Signed-off-by: Liao Chen <liaochen4@huawei.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply
* Re: [PATCH] input: tegra: Use of_property_read_variable_u32_array() and of_property_present()
From: Thierry Reding @ 2024-08-27 14:23 UTC (permalink / raw)
To: Rob Herring (Arm)
Cc: Laxman Dewangan, Dmitry Torokhov, Jonathan Hunter, linux-input,
linux-tegra, linux-kernel
In-Reply-To: <20240731201407.1838385-6-robh@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 4702 bytes --]
On Wed, Jul 31, 2024 at 02:14:01PM GMT, Rob Herring (Arm) wrote:
> There's no need to get the length of an DT array property before
> parsing the array. of_property_read_variable_u32_array() takes a
> minimum and maximum length and returns the actual length (or error
> code).
>
> This is part of a larger effort to remove callers of of_get_property()
> and similar functions. of_get_property() leaks the DT property data
> pointer which is a problem for dynamically allocated nodes which may
> be freed.
> ---
> drivers/input/keyboard/tegra-kbc.c | 72 +++++++++++-------------------
> 1 file changed, 27 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
> index a1765ed8c825..53f39fc155ea 100644
> --- a/drivers/input/keyboard/tegra-kbc.c
> +++ b/drivers/input/keyboard/tegra-kbc.c
> @@ -491,12 +491,10 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
> struct device_node *np = kbc->dev->of_node;
> u32 prop;
> int i;
> - u32 num_rows = 0;
> - u32 num_cols = 0;
> + int num_rows;
> + int num_cols;
> u32 cols_cfg[KBC_MAX_GPIO];
> u32 rows_cfg[KBC_MAX_GPIO];
> - int proplen;
> - int ret;
>
> if (!of_property_read_u32(np, "nvidia,debounce-delay-ms", &prop))
> kbc->debounce_cnt = prop;
> @@ -510,56 +508,23 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
> of_property_read_bool(np, "nvidia,wakeup-source")) /* legacy */
> kbc->wakeup = true;
>
> - if (!of_get_property(np, "nvidia,kbc-row-pins", &proplen)) {
> - dev_err(kbc->dev, "property nvidia,kbc-row-pins not found\n");
> - return -ENOENT;
> - }
> - num_rows = proplen / sizeof(u32);
> -
> - if (!of_get_property(np, "nvidia,kbc-col-pins", &proplen)) {
> - dev_err(kbc->dev, "property nvidia,kbc-col-pins not found\n");
> - return -ENOENT;
> - }
> - num_cols = proplen / sizeof(u32);
> -
> - if (num_rows > kbc->hw_support->max_rows) {
> - dev_err(kbc->dev,
> - "Number of rows is more than supported by hardware\n");
> - return -EINVAL;
> - }
> -
> - if (num_cols > kbc->hw_support->max_columns) {
> - dev_err(kbc->dev,
> - "Number of cols is more than supported by hardware\n");
> - return -EINVAL;
> - }
> -
> - if (!of_get_property(np, "linux,keymap", &proplen)) {
> + if (!of_property_present(np, "linux,keymap")) {
> dev_err(kbc->dev, "property linux,keymap not found\n");
> return -ENOENT;
> }
>
> - if (!num_rows || !num_cols || ((num_rows + num_cols) > KBC_MAX_GPIO)) {
> - dev_err(kbc->dev,
> - "keypad rows/columns not properly specified\n");
> - return -EINVAL;
> - }
> -
> /* Set all pins as non-configured */
> for (i = 0; i < kbc->num_rows_and_columns; i++)
> kbc->pin_cfg[i].type = PIN_CFG_IGNORE;
>
> - ret = of_property_read_u32_array(np, "nvidia,kbc-row-pins",
> - rows_cfg, num_rows);
> - if (ret < 0) {
> + num_rows = of_property_read_variable_u32_array(np, "nvidia,kbc-row-pins",
> + rows_cfg, 1, KBC_MAX_GPIO);
> + if (num_rows < 0) {
> dev_err(kbc->dev, "Rows configurations are not proper\n");
> - return -EINVAL;
> - }
> -
> - ret = of_property_read_u32_array(np, "nvidia,kbc-col-pins",
> - cols_cfg, num_cols);
> - if (ret < 0) {
> - dev_err(kbc->dev, "Cols configurations are not proper\n");
> + return num_rows;
> + } else if (num_rows > kbc->hw_support->max_rows) {
> + dev_err(kbc->dev,
> + "Number of rows is more than supported by hardware\n");
> return -EINVAL;
> }
>
> @@ -568,11 +533,28 @@ static int tegra_kbc_parse_dt(struct tegra_kbc *kbc)
> kbc->pin_cfg[rows_cfg[i]].num = i;
> }
>
> + num_cols = of_property_read_variable_u32_array(np, "nvidia,kbc-col-pins",
> + cols_cfg, 1, KBC_MAX_GPIO);
> + if (num_cols < 0) {
> + dev_err(kbc->dev, "Cols configurations are not proper\n");
> + return num_cols;
> + } else if (num_cols > kbc->hw_support->max_columns) {
> + dev_err(kbc->dev,
> + "Number of cols is more than supported by hardware\n");
> + return -EINVAL;
> + }
> +
> for (i = 0; i < num_cols; i++) {
> kbc->pin_cfg[cols_cfg[i]].type = PIN_CFG_COL;
> kbc->pin_cfg[cols_cfg[i]].num = i;
> }
>
> + if (!num_rows || !num_cols || ((num_rows + num_cols) > KBC_MAX_GPIO)) {
> + dev_err(kbc->dev,
> + "keypad rows/columns not properly specified\n");
> + return -EINVAL;
> + }
Previously we wouldn't try to initialize the columns when the
rows/columns were invalid, so this block could move before the last for
loop above.
But it doesn't really matter given that these are exceptions and really
shouldn't happen, so:
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: Backport request to fix a WARNING in input_mt_init_slots
From: Greg KH @ 2024-08-27 14:19 UTC (permalink / raw)
To: George Kennedy
Cc: stable, rydberg, dmitry.torokhov, penguin-kernel, linux-input,
linux-kernel, harshit.m.mogalapalli
In-Reply-To: <1724766547-24435-1-git-send-email-george.kennedy@oracle.com>
On Tue, Aug 27, 2024 at 08:49:07AM -0500, George Kennedy wrote:
> Hello,
>
> We have seen a WARNING message while fuzzing with syzkaller.
Then don't run syzkaller :)
Now queued up, thanks.
greg k-h
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox