* [PATCH v1 11/22] iio: frequency: ad9523: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/frequency/ad9523.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index b391c6e27ab0..b1554ced7a26 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -970,7 +970,7 @@ static int ad9523_setup(struct iio_dev *indio_dev)
static int ad9523_probe(struct spi_device *spi)
{
- struct ad9523_platform_data *pdata = spi->dev.platform_data;
+ struct ad9523_platform_data *pdata = dev_get_platdata(&spi->dev);
struct iio_dev *indio_dev;
struct ad9523_state *st;
int ret;
--
2.46.0
^ permalink raw reply related
* [PATCH v1 15/22] iio: light: hid-sensor-als: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/light/hid-sensor-als.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 260281194f61..0d995bc7877e 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -356,11 +356,11 @@ static int als_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_als_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
static const char *name = "als";
struct iio_dev *indio_dev;
struct als_state *als_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct als_state));
if (!indio_dev)
@@ -438,7 +438,7 @@ static int hid_als_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_als_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct als_state *als_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related
* [PATCH v1 22/22] iio: pressure: hid-sensor-press: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/pressure/hid-sensor-press.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
index 956045e2db29..b7e9a085f0cc 100644
--- a/drivers/iio/pressure/hid-sensor-press.c
+++ b/drivers/iio/pressure/hid-sensor-press.c
@@ -241,11 +241,11 @@ static int press_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_press_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
static const char *name = "press";
struct iio_dev *indio_dev;
struct press_state *press_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev,
sizeof(struct press_state));
@@ -325,7 +325,7 @@ static int hid_press_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_press_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct press_state *press_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related
* [PATCH v1 09/22] iio: dac: m62332: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/dac/m62332.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/dac/m62332.c b/drivers/iio/dac/m62332.c
index ae53baccec91..3497513854d7 100644
--- a/drivers/iio/dac/m62332.c
+++ b/drivers/iio/dac/m62332.c
@@ -201,7 +201,7 @@ static int m62332_probe(struct i2c_client *client)
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &m62332_info;
- ret = iio_map_array_register(indio_dev, client->dev.platform_data);
+ ret = iio_map_array_register(indio_dev, dev_get_platdata(&client->dev));
if (ret < 0)
return ret;
--
2.46.0
^ permalink raw reply related
* [PATCH v1 16/22] iio: light: hid-sensor-prox: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/light/hid-sensor-prox.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 26c481d2998c..5343ebd404bf 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -233,11 +233,11 @@ static int prox_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_prox_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
static const char *name = "prox";
struct iio_dev *indio_dev;
struct prox_state *prox_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev,
sizeof(struct prox_state));
@@ -315,7 +315,7 @@ static int hid_prox_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_prox_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct prox_state *prox_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related
* [PATCH v1 13/22] iio: gyro: hid-sensor-gyro-3d: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/gyro/hid-sensor-gyro-3d.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index 59a38bf9459b..490c325897bd 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -279,11 +279,11 @@ static int gyro_3d_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_gyro_3d_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
static const char *name = "gyro_3d";
struct iio_dev *indio_dev;
struct gyro_3d_state *gyro_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*gyro_state));
if (!indio_dev)
@@ -361,7 +361,7 @@ static int hid_gyro_3d_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_gyro_3d_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct gyro_3d_state *gyro_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related
* [PATCH v1 03/22] iio: adc: ad7791: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/adc/ad7791.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/ad7791.c b/drivers/iio/adc/ad7791.c
index 86effe8501b4..5d2ad3dd6caa 100644
--- a/drivers/iio/adc/ad7791.c
+++ b/drivers/iio/adc/ad7791.c
@@ -371,7 +371,7 @@ static const struct iio_info ad7791_no_filter_info = {
};
static int ad7791_setup(struct ad7791_state *st,
- struct ad7791_platform_data *pdata)
+ const struct ad7791_platform_data *pdata)
{
/* Set to poweron-reset default values */
st->mode = AD7791_MODE_BUFFER;
@@ -401,7 +401,7 @@ static void ad7791_reg_disable(void *reg)
static int ad7791_probe(struct spi_device *spi)
{
- struct ad7791_platform_data *pdata = spi->dev.platform_data;
+ const struct ad7791_platform_data *pdata = dev_get_platdata(&spi->dev);
struct iio_dev *indio_dev;
struct ad7791_state *st;
int ret;
--
2.46.0
^ permalink raw reply related
* [PATCH v1 21/22] iio: position: hid-sensor-custom-intel-hinge: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/position/hid-sensor-custom-intel-hinge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
index 76e173850a35..63a9f2fcada7 100644
--- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
+++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
@@ -263,9 +263,9 @@ static int hinge_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_hinge_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct hinge_state *st;
struct iio_dev *indio_dev;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
int ret;
int i;
@@ -344,7 +344,7 @@ static int hid_hinge_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_hinge_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct hinge_state *st = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related
* [PATCH v1 14/22] iio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index ed0267929725..3958b5e1a3f6 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2132,14 +2132,11 @@ st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
const struct st_lsm6dsx_reg **drdy_reg)
{
struct device *dev = hw->dev;
+ const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
int err = 0, drdy_pin;
- if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) {
- struct st_sensors_platform_data *pdata;
-
- pdata = (struct st_sensors_platform_data *)dev->platform_data;
+ if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0)
drdy_pin = pdata ? pdata->drdy_int_pin : 1;
- }
switch (drdy_pin) {
case 1:
@@ -2162,14 +2159,13 @@ st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
static int st_lsm6dsx_init_shub(struct st_lsm6dsx_hw *hw)
{
const struct st_lsm6dsx_shub_settings *hub_settings;
- struct st_sensors_platform_data *pdata;
struct device *dev = hw->dev;
+ const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
unsigned int data;
int err = 0;
hub_settings = &hw->settings->shub_settings;
- pdata = (struct st_sensors_platform_data *)dev->platform_data;
if (device_property_read_bool(dev, "st,pullups") ||
(pdata && pdata->pullups)) {
if (hub_settings->pullup_en.sec_page) {
@@ -2524,9 +2520,9 @@ static irqreturn_t st_lsm6dsx_sw_trigger_handler_thread(int irq,
static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
{
- struct st_sensors_platform_data *pdata;
const struct st_lsm6dsx_reg *reg;
struct device *dev = hw->dev;
+ const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
unsigned long irq_type;
bool irq_active_low;
int err;
@@ -2554,7 +2550,6 @@ static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
if (err < 0)
return err;
- pdata = (struct st_sensors_platform_data *)dev->platform_data;
if (device_property_read_bool(dev, "drive-open-drain") ||
(pdata && pdata->open_drain)) {
reg = &hw->settings->irq_config.od;
@@ -2639,7 +2634,7 @@ static int st_lsm6dsx_init_regulators(struct device *dev)
int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
struct regmap *regmap)
{
- struct st_sensors_platform_data *pdata = dev->platform_data;
+ const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
const struct st_lsm6dsx_shub_settings *hub_settings;
struct st_lsm6dsx_hw *hw;
const char *name = NULL;
--
2.46.0
^ permalink raw reply related
* [PATCH v1 06/22] iio: adc: ltc2497: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
While at it, drop duplicate NULL check that iio_map_array_register()
already has.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/adc/ltc2497-core.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/iio/adc/ltc2497-core.c b/drivers/iio/adc/ltc2497-core.c
index 996f6cbbed3c..ad8ddf80310e 100644
--- a/drivers/iio/adc/ltc2497-core.c
+++ b/drivers/iio/adc/ltc2497-core.c
@@ -168,6 +168,7 @@ static const struct iio_info ltc2497core_info = {
int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev)
{
struct ltc2497core_driverdata *ddata = iio_priv(indio_dev);
+ struct iio_map *plat_data = dev_get_platdata(dev);
int ret;
/*
@@ -200,16 +201,10 @@ int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev)
return ret;
}
- if (dev->platform_data) {
- struct iio_map *plat_data;
-
- plat_data = (struct iio_map *)dev->platform_data;
-
- ret = iio_map_array_register(indio_dev, plat_data);
- if (ret) {
- dev_err(&indio_dev->dev, "iio map err: %d\n", ret);
- goto err_regulator_disable;
- }
+ ret = iio_map_array_register(indio_dev, plat_data);
+ if (ret) {
+ dev_err(&indio_dev->dev, "iio map err: %d\n", ret);
+ goto err_regulator_disable;
}
ddata->addr_prev = LTC2497_CONFIG_DEFAULT;
--
2.46.0
^ permalink raw reply related
* [PATCH v1 18/22] iio: magnetometer: hid-sensor-magn-3d: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index 5c795a430d09..ae10db87d1e1 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -466,11 +466,11 @@ static int magn_3d_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_magn_3d_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
static char *name = "magn_3d";
struct iio_dev *indio_dev;
struct magn_3d_state *magn_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
struct iio_chan_spec *channels;
int chan_count = 0;
@@ -549,7 +549,7 @@ static int hid_magn_3d_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_magn_3d_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct magn_3d_state *magn_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related
* [PATCH v1 19/22] iio: orientation: hid-sensor-incl-3d: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/orientation/hid-sensor-incl-3d.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c
index 8943d5c78bc0..21664563b565 100644
--- a/drivers/iio/orientation/hid-sensor-incl-3d.c
+++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
@@ -299,11 +299,11 @@ static int incl_3d_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_incl_3d_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret;
static char *name = "incli_3d";
struct iio_dev *indio_dev;
struct incl_3d_state *incl_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev,
sizeof(struct incl_3d_state));
@@ -385,7 +385,7 @@ static int hid_incl_3d_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_incl_3d_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct incl_3d_state *incl_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related
* [PATCH v1 08/22] iio: dac: ad5791: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/dac/ad5791.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c
index 75b549827e15..553431bf0232 100644
--- a/drivers/iio/dac/ad5791.c
+++ b/drivers/iio/dac/ad5791.c
@@ -341,7 +341,7 @@ static const struct iio_info ad5791_info = {
static int ad5791_probe(struct spi_device *spi)
{
- struct ad5791_platform_data *pdata = spi->dev.platform_data;
+ const struct ad5791_platform_data *pdata = dev_get_platdata(&spi->dev);
struct iio_dev *indio_dev;
struct ad5791_state *st;
int ret, pos_voltage_uv = 0, neg_voltage_uv = 0;
--
2.46.0
^ permalink raw reply related
* [PATCH v1 20/22] iio: orientation: hid-sensor-rotation: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
In-Reply-To: <20240902222824.1145571-1-andy.shevchenko@gmail.com>
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/orientation/hid-sensor-rotation.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c
index 5e8cadd5177a..107adadf7711 100644
--- a/drivers/iio/orientation/hid-sensor-rotation.c
+++ b/drivers/iio/orientation/hid-sensor-rotation.c
@@ -230,11 +230,11 @@ static int dev_rot_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_dev_rot_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret;
char *name;
struct iio_dev *indio_dev;
struct dev_rot_state *rot_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev,
sizeof(struct dev_rot_state));
@@ -329,7 +329,7 @@ static int hid_dev_rot_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_dev_rot_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct dev_rot_state *rot_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related
* [PATCH] HID: amd_sfh: Convert comma to semicolon
From: Chen Ni @ 2024-09-03 2:44 UTC (permalink / raw)
To: basavaraj.natikar, jikos, bentiss, Shyam-sundar.S-k,
mario.limonciello
Cc: linux-input, linux-kernel, Chen Ni
Replace a comma between expression statements by a semicolon.
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
index 621793d92464..db36d87d5634 100644
--- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
+++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
@@ -299,8 +299,8 @@ static void amd_sfh_set_ops(struct amd_mp2_dev *mp2)
sfh_interface_init(mp2);
mp2_ops = mp2->mp2_ops;
- mp2_ops->clear_intr = amd_sfh_clear_intr_v2,
- mp2_ops->init_intr = amd_sfh_irq_init_v2,
+ mp2_ops->clear_intr = amd_sfh_clear_intr_v2;
+ mp2_ops->init_intr = amd_sfh_irq_init_v2;
mp2_ops->suspend = amd_sfh_suspend;
mp2_ops->resume = amd_sfh_resume;
mp2_ops->remove = amd_mp2_pci_remove;
--
2.25.1
^ permalink raw reply related
* [PATCH] HID: hid-sensor-custom: Convert comma to semicolon
From: Chen Ni @ 2024-09-03 2:50 UTC (permalink / raw)
To: jikos, jic23, srinivas.pandruvada, bentiss
Cc: linux-input, linux-iio, linux-kernel, Chen Ni
Replace a comma between expression statements by a semicolon.
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
drivers/hid/hid-sensor-custom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index bd400f6b472b..66f0675df24b 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -732,7 +732,7 @@ static int hid_sensor_custom_dev_if_add(struct hid_sensor_custom *sensor_inst)
sensor_inst->custom_dev.minor = MISC_DYNAMIC_MINOR;
sensor_inst->custom_dev.name = dev_name(&sensor_inst->pdev->dev);
- sensor_inst->custom_dev.fops = &hid_sensor_custom_fops,
+ sensor_inst->custom_dev.fops = &hid_sensor_custom_fops;
ret = misc_register(&sensor_inst->custom_dev);
if (ret) {
kfifo_free(&sensor_inst->data_fifo);
--
2.25.1
^ permalink raw reply related
* Re: [PATCH HID 4/7] HID: bpf: allow BPF programs to force using hid-generic
From: Peter Hutterer @ 2024-09-03 5:36 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Jiri Kosina, Vicki Pfau, Shuah Khan, Jonathan Corbet, linux-input,
linux-kselftest, linux-kernel, bpf, linux-doc
In-Reply-To: <20240903-hid-bpf-hid-generic-v1-4-9511a565b2da@kernel.org>
On Tue, Sep 03, 2024 at 01:14:34AM +0900, Benjamin Tissoires wrote:
> The use case is when we fix a device through HID-BPF, 99% of the cases
> we want the device to use hid-generic now instead of a dedicated device.
s/dedicated device/dedicated driver/ in the commit message
> That's because the dedicated device might also want to change the report
> descriptor, or will be handling the device in a different way the new
> fixed device is using.
>
> In hid-core, after matching for the device (so that we only call this new
> hook on compatible drivers), we call for `.hid_bpf_driver_probe`.
> The function can not communicate with the device because it is not yet
> started, but it can make educated guesses and decide to:
> - let hid-core decide by itself
> - force the use of this driver (by comparing the provided name with
> "hid-generic" for instance)
> - force hid-core to ignore this driver for this device.
>
> For API stability, we don't rely on a bitfield or a return value for
> chosing hid-core behavior. We simply have a couple of writeable fields
> in the new struct hid_bpf_driver, and then hid-core can make its educated
> decision.
>
> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> ---
> Documentation/hid/hid-bpf.rst | 2 +-
> drivers/hid/bpf/hid_bpf_dispatch.c | 31 ++++++++++++++++++++++++++++
> drivers/hid/bpf/hid_bpf_struct_ops.c | 3 +++
> drivers/hid/hid-core.c | 6 ++++++
> include/linux/hid_bpf.h | 40 ++++++++++++++++++++++++++++++++++++
> 5 files changed, 81 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/hid/hid-bpf.rst b/Documentation/hid/hid-bpf.rst
> index 5939eeafb361..05a43f11cdab 100644
> --- a/Documentation/hid/hid-bpf.rst
> +++ b/Documentation/hid/hid-bpf.rst
> @@ -190,7 +190,7 @@ User API data structures available in programs:
> -----------------------------------------------
>
> .. kernel-doc:: include/linux/hid_bpf.h
> - :identifiers: hid_bpf_ctx
> + :identifiers: hid_bpf_ctx hid_bpf_driver
>
> Available API that can be used in all HID-BPF struct_ops programs:
> ------------------------------------------------------------------
> diff --git a/drivers/hid/bpf/hid_bpf_dispatch.c b/drivers/hid/bpf/hid_bpf_dispatch.c
> index a272a086c950..2df136d64152 100644
> --- a/drivers/hid/bpf/hid_bpf_dispatch.c
> +++ b/drivers/hid/bpf/hid_bpf_dispatch.c
> @@ -189,6 +189,37 @@ u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *s
> }
> EXPORT_SYMBOL_GPL(call_hid_bpf_rdesc_fixup);
>
> +int call_hid_bpf_driver_probe(struct hid_device *hdev, struct hid_driver *hdrv,
> + const struct hid_device_id *id)
> +{
> + struct hid_bpf_driver drv = { 0 };
> + struct hid_bpf_ops *e;
> + int idx;
+
> + if (strscpy(drv.name, hdrv->name, sizeof(drv.name)) < 0)
> + return 0;
> +
> + idx = srcu_read_lock(&hdev->bpf.srcu);
> + list_for_each_entry_srcu(e, &hdev->bpf.prog_list, list,
> + srcu_read_lock_held(&hdev->bpf.srcu)) {
> + if (!e->hid_driver_probe)
> + continue;
> +
> + e->hid_driver_probe(hdev, &drv, id);
> + }
> +
> + srcu_read_unlock(&hdev->bpf.srcu, idx);
> +
> + if (drv.force_driver)
> + return 1;
> +
> + if (drv.ignore_driver)
> + return -1;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(call_hid_bpf_driver_probe);
> +
> static int device_match_id(struct device *dev, const void *id)
> {
> struct hid_device *hdev = to_hid_device(dev);
> diff --git a/drivers/hid/bpf/hid_bpf_struct_ops.c b/drivers/hid/bpf/hid_bpf_struct_ops.c
> index cd696c59ba0f..1e13a22f73a1 100644
> --- a/drivers/hid/bpf/hid_bpf_struct_ops.c
> +++ b/drivers/hid/bpf/hid_bpf_struct_ops.c
> @@ -46,6 +46,7 @@ static int hid_bpf_ops_check_member(const struct btf_type *t,
> case offsetof(struct hid_bpf_ops, hid_rdesc_fixup):
> case offsetof(struct hid_bpf_ops, hid_hw_request):
> case offsetof(struct hid_bpf_ops, hid_hw_output_report):
> + case offsetof(struct hid_bpf_ops, hid_driver_probe):
> break;
> default:
> if (prog->sleepable)
> @@ -79,6 +80,8 @@ static int hid_bpf_ops_btf_struct_access(struct bpf_verifier_log *log,
> WRITE_RANGE(hid_device, name, true),
> WRITE_RANGE(hid_device, uniq, true),
> WRITE_RANGE(hid_device, phys, true),
> + WRITE_RANGE(hid_bpf_driver, force_driver, false),
> + WRITE_RANGE(hid_bpf_driver, ignore_driver, false),
> };
> #undef WRITE_RANGE
> const struct btf_type *state = NULL;
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 988d0acbdf04..7845f0a789ec 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -2639,10 +2639,16 @@ static bool hid_check_device_match(struct hid_device *hdev,
> struct hid_driver *hdrv,
> const struct hid_device_id **id)
> {
> + int ret;
> +
> *id = hid_match_device(hdev, hdrv);
> if (!*id)
> return false;
>
> + ret = call_hid_bpf_driver_probe(hdev, hdrv, *id);
> + if (ret)
> + return ret > 0;
> +
> if (hdrv->match)
> return hdrv->match(hdev, hid_ignore_special_drivers);
>
> diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h
> index d4d063cf63b5..20693c218857 100644
> --- a/include/linux/hid_bpf.h
> +++ b/include/linux/hid_bpf.h
> @@ -9,6 +9,7 @@
> #include <uapi/linux/hid.h>
>
> struct hid_device;
> +struct hid_driver;
>
> /*
> * The following is the user facing HID BPF API.
> @@ -80,6 +81,22 @@ struct hid_ops {
>
> extern struct hid_ops *hid_ops;
>
> +/**
> + * struct hid_bpf_driver - User accessible data for the ``hid_bpf_probe``
> + * struct_ops
> + *
> + * @name: the name of the driver currently being treated
> + * @force_driver: set this to ``true`` to force hid-core to use this driver,
> + * bypassing any further decision made by this driver
> + * @ignore_driver: set this to ``true`` to force hid-core to ignore this driver,
> + * bypassing any further decision made by this driver
If I set both to false or true, what happens? The two seem to be
mutually exclusive, in userspace I'd use an enum here to have a
NOOP/FORCE_DRIVER/IGNORE_DRIVER value range (that can be extended later).
Maybe something like that is an option?
> + */
> +struct hid_bpf_driver {
> + __u8 name[64];
> + bool force_driver;
> + bool ignore_driver;
> +};
> +
> /**
> * struct hid_bpf_ops - A BPF struct_ops of callbacks allowing to attach HID-BPF
> * programs to a HID device
> @@ -178,6 +195,25 @@ struct hid_bpf_ops {
> */
> int (*hid_hw_output_report)(struct hid_bpf_ctx *ctx, u64 source);
>
> + /**
> + * @hid_driver_probe: called before the kernel ``.probe()`` function
> + *
> + * It has the following arguments:
> + *
> + * ``hdev``: The HID device kernel representation
> + *
> + * ``hdrv``: A BPF partially writeable representation of a HID driver
> + *
> + * ``id``: The device match structure found in the driver
> + *
> + * Note that the device has not been started yet, and thus kfuncs like
> + * ``hid_hw_output_report`` will likely fail.
Just to confirm, I can access the device's report descriptor though? For
the devices that we're looking at (e.g. the foot pedals pretending to be
an apple keyboard) the driver name and what we can set in HID_BPF_CONFIG
are not going to be enough, we'll have to check the rdesc too.
Cheers,
Peter
> + *
> + * This function is useful to force/ignore a given supported HID driver,
> + * by writing ``true`` in ``hdrv->force_driver`` or ``hdrv->ignore_driver``
> + */
> + void (*hid_driver_probe)(struct hid_device *hdev, struct hid_bpf_driver *hdrv,
> + const struct hid_device_id *id);
>
> /* private: do not show up in the docs */
> struct hid_device *hdev;
> @@ -213,6 +249,8 @@ void hid_bpf_disconnect_device(struct hid_device *hdev);
> void hid_bpf_destroy_device(struct hid_device *hid);
> int hid_bpf_device_init(struct hid_device *hid);
> u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *size);
> +int call_hid_bpf_driver_probe(struct hid_device *hdev, struct hid_driver *hdrv,
> + const struct hid_device_id *id);
> #else /* CONFIG_HID_BPF */
> static inline u8 *dispatch_hid_bpf_device_event(struct hid_device *hid, enum hid_report_type type,
> u8 *data, u32 *size, int interrupt,
> @@ -228,6 +266,8 @@ static inline int hid_bpf_connect_device(struct hid_device *hdev) { return 0; }
> static inline void hid_bpf_disconnect_device(struct hid_device *hdev) {}
> static inline void hid_bpf_destroy_device(struct hid_device *hid) {}
> static inline int hid_bpf_device_init(struct hid_device *hid) { return 0; }
> +static inline int call_hid_bpf_driver_probe(struct hid_device *hdev, struct hid_driver *hdrv,
> + const struct hid_device_id *id) { return 0; }
> /*
> * This specialized allocator has to be a macro for its allocations to be
> * accounted separately (to have a separate alloc_tag). The typecast is
>
> --
> 2.46.0
>
^ permalink raw reply
* Re: [PATCH HID 6/7] HID: bpf: Allow to control the connect mask of hid-generic from BPF
From: Peter Hutterer @ 2024-09-03 5:57 UTC (permalink / raw)
To: Benjamin Tissoires
Cc: Jiri Kosina, Vicki Pfau, Shuah Khan, Jonathan Corbet, linux-input,
linux-kselftest, linux-kernel, bpf, linux-doc
In-Reply-To: <20240903-hid-bpf-hid-generic-v1-6-9511a565b2da@kernel.org>
On Tue, Sep 03, 2024 at 01:14:36AM +0900, Benjamin Tissoires wrote:
> We make struct hid_device_id writeable and use the .driver_data field
> of hid-generic as the connect mask.
I think this needs to be spelled out a bit more: for this to work the
driver *must* be hid-generic, otherwise this doesn't work. But I'm a bit
confused why we have a custom fields for force/ignore driver but
whether the device is connected (and thus uses the driver) is hidden in
an effectively undocumented private field of one specific driver.
Wouldn't it be easier to add another boolean (or enum entry, see my
other comment) to hid_bpf_driver? This way *how* it happens is hidden
from the API as well - you say "hidraw only please" and the kernel does
the rest (through hid-generic or otherwise).
Cheers,
Peter
>
> This way, we can control from a HID-BPF program if a device needs to
> be exported through hidraw and/or hid-input mainly.
>
> This is useful in case we want to have a third party program that directly
> talks to the hidraw node and we don't want regular input events to be
> emitted. This third party program can load a BPF program that instructs
> hid-generic to rebind on the device with hidraw only and then open the
> hidraw node itself.
>
> When the application is closed, the BPF program is unloaded and the normal
> driver takes back the control of the device.
>
> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> ---
> drivers/hid/bpf/hid_bpf_struct_ops.c | 1 +
> drivers/hid/hid-core.c | 14 ++++++++------
> drivers/hid/hid-generic.c | 5 +++--
> 3 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/hid/bpf/hid_bpf_struct_ops.c b/drivers/hid/bpf/hid_bpf_struct_ops.c
> index 1e13a22f73a1..bb755edd02f0 100644
> --- a/drivers/hid/bpf/hid_bpf_struct_ops.c
> +++ b/drivers/hid/bpf/hid_bpf_struct_ops.c
> @@ -80,6 +80,7 @@ static int hid_bpf_ops_btf_struct_access(struct bpf_verifier_log *log,
> WRITE_RANGE(hid_device, name, true),
> WRITE_RANGE(hid_device, uniq, true),
> WRITE_RANGE(hid_device, phys, true),
> + WRITE_RANGE(hid_device_id, driver_data, false),
> WRITE_RANGE(hid_bpf_driver, force_driver, false),
> WRITE_RANGE(hid_bpf_driver, ignore_driver, false),
> };
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 7845f0a789ec..2bd279b23aa4 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -2637,15 +2637,17 @@ EXPORT_SYMBOL_GPL(hid_compare_device_paths);
>
> static bool hid_check_device_match(struct hid_device *hdev,
> struct hid_driver *hdrv,
> - const struct hid_device_id **id)
> + struct hid_device_id *id)
> {
> + const struct hid_device_id *_id = hid_match_device(hdev, hdrv);
> int ret;
>
> - *id = hid_match_device(hdev, hdrv);
> - if (!*id)
> + if (!_id)
> return false;
>
> - ret = call_hid_bpf_driver_probe(hdev, hdrv, *id);
> + memcpy(id, _id, sizeof(*id));
> +
> + ret = call_hid_bpf_driver_probe(hdev, hdrv, id);
> if (ret)
> return ret > 0;
>
> @@ -2662,7 +2664,7 @@ static bool hid_check_device_match(struct hid_device *hdev,
>
> static int __hid_device_probe(struct hid_device *hdev, struct hid_driver *hdrv)
> {
> - const struct hid_device_id *id;
> + struct hid_device_id id;
> int ret;
>
> if (!hid_check_device_match(hdev, hdrv, &id))
> @@ -2677,7 +2679,7 @@ static int __hid_device_probe(struct hid_device *hdev, struct hid_driver *hdrv)
> hdev->driver = hdrv;
>
> if (hdrv->probe) {
> - ret = hdrv->probe(hdev, id);
> + ret = hdrv->probe(hdev, &id);
> } else { /* default probe */
> ret = hid_open_report(hdev);
> if (!ret)
> diff --git a/drivers/hid/hid-generic.c b/drivers/hid/hid-generic.c
> index f9db991d3c5a..5cd1f3a79a4b 100644
> --- a/drivers/hid/hid-generic.c
> +++ b/drivers/hid/hid-generic.c
> @@ -64,11 +64,12 @@ static int hid_generic_probe(struct hid_device *hdev,
> if (ret)
> return ret;
>
> - return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
> + return hid_hw_start(hdev, id->driver_data);
> }
>
> static const struct hid_device_id hid_table[] = {
> - { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, HID_ANY_ID, HID_ANY_ID) },
> + { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, HID_ANY_ID, HID_ANY_ID),
> + .driver_data = HID_CONNECT_DEFAULT },
> { }
> };
> MODULE_DEVICE_TABLE(hid, hid_table);
>
> --
> 2.46.0
>
^ permalink raw reply
* Re: [PATCH v1 17/22] iio: light: lm3533-als: Get platform data via dev_get_platdata()
From: Johan Hovold @ 2024-09-03 6:33 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel, Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen
In-Reply-To: <20240902222824.1145571-18-andy.shevchenko@gmail.com>
On Tue, Sep 03, 2024 at 01:17:02AM +0300, Andy Shevchenko wrote:
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Access to platform data via dev_get_platdata() getter to make code cleaner.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
^ permalink raw reply
* Re: [PATCH v1 14/22] iio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()
From: Lorenzo Bianconi @ 2024-09-03 7:10 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel, Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen
In-Reply-To: <20240902222824.1145571-15-andy.shevchenko@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3263 bytes --]
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Access to platform data via dev_get_platdata() getter to make code cleaner.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index ed0267929725..3958b5e1a3f6 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -2132,14 +2132,11 @@ st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
> const struct st_lsm6dsx_reg **drdy_reg)
> {
> struct device *dev = hw->dev;
> + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
nit: I guess you can move pdata pointer in the 'if' block, since it is just
used there.
Regards,
Lorenzo
> int err = 0, drdy_pin;
>
> - if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) {
> - struct st_sensors_platform_data *pdata;
> -
> - pdata = (struct st_sensors_platform_data *)dev->platform_data;
> + if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0)
> drdy_pin = pdata ? pdata->drdy_int_pin : 1;
> - }
>
> switch (drdy_pin) {
> case 1:
> @@ -2162,14 +2159,13 @@ st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
> static int st_lsm6dsx_init_shub(struct st_lsm6dsx_hw *hw)
> {
> const struct st_lsm6dsx_shub_settings *hub_settings;
> - struct st_sensors_platform_data *pdata;
> struct device *dev = hw->dev;
> + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
> unsigned int data;
> int err = 0;
>
> hub_settings = &hw->settings->shub_settings;
>
> - pdata = (struct st_sensors_platform_data *)dev->platform_data;
> if (device_property_read_bool(dev, "st,pullups") ||
> (pdata && pdata->pullups)) {
> if (hub_settings->pullup_en.sec_page) {
> @@ -2524,9 +2520,9 @@ static irqreturn_t st_lsm6dsx_sw_trigger_handler_thread(int irq,
>
> static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
> {
> - struct st_sensors_platform_data *pdata;
> const struct st_lsm6dsx_reg *reg;
> struct device *dev = hw->dev;
> + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
> unsigned long irq_type;
> bool irq_active_low;
> int err;
> @@ -2554,7 +2550,6 @@ static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
> if (err < 0)
> return err;
>
> - pdata = (struct st_sensors_platform_data *)dev->platform_data;
> if (device_property_read_bool(dev, "drive-open-drain") ||
> (pdata && pdata->open_drain)) {
> reg = &hw->settings->irq_config.od;
> @@ -2639,7 +2634,7 @@ static int st_lsm6dsx_init_regulators(struct device *dev)
> int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
> struct regmap *regmap)
> {
> - struct st_sensors_platform_data *pdata = dev->platform_data;
> + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
> const struct st_lsm6dsx_shub_settings *hub_settings;
> struct st_lsm6dsx_hw *hw;
> const char *name = NULL;
> --
> 2.46.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply
* [PATCH] MAINTAINERS: remove unneeded file entry in INPUT section
From: Lukas Bulwahn @ 2024-09-03 9:39 UTC (permalink / raw)
To: Dmitry Torokhov, linux-input; +Cc: kernel-janitors, linux-kernel, Lukas Bulwahn
From: Lukas Bulwahn <lukas.bulwahn@redhat.com>
Commit b9401c658d2c ("MAINTAINERS: add gameport.h, serio.h and uinput.h to
INPUT section") adds further header files in ./include/linux/ and
./include/uapi/linux to the INPUT section, but the file
./include/linux/uinput.h does not exist since commit a11bc476b987 ("Input:
uinput - fold header into the driver proper") removed this header file
in 2017.
Fortunately, ./scripts/get_maintainer.pl --self-test=patterns complains
about a broken reference. Remove the file entry referring to the
non-existing header file in the INPUT section.
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@redhat.com>
---
MAINTAINERS | 1 -
1 file changed, 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 87108b3fefaa..3b19921eb948 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11195,7 +11195,6 @@ F: include/linux/input.h
F: include/linux/input/
F: include/linux/libps2.h
F: include/linux/serio.h
-F: include/linux/uinput.h
F: include/uapi/linux/gameport.h
F: include/uapi/linux/input-event-codes.h
F: include/uapi/linux/input.h
--
2.46.0
^ permalink raw reply related
* Re: [PATCH] HID: amd_sfh: Convert comma to semicolon
From: Basavaraj Natikar @ 2024-09-03 9:41 UTC (permalink / raw)
To: Chen Ni, basavaraj.natikar, jikos, bentiss, Shyam-sundar.S-k,
mario.limonciello
Cc: linux-input, linux-kernel
In-Reply-To: <20240903024402.493709-1-nichen@iscas.ac.cn>
On 9/3/2024 8:14 AM, Chen Ni wrote:
> Replace a comma between expression statements by a semicolon.
>
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
> drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
> index 621793d92464..db36d87d5634 100644
> --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
> +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
> @@ -299,8 +299,8 @@ static void amd_sfh_set_ops(struct amd_mp2_dev *mp2)
>
> sfh_interface_init(mp2);
> mp2_ops = mp2->mp2_ops;
> - mp2_ops->clear_intr = amd_sfh_clear_intr_v2,
> - mp2_ops->init_intr = amd_sfh_irq_init_v2,
> + mp2_ops->clear_intr = amd_sfh_clear_intr_v2;
> + mp2_ops->init_intr = amd_sfh_irq_init_v2;
> mp2_ops->suspend = amd_sfh_suspend;
> mp2_ops->resume = amd_sfh_resume;
> mp2_ops->remove = amd_mp2_pci_remove;
Looks good to me.
Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Thanks,
--
Basavaraj
^ permalink raw reply
* Re: [PATCH v1 14/22] iio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()
From: Andy Shevchenko @ 2024-09-03 10:38 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel, Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen
In-Reply-To: <Zta2gaV_8qintFts@lore-rh-laptop>
On Tue, Sep 3, 2024 at 10:11 AM Lorenzo Bianconi <lorenzo@kernel.org> wrote:
...
> > struct device *dev = hw->dev;
> > + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
>
> nit: I guess you can move pdata pointer in the 'if' block, since it is just
> used there.
Yes, but it will increase the LoCs number by 3 for no benefit for each
of such cases.
> > int err = 0, drdy_pin;
> >
> > - if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) {
> > - struct st_sensors_platform_data *pdata;
> > -
> > - pdata = (struct st_sensors_platform_data *)dev->platform_data;
> > + if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0)
> > drdy_pin = pdata ? pdata->drdy_int_pin : 1;
> > - }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH] HID: amd_sfh: Convert comma to semicolon
From: Jiri Kosina @ 2024-09-03 11:39 UTC (permalink / raw)
To: Chen Ni
Cc: basavaraj.natikar, bentiss, Shyam-sundar.S-k, mario.limonciello,
linux-input, linux-kernel
In-Reply-To: <20240903024402.493709-1-nichen@iscas.ac.cn>
On Tue, 3 Sep 2024, Chen Ni wrote:
> Replace a comma between expression statements by a semicolon.
>
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---
> drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
> index 621793d92464..db36d87d5634 100644
> --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
> +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
> @@ -299,8 +299,8 @@ static void amd_sfh_set_ops(struct amd_mp2_dev *mp2)
>
> sfh_interface_init(mp2);
> mp2_ops = mp2->mp2_ops;
> - mp2_ops->clear_intr = amd_sfh_clear_intr_v2,
> - mp2_ops->init_intr = amd_sfh_irq_init_v2,
> + mp2_ops->clear_intr = amd_sfh_clear_intr_v2;
> + mp2_ops->init_intr = amd_sfh_irq_init_v2;
> mp2_ops->suspend = amd_sfh_suspend;
> mp2_ops->resume = amd_sfh_resume;
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [PATCH] HID: multitouch: Add support for lenovo Y9000P Touchpad
From: Jiri Kosina @ 2024-09-03 11:54 UTC (permalink / raw)
To: He Lugang; +Cc: bentiss, linux-input
In-Reply-To: <EBB0056587822FAA+20240827025605.13790-1-helugang@uniontech.com>
On Tue, 27 Aug 2024, He Lugang wrote:
> The 2024 Lenovo Y9000P which use GT7868Q chip also needs a fixup.
> The information of the chip is as follows:
> I2C HID v1.00 Mouse [GXTP5100:00 27C6:01E0]
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox