Skip to content

Commit 74a53a9

Browse files
bebarinojic23
authored andcommitted
iio:proximity:sx_common: Fix device property parsing on DT systems
After commit 7a3605b ("iio: sx9310: Support ACPI property") we started using the 'indio_dev->dev' to extract device properties for various register settings in sx9310_get_default_reg(). This broke DT based systems because dev_fwnode() used in the device_property*() APIs can't find an 'of_node'. That's because the 'indio_dev->dev.of_node' pointer isn't set until iio_device_register() is called. Set the pointer earlier, next to where the ACPI companion is set, so that the device property APIs work on DT systems. Cc: Gwendal Grignou <[email protected]> Fixes: 7a3605b ("iio: sx9310: Support ACPI property") Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Gwendal Grignou <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 03779df commit 74a53a9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/iio/proximity/sx_common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ int sx_common_probe(struct i2c_client *client,
521521
return dev_err_probe(dev, ret, "error reading WHOAMI\n");
522522

523523
ACPI_COMPANION_SET(&indio_dev->dev, ACPI_COMPANION(dev));
524+
indio_dev->dev.of_node = client->dev.of_node;
524525
indio_dev->modes = INDIO_DIRECT_MODE;
525526

526527
indio_dev->channels = data->chip_info->iio_channels;

0 commit comments

Comments
 (0)