2022-09-15 03:31:28

by Ren Zhijie

[permalink] [raw]
Subject: [PATCH -next] misc: microchip: pci1xxxx: Fix build error unused-function

If CONFIG_PM_SLEEP is not set,
make ARCH=x86_64, will be failed, like this:

drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:311:12: error: ‘pci1xxxx_gpio_resume’ defined but not used [-Werror=unused-function]
static int pci1xxxx_gpio_resume(struct device *dev)
^~~~~~~~~~~~~~~~~~~~
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:295:12: error: ‘pci1xxxx_gpio_suspend’ defined but not used [-Werror=unused-function]
static int pci1xxxx_gpio_suspend(struct device *dev)
^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros,
deprecate old ones"),
add new marco DEFINE_SIMPLE_DEV_PM_OPS to fix this unused-function problem.

Fixes: 4ec7ac90ff39 ("misc: microchip: pci1xxxx: Add power management functions - suspend & resume handlers.")
Signed-off-by: Ren Zhijie <[email protected]>
---
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c
index 9cc771c604ed..4cd541166b0c 100644
--- a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c
+++ b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c
@@ -405,7 +405,7 @@ static int pci1xxxx_gpio_probe(struct auxiliary_device *aux_dev,
return devm_gpiochip_add_data(&aux_dev->dev, &priv->gpio, priv);
}

-static SIMPLE_DEV_PM_OPS(pci1xxxx_gpio_pm_ops, pci1xxxx_gpio_suspend, pci1xxxx_gpio_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(pci1xxxx_gpio_pm_ops, pci1xxxx_gpio_suspend, pci1xxxx_gpio_resume);

static const struct auxiliary_device_id pci1xxxx_gpio_auxiliary_id_table[] = {
{.name = "mchp_pci1xxxx_gp.gp_gpio"},
--
2.17.1


2022-09-15 06:16:37

by Kumaravel Thiagarajan

[permalink] [raw]
Subject: RE: [PATCH -next] misc: microchip: pci1xxxx: Fix build error unused-function

> -----Original Message-----
> From: Ren Zhijie <[email protected]>
> Sent: Thursday, September 15, 2022 8:46 AM
> To: Kumaravel Thiagarajan - I21417
> <[email protected]>; [email protected];
> [email protected]
> Cc: [email protected]; [email protected]; Ren Zhijie
> <[email protected]>
> Subject: [PATCH -next] misc: microchip: pci1xxxx: Fix build error unused-
> function
>
> If CONFIG_PM_SLEEP is not set,
> make ARCH=x86_64, will be failed, like this:
>
> drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:311:12: error:
> ‘pci1xxxx_gpio_resume’ defined but not used [-Werror=unused-function]
> static int pci1xxxx_gpio_resume(struct device *dev)
> ^~~~~~~~~~~~~~~~~~~~
> drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:295:12: error:
> ‘pci1xxxx_gpio_suspend’ defined but not used [-Werror=unused-function]
> static int pci1xxxx_gpio_suspend(struct device *dev)
> ^~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
>
> commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate
> old ones"), add new marco DEFINE_SIMPLE_DEV_PM_OPS to fix this
> unused-function problem.
>
> Fixes: 4ec7ac90ff39 ("misc: microchip: pci1xxxx: Add power management
> functions - suspend & resume handlers.")
> Signed-off-by: Ren Zhijie <[email protected]>
> ---
> drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c
> b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c
> index 9cc771c604ed..4cd541166b0c 100644
> --- a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c
> +++ b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c
> @@ -405,7 +405,7 @@ static int pci1xxxx_gpio_probe(struct auxiliary_device
> *aux_dev,
> return devm_gpiochip_add_data(&aux_dev->dev, &priv->gpio, priv); }
>
> -static SIMPLE_DEV_PM_OPS(pci1xxxx_gpio_pm_ops,
> pci1xxxx_gpio_suspend, pci1xxxx_gpio_resume);
> +static DEFINE_SIMPLE_DEV_PM_OPS(pci1xxxx_gpio_pm_ops,
> +pci1xxxx_gpio_suspend, pci1xxxx_gpio_resume);
>
> static const struct auxiliary_device_id pci1xxxx_gpio_auxiliary_id_table[] = {
> {.name = "mchp_pci1xxxx_gp.gp_gpio"},
> --
> 2.17.1
This issue was already reported by Sudip <[email protected]> and already a patch is queued and
in review https://patchwork.ozlabs.org/project/linux-gpio/patch/[email protected]/

Thank You.

Regards,
Kumaravel