Message ID | 20220807192038.1039771-1-jic23@kernel.org (mailing list archive) |
---|---|
Headers | show |
Series | PM: Introduce EXPORT_NS_GPL_DEV_PM_OPS() and use cases in IIO. | expand |
On Sun, Aug 7, 2022 at 9:13 PM Jonathan Cameron <jic23@kernel.org> wrote: > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > Perhaps the most complex case we can have is a core driver module (usually > with accompanying per bus modules) that exports, in a namespace, > a struct dev_pm_ops. The driver has different handling for runtime and > sleep suspend / resume so (almost) all callbacks are provided. > The pm.h helper macro _EXPORT_DEV_PM_OPS() could be used here but the > handling of the last two parameters is unusual and very different from > the macros intended for driver usage. First parameter needs to be "_gpl" > and second needs to be the namespace specified as a string. Other NS > macros take it without quotes. > > As such, this series proposes introducing a suitable macro and then provides > a number of IIO driver conversions. Where relevant the exports from the > driver are moved into the new namespace. > > If accepted we can either take the whole lot through the PM tree and hope > there is nothing much else overlapping with this driver code in this cycle, > or ideally we could use an immutable branch and pull this into both the > IIO and PM trees. Pretty straightforward and looks useful to me, thanks! Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Jonathan Cameron (5): > PM: core: Add EXPORT_NS_GPL_DEV_PM_OPS to avoid drivers rolling own. > iio: accel: fxls8962af: Use new EXPORT_NS_GPL_DEV_PM_OPS() > iio: gyro: fxas210002c: Move exports to IIO_FXAS210002C namespace. > iio: imu: inv_icm42600: Move exports to IIO_ICM42600 namespace > iio: imu: inv_mpu: Move exports to IIO_MPU6050 namespace > > drivers/iio/accel/fxls8962af-core.c | 17 +++++++-------- > drivers/iio/accel/fxls8962af-i2c.c | 2 +- > drivers/iio/accel/fxls8962af-spi.c | 2 +- > drivers/iio/gyro/fxas21002c_core.c | 21 ++++++++----------- > drivers/iio/gyro/fxas21002c_i2c.c | 3 ++- > drivers/iio/gyro/fxas21002c_spi.c | 3 ++- > .../iio/imu/inv_icm42600/inv_icm42600_core.c | 21 ++++++++----------- > .../iio/imu/inv_icm42600/inv_icm42600_i2c.c | 3 ++- > .../iio/imu/inv_icm42600/inv_icm42600_spi.c | 3 ++- > drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 18 +++++++--------- > drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 3 ++- > drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 3 ++- > include/linux/pm.h | 5 +++++ > 13 files changed, 52 insertions(+), 52 deletions(-) > > -- > 2.37.1 >
On Sun, Aug 7, 2022 at 9:10 PM Jonathan Cameron <jic23@kernel.org> wrote: > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > Perhaps the most complex case we can have is a core driver module (usually > with accompanying per bus modules) that exports, in a namespace, > a struct dev_pm_ops. The driver has different handling for runtime and > sleep suspend / resume so (almost) all callbacks are provided. > The pm.h helper macro _EXPORT_DEV_PM_OPS() could be used here but the > handling of the last two parameters is unusual and very different from > the macros intended for driver usage. First parameter needs to be "_gpl" > and second needs to be the namespace specified as a string. Other NS > macros take it without quotes. > > As such, this series proposes introducing a suitable macro and then provides > a number of IIO driver conversions. Where relevant the exports from the > driver are moved into the new namespace. > > If accepted we can either take the whole lot through the PM tree and hope > there is nothing much else overlapping with this driver code in this cycle, > or ideally we could use an immutable branch and pull this into both the > IIO and PM trees. > > Jonathan Cameron (5): > PM: core: Add EXPORT_NS_GPL_DEV_PM_OPS to avoid drivers rolling own. > iio: accel: fxls8962af: Use new EXPORT_NS_GPL_DEV_PM_OPS() > iio: gyro: fxas210002c: Move exports to IIO_FXAS210002C namespace. > iio: imu: inv_icm42600: Move exports to IIO_ICM42600 namespace > iio: imu: inv_mpu: Move exports to IIO_MPU6050 namespace I like what you done here. Acked-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
On Mon, 22 Aug 2022 11:04:18 +0200 Linus Walleij <linus.walleij@linaro.org> wrote: > On Sun, Aug 7, 2022 at 9:10 PM Jonathan Cameron <jic23@kernel.org> wrote: > > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com> > > > > Perhaps the most complex case we can have is a core driver module (usually > > with accompanying per bus modules) that exports, in a namespace, > > a struct dev_pm_ops. The driver has different handling for runtime and > > sleep suspend / resume so (almost) all callbacks are provided. > > The pm.h helper macro _EXPORT_DEV_PM_OPS() could be used here but the > > handling of the last two parameters is unusual and very different from > > the macros intended for driver usage. First parameter needs to be "_gpl" > > and second needs to be the namespace specified as a string. Other NS > > macros take it without quotes. > > > > As such, this series proposes introducing a suitable macro and then provides > > a number of IIO driver conversions. Where relevant the exports from the > > driver are moved into the new namespace. > > > > If accepted we can either take the whole lot through the PM tree and hope > > there is nothing much else overlapping with this driver code in this cycle, > > or ideally we could use an immutable branch and pull this into both the > > IIO and PM trees. > > > > Jonathan Cameron (5): > > PM: core: Add EXPORT_NS_GPL_DEV_PM_OPS to avoid drivers rolling own. > > iio: accel: fxls8962af: Use new EXPORT_NS_GPL_DEV_PM_OPS() > > iio: gyro: fxas210002c: Move exports to IIO_FXAS210002C namespace. > > iio: imu: inv_icm42600: Move exports to IIO_ICM42600 namespace > > iio: imu: inv_mpu: Move exports to IIO_MPU6050 namespace > > I like what you done here. > Acked-by: Linus Walleij <linus.walleij@linaro.org> Unfortunately change of plan because the EXPORT_NS_GPL_DEV_PM_OPS isn't general enough to cover some cases elsewhere. https://lore.kernel.org/all/20220808174107.38676-2-paul@crapouillou.net/ I'll switch this series over to being based on that which will be a large enough change that I'll probably not pick up any tags given on this version. Thanks Jonathan > > Yours, > Linus Walleij
From: Jonathan Cameron <Jonathan.Cameron@huawei.com> Perhaps the most complex case we can have is a core driver module (usually with accompanying per bus modules) that exports, in a namespace, a struct dev_pm_ops. The driver has different handling for runtime and sleep suspend / resume so (almost) all callbacks are provided. The pm.h helper macro _EXPORT_DEV_PM_OPS() could be used here but the handling of the last two parameters is unusual and very different from the macros intended for driver usage. First parameter needs to be "_gpl" and second needs to be the namespace specified as a string. Other NS macros take it without quotes. As such, this series proposes introducing a suitable macro and then provides a number of IIO driver conversions. Where relevant the exports from the driver are moved into the new namespace. If accepted we can either take the whole lot through the PM tree and hope there is nothing much else overlapping with this driver code in this cycle, or ideally we could use an immutable branch and pull this into both the IIO and PM trees. Jonathan Cameron (5): PM: core: Add EXPORT_NS_GPL_DEV_PM_OPS to avoid drivers rolling own. iio: accel: fxls8962af: Use new EXPORT_NS_GPL_DEV_PM_OPS() iio: gyro: fxas210002c: Move exports to IIO_FXAS210002C namespace. iio: imu: inv_icm42600: Move exports to IIO_ICM42600 namespace iio: imu: inv_mpu: Move exports to IIO_MPU6050 namespace drivers/iio/accel/fxls8962af-core.c | 17 +++++++-------- drivers/iio/accel/fxls8962af-i2c.c | 2 +- drivers/iio/accel/fxls8962af-spi.c | 2 +- drivers/iio/gyro/fxas21002c_core.c | 21 ++++++++----------- drivers/iio/gyro/fxas21002c_i2c.c | 3 ++- drivers/iio/gyro/fxas21002c_spi.c | 3 ++- .../iio/imu/inv_icm42600/inv_icm42600_core.c | 21 ++++++++----------- .../iio/imu/inv_icm42600/inv_icm42600_i2c.c | 3 ++- .../iio/imu/inv_icm42600/inv_icm42600_spi.c | 3 ++- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 18 +++++++--------- drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 3 ++- drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 3 ++- include/linux/pm.h | 5 +++++ 13 files changed, 52 insertions(+), 52 deletions(-)