On Wed, Sep 09, 2026 at 10:58:57AM +0800, Li Jun wrote: > Replace the deprecated SIMPLE_DEV_PM_OPS with DEFINE_SIMPLE_DEV_PM_OPS > and wrap the struct assignment with pm_sleep_ptr(). The old code keeps > a completely empty dev_pm_ops structure -- all callbacks are NULL -- > as dead code in the object file when CONFIG_PM_SLEEP=n, because > SET_SYSTEM_SLEEP_PM_OPS() expands to nothing while __maybe_unused on > the struct only silences the warning without removing the struct. > Switching to DEFINE_SIMPLE_DEV_PM_OPS() lets pm_sleep_ptr() eliminate > the callback references at compile time, and wrapping the struct > assignment with pm_sleep_ptr() drops the entire structure when > CONFIG_PM_SLEEP is disabled, instead of retaining an empty one. > > Signed-off-by: Li Jun <[email protected]> > --- > drivers/char/tpm/tpm_tis_i2c_cr50.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c > b/drivers/char/tpm/tpm_tis_i2c_cr50.c > index 7f828fae70d3..6c0ea5ca2b92 100644 > --- a/drivers/char/tpm/tpm_tis_i2c_cr50.c > +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c > @@ -816,14 +816,14 @@ static void tpm_cr50_i2c_remove(struct i2c_client > *client) > tpm_chip_unregister(chip); > } > > -static SIMPLE_DEV_PM_OPS(cr50_i2c_pm, tpm_pm_suspend, tpm_pm_resume); > +static DEFINE_SIMPLE_DEV_PM_OPS(cr50_i2c_pm, tpm_pm_suspend, tpm_pm_resume); > > static struct i2c_driver cr50_i2c_driver = { > .probe = tpm_cr50_i2c_probe, > .remove = tpm_cr50_i2c_remove, > .driver = { > .name = "cr50_i2c", > - .pm = &cr50_i2c_pm, > + .pm = pm_sleep_ptr(&cr50_i2c_pm), > .acpi_match_table = ACPI_PTR(cr50_i2c_acpi_id), > .of_match_table = of_match_ptr(of_cr50_i2c_match), > }, > -- > 2.25.1 >
Reviewed-by: Jarkko Sakkinen <[email protected]> BR, Jarkko
