Re: [PATCH] input: misc: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
| Newsgroups | org.kernel.vger.linux-input |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The patch breaks the build when `CONFIG_PM` is disabled because `pm80x_dev_suspend` and `pm80x_dev_resume` become undeclared identifiers. -- --- Patch [1]: [PATCH] input: misc: Convert to DEFINE_SIMPLE_DEV_PM_OPS() --- commit 831b6a38a335cea06b4312be1068bf63ef9bd3c9 Author: Triet Hoang <[email protected]> input: misc: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Convert deprecated SIMPLE_DEV_PM_OPS to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr(). This drops the __maybe_unused annotations from the resume callbacks and reduces kernel size when PM is disabled. > diff --git a/drivers/input/misc/88pm80x_onkey.c b/drivers/input/misc/88pm80x_onkey.c > index fee28e537898a..d4f344e2bf5c4 100644 > --- a/drivers/input/misc/88pm80x_onkey.c > +++ b/drivers/input/misc/88pm80x_onkey.c [ ... ] > @@ -47,7 +47,7 @@ static irqreturn_t pm80x_onkey_handler(int irq, void *data) > return IRQ_HANDLED; > } > > -static SIMPLE_DEV_PM_OPS(pm80x_onkey_pm_ops, pm80x_dev_suspend, > +static DEFINE_SIMPLE_DEV_PM_OPS(pm80x_onkey_pm_ops, pm80x_dev_suspend, > pm80x_dev_resume); [Severity: Low] Does this break the build when CONFIG_PM is disabled? Unlike SIMPLE_DEV_PM_OPS, DEFINE_SIMPLE_DEV_PM_OPS uses pm_sleep_ptr() which evaluates the C ternary operator with IS_ENABLED(). This means the compiler still parses the arguments and requires them to be declared, even if they are ultimately discarded. Looking at include/linux/mfd/88pm80x.h, pm80x_dev_suspend and pm80x_dev_resume are wrapped in #ifdef CONFIG_PM without providing empty fallback stubs: #ifdef CONFIG_PM static inline int pm80x_dev_suspend(struct device *dev) { ... Will this result in undeclared identifier compilation errors when building with CONFIG_PM=n? -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1