Commit 80294537 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Guenter Roeck
Browse files

hwmon: (max31722) Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()



These newer PM macros allow the compiler to see what code it can remove
if !CONFIG_PM_SLEEP. This allows the removal of __maybe_unused markings
whilst achieving the same result.

Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220925172759.3573439-10-jic23@kernel.org


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent ca19f965
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ static void max31722_remove(struct spi_device *spi)
		dev_warn(&spi->dev, "Failed to put device in stand-by mode\n");
}

static int __maybe_unused max31722_suspend(struct device *dev)
static int max31722_suspend(struct device *dev)
{
	struct spi_device *spi_device = to_spi_device(dev);
	struct max31722_data *data = spi_get_drvdata(spi_device);
@@ -121,7 +121,7 @@ static int __maybe_unused max31722_suspend(struct device *dev)
	return max31722_set_mode(data, MAX31722_MODE_STANDBY);
}

static int __maybe_unused max31722_resume(struct device *dev)
static int max31722_resume(struct device *dev)
{
	struct spi_device *spi_device = to_spi_device(dev);
	struct max31722_data *data = spi_get_drvdata(spi_device);
@@ -129,7 +129,7 @@ static int __maybe_unused max31722_resume(struct device *dev)
	return max31722_set_mode(data, MAX31722_MODE_CONTINUOUS);
}

static SIMPLE_DEV_PM_OPS(max31722_pm_ops, max31722_suspend, max31722_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(max31722_pm_ops, max31722_suspend, max31722_resume);

static const struct spi_device_id max31722_spi_id[] = {
	{"max31722", 0},
@@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(spi, max31722_spi_id);
static struct spi_driver max31722_driver = {
	.driver = {
		.name = "max31722",
		.pm = &max31722_pm_ops,
		.pm = pm_sleep_ptr(&max31722_pm_ops),
	},
	.probe =            max31722_probe,
	.remove =           max31722_remove,