Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH WIP v2 09/11] dt-bindings: input: touchscreen: st,stmfts: Introduce STM FTS5
From: Krzysztof Kozlowski @ 2026-03-22 10:17 UTC (permalink / raw)
  To: david, Dmitry Torokhov, Maxime Coquelin, Alexandre Torgue,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Henrik Rydberg,
	Bjorn Andersson, Konrad Dybcio
  Cc: Petr Hodina, linux-input, linux-stm32, linux-arm-kernel,
	linux-kernel, devicetree, linux-arm-msm, phone-devel
In-Reply-To: <20260315-stmfts5-v2-9-70bc83ee9591@ixit.cz>

On 15/03/2026 19:52, David Heidelberg via B4 Relay wrote:
> From: David Heidelberg <david@ixit.cz>
> 
> Introduce more recent STM FTS5 touchscreen support.
> 
> Signed-off-by: David Heidelberg <david@ixit.cz>
> ---
>  .../devicetree/bindings/input/touchscreen/st,stmfts.yaml  | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/st,stmfts.yaml b/Documentation/devicetree/bindings/input/touchscreen/st,stmfts.yaml
> index 64c4f24ea3dd0..66255893a99fb 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/st,stmfts.yaml
> +++ b/Documentation/devicetree/bindings/input/touchscreen/st,stmfts.yaml
> @@ -16,10 +16,23 @@ description:
>  
>  allOf:
>    - $ref: touchscreen.yaml#
> +  - if:
> +      properties:
> +        compatible:
> +          const: st,stmfts5
> +    then:
> +      properties:
> +        switch-gpios:
> +          description: Switch between SLPI and AP mode.

Do not define properties in if:then: branches. Anyway, not a property of
this device.

Best regards,
Krzysztof

^ permalink raw reply

* [PATCH v2 0/3] Input: gpio-keys - add full support of EV_REL and EV_ABS
From: Xiong Nandi @ 2026-03-22 11:35 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: linux-input, linux-kernel, Xiong Nandi, Fabrice Gasnier,
	Gatien Chevallier, Ingo Molnar, Marco Crivellari, Thomas Gleixner
In-Reply-To: <ab5CXO6Fk7lhGazv@google.com>

This series add full support of EV_REL and EV_ABS

v2: Split into 3 patches as requested. (In reply to ab5CXO6Fk7lhGazv@google.com)

Xiong Nandi (3):
  Input: gpio-keys - set EV_ABS axis parameters at setup time
  Input: gpio-keys - use shared axis counter for EV_ABS events
  Input: gpio-keys - add EV_REL event type support

 drivers/input/keyboard/gpio_keys.c | 65 +++++++++++++++++++++++++++++-
 include/linux/gpio_keys.h          |  4 +-
 2 files changed, 65 insertions(+), 4 deletions(-)

-- 
2.25.1


^ permalink raw reply

* [PATCH v2 1/3] Input: gpio-keys - set EV_ABS axis parameters at setup time
From: Xiong Nandi @ 2026-03-22 11:35 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: linux-input, linux-kernel, Xiong Nandi, Gatien Chevallier,
	Marco Crivellari, Thomas Gleixner, Fabrice Gasnier
In-Reply-To: <ab5CXO6Fk7lhGazv@google.com>

The driver calls input_set_capability() for EV_ABS axes but never
sets the actual axis parameters, so the input subsystem sees
unbounded ranges.

Add a helper that scans buttons sharing the same axis code, works
out the min/max values, and calls input_set_abs_params().

Signed-off-by: Xiong Nandi <xndchn@gmail.com>
---
 drivers/input/keyboard/gpio_keys.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index e19617485679..f97ca8dd073a 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -493,6 +493,27 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static void gpio_keys_set_abs_params(struct input_dev *input,
+				     struct gpio_keys_drvdata *ddata,
+				     unsigned int code)
+{
+	int i, min = 0, max = 0;
+
+	for (i = 0; i < ddata->pdata->nbuttons; i++) {
+		const struct gpio_keys_button *button = &ddata->pdata->buttons[i];
+
+		if (button->type != EV_ABS || button->code != code)
+			continue;
+
+		if (button->value < min)
+			min = button->value;
+		if (button->value > max)
+			max = button->value;
+	}
+
+	input_set_abs_params(input, code, min, max, 0, 0);
+}
+
 static int gpio_keys_setup_key(struct platform_device *pdev,
 				struct input_dev *input,
 				struct gpio_keys_drvdata *ddata,
@@ -651,6 +672,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 	bdata->code = &ddata->keymap[idx];
 	*bdata->code = button->code;
 	input_set_capability(input, button->type ?: EV_KEY, *bdata->code);
+	if ((button->type ?: EV_KEY) == EV_ABS)
+		gpio_keys_set_abs_params(input, ddata, button->code);
 
 	/*
 	 * Install custom action to cancel release timer and
-- 
2.25.1


^ permalink raw reply related

* [PATCH v2 2/3] Input: gpio-keys - use shared axis counter for EV_ABS events
From: Xiong Nandi @ 2026-03-22 11:35 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: linux-input, linux-kernel, Xiong Nandi, Gatien Chevallier,
	Marco Crivellari, Ingo Molnar, Fabrice Gasnier, Thomas Gleixner
In-Reply-To: <ab5CXO6Fk7lhGazv@google.com>

When two buttons share an EV_ABS axis code, releasing one button
zeroes the axis while the other is still held.

Add a shared atomic counter per (type, code) pair so the axis only
resets to zero when the last button on it is released.

Signed-off-by: Xiong Nandi <xndchn@gmail.com>
---
 drivers/input/keyboard/gpio_keys.c | 40 +++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index f97ca8dd073a..4cbfd5a273bd 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -51,8 +51,10 @@ struct gpio_button_data {
 	spinlock_t lock;
 	bool disabled;
 	bool key_pressed;
+	bool axis_active;
 	bool suspended;
 	bool debounce_use_hrtimer;
+	atomic_t *axis_count;
 };
 
 struct gpio_keys_drvdata {
@@ -374,8 +376,15 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
 	}
 
 	if (type == EV_ABS) {
-		if (state)
+		if (state && !bdata->axis_active) {
+			bdata->axis_active = true;
+			atomic_inc(bdata->axis_count);
 			input_event(input, type, button->code, button->value);
+		} else if (!state && bdata->axis_active) {
+			bdata->axis_active = false;
+			if (atomic_dec_and_test(bdata->axis_count))
+				input_event(input, type, button->code, 0);
+		}
 	} else {
 		input_event(input, type, *bdata->code, state);
 	}
@@ -951,6 +960,35 @@ static int gpio_keys_probe(struct platform_device *pdev)
 
 	fwnode_handle_put(child);
 
+	/* Allocate shared axis counters for EV_ABS buttons */
+	for (i = 0; i < pdata->nbuttons; i++) {
+		struct gpio_button_data *bdata = &ddata->data[i];
+		unsigned int type = bdata->button->type ?: EV_KEY;
+		int j;
+
+		if (type != EV_ABS)
+			continue;
+
+		/* Reuse counter from an earlier button with same (type, code) */
+		for (j = 0; j < i; j++) {
+			struct gpio_button_data *prev = &ddata->data[j];
+			unsigned int prev_type = prev->button->type ?: EV_KEY;
+
+			if (prev_type == type &&
+			    prev->button->code == bdata->button->code) {
+				bdata->axis_count = prev->axis_count;
+				break;
+			}
+		}
+
+		if (!bdata->axis_count) {
+			bdata->axis_count = devm_kzalloc(dev,
+					sizeof(*bdata->axis_count), GFP_KERNEL);
+			if (!bdata->axis_count)
+				return -ENOMEM;
+		}
+	}
+
 	error = input_register_device(input);
 	if (error) {
 		dev_err(dev, "Unable to register input device, error: %d\n",
-- 
2.25.1


^ permalink raw reply related

* [PATCH v2 3/3] Input: gpio-keys - add EV_REL event type support
From: Xiong Nandi @ 2026-03-22 11:35 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: linux-input, linux-kernel, Xiong Nandi, Gatien Chevallier,
	Thomas Gleixner, Fabrice Gasnier, Marco Crivellari
In-Reply-To: <ab5CXO6Fk7lhGazv@google.com>

The polled path handles EV_REL but the interrupt path silently
ignores it. Widen the type check so EV_REL goes through the same
reporting and shared-counter logic as EV_ABS.

Signed-off-by: Xiong Nandi <xndchn@gmail.com>
---
 drivers/input/keyboard/gpio_keys.c | 6 +++---
 include/linux/gpio_keys.h          | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 4cbfd5a273bd..652a6932c52f 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -375,7 +375,7 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
 		return;
 	}
 
-	if (type == EV_ABS) {
+	if (type == EV_ABS || type == EV_REL) {
 		if (state && !bdata->axis_active) {
 			bdata->axis_active = true;
 			atomic_inc(bdata->axis_count);
@@ -960,13 +960,13 @@ static int gpio_keys_probe(struct platform_device *pdev)
 
 	fwnode_handle_put(child);
 
-	/* Allocate shared axis counters for EV_ABS buttons */
+	/* Allocate shared axis counters for EV_ABS/EV_REL buttons */
 	for (i = 0; i < pdata->nbuttons; i++) {
 		struct gpio_button_data *bdata = &ddata->data[i];
 		unsigned int type = bdata->button->type ?: EV_KEY;
 		int j;
 
-		if (type != EV_ABS)
+		if (type != EV_ABS && type != EV_REL)
 			continue;
 
 		/* Reuse counter from an earlier button with same (type, code) */
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 80fa930b04c6..75a745a32fe1 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -13,13 +13,13 @@ struct device;
  * @active_low:		%true indicates that button is considered
  *			depressed when gpio is low
  * @desc:		label that will be attached to button's gpio
- * @type:		input event type (%EV_KEY, %EV_SW, %EV_ABS)
+ * @type:		input event type (%EV_KEY, %EV_SW, %EV_ABS, %EV_REL)
  * @wakeup:		configure the button as a wake-up source
  * @wakeup_event_action:	event action to trigger wakeup
  * @debounce_interval:	debounce ticks interval in msecs
  * @can_disable:	%true indicates that userspace is allowed to
  *			disable button via sysfs
- * @value:		axis value for %EV_ABS
+ * @value:		axis value for %EV_ABS/%EV_REL
  * @irq:		Irq number in case of interrupt keys
  * @wakeirq:		Optional dedicated wake-up interrupt
  */
-- 
2.25.1


^ permalink raw reply related

* Re: [PATCH v2 2/2] iio: inkern: Use namespaced exports
From: Jonathan Cameron @ 2026-03-22 12:25 UTC (permalink / raw)
  To: Romain Gantois
  Cc: MyungJoo Ham, Chanwoo Choi, Guenter Roeck, Peter Rosin,
	David Lechner, Nuno Sá, Andy Shevchenko, Lars-Peter Clausen,
	Michael Hennerich, Mariel Tinaco, Kevin Tsai, Linus Walleij,
	Dmitry Torokhov, Eugen Hristev, Vinod Koul,
	Kishon Vijay Abraham I, Sebastian Reichel, Chen-Yu Tsai,
	Hans de Goede, Support Opensource, Paul Cercueil, Iskren Chernev,
	Krzysztof Kozlowski, Marek Szyprowski, Matheus Castello,
	Saravanan Sekar, Matthias Brugger, AngeloGioacchino Del Regno,
	Casey Connolly, Pali Rohár, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Amit Kucheria, Thara Gopinath, Rafael J. Wysocki,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Claudiu Beznea,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Sylwester Nawrocki, Olivier Moysan, Arnaud Pouliquen,
	Maxime Coquelin, Alexandre Torgue, Thomas Petazzoni, linux-kernel,
	linux-hwmon, linux-iio, linux-input, linux-phy, linux-pm,
	linux-mips, linux-mediatek, linux-arm-msm, linux-sound,
	linux-stm32, Sebastian Reichel, Andy Shevchenko
In-Reply-To: <20260111170222.43aee69a@jic23-huawei>

On Sun, 11 Jan 2026 17:02:22 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Tue, 09 Dec 2025 09:25:56 +0100
> Romain Gantois <romain.gantois@bootlin.com> wrote:
> 
> > Use namespaced exports for IIO consumer API functions.
> > 
> > This will make it easier to manage the IIO export surface. Consumer drivers
> > will only be provided access to a specific set of functions, thereby
> > restricting usage of internal IIO functions by other parts of the kernel.
> > 
> > This change cannot be split into several parts without breaking
> > bisectability, thus all of the affected drivers are modified at once.
> > 
> > Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for power-supply
> > Acked-by: Guenter Roeck <linux@roeck-us.net>
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> > Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>  
> Ideally looking for a couple more Acks.
> 
> If any of the maintainers of other trees who haven't already replied
> have time for a quick glance that would be great.  I'll spin an
> immutable branch but I'm not really expecting any non trivial
> conflicts unless there is a new user in flight that I've forgotten
> about.

At this stage, given I'm still waiting on replies from a couple of
subsystem maintainers, I'm thinking we'll do this next cycle and I'll
provide an immutable branch based on rc1 for anyone to grab if they
run into merge conflicts in linux-next.

Thanks,

Jonathan

> 
> Jonathan
> 
> > ---
> >  drivers/extcon/extcon-adc-jack.c                |  1 +
> >  drivers/hwmon/iio_hwmon.c                       |  1 +
> >  drivers/hwmon/ntc_thermistor.c                  |  1 +
> >  drivers/iio/adc/envelope-detector.c             |  1 +
> >  drivers/iio/afe/iio-rescale.c                   |  1 +
> >  drivers/iio/buffer/industrialio-buffer-cb.c     |  1 +
> >  drivers/iio/buffer/industrialio-hw-consumer.c   |  1 +
> >  drivers/iio/dac/ad8460.c                        |  1 +
> >  drivers/iio/dac/dpot-dac.c                      |  1 +
> >  drivers/iio/inkern.c                            | 54 ++++++++++++-------------
> >  drivers/iio/light/cm3605.c                      |  1 +
> >  drivers/iio/light/gp2ap002.c                    |  1 +
> >  drivers/iio/multiplexer/iio-mux.c               |  1 +
> >  drivers/iio/potentiostat/lmp91000.c             |  1 +
> >  drivers/input/joystick/adc-joystick.c           |  1 +
> >  drivers/input/keyboard/adc-keys.c               |  1 +
> >  drivers/input/touchscreen/colibri-vf50-ts.c     |  1 +
> >  drivers/input/touchscreen/resistive-adc-touch.c |  1 +
> >  drivers/phy/motorola/phy-cpcap-usb.c            |  1 +
> >  drivers/power/supply/ab8500_btemp.c             |  1 +
> >  drivers/power/supply/ab8500_charger.c           |  1 +
> >  drivers/power/supply/ab8500_fg.c                |  1 +
> >  drivers/power/supply/axp20x_ac_power.c          |  1 +
> >  drivers/power/supply/axp20x_battery.c           |  1 +
> >  drivers/power/supply/axp20x_usb_power.c         |  1 +
> >  drivers/power/supply/axp288_fuel_gauge.c        |  1 +
> >  drivers/power/supply/cpcap-battery.c            |  1 +
> >  drivers/power/supply/cpcap-charger.c            |  1 +
> >  drivers/power/supply/da9150-charger.c           |  1 +
> >  drivers/power/supply/generic-adc-battery.c      |  1 +
> >  drivers/power/supply/ingenic-battery.c          |  1 +
> >  drivers/power/supply/intel_dc_ti_battery.c      |  1 +
> >  drivers/power/supply/lego_ev3_battery.c         |  1 +
> >  drivers/power/supply/lp8788-charger.c           |  1 +
> >  drivers/power/supply/max17040_battery.c         |  1 +
> >  drivers/power/supply/mp2629_charger.c           |  1 +
> >  drivers/power/supply/mt6370-charger.c           |  1 +
> >  drivers/power/supply/qcom_smbx.c                |  1 +
> >  drivers/power/supply/rn5t618_power.c            |  1 +
> >  drivers/power/supply/rx51_battery.c             |  1 +
> >  drivers/power/supply/sc27xx_fuel_gauge.c        |  1 +
> >  drivers/power/supply/twl4030_charger.c          |  1 +
> >  drivers/power/supply/twl4030_madc_battery.c     |  1 +
> >  drivers/power/supply/twl6030_charger.c          |  1 +
> >  drivers/thermal/qcom/qcom-spmi-adc-tm5.c        |  1 +
> >  drivers/thermal/qcom/qcom-spmi-temp-alarm.c     |  1 +
> >  drivers/thermal/renesas/rzg3s_thermal.c         |  1 +
> >  drivers/thermal/thermal-generic-adc.c           |  1 +
> >  sound/soc/codecs/audio-iio-aux.c                |  1 +
> >  sound/soc/samsung/aries_wm8994.c                |  1 +
> >  sound/soc/samsung/midas_wm1811.c                |  1 +
> >  sound/soc/stm/stm32_adfsdm.c                    |  1 +
> >  52 files changed, 78 insertions(+), 27 deletions(-)
> > 
> > diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c
> > index 7e3c9f38297b..e735f43dcdeb 100644
> > --- a/drivers/extcon/extcon-adc-jack.c
> > +++ b/drivers/extcon/extcon-adc-jack.c
> > @@ -210,3 +210,4 @@ module_platform_driver(adc_jack_driver);
> >  MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");
> >  MODULE_DESCRIPTION("ADC Jack extcon driver");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c
> > index e376d4cde5ad..4c7843fbcc50 100644
> > --- a/drivers/hwmon/iio_hwmon.c
> > +++ b/drivers/hwmon/iio_hwmon.c
> > @@ -222,3 +222,4 @@ module_platform_driver(iio_hwmon_driver);
> >  MODULE_AUTHOR("Jonathan Cameron <jic23@kernel.org>");
> >  MODULE_DESCRIPTION("IIO to hwmon driver");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
> > index d21f7266c411..417807fad80b 100644
> > --- a/drivers/hwmon/ntc_thermistor.c
> > +++ b/drivers/hwmon/ntc_thermistor.c
> > @@ -706,3 +706,4 @@ MODULE_DESCRIPTION("NTC Thermistor Driver");
> >  MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");
> >  MODULE_LICENSE("GPL");
> >  MODULE_ALIAS("platform:ntc-thermistor");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/iio/adc/envelope-detector.c b/drivers/iio/adc/envelope-detector.c
> > index 5b16fe737659..fea20e7e6cd9 100644
> > --- a/drivers/iio/adc/envelope-detector.c
> > +++ b/drivers/iio/adc/envelope-detector.c
> > @@ -406,3 +406,4 @@ module_platform_driver(envelope_detector_driver);
> >  MODULE_DESCRIPTION("Envelope detector using a DAC and a comparator");
> >  MODULE_AUTHOR("Peter Rosin <peda@axentia.se>");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
> > index ecaf59278c6f..d7f55109af3e 100644
> > --- a/drivers/iio/afe/iio-rescale.c
> > +++ b/drivers/iio/afe/iio-rescale.c
> > @@ -609,3 +609,4 @@ module_platform_driver(rescale_driver);
> >  MODULE_DESCRIPTION("IIO rescale driver");
> >  MODULE_AUTHOR("Peter Rosin <peda@axentia.se>");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/iio/buffer/industrialio-buffer-cb.c b/drivers/iio/buffer/industrialio-buffer-cb.c
> > index 3e27385069ed..608ea9afc15a 100644
> > --- a/drivers/iio/buffer/industrialio-buffer-cb.c
> > +++ b/drivers/iio/buffer/industrialio-buffer-cb.c
> > @@ -153,3 +153,4 @@ EXPORT_SYMBOL_GPL(iio_channel_cb_get_iio_dev);
> >  MODULE_AUTHOR("Jonathan Cameron <jic23@kernel.org>");
> >  MODULE_DESCRIPTION("Industrial I/O callback buffer");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/iio/buffer/industrialio-hw-consumer.c b/drivers/iio/buffer/industrialio-hw-consumer.c
> > index 526b2a8d725d..d7ff086ed783 100644
> > --- a/drivers/iio/buffer/industrialio-hw-consumer.c
> > +++ b/drivers/iio/buffer/industrialio-hw-consumer.c
> > @@ -211,3 +211,4 @@ EXPORT_SYMBOL_GPL(iio_hw_consumer_disable);
> >  MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
> >  MODULE_DESCRIPTION("Hardware consumer buffer the IIO framework");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/iio/dac/ad8460.c b/drivers/iio/dac/ad8460.c
> > index 6e45686902dd..ad654819ca22 100644
> > --- a/drivers/iio/dac/ad8460.c
> > +++ b/drivers/iio/dac/ad8460.c
> > @@ -955,3 +955,4 @@ MODULE_AUTHOR("Mariel Tinaco <mariel.tinaco@analog.com");
> >  MODULE_DESCRIPTION("AD8460 DAC driver");
> >  MODULE_LICENSE("GPL");
> >  MODULE_IMPORT_NS("IIO_DMAENGINE_BUFFER");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/iio/dac/dpot-dac.c b/drivers/iio/dac/dpot-dac.c
> > index d1b8441051ae..49dbdb7df955 100644
> > --- a/drivers/iio/dac/dpot-dac.c
> > +++ b/drivers/iio/dac/dpot-dac.c
> > @@ -254,3 +254,4 @@ module_platform_driver(dpot_dac_driver);
> >  MODULE_DESCRIPTION("DAC emulation driver using a digital potentiometer");
> >  MODULE_AUTHOR("Peter Rosin <peda@axentia.se>");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> > index 1e5eb5a41271..c75c3a8d233f 100644
> > --- a/drivers/iio/inkern.c
> > +++ b/drivers/iio/inkern.c
> > @@ -281,7 +281,7 @@ struct iio_channel *fwnode_iio_channel_get_by_name(struct fwnode_handle *fwnode,
> >  
> >  	return ERR_PTR(-ENODEV);
> >  }
> > -EXPORT_SYMBOL_GPL(fwnode_iio_channel_get_by_name);
> > +EXPORT_SYMBOL_NS_GPL(fwnode_iio_channel_get_by_name, "IIO_CONSUMER");
> >  
> >  static struct iio_channel *fwnode_iio_channel_get_all(struct device *dev)
> >  {
> > @@ -386,7 +386,7 @@ struct iio_channel *iio_channel_get(struct device *dev,
> >  
> >  	return iio_channel_get_sys(name, channel_name);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_channel_get);
> > +EXPORT_SYMBOL_NS_GPL(iio_channel_get, "IIO_CONSUMER");
> >  
> >  void iio_channel_release(struct iio_channel *channel)
> >  {
> > @@ -395,7 +395,7 @@ void iio_channel_release(struct iio_channel *channel)
> >  	iio_device_put(channel->indio_dev);
> >  	kfree(channel);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_channel_release);
> > +EXPORT_SYMBOL_NS_GPL(iio_channel_release, "IIO_CONSUMER");
> >  
> >  static void devm_iio_channel_free(void *iio_channel)
> >  {
> > @@ -418,7 +418,7 @@ struct iio_channel *devm_iio_channel_get(struct device *dev,
> >  
> >  	return channel;
> >  }
> > -EXPORT_SYMBOL_GPL(devm_iio_channel_get);
> > +EXPORT_SYMBOL_NS_GPL(devm_iio_channel_get, "IIO_CONSUMER");
> >  
> >  struct iio_channel *devm_fwnode_iio_channel_get_by_name(struct device *dev,
> >  							struct fwnode_handle *fwnode,
> > @@ -437,7 +437,7 @@ struct iio_channel *devm_fwnode_iio_channel_get_by_name(struct device *dev,
> >  
> >  	return channel;
> >  }
> > -EXPORT_SYMBOL_GPL(devm_fwnode_iio_channel_get_by_name);
> > +EXPORT_SYMBOL_NS_GPL(devm_fwnode_iio_channel_get_by_name, "IIO_CONSUMER");
> >  
> >  struct iio_channel *iio_channel_get_all(struct device *dev)
> >  {
> > @@ -506,7 +506,7 @@ struct iio_channel *iio_channel_get_all(struct device *dev)
> >  		iio_device_put(chans[i].indio_dev);
> >  	return ERR_PTR(ret);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_channel_get_all);
> > +EXPORT_SYMBOL_NS_GPL(iio_channel_get_all, "IIO_CONSUMER");
> >  
> >  void iio_channel_release_all(struct iio_channel *channels)
> >  {
> > @@ -518,7 +518,7 @@ void iio_channel_release_all(struct iio_channel *channels)
> >  	}
> >  	kfree(channels);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_channel_release_all);
> > +EXPORT_SYMBOL_NS_GPL(iio_channel_release_all, "IIO_CONSUMER");
> >  
> >  static void devm_iio_channel_free_all(void *iio_channels)
> >  {
> > @@ -541,7 +541,7 @@ struct iio_channel *devm_iio_channel_get_all(struct device *dev)
> >  
> >  	return channels;
> >  }
> > -EXPORT_SYMBOL_GPL(devm_iio_channel_get_all);
> > +EXPORT_SYMBOL_NS_GPL(devm_iio_channel_get_all, "IIO_CONSUMER");
> >  
> >  static int iio_channel_read(struct iio_channel *chan, int *val, int *val2,
> >  			    enum iio_chan_info_enum info)
> > @@ -585,7 +585,7 @@ int iio_read_channel_raw(struct iio_channel *chan, int *val)
> >  
> >  	return iio_channel_read(chan, val, NULL, IIO_CHAN_INFO_RAW);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_channel_raw);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_channel_raw, "IIO_CONSUMER");
> >  
> >  int iio_read_channel_average_raw(struct iio_channel *chan, int *val)
> >  {
> > @@ -597,7 +597,7 @@ int iio_read_channel_average_raw(struct iio_channel *chan, int *val)
> >  
> >  	return iio_channel_read(chan, val, NULL, IIO_CHAN_INFO_AVERAGE_RAW);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_channel_average_raw);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_channel_average_raw, "IIO_CONSUMER");
> >  
> >  int iio_multiply_value(int *result, s64 multiplier,
> >  		       unsigned int type, int val, int val2)
> > @@ -701,7 +701,7 @@ int iio_convert_raw_to_processed(struct iio_channel *chan, int raw,
> >  	return iio_convert_raw_to_processed_unlocked(chan, raw, processed,
> >  						     scale);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_convert_raw_to_processed);
> > +EXPORT_SYMBOL_NS_GPL(iio_convert_raw_to_processed, "IIO_CONSUMER");
> >  
> >  int iio_read_channel_attribute(struct iio_channel *chan, int *val, int *val2,
> >  			       enum iio_chan_info_enum attribute)
> > @@ -714,13 +714,13 @@ int iio_read_channel_attribute(struct iio_channel *chan, int *val, int *val2,
> >  
> >  	return iio_channel_read(chan, val, val2, attribute);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_channel_attribute);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_channel_attribute, "IIO_CONSUMER");
> >  
> >  int iio_read_channel_offset(struct iio_channel *chan, int *val, int *val2)
> >  {
> >  	return iio_read_channel_attribute(chan, val, val2, IIO_CHAN_INFO_OFFSET);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_channel_offset);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_channel_offset, "IIO_CONSUMER");
> >  
> >  int iio_read_channel_processed_scale(struct iio_channel *chan, int *val,
> >  				     unsigned int scale)
> > @@ -748,20 +748,20 @@ int iio_read_channel_processed_scale(struct iio_channel *chan, int *val,
> >  							     scale);
> >  	}
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_channel_processed_scale);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_channel_processed_scale, "IIO_CONSUMER");
> >  
> >  int iio_read_channel_processed(struct iio_channel *chan, int *val)
> >  {
> >  	/* This is just a special case with scale factor 1 */
> >  	return iio_read_channel_processed_scale(chan, val, 1);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_channel_processed);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_channel_processed, "IIO_CONSUMER");
> >  
> >  int iio_read_channel_scale(struct iio_channel *chan, int *val, int *val2)
> >  {
> >  	return iio_read_channel_attribute(chan, val, val2, IIO_CHAN_INFO_SCALE);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_channel_scale);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_channel_scale, "IIO_CONSUMER");
> >  
> >  static int iio_channel_read_avail(struct iio_channel *chan,
> >  				  const int **vals, int *type, int *length,
> > @@ -790,7 +790,7 @@ int iio_read_avail_channel_attribute(struct iio_channel *chan,
> >  
> >  	return iio_channel_read_avail(chan, vals, type, length, attribute);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_avail_channel_attribute);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_avail_channel_attribute, "IIO_CONSUMER");
> >  
> >  int iio_read_avail_channel_raw(struct iio_channel *chan,
> >  			       const int **vals, int *length)
> > @@ -807,7 +807,7 @@ int iio_read_avail_channel_raw(struct iio_channel *chan,
> >  
> >  	return ret;
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_avail_channel_raw);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_avail_channel_raw, "IIO_CONSUMER");
> >  
> >  static int iio_channel_read_max(struct iio_channel *chan,
> >  				int *val, int *val2, int *type,
> > @@ -863,7 +863,7 @@ int iio_read_max_channel_raw(struct iio_channel *chan, int *val)
> >  
> >  	return iio_channel_read_max(chan, val, NULL, &type, IIO_CHAN_INFO_RAW);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_max_channel_raw);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_max_channel_raw, "IIO_CONSUMER");
> >  
> >  static int iio_channel_read_min(struct iio_channel *chan,
> >  				int *val, int *val2, int *type,
> > @@ -919,7 +919,7 @@ int iio_read_min_channel_raw(struct iio_channel *chan, int *val)
> >  
> >  	return iio_channel_read_min(chan, val, NULL, &type, IIO_CHAN_INFO_RAW);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_min_channel_raw);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_min_channel_raw, "IIO_CONSUMER");
> >  
> >  int iio_get_channel_type(struct iio_channel *chan, enum iio_chan_type *type)
> >  {
> > @@ -933,7 +933,7 @@ int iio_get_channel_type(struct iio_channel *chan, enum iio_chan_type *type)
> >  
> >  	return 0;
> >  }
> > -EXPORT_SYMBOL_GPL(iio_get_channel_type);
> > +EXPORT_SYMBOL_NS_GPL(iio_get_channel_type, "IIO_CONSUMER");
> >  
> >  static int iio_channel_write(struct iio_channel *chan, int val, int val2,
> >  			     enum iio_chan_info_enum info)
> > @@ -957,13 +957,13 @@ int iio_write_channel_attribute(struct iio_channel *chan, int val, int val2,
> >  
> >  	return iio_channel_write(chan, val, val2, attribute);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_write_channel_attribute);
> > +EXPORT_SYMBOL_NS_GPL(iio_write_channel_attribute, "IIO_CONSUMER");
> >  
> >  int iio_write_channel_raw(struct iio_channel *chan, int val)
> >  {
> >  	return iio_write_channel_attribute(chan, val, 0, IIO_CHAN_INFO_RAW);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_write_channel_raw);
> > +EXPORT_SYMBOL_NS_GPL(iio_write_channel_raw, "IIO_CONSUMER");
> >  
> >  unsigned int iio_get_channel_ext_info_count(struct iio_channel *chan)
> >  {
> > @@ -978,7 +978,7 @@ unsigned int iio_get_channel_ext_info_count(struct iio_channel *chan)
> >  
> >  	return i;
> >  }
> > -EXPORT_SYMBOL_GPL(iio_get_channel_ext_info_count);
> > +EXPORT_SYMBOL_NS_GPL(iio_get_channel_ext_info_count, "IIO_CONSUMER");
> >  
> >  static const struct iio_chan_spec_ext_info *
> >  iio_lookup_ext_info(const struct iio_channel *chan, const char *attr)
> > @@ -1013,7 +1013,7 @@ ssize_t iio_read_channel_ext_info(struct iio_channel *chan,
> >  	return ext_info->read(chan->indio_dev, ext_info->private,
> >  			      chan->channel, buf);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_channel_ext_info);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_channel_ext_info, "IIO_CONSUMER");
> >  
> >  ssize_t iio_write_channel_ext_info(struct iio_channel *chan, const char *attr,
> >  				   const char *buf, size_t len)
> > @@ -1027,7 +1027,7 @@ ssize_t iio_write_channel_ext_info(struct iio_channel *chan, const char *attr,
> >  	return ext_info->write(chan->indio_dev, ext_info->private,
> >  			       chan->channel, buf, len);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_write_channel_ext_info);
> > +EXPORT_SYMBOL_NS_GPL(iio_write_channel_ext_info, "IIO_CONSUMER");
> >  
> >  ssize_t iio_read_channel_label(struct iio_channel *chan, char *buf)
> >  {
> > @@ -1038,4 +1038,4 @@ ssize_t iio_read_channel_label(struct iio_channel *chan, char *buf)
> >  
> >  	return do_iio_read_channel_label(chan->indio_dev, chan->channel, buf);
> >  }
> > -EXPORT_SYMBOL_GPL(iio_read_channel_label);
> > +EXPORT_SYMBOL_NS_GPL(iio_read_channel_label, "IIO_CONSUMER");
> > diff --git a/drivers/iio/light/cm3605.c b/drivers/iio/light/cm3605.c
> > index 0c17378e27d1..1bd11292d005 100644
> > --- a/drivers/iio/light/cm3605.c
> > +++ b/drivers/iio/light/cm3605.c
> > @@ -325,3 +325,4 @@ module_platform_driver(cm3605_driver);
> >  MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>");
> >  MODULE_DESCRIPTION("CM3605 ambient light and proximity sensor driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/iio/light/gp2ap002.c b/drivers/iio/light/gp2ap002.c
> > index a0d8a58f2704..04b1f6eade0e 100644
> > --- a/drivers/iio/light/gp2ap002.c
> > +++ b/drivers/iio/light/gp2ap002.c
> > @@ -717,3 +717,4 @@ module_i2c_driver(gp2ap002_driver);
> >  MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>");
> >  MODULE_DESCRIPTION("GP2AP002 ambient light and proximity sensor driver");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/iio/multiplexer/iio-mux.c b/drivers/iio/multiplexer/iio-mux.c
> > index b742ca9a99d1..e193913f5af7 100644
> > --- a/drivers/iio/multiplexer/iio-mux.c
> > +++ b/drivers/iio/multiplexer/iio-mux.c
> > @@ -464,3 +464,4 @@ module_platform_driver(mux_driver);
> >  MODULE_DESCRIPTION("IIO multiplexer driver");
> >  MODULE_AUTHOR("Peter Rosin <peda@axentia.se>");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c
> > index eccc2a34358f..7d993f2acda4 100644
> > --- a/drivers/iio/potentiostat/lmp91000.c
> > +++ b/drivers/iio/potentiostat/lmp91000.c
> > @@ -423,3 +423,4 @@ module_i2c_driver(lmp91000_driver);
> >  MODULE_AUTHOR("Matt Ranostay <matt.ranostay@konsulko.com>");
> >  MODULE_DESCRIPTION("LMP91000 digital potentiostat");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/input/joystick/adc-joystick.c b/drivers/input/joystick/adc-joystick.c
> > index ff44f9978b71..4fa42f88bcfa 100644
> > --- a/drivers/input/joystick/adc-joystick.c
> > +++ b/drivers/input/joystick/adc-joystick.c
> > @@ -329,3 +329,4 @@ module_platform_driver(adc_joystick_driver);
> >  MODULE_DESCRIPTION("Input driver for joysticks connected over ADC");
> >  MODULE_AUTHOR("Artur Rojek <contact@artur-rojek.eu>");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/input/keyboard/adc-keys.c b/drivers/input/keyboard/adc-keys.c
> > index f1753207429d..d687459a0c80 100644
> > --- a/drivers/input/keyboard/adc-keys.c
> > +++ b/drivers/input/keyboard/adc-keys.c
> > @@ -202,3 +202,4 @@ module_platform_driver(adc_keys_driver);
> >  MODULE_AUTHOR("Alexandre Belloni <alexandre.belloni@free-electrons.com>");
> >  MODULE_DESCRIPTION("Input driver for resistor ladder connected on ADC");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/input/touchscreen/colibri-vf50-ts.c b/drivers/input/touchscreen/colibri-vf50-ts.c
> > index 98d5b2ba63fb..89c4d7b2b89e 100644
> > --- a/drivers/input/touchscreen/colibri-vf50-ts.c
> > +++ b/drivers/input/touchscreen/colibri-vf50-ts.c
> > @@ -372,3 +372,4 @@ module_platform_driver(vf50_touch_driver);
> >  MODULE_AUTHOR("Sanchayan Maity");
> >  MODULE_DESCRIPTION("Colibri VF50 Touchscreen driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/input/touchscreen/resistive-adc-touch.c b/drivers/input/touchscreen/resistive-adc-touch.c
> > index 7e761ec73273..2fefd652864c 100644
> > --- a/drivers/input/touchscreen/resistive-adc-touch.c
> > +++ b/drivers/input/touchscreen/resistive-adc-touch.c
> > @@ -301,3 +301,4 @@ module_platform_driver(grts_driver);
> >  MODULE_AUTHOR("Eugen Hristev <eugen.hristev@microchip.com>");
> >  MODULE_DESCRIPTION("Generic ADC Resistive Touch Driver");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c
> > index 7cb020dd3423..9591672b0511 100644
> > --- a/drivers/phy/motorola/phy-cpcap-usb.c
> > +++ b/drivers/phy/motorola/phy-cpcap-usb.c
> > @@ -717,3 +717,4 @@ MODULE_ALIAS("platform:cpcap_usb");
> >  MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
> >  MODULE_DESCRIPTION("CPCAP usb phy driver");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c
> > index e5202a7b6209..36b0c52a4b8b 100644
> > --- a/drivers/power/supply/ab8500_btemp.c
> > +++ b/drivers/power/supply/ab8500_btemp.c
> > @@ -829,3 +829,4 @@ MODULE_LICENSE("GPL v2");
> >  MODULE_AUTHOR("Johan Palsson, Karl Komierowski, Arun R Murthy");
> >  MODULE_ALIAS("platform:ab8500-btemp");
> >  MODULE_DESCRIPTION("AB8500 battery temperature driver");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c
> > index 5f4537766e5b..6e49d1b28254 100644
> > --- a/drivers/power/supply/ab8500_charger.c
> > +++ b/drivers/power/supply/ab8500_charger.c
> > @@ -3751,3 +3751,4 @@ MODULE_LICENSE("GPL v2");
> >  MODULE_AUTHOR("Johan Palsson, Karl Komierowski, Arun R Murthy");
> >  MODULE_ALIAS("platform:ab8500-charger");
> >  MODULE_DESCRIPTION("AB8500 charger management driver");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c
> > index 9dd99722667a..5fa559f796aa 100644
> > --- a/drivers/power/supply/ab8500_fg.c
> > +++ b/drivers/power/supply/ab8500_fg.c
> > @@ -3252,3 +3252,4 @@ MODULE_LICENSE("GPL v2");
> >  MODULE_AUTHOR("Johan Palsson, Karl Komierowski");
> >  MODULE_ALIAS("platform:ab8500-fg");
> >  MODULE_DESCRIPTION("AB8500 Fuel Gauge driver");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/axp20x_ac_power.c b/drivers/power/supply/axp20x_ac_power.c
> > index 5f6ea416fa30..e9049d6229df 100644
> > --- a/drivers/power/supply/axp20x_ac_power.c
> > +++ b/drivers/power/supply/axp20x_ac_power.c
> > @@ -421,3 +421,4 @@ module_platform_driver(axp20x_ac_power_driver);
> >  MODULE_AUTHOR("Quentin Schulz <quentin.schulz@free-electrons.com>");
> >  MODULE_DESCRIPTION("AXP20X and AXP22X PMICs' AC power supply driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c
> > index 50ca8e110085..ee8701a6e907 100644
> > --- a/drivers/power/supply/axp20x_battery.c
> > +++ b/drivers/power/supply/axp20x_battery.c
> > @@ -1155,3 +1155,4 @@ module_platform_driver(axp20x_batt_driver);
> >  MODULE_DESCRIPTION("Battery power supply driver for AXP20X and AXP22X PMICs");
> >  MODULE_AUTHOR("Quentin Schulz <quentin.schulz@free-electrons.com>");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
> > index e75d1e377ac1..599adcf84968 100644
> > --- a/drivers/power/supply/axp20x_usb_power.c
> > +++ b/drivers/power/supply/axp20x_usb_power.c
> > @@ -1080,3 +1080,4 @@ module_platform_driver(axp20x_usb_power_driver);
> >  MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
> >  MODULE_DESCRIPTION("AXP20x PMIC USB power supply status driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
> > index a3d71fc72064..c6897dd808fc 100644
> > --- a/drivers/power/supply/axp288_fuel_gauge.c
> > +++ b/drivers/power/supply/axp288_fuel_gauge.c
> > @@ -817,3 +817,4 @@ MODULE_AUTHOR("Ramakrishna Pallala <ramakrishna.pallala@intel.com>");
> >  MODULE_AUTHOR("Todd Brandt <todd.e.brandt@linux.intel.com>");
> >  MODULE_DESCRIPTION("Xpower AXP288 Fuel Gauge Driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/cpcap-battery.c
> > index 8106d1edcbc2..542c3c70e3cb 100644
> > --- a/drivers/power/supply/cpcap-battery.c
> > +++ b/drivers/power/supply/cpcap-battery.c
> > @@ -1176,3 +1176,4 @@ module_platform_driver(cpcap_battery_driver);
> >  MODULE_LICENSE("GPL v2");
> >  MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
> >  MODULE_DESCRIPTION("CPCAP PMIC Battery Driver");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c
> > index d0c3008db534..89bc0fc3c9f8 100644
> > --- a/drivers/power/supply/cpcap-charger.c
> > +++ b/drivers/power/supply/cpcap-charger.c
> > @@ -977,3 +977,4 @@ MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
> >  MODULE_DESCRIPTION("CPCAP Battery Charger Interface driver");
> >  MODULE_LICENSE("GPL v2");
> >  MODULE_ALIAS("platform:cpcap-charger");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/da9150-charger.c b/drivers/power/supply/da9150-charger.c
> > index 27f36ef5b88d..58449df6068c 100644
> > --- a/drivers/power/supply/da9150-charger.c
> > +++ b/drivers/power/supply/da9150-charger.c
> > @@ -644,3 +644,4 @@ module_platform_driver(da9150_charger_driver);
> >  MODULE_DESCRIPTION("Charger Driver for DA9150");
> >  MODULE_AUTHOR("Adam Thomson <Adam.Thomson.Opensource@diasemi.com>");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/generic-adc-battery.c b/drivers/power/supply/generic-adc-battery.c
> > index f5f2566b3a32..d18c8ee40405 100644
> > --- a/drivers/power/supply/generic-adc-battery.c
> > +++ b/drivers/power/supply/generic-adc-battery.c
> > @@ -298,3 +298,4 @@ module_platform_driver(gab_driver);
> >  MODULE_AUTHOR("anish kumar <yesanishhere@gmail.com>");
> >  MODULE_DESCRIPTION("generic battery driver using IIO");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/ingenic-battery.c b/drivers/power/supply/ingenic-battery.c
> > index b111c7ce2be3..5be269f17bff 100644
> > --- a/drivers/power/supply/ingenic-battery.c
> > +++ b/drivers/power/supply/ingenic-battery.c
> > @@ -190,3 +190,4 @@ module_platform_driver(ingenic_battery_driver);
> >  MODULE_DESCRIPTION("Battery driver for Ingenic JZ47xx SoCs");
> >  MODULE_AUTHOR("Artur Rojek <contact@artur-rojek.eu>");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/intel_dc_ti_battery.c b/drivers/power/supply/intel_dc_ti_battery.c
> > index 56b0c92e9d28..1a16ded563bc 100644
> > --- a/drivers/power/supply/intel_dc_ti_battery.c
> > +++ b/drivers/power/supply/intel_dc_ti_battery.c
> > @@ -387,3 +387,4 @@ MODULE_ALIAS("platform:" DEV_NAME);
> >  MODULE_AUTHOR("Hans de Goede <hansg@kernel.org>");
> >  MODULE_DESCRIPTION("Intel Dollar Cove (TI) battery driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/lego_ev3_battery.c b/drivers/power/supply/lego_ev3_battery.c
> > index 28454de05761..414816662b06 100644
> > --- a/drivers/power/supply/lego_ev3_battery.c
> > +++ b/drivers/power/supply/lego_ev3_battery.c
> > @@ -231,3 +231,4 @@ module_platform_driver(lego_ev3_battery_driver);
> >  MODULE_LICENSE("GPL");
> >  MODULE_AUTHOR("David Lechner <david@lechnology.com>");
> >  MODULE_DESCRIPTION("LEGO MINDSTORMS EV3 Battery Driver");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/lp8788-charger.c b/drivers/power/supply/lp8788-charger.c
> > index f0a680c155c4..8c6ec98362d0 100644
> > --- a/drivers/power/supply/lp8788-charger.c
> > +++ b/drivers/power/supply/lp8788-charger.c
> > @@ -727,3 +727,4 @@ MODULE_DESCRIPTION("TI LP8788 Charger Driver");
> >  MODULE_AUTHOR("Milo Kim");
> >  MODULE_LICENSE("GPL");
> >  MODULE_ALIAS("platform:lp8788-charger");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
> > index c1640bc6accd..1fe658bfecc1 100644
> > --- a/drivers/power/supply/max17040_battery.c
> > +++ b/drivers/power/supply/max17040_battery.c
> > @@ -635,3 +635,4 @@ module_i2c_driver(max17040_i2c_driver);
> >  MODULE_AUTHOR("Minkyu Kang <mk7.kang@samsung.com>");
> >  MODULE_DESCRIPTION("MAX17040 Fuel Gauge");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/mp2629_charger.c b/drivers/power/supply/mp2629_charger.c
> > index d281c1059629..ed49f9a04c8c 100644
> > --- a/drivers/power/supply/mp2629_charger.c
> > +++ b/drivers/power/supply/mp2629_charger.c
> > @@ -660,3 +660,4 @@ module_platform_driver(mp2629_charger_driver);
> >  MODULE_AUTHOR("Saravanan Sekar <sravanhome@gmail.com>");
> >  MODULE_DESCRIPTION("MP2629 Charger driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/mt6370-charger.c b/drivers/power/supply/mt6370-charger.c
> > index e6db961d5818..2d02fdf37d70 100644
> > --- a/drivers/power/supply/mt6370-charger.c
> > +++ b/drivers/power/supply/mt6370-charger.c
> > @@ -941,3 +941,4 @@ module_platform_driver(mt6370_chg_driver);
> >  MODULE_AUTHOR("ChiaEn Wu <chiaen_wu@richtek.com>");
> >  MODULE_DESCRIPTION("MediaTek MT6370 Charger Driver");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/qcom_smbx.c b/drivers/power/supply/qcom_smbx.c
> > index b1cb925581ec..63b88754155c 100644
> > --- a/drivers/power/supply/qcom_smbx.c
> > +++ b/drivers/power/supply/qcom_smbx.c
> > @@ -1050,3 +1050,4 @@ module_platform_driver(qcom_spmi_smb);
> >  MODULE_AUTHOR("Casey Connolly <casey.connolly@linaro.org>");
> >  MODULE_DESCRIPTION("Qualcomm SMB2 Charger Driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/rn5t618_power.c b/drivers/power/supply/rn5t618_power.c
> > index 40dec55a9f73..a3f30e390c11 100644
> > --- a/drivers/power/supply/rn5t618_power.c
> > +++ b/drivers/power/supply/rn5t618_power.c
> > @@ -821,3 +821,4 @@ module_platform_driver(rn5t618_power_driver);
> >  MODULE_ALIAS("platform:rn5t618-power");
> >  MODULE_DESCRIPTION("Power supply driver for RICOH RN5T618");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/rx51_battery.c b/drivers/power/supply/rx51_battery.c
> > index b0220ec2d926..57266921dc8e 100644
> > --- a/drivers/power/supply/rx51_battery.c
> > +++ b/drivers/power/supply/rx51_battery.c
> > @@ -246,3 +246,4 @@ MODULE_ALIAS("platform:rx51-battery");
> >  MODULE_AUTHOR("Pali Rohár <pali@kernel.org>");
> >  MODULE_DESCRIPTION("Nokia RX-51 battery driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c
> > index a7ed9de8a289..1719ec4173e6 100644
> > --- a/drivers/power/supply/sc27xx_fuel_gauge.c
> > +++ b/drivers/power/supply/sc27xx_fuel_gauge.c
> > @@ -1350,3 +1350,4 @@ module_platform_driver(sc27xx_fgu_driver);
> >  
> >  MODULE_DESCRIPTION("Spreadtrum SC27XX PMICs Fual Gauge Unit Driver");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c
> > index 04216b2bfb6c..151f7b24e9b9 100644
> > --- a/drivers/power/supply/twl4030_charger.c
> > +++ b/drivers/power/supply/twl4030_charger.c
> > @@ -1144,3 +1144,4 @@ MODULE_AUTHOR("Gražvydas Ignotas");
> >  MODULE_DESCRIPTION("TWL4030 Battery Charger Interface driver");
> >  MODULE_LICENSE("GPL");
> >  MODULE_ALIAS("platform:twl4030_bci");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/twl4030_madc_battery.c b/drivers/power/supply/twl4030_madc_battery.c
> > index 3935162e350b..9b3785d1643c 100644
> > --- a/drivers/power/supply/twl4030_madc_battery.c
> > +++ b/drivers/power/supply/twl4030_madc_battery.c
> > @@ -237,3 +237,4 @@ MODULE_LICENSE("GPL");
> >  MODULE_AUTHOR("Lukas Märdian <lukas@goldelico.com>");
> >  MODULE_DESCRIPTION("twl4030_madc battery driver");
> >  MODULE_ALIAS("platform:twl4030_madc_battery");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/power/supply/twl6030_charger.c b/drivers/power/supply/twl6030_charger.c
> > index b4ec26ff257c..82911a811f4e 100644
> > --- a/drivers/power/supply/twl6030_charger.c
> > +++ b/drivers/power/supply/twl6030_charger.c
> > @@ -579,3 +579,4 @@ module_platform_driver(twl6030_charger_driver);
> >  
> >  MODULE_DESCRIPTION("TWL6030 Battery Charger Interface driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
> > index d7f2e6ca92c2..bb6222c8cc5f 100644
> > --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
> > +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
> > @@ -1069,3 +1069,4 @@ module_platform_driver(adc_tm5_driver);
> >  
> >  MODULE_DESCRIPTION("SPMI PMIC Thermal Monitor ADC driver");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> > index f39ca0ddd17b..fb003ca96454 100644
> > --- a/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> > +++ b/drivers/thermal/qcom/qcom-spmi-temp-alarm.c
> > @@ -904,3 +904,4 @@ module_platform_driver(qpnp_tm_driver);
> >  MODULE_ALIAS("platform:spmi-temp-alarm");
> >  MODULE_DESCRIPTION("QPNP PMIC Temperature Alarm driver");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/thermal/renesas/rzg3s_thermal.c b/drivers/thermal/renesas/rzg3s_thermal.c
> > index e25e36c99a88..7ced8f76a0ec 100644
> > --- a/drivers/thermal/renesas/rzg3s_thermal.c
> > +++ b/drivers/thermal/renesas/rzg3s_thermal.c
> > @@ -270,3 +270,4 @@ module_platform_driver(rzg3s_thermal_driver);
> >  MODULE_DESCRIPTION("Renesas RZ/G3S Thermal Sensor Unit Driver");
> >  MODULE_AUTHOR("Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c
> > index 7c844589b153..cfdb8e674dd2 100644
> > --- a/drivers/thermal/thermal-generic-adc.c
> > +++ b/drivers/thermal/thermal-generic-adc.c
> > @@ -228,3 +228,4 @@ module_platform_driver(gadc_thermal_driver);
> >  MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
> >  MODULE_DESCRIPTION("Generic ADC thermal driver using IIO framework with DT");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/sound/soc/codecs/audio-iio-aux.c b/sound/soc/codecs/audio-iio-aux.c
> > index 588e48044c13..864a5a676495 100644
> > --- a/sound/soc/codecs/audio-iio-aux.c
> > +++ b/sound/soc/codecs/audio-iio-aux.c
> > @@ -312,3 +312,4 @@ module_platform_driver(audio_iio_aux_driver);
> >  MODULE_AUTHOR("Herve Codina <herve.codina@bootlin.com>");
> >  MODULE_DESCRIPTION("IIO ALSA SoC aux driver");
> >  MODULE_LICENSE("GPL");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/sound/soc/samsung/aries_wm8994.c b/sound/soc/samsung/aries_wm8994.c
> > index 3723329b266d..b6f0f3c0d393 100644
> > --- a/sound/soc/samsung/aries_wm8994.c
> > +++ b/sound/soc/samsung/aries_wm8994.c
> > @@ -700,3 +700,4 @@ module_platform_driver(aries_audio_driver);
> >  MODULE_DESCRIPTION("ALSA SoC ARIES WM8994");
> >  MODULE_LICENSE("GPL");
> >  MODULE_ALIAS("platform:aries-audio-wm8994");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/sound/soc/samsung/midas_wm1811.c b/sound/soc/samsung/midas_wm1811.c
> > index 239e958b88d3..12c4962f901d 100644
> > --- a/sound/soc/samsung/midas_wm1811.c
> > +++ b/sound/soc/samsung/midas_wm1811.c
> > @@ -773,3 +773,4 @@ module_platform_driver(midas_driver);
> >  MODULE_AUTHOR("Simon Shields <simon@lineageos.org>");
> >  MODULE_DESCRIPTION("ASoC support for Midas");
> >  MODULE_LICENSE("GPL v2");
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> > diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c
> > index c914d1c46850..dabcd2759187 100644
> > --- a/sound/soc/stm/stm32_adfsdm.c
> > +++ b/sound/soc/stm/stm32_adfsdm.c
> > @@ -407,3 +407,4 @@ MODULE_DESCRIPTION("stm32 DFSDM DAI driver");
> >  MODULE_AUTHOR("Arnaud Pouliquen <arnaud.pouliquen@st.com>");
> >  MODULE_LICENSE("GPL v2");
> >  MODULE_ALIAS("platform:" STM32_ADFSDM_DRV_NAME);
> > +MODULE_IMPORT_NS("IIO_CONSUMER");
> >   
> 
> 


^ permalink raw reply

* Re: [PATCH v2] Bluetooth: HIDP: cap report descriptor size in HID setup
From: Eric_Terminal @ 2026-03-22 15:37 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Bastien Nocera, marcel, johan.hedberg, luiz.dentz,
	linux-bluetooth, linux-kernel, linux-input
In-Reply-To: <abFA9nm_fBqw8mNS@beelink>

Hi all,

Just a gentle ping on this patch.

Since Benjamin reviewed it from the input side and concluded it should
be safe, I was wondering if there are any further comments from the
Bluetooth side, or if anything else is needed from me for this to be
merged?

Thanks,
Yufan

On Wed, Mar 11, 2026 at 6:19 PM Benjamin Tissoires <bentiss@kernel.org> wrote:
>
> On Mar 01 2026, Bastien Nocera wrote:
> > On Sun, 2026-03-01 at 01:26 +0800, Eric-Terminal wrote:
> > > From: Yufan Chen <ericterminal@gmail.com>
> > >
> > > hidp_setup_hid() duplicates the report descriptor from userspace
> > > based on
> > > req->rd_size. Large values can trigger oversized copies.
> > >
> > > Do not reject the connection when rd_size exceeds
> > > HID_MAX_DESCRIPTOR_SIZE. Instead, cap rd_size in hidp_setup_hid()
> > > and use the capped value for memdup_user() and session->rd_size.
> > >
> > > This keeps compatibility with existing userspace behavior while
> > > bounding memory usage in the HID setup path.
> >
> > Cross-sending this to linux-input@ for review, they would know the best
> > way to deal with oversized HID descriptors.
>
> AFAICT the hid-core code would be fine with it (it would parse it), but
> there will be some issues (hidraw will not be able to export the entire
> rdesc, so is the sysfs).
>
> For reference, usbhid just returns -EINVAL for oversize report
> descriptors.
>
> Anyway, if the report descriptor is truncated, like in this patch, the
> hid core parse will fail if the data is not correct, so I thing this
> should be safe.
>
> Cheers,
> Benjamin
>
> >
> > >
> > > Signed-off-by: Yufan Chen <ericterminal@gmail.com>
> > > ---
> > >  net/bluetooth/hidp/core.c | 7 +++++--
> > >  1 file changed, 5 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
> > > index 6fe815241..31aeffa39 100644
> > > --- a/net/bluetooth/hidp/core.c
> > > +++ b/net/bluetooth/hidp/core.c
> > > @@ -755,13 +755,16 @@ static int hidp_setup_hid(struct hidp_session
> > > *session,
> > >                             const struct hidp_connadd_req *req)
> > >  {
> > >     struct hid_device *hid;
> > > +   unsigned int rd_size;
> > >     int err;
> > >
> > > -   session->rd_data = memdup_user(req->rd_data, req->rd_size);
> > > +   rd_size = min_t(unsigned int, req->rd_size,
> > > HID_MAX_DESCRIPTOR_SIZE);
> > > +
> > > +   session->rd_data = memdup_user(req->rd_data, rd_size);
> > >     if (IS_ERR(session->rd_data))
> > >             return PTR_ERR(session->rd_data);
> > >
> > > -   session->rd_size = req->rd_size;
> > > +   session->rd_size = rd_size;
> > >
> > >     hid = hid_allocate_device();
> > >     if (IS_ERR(hid)) {
> >

^ permalink raw reply

* Re: [PATCH v2 2/2] iio: inkern: Use namespaced exports
From: Dmitry Torokhov @ 2026-03-22 22:24 UTC (permalink / raw)
  To: Romain Gantois
  Cc: MyungJoo Ham, Chanwoo Choi, Guenter Roeck, Peter Rosin,
	Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Lars-Peter Clausen, Michael Hennerich, Mariel Tinaco, Kevin Tsai,
	Linus Walleij, Eugen Hristev, Vinod Koul, Kishon Vijay Abraham I,
	Sebastian Reichel, Chen-Yu Tsai, Hans de Goede,
	Support Opensource, Paul Cercueil, Iskren Chernev,
	Krzysztof Kozlowski, Marek Szyprowski, Matheus Castello,
	Saravanan Sekar, Matthias Brugger, AngeloGioacchino Del Regno,
	Casey Connolly, Pali Rohár, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Amit Kucheria, Thara Gopinath, Rafael J. Wysocki,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Claudiu Beznea,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Sylwester Nawrocki, Olivier Moysan, Arnaud Pouliquen,
	Maxime Coquelin, Alexandre Torgue, Thomas Petazzoni, linux-kernel,
	linux-hwmon, linux-iio, linux-input, linux-phy, linux-pm,
	linux-mips, linux-mediatek, linux-arm-msm, linux-sound,
	linux-stm32, Sebastian Reichel, Andy Shevchenko
In-Reply-To: <20251209-iio-inkern-use-namespaced-exports-v2-2-9799a33c4b7f@bootlin.com>

On Tue, Dec 09, 2025 at 09:25:56AM +0100, Romain Gantois wrote:
> Use namespaced exports for IIO consumer API functions.
> 
> This will make it easier to manage the IIO export surface. Consumer drivers
> will only be provided access to a specific set of functions, thereby
> restricting usage of internal IIO functions by other parts of the kernel.
> 
> This change cannot be split into several parts without breaking
> bisectability, thus all of the affected drivers are modified at once.
> 
> Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for power-supply
> Acked-by: Guenter Roeck <linux@roeck-us.net>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>

For input:

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v2 2/2] iio: inkern: Use namespaced exports
From: Dmitry Torokhov @ 2026-03-22 22:26 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Romain Gantois, MyungJoo Ham, Chanwoo Choi, Guenter Roeck,
	Peter Rosin, David Lechner, Nuno Sá, Andy Shevchenko,
	Lars-Peter Clausen, Michael Hennerich, Mariel Tinaco, Kevin Tsai,
	Linus Walleij, Eugen Hristev, Vinod Koul, Kishon Vijay Abraham I,
	Sebastian Reichel, Chen-Yu Tsai, Hans de Goede,
	Support Opensource, Paul Cercueil, Iskren Chernev,
	Krzysztof Kozlowski, Marek Szyprowski, Matheus Castello,
	Saravanan Sekar, Matthias Brugger, AngeloGioacchino Del Regno,
	Casey Connolly, Pali Rohár, Orson Zhai, Baolin Wang,
	Chunyan Zhang, Amit Kucheria, Thara Gopinath, Rafael J. Wysocki,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Claudiu Beznea,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Sylwester Nawrocki, Olivier Moysan, Arnaud Pouliquen,
	Maxime Coquelin, Alexandre Torgue, Thomas Petazzoni, linux-kernel,
	linux-hwmon, linux-iio, linux-input, linux-phy, linux-pm,
	linux-mips, linux-mediatek, linux-arm-msm, linux-sound,
	linux-stm32, Sebastian Reichel, Andy Shevchenko
In-Reply-To: <20260322122529.62093f12@jic23-huawei>

On Sun, Mar 22, 2026 at 12:25:29PM +0000, Jonathan Cameron wrote:
> On Sun, 11 Jan 2026 17:02:22 +0000
> Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > On Tue, 09 Dec 2025 09:25:56 +0100
> > Romain Gantois <romain.gantois@bootlin.com> wrote:
> > 
> > > Use namespaced exports for IIO consumer API functions.
> > > 
> > > This will make it easier to manage the IIO export surface. Consumer drivers
> > > will only be provided access to a specific set of functions, thereby
> > > restricting usage of internal IIO functions by other parts of the kernel.
> > > 
> > > This change cannot be split into several parts without breaking
> > > bisectability, thus all of the affected drivers are modified at once.
> > > 
> > > Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for power-supply
> > > Acked-by: Guenter Roeck <linux@roeck-us.net>
> > > Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> > > Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>  
> > Ideally looking for a couple more Acks.
> > 
> > If any of the maintainers of other trees who haven't already replied
> > have time for a quick glance that would be great.  I'll spin an
> > immutable branch but I'm not really expecting any non trivial
> > conflicts unless there is a new user in flight that I've forgotten
> > about.
> 
> At this stage, given I'm still waiting on replies from a couple of
> subsystem maintainers, I'm thinking we'll do this next cycle and I'll
> provide an immutable branch based on rc1 for anyone to grab if they
> run into merge conflicts in linux-next.

Sorry, I just acked the input bits in the patch, but in general I feel
these kind of mechanical changes in consumers do not require an ack and
you can just go an apply such changes.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: uinput - fix circular locking dependency with ff-core
From: Dmitry Torokhov @ 2026-03-23  2:47 UTC (permalink / raw)
  To: Mikhail Gavrilov; +Cc: linux-input, linux-kernel
In-Reply-To: <20260228223628.472208-1-mikhail.v.gavrilov@gmail.com>

Hi Mikhail,

On Sun, Mar 01, 2026 at 03:36:28AM +0500, Mikhail Gavrilov wrote:
> A lockdep circular locking dependency warning can be triggered
> reproducibly when using a force-feedback gamepad with uinput (for
> example, playing ELDEN RING under Wine with a Flydigi Vader 5
> controller):
> 
>   ff->mutex -> udev->mutex -> input_mutex -> dev->mutex -> ff->mutex
> 
> The cycle is caused by four lock acquisition paths:
> 
> 1. ff upload: input_ff_upload() holds ff->mutex and calls
>    uinput_dev_upload_effect() -> uinput_request_submit() ->
>    uinput_request_send(), which acquires udev->mutex.
> 
> 2. device create: uinput_ioctl_handler() holds udev->mutex and calls
>    uinput_create_device() -> input_register_device(), which acquires
>    input_mutex.
> 
> 3. device register: input_register_device() holds input_mutex and
>    calls kbd_connect() -> input_register_handle(), which acquires
>    dev->mutex.
> 
> 4. evdev release: evdev_release() calls input_flush_device() under
>    dev->mutex, which calls input_ff_flush() acquiring ff->mutex.
> 
> Fix this by replacing udev->mutex with the existing
> udev->requests_lock spinlock in uinput_request_send().  The function
> only needs to atomically check device state and queue an input event
> into the ring buffer via uinput_dev_event() -- both operations are safe
> under a spinlock (ktime_get_ts64() and wake_up_interruptible() do not
> sleep).  This breaks the ff->mutex -> udev->mutex link since a spinlock
> is a leaf in the lock ordering and cannot form cycles with mutexes.
> 
> To keep state transitions visible to uinput_request_send(), protect
> writes to udev->state in uinput_create_device() and
> uinput_destroy_device() with the same spinlock.

Thank you for the patch, it looks solid, however I wonder if creating a
separate "state_lock" spinlock would not be better than reusing
requests_lock?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 2/3] Input: adafruit-seesaw - add interrupt support
From: Dmitry Torokhov @ 2026-03-23  5:12 UTC (permalink / raw)
  To: charles.embedded
  Cc: Anshul Dalal, Shuah Khan, Brigham Campbell, linux-input,
	linux-kernel, Charles Dias
In-Reply-To: <20260321202446.724277-3-charles.embedded@gmail.com>

Hi Charles,

On Sat, Mar 21, 2026 at 05:24:45PM -0300, charles.embedded@gmail.com wrote:
> @@ -289,6 +341,19 @@ static int seesaw_probe(struct i2c_client *client)
>  	input_set_max_poll_interval(seesaw->input_dev, SEESAW_GAMEPAD_POLL_MAX);
>  	input_set_min_poll_interval(seesaw->input_dev, SEESAW_GAMEPAD_POLL_MIN);
>  
> +	if (client->irq) {
> +		err = seesaw_register_write_u32(client, SEESAW_GPIO_INTENSET, SEESAW_BUTTON_MASK);
> +		if (err)
> +			return dev_err_probe(&client->dev, err,
> +						"failed to enable hardware interrupts\n");

Maybe this should be in seesaw_open()?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: uinput - fix circular locking dependency with ff-core
From: Mikhail Gavrilov @ 2026-03-23  5:17 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
In-Reply-To: <acCpW6McaPOE0Jq5@google.com>

On Mon, Mar 23, 2026 at 7:47 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> Thank you for the patch, it looks solid, however I wonder if creating a
> separate "state_lock" spinlock would not be better than reusing
> requests_lock?

Hi Dmitry,

Thank you for the review.

A separate spinlock would certainly be cleaner from a naming
perspective. One thing I'd like to note though: the current
approach of reusing requests_lock has the benefit of atomically
checking state and queueing the event in uinput_request_send(),
and atomically changing state and flushing requests in
uinput_destroy_device(). With a separate state_lock these become
two independent locks, so the ordering between them would need to
be defined.

That said, if you prefer the cleaner separation I'm happy to make
the change. Please let me know.

-- 
Best Regards,
Mike Gavrilov.

^ permalink raw reply

* Re: [PATCH] Input: uinput - fix circular locking dependency with ff-core
From: Dmitry Torokhov @ 2026-03-23  5:34 UTC (permalink / raw)
  To: Mikhail Gavrilov; +Cc: linux-input, linux-kernel
In-Reply-To: <CABXGCsOwJu2dw67bR38MJb5DFvGon=MUCxKcGEQYfT6qrPZU1w@mail.gmail.com>

On Mon, Mar 23, 2026 at 10:17:01AM +0500, Mikhail Gavrilov wrote:
> On Mon, Mar 23, 2026 at 7:47 AM Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> >
> > Thank you for the patch, it looks solid, however I wonder if creating a
> > separate "state_lock" spinlock would not be better than reusing
> > requests_lock?
> 
> Hi Dmitry,
> 
> Thank you for the review.
> 
> A separate spinlock would certainly be cleaner from a naming
> perspective. One thing I'd like to note though: the current
> approach of reusing requests_lock has the benefit of atomically
> checking state and queueing the event in uinput_request_send(),
> and atomically changing state and flushing requests in
> uinput_destroy_device(). With a separate state_lock these become
> two independent locks, so the ordering between them would need to
> be defined.

Hmm, I am not sure I see the issue. We are not going to change state
back to UIST_CREATED until after uinput_destroy_device() returns so we
will not submit more requests...

What am I missing?

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH] Input: uinput - fix circular locking dependency with ff-core
From: Mikhail Gavrilov @ 2026-03-23  5:39 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
In-Reply-To: <acDPeFpxX57Uu0Mm@google.com>

On Mon, Mar 23, 2026 at 10:34 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> Hmm, I am not sure I see the issue. We are not going to change state
> back to UIST_CREATED until after uinput_destroy_device() returns so we
> will not submit more requests...
>
> What am I missing?

You are right, there is no lock ordering issue since the state
transition is one-way.

The reason I reused requests_lock is that uinput_request_send()
needs to atomically check state and access udev->dev. If we use a
separate state_lock and release it before calling
uinput_dev_event(), uinput_destroy_device() could run in between,
unregister the device, and we'd hit a use-after-free on udev->dev.

A separate lock would need to be held across the same scope,
making it functionally equivalent to reusing requests_lock.

-- 
Best Regards,
Mike Gavrilov.

^ permalink raw reply

* [PATCH 2/7] Input: aiptek: validate macro key indices
From: Pengpeng Hou @ 2026-03-23  7:03 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, pengpeng

aiptek_irq() derives macro key indices directly from tablet reports and
then uses them to index macroKeyEvents[]. Report types 4 and 5 use
(data[3] >> 1), while report type 6 reads a 16-bit macro number from the
packet body. None of those indices are checked against the array bounds
before input_report_key() dereferences them.

Reject out-of-range macro indices at each use site so malformed reports
cannot read past macroKeyEvents[].

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/input/tablet/aiptek.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index 6df24cee3c9d..ab5886a9241d 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -676,12 +676,15 @@ static void aiptek_irq(struct urb *urb)
 			}
 		}
 
-		if (aiptek->lastMacro != -1 && aiptek->lastMacro != macro) {
+		if (aiptek->lastMacro >= 0 &&
+		    aiptek->lastMacro < ARRAY_SIZE(macroKeyEvents) &&
+		    aiptek->lastMacro != macro) {
 		        input_report_key(inputdev, macroKeyEvents[aiptek->lastMacro], 0);
 			aiptek->lastMacro = -1;
 		}
 
-		if (macro != -1 && macro != aiptek->lastMacro) {
+		if (macro >= 0 && macro < ARRAY_SIZE(macroKeyEvents) &&
+		    macro != aiptek->lastMacro) {
 			input_report_key(inputdev, macroKeyEvents[macro], 1);
 			aiptek->lastMacro = macro;
 		}
@@ -715,12 +718,15 @@ static void aiptek_irq(struct urb *urb)
 			}
 		}
 
-		if (aiptek->lastMacro != -1 && aiptek->lastMacro != macro) {
+		if (aiptek->lastMacro >= 0 &&
+		    aiptek->lastMacro < ARRAY_SIZE(macroKeyEvents) &&
+		    aiptek->lastMacro != macro) {
 		        input_report_key(inputdev, macroKeyEvents[aiptek->lastMacro], 0);
 			aiptek->lastMacro = -1;
 		}
 
-		if (macro != -1 && macro != aiptek->lastMacro) {
+		if (macro >= 0 && macro < ARRAY_SIZE(macroKeyEvents) &&
+		    macro != aiptek->lastMacro) {
 			input_report_key(inputdev, macroKeyEvents[macro], 1);
 			aiptek->lastMacro = macro;
 		}
@@ -737,11 +743,11 @@ static void aiptek_irq(struct urb *urb)
 	 */
 	else if (data[0] == 6) {
 		macro = get_unaligned_le16(data + 1);
-		if (macro > 0) {
+		if (macro > 0 && macro - 1 < ARRAY_SIZE(macroKeyEvents)) {
 			input_report_key(inputdev, macroKeyEvents[macro - 1],
 					 0);
 		}
-		if (macro < 25) {
+		if (macro + 1 < ARRAY_SIZE(macroKeyEvents)) {
 			input_report_key(inputdev, macroKeyEvents[macro + 1],
 					 0);
 		}
@@ -760,7 +766,8 @@ static void aiptek_irq(struct urb *urb)
 				aiptek->curSetting.toolMode;
 		}
 
-		input_report_key(inputdev, macroKeyEvents[macro], 1);
+		if (macro < ARRAY_SIZE(macroKeyEvents))
+			input_report_key(inputdev, macroKeyEvents[macro], 1);
 		input_report_abs(inputdev, ABS_MISC,
 				 1 | AIPTEK_REPORT_TOOL_UNKNOWN);
 		input_sync(inputdev);
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related

* [PATCH] Input: gf2k: clamp hat values to the lookup table
From: Pengpeng Hou @ 2026-03-23  7:45 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, kees, pengpeng

gf2k_read() decodes the hat position from a 4-bit field and uses it
directly to index gf2k_hat_to_axis[]. The lookup table only has nine
entries, so malformed packets can read past the end of the fixed table.

Clamp invalid hat values to the neutral position before indexing the
lookup table.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/input/joystick/gf2k.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c
index 5a1cdce0bc48..78fba36285dc 100644
--- a/drivers/input/joystick/gf2k.c
+++ b/drivers/input/joystick/gf2k.c
@@ -164,6 +164,8 @@ static void gf2k_read(struct gf2k *gf2k, unsigned char *data)
 		input_report_abs(dev, gf2k_abs[i], GB(i*9+60,8,0) | GB(i+54,1,9));
 
 	t = GB(40,4,0);
+	if (t >= ARRAY_SIZE(gf2k_hat_to_axis))
+		t = 0;
 
 	for (i = 0; i < gf2k_hats[gf2k->id]; i++)
 		input_report_abs(dev, ABS_HAT0X + i, gf2k_hat_to_axis[t][i]);
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related

* Re: [PATCH v6 4/4] Input: Add TouchNetix aXiom I2C Touchscreen support
From: Andrew Thomas @ 2026-03-23  9:59 UTC (permalink / raw)
  To: Marco Felsch
  Cc: Luis Chamberlain, Russ Weight, Greg Kroah-Hartman,
	Rafael J. Wysocki, Andrew Morton, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Dmitry Torokhov, Kamel Bouhara,
	Marco Felsch, Henrik Rydberg, Danilo Krummrich, linux-kernel,
	devicetree, linux-input
In-Reply-To: <enyz3io3i7mzoaquexpkbsjtxmcuib7lxj334ii2yqvdgpvajb@aspqccwo7vnf>

On Fri, Mar 13, 2026 at 08:50:05PM +0100, Marco Felsch wrote:
>Hi Andrew,
>
>thanks for your feedback! Please see below.
>
>On 26-03-13, Andrew Thomas wrote:
>> On Tue, Mar 03, 2026 at 11:41:22PM +0100, Marco Felsch wrote:
>> >This adds the initial support for the TouchNetix AX54A touchcontroller
>> >which is part of TouchNetix's aXiom touchscreen controller family.
>> >
>> >The TouchNetix aXiom family provides two physical interfaces: SPI and
>> >I2C. This patch covers only the I2C interface.
>> >
>> >Apart the input event handling the driver supports firmware updates too.
>> >One firmware interface handles the touchcontroller firmware (AXFW)
>> >update the other handles the touchcontroller configuration (TH2CFGBIN)
>> >update.
>> >
>> >Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>> >---
>
>...
>
>> >+static int axiom_u02_enter_bootloader(struct axiom_data *ts)
>> >+{
>> >+	struct axiom_u02_rev1_system_manager_msg msg = { };
>> >+	struct device *dev = ts->dev;
>> >+	unsigned int val;
>> >+	int error;
>> >+
>> >+	if (!axiom_driver_supports_usage(ts, AXIOM_U02))
>> >+		return -EINVAL;
>> >+
>> >+	/*
>> >+	 * Enter the bootloader mode requires 3 consecutive messages so we can't
>> >+	 * check for the response.
>> >+	 * TODO: Check if it's required to add a delay between the consecutive
>> >+	 * CMD_ENTERBOOTLOADER cmds.
>> >+	 */
>> >+	msg.command = cpu_to_le16(AXIOM_U02_REV1_CMD_ENTERBOOTLOADER);
>> >+	msg.parameters[0] = cpu_to_le16(AXIOM_U02_REV1_PARAM0_ENTERBOOLOADER_KEY1);
>> >+	error = axiom_u02_send_msg(ts, &msg, false);
>>
>> As mentioned before the delay between commands is too short and the
>> next command is sent before u02 is ready, which means the driver fails
>> to put axiom into the bootloader.
>
>Please see my comment [1].
>
>> Have you tested with an i2c speed of 400KHz?
>
>Yes, my target platform is based on a i.MX8MP.
>
>> All you need is to put true in above to wait for the bootloader command.
>> error = axiom_u02_send_msg(ts, &msg, true);
>
>Please see my comment [1].
>
>> Just dont do it for the last command.
>
>Please see my comment [1].
>
>> I am not too sure why you are having issues with this, this is how we
>> do it for all our devices.
>
>Please see my comment [1].
>
>On what platform do you perform the tests?
>
>> >+	if (error) {
>> >+		dev_err(dev, "Failed to send bootloader-key1: %d\n", error);
>> >+		return error;
>> >+	}
>> >+
>> >+	msg.parameters[0] = cpu_to_le16(AXIOM_U02_REV1_PARAM0_ENTERBOOLOADER_KEY2);
>> >+	error = axiom_u02_send_msg(ts, &msg, false);
>>
>> Here also.
>
>Please see my comment [1].
>
>> >+	if (error) {
>> >+		dev_err(dev, "Failed to send bootloader-key2: %d\n", error);
>> >+		return error;
>> >+	}
>> >+
>> >+	msg.parameters[0] = cpu_to_le16(AXIOM_U02_REV1_PARAM0_ENTERBOOLOADER_KEY3);
>> >+	error = axiom_u02_send_msg(ts, &msg, false);
>> >+	if (error) {
>> >+		dev_err(dev, "Failed to send bootloader-key3: %d\n", error);
>> >+		return error;
>> >+	}
>> >+
>> >+	/* Sleep before the first read to give the device time */
>> >+	fsleep(250 * USEC_PER_MSEC);
>> >+
>> >+	/* Wait till the device reports it is in bootloader mode */
>> >+	error = regmap_read_poll_timeout(ts->regmap,
>> >+					 AXIOM_U31_REV1_DEVICE_ID_HIGH_REG, val,
>> >+					 FIELD_GET(AXIOM_U31_REV1_MODE_MASK, val) ==
>> >+						AXIOM_U31_REV1_MODE_BLP,
>> >+					 250 * USEC_PER_MSEC, USEC_PER_SEC);
>> >+	if (error)
>> >+		return error;
>> >+
>> >+	return 0;
>> >+}
>> >+
>>
>> ...
>>
>>
>> Other than the above comments I have no issues with the driver.
>
>If you're fine with the patch you could add your acked-by [2] :)
>
>> We can support more usages in a later patch.
>
>Sure :)
>
>[1] https://lore.kernel.org/all/4x3dnedfzf3rqzsy3wjdoj6yaxmy6kop37xhxeao4vjer7ifdi@35ux42ztq3eb
>[2] https://docs.kernel.org/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by
>
>Regards,
>  Marco
>-- 
>#gernperDu
>#CallMeByMyFirstName
>
>Pengutronix e.K.                           |                             |
>Steuerwalder Str. 21                       | https://www.pengutronix.de |
>31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
>Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |

Acked-by: Andrew Thomas <andrew.thomas@touchnetix.com>


^ permalink raw reply

* [PATCH] Input: penmount: bound packet buffer indices in IRQ path
From: Pengpeng Hou @ 2026-03-23 12:17 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: andriy.shevchenko, kees, linux-input, linux-kernel, pengpeng

The IRQ handler stores each incoming byte into pm->data[] before the
packet parser gets a chance to reset pm->idx. If the incoming serial
stream never matches one of the expected packet headers, pm->idx can
advance past the fixed receive buffer and the next IRQ will write beyond
PM_MAX_LENGTH.

Reset stale indices before writing the next byte so malformed packet
streams cannot walk past the end of the local packet buffer.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/input/touchscreen/penmount.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/touchscreen/penmount.c b/drivers/input/touchscreen/penmount.c
index 4b57b6664e37..ba09096c6573 100644
--- a/drivers/input/touchscreen/penmount.c
+++ b/drivers/input/touchscreen/penmount.c
@@ -163,6 +163,9 @@ static irqreturn_t pm_interrupt(struct serio *serio,
 {
 	struct pm *pm = serio_get_drvdata(serio);
 
+	if (pm->idx >= pm->packetsize || pm->idx >= PM_MAX_LENGTH)
+		pm->idx = 0;
+
 	pm->data[pm->idx] = data;
 
 	pm->parse_packet(pm);
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related

* [PATCH] HID: playstation: validate num_touch_reports in DualShock 4 reports
From: FirstName LastName @ 2026-03-23 12:47 UTC (permalink / raw)
  To: Roderick Colenbrander, Jiri Kosina, Benjamin Tissoires
  Cc: linux-input, linux-kernel, Benoît Sevens

From: Benoît Sevens <bsevens@google.com>

The DualShock 4 HID driver fails to validate the num_touch_reports field
received from the device in both USB and Bluetooth input reports.
A malicious device could set this field to a value larger than the
allocated size of the touch_reports array (3 for USB, 4 for Bluetooth),
leading to an out-of-bounds read in dualshock4_parse_report().

This can result in kernel memory disclosure when processing malicious
HID reports.

Validate num_touch_reports against the array size for the respective
connection types before processing the touch data.

Signed-off-by: Benoît Sevens <bsevens@google.com>
---
 drivers/hid/hid-playstation.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index 3c0db8f93c82..c43caac20b61 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -2377,6 +2377,12 @@ static int dualshock4_parse_report(struct ps_device *ps_dev, struct hid_report *
 		struct dualshock4_input_report_usb *usb =
 			(struct dualshock4_input_report_usb *)data;
 
+		if (usb->num_touch_reports > ARRAY_SIZE(usb->touch_reports)) {
+			hid_err(hdev, "DualShock4 USB input report has invalid num_touch_reports=%d\n",
+				usb->num_touch_reports);
+			return -EINVAL;
+		}
+
 		ds4_report = &usb->common;
 		num_touch_reports = usb->num_touch_reports;
 		touch_reports = usb->touch_reports;
@@ -2391,6 +2397,12 @@ static int dualshock4_parse_report(struct ps_device *ps_dev, struct hid_report *
 			return -EILSEQ;
 		}
 
+		if (bt->num_touch_reports > ARRAY_SIZE(bt->touch_reports)) {
+			hid_err(hdev, "DualShock4 BT input report has invalid num_touch_reports=%d\n",
+				bt->num_touch_reports);
+			return -EINVAL;
+		}
+
 		ds4_report = &bt->common;
 		num_touch_reports = bt->num_touch_reports;
 		touch_reports = bt->touch_reports;
-- 
2.53.0.959.g497ff81fa9-goog


^ permalink raw reply related

* Re: [PATCH] Input: penmount: bound packet buffer indices in IRQ path
From: Andy Shevchenko @ 2026-03-23 13:32 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: dmitry.torokhov, kees, linux-input, linux-kernel
In-Reply-To: <20260323121715.74954-1-pengpeng@iscas.ac.cn>

On Mon, Mar 23, 2026 at 08:17:15PM +0800, Pengpeng Hou wrote:
> The IRQ handler stores each incoming byte into pm->data[] before the
> packet parser gets a chance to reset pm->idx. If the incoming serial
> stream never matches one of the expected packet headers, pm->idx can
> advance past the fixed receive buffer and the next IRQ will write beyond
> PM_MAX_LENGTH.

How did you find the issue? Any assistance?

> Reset stale indices before writing the next byte so malformed packet
> streams cannot walk past the end of the local packet buffer.

Why do you think this is the best possible approach? Maybe we should
simply ignore IRQ or handle it without any further actions?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply

* [PATCH] dt-bindings: input: matrix-keymap: fix key board wording
From: Hugo Villeneuve @ 2026-03-23 14:00 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Olof Johansson
  Cc: hugo, Hugo Villeneuve, linux-input, devicetree, linux-kernel

From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

The correct wording is keyboard, without a space.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
 Documentation/devicetree/bindings/input/matrix-keymap.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/matrix-keymap.yaml b/Documentation/devicetree/bindings/input/matrix-keymap.yaml
index a715c2a773fe..ce910e4ac823 100644
--- a/Documentation/devicetree/bindings/input/matrix-keymap.yaml
+++ b/Documentation/devicetree/bindings/input/matrix-keymap.yaml
@@ -4,13 +4,13 @@
 $id: http://devicetree.org/schemas/input/matrix-keymap.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Common Key Matrices on Matrix-connected Key Boards
+title: Common Key Matrices on Matrix-connected Keyboards
 
 maintainers:
   - Olof Johansson <olof@lixom.net>
 
 description: |
-  A simple common binding for matrix-connected key boards. Currently targeted at
+  A simple common binding for matrix-connected keyboards. Currently targeted at
   defining the keys in the scope of linux key codes since that is a stable and
   standardized interface at this time.
 

base-commit: c369299895a591d96745d6492d4888259b004a9e
-- 
2.47.3


^ permalink raw reply related

* Re: (subset) [PATCH v8 0/2] Add support for sound profile switching and leverage for OnePlus slider
From: Bjorn Andersson @ 2026-03-23 14:50 UTC (permalink / raw)
  To: Dmitry Torokhov, Jonathan Corbet, Jiri Kosina, Benjamin Tissoires,
	Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Casey Connolly, Guido Günther, David Heidelberg
  Cc: linux-input, linux-doc, linux-kernel, linux-arm-msm, devicetree,
	phone-devel, Gergo Koteles, Casey Connolly
In-Reply-To: <20251113-op6-tri-state-v8-0-54073f3874bc@ixit.cz>


On Thu, 13 Nov 2025 17:02:57 +0100, David Heidelberg wrote:
> This series add initial support for OnePlus 6 and 6T, but other OnePlus
> phones contains same mechanism to switch sound profiles.
> 
> This code was tested for two years within the downstream Snapdragon 845 tree.
> It is now perfectly integrated with feedbackd in the Phosh environment.
> 
> The series is also available (until merged) at
>   https://gitlab.com/sdm845/sdm845-next/-/commits/b4/op6-tri-state
> 
> [...]

Applied, thanks!

[2/2] arm64: dts: qcom: sdm845-oneplus: Add alert-slider
      commit: ca5adb26c5927f28016c6b1778622dee9ada5ca0

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>

^ permalink raw reply

* [PATCH 6.6 099/567] HID: Add HID_CLAIMED_INPUT guards in raw_event callbacks missing them
From: Greg Kroah-Hartman @ 2026-03-23 13:40 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, patches, Jiri Kosina, Benjamin Tissoires,
	Bastien Nocera, linux-input, stable
In-Reply-To: <20260323134533.749096647@linuxfoundation.org>

6.6-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ecfa6f34492c493a9a1dc2900f3edeb01c79946b upstream.

In commit 2ff5baa9b527 ("HID: appleir: Fix potential NULL dereference at
raw event handle"), we handle the fact that raw event callbacks
can happen even for a HID device that has not been "claimed" causing a
crash if a broken device were attempted to be connected to the system.

Fix up the remaining in-tree HID drivers that forgot to add this same
check to resolve the same issue.

Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <bentiss@kernel.org>
Cc: Bastien Nocera <hadess@hadess.net>
Cc: linux-input@vger.kernel.org
Cc: stable <stable@kernel.org>
Assisted-by: gkh_clanker_2000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hid/hid-cmedia.c          |    2 +-
 drivers/hid/hid-creative-sb0540.c |    2 +-
 drivers/hid/hid-zydacron.c        |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/hid/hid-cmedia.c
+++ b/drivers/hid/hid-cmedia.c
@@ -99,7 +99,7 @@ static int cmhid_raw_event(struct hid_de
 {
 	struct cmhid *cm = hid_get_drvdata(hid);
 
-	if (len != CM6533_JD_RAWEV_LEN)
+	if (len != CM6533_JD_RAWEV_LEN || !(hid->claimed & HID_CLAIMED_INPUT))
 		goto out;
 	if (memcmp(data+CM6533_JD_SFX_OFFSET, ji_sfx, sizeof(ji_sfx)))
 		goto out;
--- a/drivers/hid/hid-creative-sb0540.c
+++ b/drivers/hid/hid-creative-sb0540.c
@@ -153,7 +153,7 @@ static int creative_sb0540_raw_event(str
 	u64 code, main_code;
 	int key;
 
-	if (len != 6)
+	if (len != 6 || !(hid->claimed & HID_CLAIMED_INPUT))
 		return 0;
 
 	/* From daemons/hw_hiddev.c sb0540_rec() in lirc */
--- a/drivers/hid/hid-zydacron.c
+++ b/drivers/hid/hid-zydacron.c
@@ -114,7 +114,7 @@ static int zc_raw_event(struct hid_devic
 	unsigned key;
 	unsigned short index;
 
-	if (report->id == data[0]) {
+	if (report->id == data[0] && (hdev->claimed & HID_CLAIMED_INPUT)) {
 
 		/* break keys */
 		for (index = 0; index < 4; index++) {



^ permalink raw reply

* [PATCH v2 00/19] tracepoint: Avoid double static_branch evaluation at guarded call sites
From: Vineeth Pillai (Google) @ 2026-03-23 16:00 UTC (permalink / raw)
  To: Steven Rostedt, Peter Zijlstra, Dmitry Ilvokhin
  Cc: Vineeth Pillai (Google), Masami Hiramatsu, Mathieu Desnoyers,
	Ingo Molnar, Jens Axboe, io-uring, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
	Marcelo Ricardo Leitner, Xin Long, Jon Maloy, Aaron Conole,
	Eelco Chaudron, Ilya Maximets, netdev, bpf, linux-sctp,
	tipc-discussion, dev, Jiri Pirko, Oded Gabbay, Koby Elbaz,
	dri-devel, Rafael J. Wysocki, Viresh Kumar, Gautham R. Shenoy,
	Huang Rui, Mario Limonciello, Len Brown, Srinivas Pandruvada,
	linux-pm, MyungJoo Ham, Kyungmin Park, Chanwoo Choi,
	Christian König, Sumit Semwal, linaro-mm-sig, Eddie James,
	Andrew Jeffery, Joel Stanley, linux-fsi, David Airlie,
	Simona Vetter, Alex Deucher, Danilo Krummrich, Matthew Brost,
	Philipp Stanner, Harry Wentland, Leo Li, amd-gfx, Jiri Kosina,
	Benjamin Tissoires, linux-input, Wolfram Sang, linux-i2c,
	Mark Brown, Michael Hennerich, Nuno Sá, linux-spi,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi, Chris Mason,
	David Sterba, linux-btrfs, Thomas Gleixner, Andrew Morton,
	SeongJae Park, linux-mm, Borislav Petkov, Dave Hansen, x86,
	linux-trace-kernel, linux-kernel

When a caller already guards a tracepoint with an explicit enabled check:

  if (trace_foo_enabled() && cond)
      trace_foo(args);

trace_foo() internally re-evaluates the static_branch_unlikely() key.
Since static branches are patched binary instructions the compiler cannot
fold the two evaluations, so every such site pays the cost twice.

This series introduces trace_call__##name() as a companion to
trace_##name().  It calls __do_trace_##name() directly, bypassing the
redundant static-branch re-check, while preserving all other correctness
properties of the normal path (RCU-watching assertion, might_fault() for
syscall tracepoints).  The internal __do_trace_##name() symbol is not
leaked to call sites; trace_call__##name() is the only new public API.

  if (trace_foo_enabled() && cond)
      trace_call__foo(args);   /* calls __do_trace_foo() directly */

The first patch adds the three-location change to
include/linux/tracepoint.h (__DECLARE_TRACE, __DECLARE_TRACE_SYSCALL,
and the !TRACEPOINTS_ENABLED stub).  The remaining 18 patches
mechanically convert all guarded call sites found in the tree:
kernel/, io_uring/, net/, accel/habanalabs, cpufreq/, devfreq/,
dma-buf/, fsi/, drm/, HID, i2c/, spi/, scsi/ufs/, btrfs/,
net/devlink/, kernel/time/, kernel/trace/, mm/damon/, and arch/x86/.

This series is motivated by Peter Zijlstra's observation in the discussion
around Dmitry Ilvokhin's locking tracepoint instrumentation series, where
he noted that compilers cannot optimize static branches and that guarded
call sites end up evaluating the static branch twice for no reason, and
by Steven Rostedt's suggestion to add a proper API instead of exposing
internal implementation details like __do_trace_##name() directly to
call sites:

  https://lore.kernel.org/linux-trace-kernel/8298e098d3418cb446ef396f119edac58a3414e9.1772642407.git.d@ilvokhin.com

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Suggested-by: Peter Zijlstra <peterz@infradead.org>

Changes in v2:
- Renamed trace_invoke_##name() to trace_call__##name() (double
  underscore) per review comments.
- Added 4 new patches covering sites missed in v1, found using
  coccinelle to scan the tree (Keith Busch):
    * net/devlink: guarded tracepoint_enabled() block in trap.c
    * kernel/time: early-return guard in tick-sched.c (tick_stop)
    * kernel/trace: early-return guard in trace_benchmark.c
    * mm/damon: early-return guard in core.c
    * arch/x86: do_trace_*() wrapper functions in lib/msr.c, which
      are called exclusively from tracepoint_enabled()-guarded sites
      in asm/msr.h

v1: https://lore.kernel.org/linux-trace-kernel/abSqrJ1J59RQC47U@kbusch-mbp/

Vineeth Pillai (Google) (19):
  tracepoint: Add trace_call__##name() API
  kernel: Use trace_call__##name() at guarded tracepoint call sites
  io_uring: Use trace_call__##name() at guarded tracepoint call sites
  net: Use trace_call__##name() at guarded tracepoint call sites
  accel/habanalabs: Use trace_call__##name() at guarded tracepoint call
    sites
  cpufreq: Use trace_call__##name() at guarded tracepoint call sites
  devfreq: Use trace_call__##name() at guarded tracepoint call sites
  dma-buf: Use trace_call__##name() at guarded tracepoint call sites
  fsi: Use trace_call__##name() at guarded tracepoint call sites
  drm: Use trace_call__##name() at guarded tracepoint call sites
  HID: Use trace_call__##name() at guarded tracepoint call sites
  i2c: Use trace_call__##name() at guarded tracepoint call sites
  spi: Use trace_call__##name() at guarded tracepoint call sites
  scsi: ufs: Use trace_call__##name() at guarded tracepoint call sites
  btrfs: Use trace_call__##name() at guarded tracepoint call sites
  net: devlink: Use trace_call__##name() at guarded tracepoint call
    sites
  kernel: time, trace: Use trace_call__##name() at guarded tracepoint
    call sites
  mm: damon: Use trace_call__##name() at guarded tracepoint call sites
  x86: msr: Use trace_call__##name() at guarded tracepoint call sites

 arch/x86/lib/msr.c                                |  6 +++---
 drivers/accel/habanalabs/common/device.c          | 12 ++++++------
 drivers/accel/habanalabs/common/mmu/mmu.c         |  3 ++-
 drivers/accel/habanalabs/common/pci/pci.c         |  4 ++--
 drivers/cpufreq/amd-pstate.c                      | 10 +++++-----
 drivers/cpufreq/cpufreq.c                         |  2 +-
 drivers/cpufreq/intel_pstate.c                    |  2 +-
 drivers/devfreq/devfreq.c                         |  2 +-
 drivers/dma-buf/dma-fence.c                       |  4 ++--
 drivers/fsi/fsi-master-aspeed.c                   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c            |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c            |  4 ++--
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 +-
 drivers/gpu/drm/scheduler/sched_entity.c          |  4 ++--
 drivers/hid/intel-ish-hid/ipc/pci-ish.c           |  2 +-
 drivers/i2c/i2c-core-slave.c                      |  2 +-
 drivers/spi/spi-axi-spi-engine.c                  |  4 ++--
 drivers/ufs/core/ufshcd.c                         | 12 ++++++------
 fs/btrfs/extent_map.c                             |  4 ++--
 fs/btrfs/raid56.c                                 |  4 ++--
 include/linux/tracepoint.h                        | 11 +++++++++++
 io_uring/io_uring.h                               |  2 +-
 kernel/irq_work.c                                 |  2 +-
 kernel/sched/ext.c                                |  2 +-
 kernel/smp.c                                      |  2 +-
 kernel/time/tick-sched.c                          | 12 ++++++------
 kernel/trace/trace_benchmark.c                    |  2 +-
 mm/damon/core.c                                   |  2 +-
 net/core/dev.c                                    |  2 +-
 net/core/xdp.c                                    |  2 +-
 net/devlink/trap.c                                |  2 +-
 net/openvswitch/actions.c                         |  2 +-
 net/openvswitch/datapath.c                        |  2 +-
 net/sctp/outqueue.c                               |  2 +-
 net/tipc/node.c                                   |  2 +-
 35 files changed, 74 insertions(+), 62 deletions(-)

-- 
2.53.0


^ permalink raw reply

* [PATCH v2 01/19] tracepoint: Add trace_call__##name() API
From: Vineeth Pillai (Google) @ 2026-03-23 16:00 UTC (permalink / raw)
  To: Steven Rostedt, Peter Zijlstra, Dmitry Ilvokhin
  Cc: Vineeth Pillai (Google), Masami Hiramatsu, Mathieu Desnoyers,
	Ingo Molnar, Jens Axboe, io-uring, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
	Marcelo Ricardo Leitner, Xin Long, Jon Maloy, Aaron Conole,
	Eelco Chaudron, Ilya Maximets, netdev, bpf, linux-sctp,
	tipc-discussion, dev, Jiri Pirko, Oded Gabbay, Koby Elbaz,
	dri-devel, Rafael J. Wysocki, Viresh Kumar, Gautham R. Shenoy,
	Huang Rui, Mario Limonciello, Len Brown, Srinivas Pandruvada,
	linux-pm, MyungJoo Ham, Kyungmin Park, Chanwoo Choi,
	Christian König, Sumit Semwal, linaro-mm-sig, Eddie James,
	Andrew Jeffery, Joel Stanley, linux-fsi, David Airlie,
	Simona Vetter, Alex Deucher, Danilo Krummrich, Matthew Brost,
	Philipp Stanner, Harry Wentland, Leo Li, amd-gfx, Jiri Kosina,
	Benjamin Tissoires, linux-input, Wolfram Sang, linux-i2c,
	Mark Brown, Michael Hennerich, Nuno Sá, linux-spi,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi, Chris Mason,
	David Sterba, linux-btrfs, Thomas Gleixner, Andrew Morton,
	SeongJae Park, linux-mm, Borislav Petkov, Dave Hansen, x86,
	linux-trace-kernel, linux-kernel
In-Reply-To: <20260323160052.17528-1-vineeth@bitbyteword.org>

Add trace_call__##name() as a companion to trace_##name().  When a
caller already guards a tracepoint with an explicit enabled check:

  if (trace_foo_enabled() && cond)
      trace_foo(args);

trace_foo() internally repeats the static_branch_unlikely() test, which
the compiler cannot fold since static branches are patched binary
instructions.  This results in two static-branch evaluations for every
guarded call site.

trace_call__##name() calls __do_trace_##name() directly, skipping the
redundant static-branch re-check.  This avoids leaking the internal
__do_trace_##name() symbol into call sites while still eliminating the
double evaluation:

  if (trace_foo_enabled() && cond)
      trace_invoke_foo(args);   /* calls __do_trace_foo() directly */

Three locations are updated:
- __DECLARE_TRACE: invoke form omits static_branch_unlikely, retains
  the LOCKDEP RCU-watching assertion.
- __DECLARE_TRACE_SYSCALL: same, plus retains might_fault().
- !TRACEPOINTS_ENABLED stub: empty no-op so callers compile cleanly
  when tracepoints are compiled out.

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Vineeth Pillai (Google) <vineeth@bitbyteword.org>
Assisted-by: Claude:claude-sonnet-4-6
---
 include/linux/tracepoint.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 22ca1c8b54f32..ed969705341f1 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -294,6 +294,10 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 			WARN_ONCE(!rcu_is_watching(),			\
 				  "RCU not watching for tracepoint");	\
 		}							\
+	}								\
+	static inline void trace_call__##name(proto)			\
+	{								\
+		__do_trace_##name(args);				\
 	}
 
 #define __DECLARE_TRACE_SYSCALL(name, proto, args, data_proto)		\
@@ -313,6 +317,11 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 			WARN_ONCE(!rcu_is_watching(),			\
 				  "RCU not watching for tracepoint");	\
 		}							\
+	}								\
+	static inline void trace_call__##name(proto)			\
+	{								\
+		might_fault();						\
+		__do_trace_##name(args);				\
 	}
 
 /*
@@ -398,6 +407,8 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 #define __DECLARE_TRACE_COMMON(name, proto, args, data_proto)		\
 	static inline void trace_##name(proto)				\
 	{ }								\
+	static inline void trace_call__##name(proto)			\
+	{ }								\
 	static inline int						\
 	register_trace_##name(void (*probe)(data_proto),		\
 			      void *data)				\
-- 
2.53.0


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox