Skip to content

Commit 2c9d8e1

Browse files
commodojic23
authored andcommitted
iio: light: lm3533-als: use iio_device_set_parent() to assign parent
This assignment is the more peculiar as it assigns the parent of the platform-device's device (i.e. pdev->dev.parent) as the IIO device's parent. Since the devm_iio_device_alloc() [now] assigns the device argument as the default parent (and since this is the more common case), for cases where the parent needs to be different, the iio_device_set_parent helper should be used. That makes things a bit more obvious about the new behavior of devm_iio_device_alloc() and makes it clearer that iio_device_set_parent() should be used. Signed-off-by: Alexandru Ardelean <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 2cbd541 commit 2c9d8e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/light/lm3533-als.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ static int lm3533_als_probe(struct platform_device *pdev)
852852
indio_dev->channels = lm3533_als_channels;
853853
indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels);
854854
indio_dev->name = dev_name(&pdev->dev);
855-
indio_dev->dev.parent = pdev->dev.parent;
855+
iio_device_set_parent(indio_dev, pdev->dev.parent);
856856
indio_dev->modes = INDIO_DIRECT_MODE;
857857

858858
als = iio_priv(indio_dev);

0 commit comments

Comments
 (0)