diff options
| -rw-r--r-- | drivers/iio/accel/hid-sensor-accel-3d.c | 5 | ||||
| -rw-r--r-- | drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 9 | ||||
| -rw-r--r-- | drivers/iio/common/hid-sensors/hid-sensor-trigger.h | 2 | ||||
| -rw-r--r-- | drivers/iio/gyro/hid-sensor-gyro-3d.c | 5 | ||||
| -rw-r--r-- | drivers/iio/light/hid-sensor-als.c | 5 | ||||
| -rw-r--r-- | drivers/iio/magnetometer/hid-sensor-magn-3d.c | 5 | ||||
| -rw-r--r-- | include/linux/hid-sensor-hub.h | 3 |
7 files changed, 20 insertions, 14 deletions
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c index dcda17395c4e..1cae4e920c9b 100644 --- a/drivers/iio/accel/hid-sensor-accel-3d.c +++ b/drivers/iio/accel/hid-sensor-accel-3d.c | |||
| @@ -350,7 +350,7 @@ static int hid_accel_3d_probe(struct platform_device *pdev) | |||
| 350 | error_iio_unreg: | 350 | error_iio_unreg: |
| 351 | iio_device_unregister(indio_dev); | 351 | iio_device_unregister(indio_dev); |
| 352 | error_remove_trigger: | 352 | error_remove_trigger: |
| 353 | hid_sensor_remove_trigger(indio_dev); | 353 | hid_sensor_remove_trigger(&accel_state->common_attributes); |
| 354 | error_unreg_buffer_funcs: | 354 | error_unreg_buffer_funcs: |
| 355 | iio_triggered_buffer_cleanup(indio_dev); | 355 | iio_triggered_buffer_cleanup(indio_dev); |
| 356 | error_free_dev_mem: | 356 | error_free_dev_mem: |
| @@ -363,10 +363,11 @@ static int hid_accel_3d_remove(struct platform_device *pdev) | |||
| 363 | { | 363 | { |
| 364 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; | 364 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
| 365 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); | 365 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); |
| 366 | struct accel_3d_state *accel_state = iio_priv(indio_dev); | ||
| 366 | 367 | ||
| 367 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_ACCEL_3D); | 368 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_ACCEL_3D); |
| 368 | iio_device_unregister(indio_dev); | 369 | iio_device_unregister(indio_dev); |
| 369 | hid_sensor_remove_trigger(indio_dev); | 370 | hid_sensor_remove_trigger(&accel_state->common_attributes); |
| 370 | iio_triggered_buffer_cleanup(indio_dev); | 371 | iio_triggered_buffer_cleanup(indio_dev); |
| 371 | kfree(indio_dev->channels); | 372 | kfree(indio_dev->channels); |
| 372 | 373 | ||
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index b6e77e0fc420..bbd6426c9726 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
| @@ -55,11 +55,10 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig, | |||
| 55 | return 0; | 55 | return 0; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | void hid_sensor_remove_trigger(struct iio_dev *indio_dev) | 58 | void hid_sensor_remove_trigger(struct hid_sensor_common *attrb) |
| 59 | { | 59 | { |
| 60 | iio_trigger_unregister(indio_dev->trig); | 60 | iio_trigger_unregister(attrb->trigger); |
| 61 | iio_trigger_free(indio_dev->trig); | 61 | iio_trigger_free(attrb->trigger); |
| 62 | indio_dev->trig = NULL; | ||
| 63 | } | 62 | } |
| 64 | EXPORT_SYMBOL(hid_sensor_remove_trigger); | 63 | EXPORT_SYMBOL(hid_sensor_remove_trigger); |
| 65 | 64 | ||
| @@ -90,7 +89,7 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, | |||
| 90 | dev_err(&indio_dev->dev, "Trigger Register Failed\n"); | 89 | dev_err(&indio_dev->dev, "Trigger Register Failed\n"); |
| 91 | goto error_free_trig; | 90 | goto error_free_trig; |
| 92 | } | 91 | } |
| 93 | indio_dev->trig = trig; | 92 | indio_dev->trig = attrb->trigger = trig; |
| 94 | 93 | ||
| 95 | return ret; | 94 | return ret; |
| 96 | 95 | ||
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.h b/drivers/iio/common/hid-sensors/hid-sensor-trigger.h index 9a8731478eda..ca02f7811aa8 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.h +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.h | |||
| @@ -21,6 +21,6 @@ | |||
| 21 | 21 | ||
| 22 | int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, | 22 | int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, |
| 23 | struct hid_sensor_common *attrb); | 23 | struct hid_sensor_common *attrb); |
| 24 | void hid_sensor_remove_trigger(struct iio_dev *indio_dev); | 24 | void hid_sensor_remove_trigger(struct hid_sensor_common *attrb); |
| 25 | 25 | ||
| 26 | #endif | 26 | #endif |
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c index ea01c6bcfb56..e54f0f4959d3 100644 --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c | |||
| @@ -348,7 +348,7 @@ static int hid_gyro_3d_probe(struct platform_device *pdev) | |||
| 348 | error_iio_unreg: | 348 | error_iio_unreg: |
| 349 | iio_device_unregister(indio_dev); | 349 | iio_device_unregister(indio_dev); |
| 350 | error_remove_trigger: | 350 | error_remove_trigger: |
| 351 | hid_sensor_remove_trigger(indio_dev); | 351 | hid_sensor_remove_trigger(&gyro_state->common_attributes); |
| 352 | error_unreg_buffer_funcs: | 352 | error_unreg_buffer_funcs: |
| 353 | iio_triggered_buffer_cleanup(indio_dev); | 353 | iio_triggered_buffer_cleanup(indio_dev); |
| 354 | error_free_dev_mem: | 354 | error_free_dev_mem: |
| @@ -361,10 +361,11 @@ static int hid_gyro_3d_remove(struct platform_device *pdev) | |||
| 361 | { | 361 | { |
| 362 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; | 362 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
| 363 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); | 363 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); |
| 364 | struct gyro_3d_state *gyro_state = iio_priv(indio_dev); | ||
| 364 | 365 | ||
| 365 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_GYRO_3D); | 366 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_GYRO_3D); |
| 366 | iio_device_unregister(indio_dev); | 367 | iio_device_unregister(indio_dev); |
| 367 | hid_sensor_remove_trigger(indio_dev); | 368 | hid_sensor_remove_trigger(&gyro_state->common_attributes); |
| 368 | iio_triggered_buffer_cleanup(indio_dev); | 369 | iio_triggered_buffer_cleanup(indio_dev); |
| 369 | kfree(indio_dev->channels); | 370 | kfree(indio_dev->channels); |
| 370 | 371 | ||
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index fa6ae8cf89ea..8e8b9d722853 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c | |||
| @@ -314,7 +314,7 @@ static int hid_als_probe(struct platform_device *pdev) | |||
| 314 | error_iio_unreg: | 314 | error_iio_unreg: |
| 315 | iio_device_unregister(indio_dev); | 315 | iio_device_unregister(indio_dev); |
| 316 | error_remove_trigger: | 316 | error_remove_trigger: |
| 317 | hid_sensor_remove_trigger(indio_dev); | 317 | hid_sensor_remove_trigger(&als_state->common_attributes); |
| 318 | error_unreg_buffer_funcs: | 318 | error_unreg_buffer_funcs: |
| 319 | iio_triggered_buffer_cleanup(indio_dev); | 319 | iio_triggered_buffer_cleanup(indio_dev); |
| 320 | error_free_dev_mem: | 320 | error_free_dev_mem: |
| @@ -327,10 +327,11 @@ static int hid_als_remove(struct platform_device *pdev) | |||
| 327 | { | 327 | { |
| 328 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; | 328 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
| 329 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); | 329 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); |
| 330 | struct als_state *als_state = iio_priv(indio_dev); | ||
| 330 | 331 | ||
| 331 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_ALS); | 332 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_ALS); |
| 332 | iio_device_unregister(indio_dev); | 333 | iio_device_unregister(indio_dev); |
| 333 | hid_sensor_remove_trigger(indio_dev); | 334 | hid_sensor_remove_trigger(&als_state->common_attributes); |
| 334 | iio_triggered_buffer_cleanup(indio_dev); | 335 | iio_triggered_buffer_cleanup(indio_dev); |
| 335 | kfree(indio_dev->channels); | 336 | kfree(indio_dev->channels); |
| 336 | 337 | ||
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c index 2634920562fb..b26e1028a0a0 100644 --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c | |||
| @@ -351,7 +351,7 @@ static int hid_magn_3d_probe(struct platform_device *pdev) | |||
| 351 | error_iio_unreg: | 351 | error_iio_unreg: |
| 352 | iio_device_unregister(indio_dev); | 352 | iio_device_unregister(indio_dev); |
| 353 | error_remove_trigger: | 353 | error_remove_trigger: |
| 354 | hid_sensor_remove_trigger(indio_dev); | 354 | hid_sensor_remove_trigger(&magn_state->common_attributes); |
| 355 | error_unreg_buffer_funcs: | 355 | error_unreg_buffer_funcs: |
| 356 | iio_triggered_buffer_cleanup(indio_dev); | 356 | iio_triggered_buffer_cleanup(indio_dev); |
| 357 | error_free_dev_mem: | 357 | error_free_dev_mem: |
| @@ -364,10 +364,11 @@ static int hid_magn_3d_remove(struct platform_device *pdev) | |||
| 364 | { | 364 | { |
| 365 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; | 365 | struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; |
| 366 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); | 366 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); |
| 367 | struct magn_3d_state *magn_state = iio_priv(indio_dev); | ||
| 367 | 368 | ||
| 368 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_COMPASS_3D); | 369 | sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_COMPASS_3D); |
| 369 | iio_device_unregister(indio_dev); | 370 | iio_device_unregister(indio_dev); |
| 370 | hid_sensor_remove_trigger(indio_dev); | 371 | hid_sensor_remove_trigger(&magn_state->common_attributes); |
| 371 | iio_triggered_buffer_cleanup(indio_dev); | 372 | iio_triggered_buffer_cleanup(indio_dev); |
| 372 | kfree(indio_dev->channels); | 373 | kfree(indio_dev->channels); |
| 373 | 374 | ||
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index a265af294ea4..206a2af6b62b 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | 21 | ||
| 22 | #include <linux/hid.h> | 22 | #include <linux/hid.h> |
| 23 | #include <linux/hid-sensor-ids.h> | 23 | #include <linux/hid-sensor-ids.h> |
| 24 | #include <linux/iio/iio.h> | ||
| 25 | #include <linux/iio/trigger.h> | ||
| 24 | 26 | ||
| 25 | /** | 27 | /** |
| 26 | * struct hid_sensor_hub_attribute_info - Attribute info | 28 | * struct hid_sensor_hub_attribute_info - Attribute info |
| @@ -184,6 +186,7 @@ struct hid_sensor_common { | |||
| 184 | struct platform_device *pdev; | 186 | struct platform_device *pdev; |
| 185 | unsigned usage_id; | 187 | unsigned usage_id; |
| 186 | bool data_ready; | 188 | bool data_ready; |
| 189< | |||
