* [PATCH 0/2] Trivial cleanup and refactor dev_pm_ops handling.
@ 2022-08-07 18:45 Jonathan Cameron
2022-08-07 18:45 ` [PATCH 1/2] iio: magn: hmc5843: Drop excessive indentation of assignments of hmc5843_driver Jonathan Cameron
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Jonathan Cameron @ 2022-08-07 18:45 UTC (permalink / raw)
To: linux-iio; +Cc: Paul Cercueil, Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This driver was taking an unusual approach to handling the optionality of
structures / callbacks depending on CONFIG_PM. Bring it inline with
other similar drivers.
Part of continuing to move IIO over to the new PM macros that don't require
such complex handling.
Jonathan Cameron (2):
iio: magn: hmc5843: Drop excessive indentation of assignments of
hmc5843_driver
iio: magn: hmc5843: Move struct dev_pm_ops out of header
drivers/iio/magnetometer/hmc5843.h | 13 +------------
drivers/iio/magnetometer/hmc5843_core.c | 8 ++++----
drivers/iio/magnetometer/hmc5843_i2c.c | 2 +-
drivers/iio/magnetometer/hmc5843_spi.c | 14 +++++++-------
4 files changed, 13 insertions(+), 24 deletions(-)
--
2.37.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] iio: magn: hmc5843: Drop excessive indentation of assignments of hmc5843_driver
2022-08-07 18:45 [PATCH 0/2] Trivial cleanup and refactor dev_pm_ops handling Jonathan Cameron
@ 2022-08-07 18:45 ` Jonathan Cameron
2022-08-07 18:45 ` [PATCH 2/2] iio: magn: hmc5843: Move struct dev_pm_ops out of header Jonathan Cameron
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2022-08-07 18:45 UTC (permalink / raw)
To: linux-iio; +Cc: Paul Cercueil, Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This formatting is odd, so fix it to be more standard.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/iio/magnetometer/hmc5843_spi.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/magnetometer/hmc5843_spi.c b/drivers/iio/magnetometer/hmc5843_spi.c
index 8403f09aba39..310027a53342 100644
--- a/drivers/iio/magnetometer/hmc5843_spi.c
+++ b/drivers/iio/magnetometer/hmc5843_spi.c
@@ -86,13 +86,13 @@ static const struct spi_device_id hmc5843_id[] = {
MODULE_DEVICE_TABLE(spi, hmc5843_id);
static struct spi_driver hmc5843_driver = {
- .driver = {
- .name = "hmc5843",
- .pm = HMC5843_PM_OPS,
- },
- .id_table = hmc5843_id,
- .probe = hmc5843_spi_probe,
- .remove = hmc5843_spi_remove,
+ .driver = {
+ .name = "hmc5843",
+ .pm = HMC5843_PM_OPS,
+ },
+ .id_table = hmc5843_id,
+ .probe = hmc5843_spi_probe,
+ .remove = hmc5843_spi_remove,
};
module_spi_driver(hmc5843_driver);
--
2.37.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] iio: magn: hmc5843: Move struct dev_pm_ops out of header
2022-08-07 18:45 [PATCH 0/2] Trivial cleanup and refactor dev_pm_ops handling Jonathan Cameron
2022-08-07 18:45 ` [PATCH 1/2] iio: magn: hmc5843: Drop excessive indentation of assignments of hmc5843_driver Jonathan Cameron
@ 2022-08-07 18:45 ` Jonathan Cameron
2022-08-07 18:58 ` [PATCH 0/2] iio: magn: hmc5843: Trivial cleanup and refactor dev_pm_ops handling Jonathan Cameron
2022-08-08 9:22 ` [PATCH 0/2] " Andy Shevchenko
3 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2022-08-07 18:45 UTC (permalink / raw)
To: linux-iio; +Cc: Paul Cercueil, Jonathan Cameron
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Having this structure defined static in the header lead to
unnecessary duplication and required additional symbol exports.
Use the EXPORT_NS_SIMPLE_DEV_PM_OPS() to clean this up in the same
fashion as many other drivers do this.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/iio/magnetometer/hmc5843.h | 13 +------------
drivers/iio/magnetometer/hmc5843_core.c | 8 ++++----
drivers/iio/magnetometer/hmc5843_i2c.c | 2 +-
drivers/iio/magnetometer/hmc5843_spi.c | 2 +-
4 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/drivers/iio/magnetometer/hmc5843.h b/drivers/iio/magnetometer/hmc5843.h
index 9120c8bbf3dd..60fbb5431c88 100644
--- a/drivers/iio/magnetometer/hmc5843.h
+++ b/drivers/iio/magnetometer/hmc5843.h
@@ -52,16 +52,5 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
enum hmc5843_ids id, const char *name);
void hmc5843_common_remove(struct device *dev);
-int hmc5843_common_suspend(struct device *dev);
-int hmc5843_common_resume(struct device *dev);
-
-#ifdef CONFIG_PM_SLEEP
-static __maybe_unused SIMPLE_DEV_PM_OPS(hmc5843_pm_ops,
- hmc5843_common_suspend,
- hmc5843_common_resume);
-#define HMC5843_PM_OPS (&hmc5843_pm_ops)
-#else
-#define HMC5843_PM_OPS NULL
-#endif
-
+extern const struct dev_pm_ops hmc5843_pm_ops;
#endif /* HMC5843_CORE_H */
diff --git a/drivers/iio/magnetometer/hmc5843_core.c b/drivers/iio/magnetometer/hmc5843_core.c
index 4a63b2da9df0..c5521d61da29 100644
--- a/drivers/iio/magnetometer/hmc5843_core.c
+++ b/drivers/iio/magnetometer/hmc5843_core.c
@@ -603,19 +603,19 @@ static const struct iio_info hmc5843_info = {
static const unsigned long hmc5843_scan_masks[] = {0x7, 0};
-int hmc5843_common_suspend(struct device *dev)
+static int hmc5843_common_suspend(struct device *dev)
{
return hmc5843_set_mode(iio_priv(dev_get_drvdata(dev)),
HMC5843_MODE_SLEEP);
}
-EXPORT_SYMBOL_NS(hmc5843_common_suspend, IIO_HMC5843);
-int hmc5843_common_resume(struct device *dev)
+static int hmc5843_common_resume(struct device *dev)
{
return hmc5843_set_mode(iio_priv(dev_get_drvdata(dev)),
HMC5843_MODE_CONVERSION_CONTINUOUS);
}
-EXPORT_SYMBOL_NS(hmc5843_common_resume, IIO_HMC5843);
+EXPORT_NS_SIMPLE_DEV_PM_OPS(hmc5843_pm_ops, hmc5843_common_suspend,
+ hmc5843_common_resume, IIO_HMC5843);
int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
enum hmc5843_ids id, const char *name)
diff --git a/drivers/iio/magnetometer/hmc5843_i2c.c b/drivers/iio/magnetometer/hmc5843_i2c.c
index 8d2ff8fc204d..825a881d37fb 100644
--- a/drivers/iio/magnetometer/hmc5843_i2c.c
+++ b/drivers/iio/magnetometer/hmc5843_i2c.c
@@ -93,7 +93,7 @@ MODULE_DEVICE_TABLE(of, hmc5843_of_match);
static struct i2c_driver hmc5843_driver = {
.driver = {
.name = "hmc5843",
- .pm = HMC5843_PM_OPS,
+ .pm = pm_sleep_ptr(&hmc5843_pm_ops),
.of_match_table = hmc5843_of_match,
},
.id_table = hmc5843_id,
diff --git a/drivers/iio/magnetometer/hmc5843_spi.c b/drivers/iio/magnetometer/hmc5843_spi.c
index 310027a53342..c42d2e2a6a6c 100644
--- a/drivers/iio/magnetometer/hmc5843_spi.c
+++ b/drivers/iio/magnetometer/hmc5843_spi.c
@@ -88,7 +88,7 @@ MODULE_DEVICE_TABLE(spi, hmc5843_id);
static struct spi_driver hmc5843_driver = {
.driver = {
.name = "hmc5843",
- .pm = HMC5843_PM_OPS,
+ .pm = pm_sleep_ptr(&hmc5843_pm_ops),
},
.id_table = hmc5843_id,
.probe = hmc5843_spi_probe,
--
2.37.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] iio: magn: hmc5843: Trivial cleanup and refactor dev_pm_ops handling.
2022-08-07 18:45 [PATCH 0/2] Trivial cleanup and refactor dev_pm_ops handling Jonathan Cameron
2022-08-07 18:45 ` [PATCH 1/2] iio: magn: hmc5843: Drop excessive indentation of assignments of hmc5843_driver Jonathan Cameron
2022-08-07 18:45 ` [PATCH 2/2] iio: magn: hmc5843: Move struct dev_pm_ops out of header Jonathan Cameron
@ 2022-08-07 18:58 ` Jonathan Cameron
2022-08-08 9:22 ` [PATCH 0/2] " Andy Shevchenko
3 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2022-08-07 18:58 UTC (permalink / raw)
To: linux-iio; +Cc: Paul Cercueil, Jonathan Cameron
On Sun, 7 Aug 2022 19:45:32 +0100
Jonathan Cameron <jic23@kernel.org> wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> This driver was taking an unusual approach to handling the optionality of
> structures / callbacks depending on CONFIG_PM. Bring it inline with
> other similar drivers.
>
> Part of continuing to move IIO over to the new PM macros that don't require
> such complex handling.
Obviously setting a bad example here. Should have include iio: magn: hmc5843 as
prefix for this cover letter. Sorry about that!
>
> Jonathan Cameron (2):
> iio: magn: hmc5843: Drop excessive indentation of assignments of
> hmc5843_driver
> iio: magn: hmc5843: Move struct dev_pm_ops out of header
>
> drivers/iio/magnetometer/hmc5843.h | 13 +------------
> drivers/iio/magnetometer/hmc5843_core.c | 8 ++++----
> drivers/iio/magnetometer/hmc5843_i2c.c | 2 +-
> drivers/iio/magnetometer/hmc5843_spi.c | 14 +++++++-------
> 4 files changed, 13 insertions(+), 24 deletions(-)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] Trivial cleanup and refactor dev_pm_ops handling.
2022-08-07 18:45 [PATCH 0/2] Trivial cleanup and refactor dev_pm_ops handling Jonathan Cameron
` (2 preceding siblings ...)
2022-08-07 18:58 ` [PATCH 0/2] iio: magn: hmc5843: Trivial cleanup and refactor dev_pm_ops handling Jonathan Cameron
@ 2022-08-08 9:22 ` Andy Shevchenko
2022-08-13 16:08 ` Jonathan Cameron
3 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2022-08-08 9:22 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, Paul Cercueil, Jonathan Cameron
On Sun, Aug 7, 2022 at 8:38 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> This driver was taking an unusual approach to handling the optionality of
> structures / callbacks depending on CONFIG_PM. Bring it inline with
> other similar drivers.
>
> Part of continuing to move IIO over to the new PM macros that don't require
> such complex handling.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Jonathan Cameron (2):
> iio: magn: hmc5843: Drop excessive indentation of assignments of
> hmc5843_driver
> iio: magn: hmc5843: Move struct dev_pm_ops out of header
>
> drivers/iio/magnetometer/hmc5843.h | 13 +------------
> drivers/iio/magnetometer/hmc5843_core.c | 8 ++++----
> drivers/iio/magnetometer/hmc5843_i2c.c | 2 +-
> drivers/iio/magnetometer/hmc5843_spi.c | 14 +++++++-------
> 4 files changed, 13 insertions(+), 24 deletions(-)
>
> --
> 2.37.1
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] Trivial cleanup and refactor dev_pm_ops handling.
2022-08-08 9:22 ` [PATCH 0/2] " Andy Shevchenko
@ 2022-08-13 16:08 ` Jonathan Cameron
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2022-08-13 16:08 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-iio, Paul Cercueil, Jonathan Cameron
On Mon, 8 Aug 2022 11:22:00 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Sun, Aug 7, 2022 at 8:38 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > This driver was taking an unusual approach to handling the optionality of
> > structures / callbacks depending on CONFIG_PM. Bring it inline with
> > other similar drivers.
> >
> > Part of continuing to move IIO over to the new PM macros that don't require
> > such complex handling.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Thanks,
Applied
>
> > Jonathan Cameron (2):
> > iio: magn: hmc5843: Drop excessive indentation of assignments of
> > hmc5843_driver
> > iio: magn: hmc5843: Move struct dev_pm_ops out of header
> >
> > drivers/iio/magnetometer/hmc5843.h | 13 +------------
> > drivers/iio/magnetometer/hmc5843_core.c | 8 ++++----
> > drivers/iio/magnetometer/hmc5843_i2c.c | 2 +-
> > drivers/iio/magnetometer/hmc5843_spi.c | 14 +++++++-------
> > 4 files changed, 13 insertions(+), 24 deletions(-)
> >
> > --
> > 2.37.1
> >
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-08-13 15:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-07 18:45 [PATCH 0/2] Trivial cleanup and refactor dev_pm_ops handling Jonathan Cameron
2022-08-07 18:45 ` [PATCH 1/2] iio: magn: hmc5843: Drop excessive indentation of assignments of hmc5843_driver Jonathan Cameron
2022-08-07 18:45 ` [PATCH 2/2] iio: magn: hmc5843: Move struct dev_pm_ops out of header Jonathan Cameron
2022-08-07 18:58 ` [PATCH 0/2] iio: magn: hmc5843: Trivial cleanup and refactor dev_pm_ops handling Jonathan Cameron
2022-08-08 9:22 ` [PATCH 0/2] " Andy Shevchenko
2022-08-13 16:08 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).