iio: light: vcnl4000: Don't create sysfs PM nodes for child
PATCH 1/1 iio: light: vcnl4000: Don't create sysfs PM nodes for child
PM runtime is enabled for the parent i2c device, but it is disabled for the iio child device and remains so in this driver. But as the child sysfs PM directory is created by default by iio_device_register => cdev_device_add => dpm_sysfs_add it doesn't bring any value exposing it since it won't give any usable data for the user.
Tell dpm_sysfs to not create the PM directory for the iio device.
--- drivers/iio/light/vcnl4000.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/light/vcnl4000.c +1 -0
@@ -1072,6 +1072,7 @@ static int vcnl4000_probe(struct i2c_client *client,if (ret <0 ) goto fail_poweroff; +device_set_pm_not_required (&indio_dev->dev); ret =iio_device_register (indio_dev);if (ret <0 ) goto fail_poweroff;
Signature · 1 line
2.30.2
Jonathan Cameron
maintainerQuoted 9 lines · On Tue, 1 Nov 2022 13:21:51 +0100 Mårten Lindahl <[email protected]>…
PM runtime is enabled for the parent i2c device, but it is disabled for the iio child device and remains so in this driver. But as the child sysfs PM directory is created by default by
iio_device_register=>cdev_device_add=>dpm_sysfs_addit doesn't bring any value exposing it since it won't give any usable data for the user.Tell
dpm_sysfsto not create the PM directory for the iio device.Signed-off-by Mårten Lindahl <[email protected]>
Ah this one.. +CC Sudeep who I am sure has considered such changes in other similar cases (he did the original ones that mean this infastructure exists).
So, the problem here is that it drops an ABI that has existed in IIO for a long time. I fully admit the ABI is confusing and pointless. What I'm not sure on is that we are entirely safe to remove it.
If we are going to do this, it shouldn't be on a per driver basis, but rather a global change for all IIO drivers with the proviso that we are relying on the 'if no one notices an ABI change, it is fine' exception to never changing userspace ABI.
Until now this has more or less only been used for new subsystems or where there were warnings generated due to spurious interface usage in normal flows.
In IIO, nothing should touch these and I 'think' they don't do anything if anyone pokes them.
Jonathan
Quoted 16 lines
--- drivers/iio/light/vcnl4000.c | 1 + 1 file changed, 1 insertion(+)drivers/iio/light/vcnl4000.c +1
-0@@ -1072,6 +1072,7 @@ static int vcnl4000_probe(struct i2c_client *client,if (ret <0 ) goto fail_poweroff; +device_set_pm_not_required (&indio_dev->dev); ret =iio_device_register (indio_dev);if (ret <0 ) goto fail_poweroff;
Quoted 25 lines · Jonathan Cameron
Quoted 9 lines · On Tue, 1 Nov 2022 13:21:51 +0100 Mårten Lindahl <[email protected]>…
PM runtime is enabled for the parent i2c device, but it is disabled for the iio child device and remains so in this driver. But as the child sysfs PM directory is created by default by
iio_device_register=>cdev_device_add=>dpm_sysfs_addit doesn't bring any value exposing it since it won't give any usable data for the user.Tell
dpm_sysfsto not create the PM directory for the iio device.Signed-off-by Mårten Lindahl <[email protected]>Ah this one.. +CC Sudeep who I am sure has considered such changes in other similar cases (he did the original ones that mean this infastructure exists).
So, the problem here is that it drops an ABI that has existed in IIO for a long time. I fully admit the ABI is confusing and pointless. What I'm not sure on is that we are entirely safe to remove it.
If we are going to do this, it shouldn't be on a per driver basis, but rather a global change for all IIO drivers with the proviso that we are relying on the 'if no one notices an ABI change, it is fine' exception to never changing userspace ABI.
Quoted 7 lines
Until now this has more or less only been used for new subsystems or where there were warnings generated due to spurious interface usage in normal flows.
In IIO, nothing should touch these and I 'think' they don't do anything if anyone pokes them.
Jonathan
Hi Jonathan!
Thanks. I'll drop this change then.
Kind regards
Mårten
Quoted 19 lines
Quoted 18 lines
--- drivers/iio/light/vcnl4000.c | 1 + 1 file changed, 1 insertion(+)drivers/iio/light/vcnl4000.c +1
-0@@ -1072,6 +1072,7 @@ static int vcnl4000_probe(struct i2c_client *client,if (ret <0 ) goto fail_poweroff; +device_set_pm_not_required (&indio_dev->dev); ret =iio_device_register (indio_dev);if (ret <0 ) goto fail_poweroff;
Quoted 9 lines · Jonathan Cameron
Quoted 6 lines · On Tue, 1 Nov 2022 13:21:51 +0100 Mårten Lindahl <[email protected]>…
PM runtime is enabled for the parent i2c device, but it is disabled for the iio child device and remains so in this driver. But as the child sysfs PM directory is created by default by
iio_device_register=>cdev_device_add=>dpm_sysfs_addit doesn't bring any value exposing it since it won't give any usable data for the user.
Quoted 7 lines
Quoted 3 lines
Tell
dpm_sysfsto not create the PM directory for the iio device.Signed-off-by Mårten Lindahl <[email protected]>Ah this one.. +CC Sudeep who I am sure has considered such changes in other similar cases (he did the original ones that mean this infastructure exists).
Yes it was added for cache devices which are child devices of CPU devices via Commit 85945c28b5a8 ("PM / core: Add support to skip power management in device/driver model")
Since CPU and its children are power managed quite differently(via cpuidle or cpu hotplug), the new API(device_set_pm_not_required) fits the usecase there well. I am not sure about this IIO usecase.
Signature · 2 lines
Regards, Sudeep
Quoted 18 lines · On Mon, 7 Nov 2022 10:36:36 +0000 Sudeep Holla <[email protected]> wrote:
Quoted 9 lines · Jonathan Cameron
Quoted 6 lines · On Tue, 1 Nov 2022 13:21:51 +0100 Mårten Lindahl <[email protected]>…
PM runtime is enabled for the parent i2c device, but it is disabled for the iio child device and remains so in this driver. But as the child sysfs PM directory is created by default by
iio_device_register=>cdev_device_add=>dpm_sysfs_addit doesn't bring any value exposing it since it won't give any usable data for the user.Quoted 7 lines
Quoted 3 lines
Tell
dpm_sysfsto not create the PM directory for the iio device.Signed-off-by Mårten Lindahl <[email protected]>Ah this one.. +CC Sudeep who I am sure has considered such changes in other similar cases (he did the original ones that mean this infastructure exists).
Quoted 7 lines
Yes it was added for cache devices which are child devices of CPU devices via Commit
85945c28b5a8("PM / core: Add support to skip power management in device/driver model")Since CPU and its children are power managed quite differently(via cpuidle or cpu hotplug), the new
API(device_set_pm_not_required)fits the usecase there well. I am not sure about this IIO usecase.
These are effectively pseudo devices for purposes of the driver model, with parents as the actual physical devices. As such all the PM infrastructure is associate with the appropriate bus specific device rather than the struct iio_dev->dev.
So I'm fairly sure we should just not expose the sysfs attributes. This is similar to CXL for which they are only exposed for the PCI devices, not the bunch of subdevices created.
Jonathan
Quoted 24 lines · Jonathan Cameron
Quoted 21 lines · On Mon, 7 Nov 2022 10:36:36 +0000 Sudeep Holla <[email protected]> wrote:
Quoted 9 lines · Jonathan Cameron
Quoted 6 lines · On Tue, 1 Nov 2022 13:21:51 +0100 Mårten Lindahl <[email protected]>…
PM runtime is enabled for the parent i2c device, but it is disabled for the iio child device and remains so in this driver. But as the child sysfs PM directory is created by default by
iio_device_register=>cdev_device_add=>dpm_sysfs_addit doesn't bring any value exposing it since it won't give any usable data for the user.Quoted 7 lines
Quoted 3 lines
Tell
dpm_sysfsto not create the PM directory for the iio device.Signed-off-by Mårten Lindahl <[email protected]>Ah this one.. +CC Sudeep who I am sure has considered such changes in other similar cases (he did the original ones that mean this infastructure exists).
Yes it was added for cache devices which are child devices of CPU devices via Commit
85945c28b5a8("PM / core: Add support to skip power management in device/driver model")
Quoted 9 lines
Quoted 4 lines
Since CPU and its children are power managed quite differently(via cpuidle or cpu hotplug), the new
API(device_set_pm_not_required)fits the usecase there well. I am not sure about this IIO usecase.These are effectively pseudo devices for purposes of the driver model, with parents as the actual physical devices. As such all the PM infrastructure is associate with the appropriate bus specific device rather than the struct
iio_dev->dev.
Ah if there are psuedo devices or companion like devices, then yes I agree worth not exposing the sysfs.
Quoted 1 line
So I'm fairly sure we should just not expose the sysfs attributes.
Agreed if it is psuedo device like you mention above.
Quoted 3 lines
This is similar to CXL for which they are only exposed for the PCI devices, not the bunch of subdevices created.
OK
Signature · 2 lines
Regards, Sudeep