Re: [PATCH] hwmon: jc42: Simplify pm ops handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14.11.2023 14:53, Guenter Roeck wrote:
> On Mon, Nov 13, 2023 at 08:20:49PM +0100, Heiner Kallweit wrote:
>> Use pm_sleep_ptr/DEFINE_SIMPLE_DEV_PM_OPS to simplify the code.
>>
>> Note: Apparently conditional compiling based on CONFIG_PM
>> wasn't optimal, it should have been CONFIG_PM_SLEEP.
> 
> Maybe that is apparent to you, but not to me, and I assume it won't
> be apparent to others either. That warrants a real explanation,
> not just "apparently".
> 

See e.g. pm_generic_suspend(), it's NULL if CONFIG_PM_SLEEP isn't
defined. Another hint is the following from pm.h:

#ifdef CONFIG_PM_SLEEP
#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
	SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
#else
#define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
#endif

CONFIG_PM_SLEEP implies CONFIG_PM, but we can have a setup where
CONFIG_PM is defined but CONFIG_PM_SLEEP is not. In this case
jc42_suspend/resume would be defined but not used by the PM core.

> Guenter

Heiner




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux