6bf392f2 | 18-Jul-2024 |
Nuno Sa <nuno.sa@analog.com> |
iio: health: afe4404: make use of iio_for_each_active_channel()
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when the
iio: health: afe4404: make use of iio_for_each_active_channel()
Use iio_for_each_active_channel() to iterate over active channels accessing '.masklength' so it can be annotated as __private when there are no more direct users of it.
Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240718-dev-iio-masklength-private2-v1-7-8e12cd042906@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
4ae1ebaa | 18-Jul-2024 |
Nuno Sa <nuno.sa@analog.com> |
iio: health: max30102: make use of iio_get_masklength()
Use iio_get_masklength() to access '.masklength' so it can be annotated as __private when there are no more direct users of it.
Signed-off-by
iio: health: max30102: make use of iio_get_masklength()
Use iio_get_masklength() to access '.masklength' so it can be annotated as __private when there are no more direct users of it.
Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240718-dev-iio-masklength-private2-v1-6-8e12cd042906@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
51373588 | 17-Jun-2024 |
Trevor Gamblin <tgamblin@baylibre.com> |
iio: health: max30102: make use of regmap_set_bits()
Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits().
Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibr
iio: health: max30102: make use of regmap_set_bits()
Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits().
Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-26-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
04f16857 | 17-Jun-2024 |
Trevor Gamblin <tgamblin@baylibre.com> |
iio: health: max30100: make use of regmap_set_bits()
Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits().
Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibr
iio: health: max30100: make use of regmap_set_bits()
Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits().
Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-25-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
9d0142fc | 17-Jun-2024 |
Trevor Gamblin <tgamblin@baylibre.com> |
iio: health: afe4404: make use of regmap_clear_bits(), regmap_set_bits()
Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits().
Instead of using regmap_update_bits
iio: health: afe4404: make use of regmap_clear_bits(), regmap_set_bits()
Instead of using regmap_update_bits() and passing the mask twice, use regmap_set_bits().
Instead of using regmap_update_bits() and passing val = 0, use regmap_clear_bits().
Suggested-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240617-review-v3-24-88d1338c4cca@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
044b4323 | 23-Jan-2024 |
Andrew Davis <afd@ti.com> |
iio: health: afe4404: Use devm IIO helpers
Use a device lifecycle managed IIO helper functions. This helps prevent mistakes like unregistering and freeing out of order in cleanup functions and forge
iio: health: afe4404: Use devm IIO helpers
Use a device lifecycle managed IIO helper functions. This helps prevent mistakes like unregistering and freeing out of order in cleanup functions and forgetting to unregister and free on error paths.
Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123140918.215818-4-afd@ti.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
5ff7ea50 | 23-Jan-2024 |
Andrew Davis <afd@ti.com> |
iio: health: afe4404: Use devm action helper for regulator disable
Use a device lifecycle managed action for regulator disable function. This helps prevent mistakes like unregistering out of order i
iio: health: afe4404: Use devm action helper for regulator disable
Use a device lifecycle managed action for regulator disable function. This helps prevent mistakes like unregistering out of order in cleanup functions and forgetting to unregister on error paths.
Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123140918.215818-3-afd@ti.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
e73a640f | 23-Jan-2024 |
Andrew Davis <afd@ti.com> |
iio: health: afe4403: Use devm IIO helpers
Use a device lifecycle managed IIO helper functions. This helps prevent mistakes like unregistering and freeing out of order in cleanup functions and forge
iio: health: afe4403: Use devm IIO helpers
Use a device lifecycle managed IIO helper functions. This helps prevent mistakes like unregistering and freeing out of order in cleanup functions and forgetting to unregister and free on error paths.
Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240123140918.215818-2-afd@ti.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
15818f08 | 18-Nov-2022 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
iio: health: max30102: Convert to i2c's .probe_new()
.probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function.
Signed-off-by: Uwe Kleine-König <u.k
iio: health: max30102: Convert to i2c's .probe_new()
.probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-100-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
3ef7e6e0 | 18-Nov-2022 |
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
iio: health: max30100: Convert to i2c's .probe_new()
The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted.
Signed-off-by: Uwe Kleine-König <u.kleine
iio: health: max30100: Convert to i2c's .probe_new()
The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-99-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
6b701cda | 12-Oct-2022 |
Nuno Sá <nuno.sa@analog.com> |
iio: health: max30102: do not use internal iio_dev lock
The pattern used in this device does not quite fit in the iio_device_claim_direct_mode() typical usage. In this case, we want to know if we ar
iio: health: max30102: do not use internal iio_dev lock
The pattern used in this device does not quite fit in the iio_device_claim_direct_mode() typical usage. In this case, we want to know if we are in buffered mode or not to know if the device is powered (buffer mode) or not. And depending on that max30102_get_temp() will power on the device if needed. Hence, in order to keep the same functionality, we try to:
1. Claim Buffered mode; 2: If 1) succeeds call max30102_get_temp() without powering on the device; 3: Release Buffered mode; 4: If 1) fails, Claim Direct mode; 5: If 4) succeeds call max30102_get_temp() with powering on the device; 6: Release Direct mode; 7: If 4) fails, goto to 1) and try again.
This dance between buffered and direct mode is not particularly pretty (as well as the loop introduced by the goto statement) but it does allow us to get rid of the mlock usage while keeping the same behavior.
Signed-off-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20221012151620.1725215-4-nuno.sa@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
fc92d9e3 | 07-Nov-2022 |
Wei Yongjun <weiyongjun1@huawei.com> |
iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw
KASAN report out-of-bounds read as follows:
BUG: KASAN: global-out-of-bounds in afe4404_read_raw+0x2ce/0x380 Read of size 4 at addr ff
iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw
KASAN report out-of-bounds read as follows:
BUG: KASAN: global-out-of-bounds in afe4404_read_raw+0x2ce/0x380 Read of size 4 at addr ffffffffc00e4658 by task cat/278
Call Trace: afe4404_read_raw iio_read_channel_info dev_attr_show
The buggy address belongs to the variable: afe4404_channel_leds+0x18/0xffffffffffffe9c0
This issue can be reproduce by singe command:
$ cat /sys/bus/i2c/devices/0-0058/iio\:device0/in_intensity6_raw
The array size of afe4404_channel_leds and afe4404_channel_offdacs are less than channels, so access with chan->address cause OOB read in afe4404_[read|write]_raw. Fix it by moving access before use them.
Fixes: b36e8257641a ("iio: health/afe440x: Use regmap fields") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20221107152010.95937-1-weiyongjun@huaweicloud.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
show more ...
|
b220558c | 21-Jun-2022 |
Jonathan Cameron <Jonathan.Cameron@huawei.com> |
iio: health: afe4404: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + remove
iio: health: afe4404: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20220621202719.13644-19-jic23@kernel.org
show more ...
|