[PATCH v2 0/2] iio: afe: rescale: Get driver data using platform_get_match_data()
From: Fabio Forni via B4 Relay
Date: Fri Nov 27 2026 - 18:22:32 EST
Add a new helper to get data when drivers are bound using platform_device
plus swnodes, that typically happpens when such drivers are dynamically
instantiated.
As swnodes do not implement device_get_match_data(), a fallback mechanism
is needed to access driver_data inside platform_device_id structs. While
drivers can have such logic locally, Andy Shevchenko suggested to add a
global helper for this situation. See discussion in v1.
v1 was about adding the logic above in iio-rescale: the same goal applies
to this revision. iio-rescale is modified to call the new
platform_get_match_data() helper.
Signed-off-by: Fabio Forni <development@xxxxxxxxxx>
---
Changes in v2:
- Add platform_get_match_data()
- Use platform_get_match_data() in iio-rescale
- Use imperative mood throughout commits and cover letter
- Link to v1: https://lore.kernel.org/r/20261008-iio_rescale_platform_ids-v1-1-019f1c144022@xxxxxxxxxx
---
Fabio Forni (2):
drivers: core: platform: Add platform_get_match_data() helper
iio: afe: iio-rescale: Add platform IDs
drivers/base/platform.c | 28 ++++++++++++++++++++++++++++
drivers/iio/afe/iio-rescale.c | 18 +++++++++++++++++-
include/linux/platform_device.h | 2 ++
3 files changed, 47 insertions(+), 1 deletion(-)
---
base-commit: 4dce97c6c265544342e716e62fd24bbb232590c5
change-id: 20261008-iio_rescale_platform_ids-0d2a7dac974a
Best regards,
--
Fabio Forni <development@xxxxxxxxxx>