Skip to content

Commit

Permalink
iio: light: lm3533-als: use iio_device_set_parent() to assign parent
Browse files Browse the repository at this point in the history
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 <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Alexandru Ardelean authored and Jonathan Cameron committed Jun 14, 2020
1 parent 2cbd541 commit 2c9d8e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/light/lm3533-als.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ static int lm3533_als_probe(struct platform_device *pdev)
indio_dev->channels = lm3533_als_channels;
indio_dev->num_channels = ARRAY_SIZE(lm3533_als_channels);
indio_dev->name = dev_name(&pdev->dev);
indio_dev->dev.parent = pdev->dev.parent;
iio_device_set_parent(indio_dev, pdev->dev.parent);
indio_dev->modes = INDIO_DIRECT_MODE;

als = iio_priv(indio_dev);
Expand Down

0 comments on commit 2c9d8e1

Please sign in to comment.