I2C: runtime: Fix checks which make legacy suspend to never get called
Subsystems (2)
PATCH 1/1 I2C: runtime: Fix checks which make legacy suspend to never get called
For devices which are not adapted to runtime PM a call to pm_runtime_suspended always returns true.
Hence the pm_runtime_suspended checks below prevent legacy suspend from getting called.
So do a pm_runtime_suspended check only for devices with a dev_pm_ops populated (which hence do not rely on the legacy suspend)
--- drivers/i2c/i2c-core.c | 44 ++++++++++++++++++++++++-------------------- 1 files changed, 24 insertions(+), 20 deletions(-)
drivers/i2c/i2c-core.c +24 -20
@@ -197,11 +197,12 @@ static int i2c_device_pm_suspend(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->suspend ? pm->suspend (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->suspend ? pm->suspend (dev) :0 ; + }return i2c_legacy_suspend (dev,PMSG_SUSPEND ); }
@@ -229,11 +230,12 @@ static int i2c_device_pm_freeze(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->freeze ? pm->freeze (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->freeze ? pm->freeze (dev) :0 ; + }return i2c_legacy_suspend (dev,PMSG_FREEZE ); }
@@ -242,11 +244,12 @@ static int i2c_device_pm_thaw(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->thaw ? pm->thaw (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->thaw ? pm->thaw (dev) :0 ; + }return i2c_legacy_resume (dev); }
@@ -255,11 +258,12 @@ static int i2c_device_pm_poweroff(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->poweroff ? pm->poweroff (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->poweroff ? pm->poweroff (dev) :0 ; + }return i2c_legacy_suspend (dev,PMSG_HIBERNATE ); }
Signature · 1 line
1.7.0.4
A message that is not in the archive (sent off-list or not yet received): 1285602360-21180-1-git-send-email-rnayak-l0cyMroinI0@public.gmane.org
Rafael J. Wysocki
Acked-byQuoted 9 lines · Rajendra Nayak
For devices which are not adapted to runtime PM a call to
pm_runtime_suspendedalways returns true.Hence the
pm_runtime_suspendedchecks below prevent legacy suspend from getting called.So do a
pm_runtime_suspendedcheck only for devices with adev_pm_opspopulated (which hence do not rely on the legacy suspend)
Makes sense.
Quoted 2 lines
Signed-off-by Rajendra Nayak <[email protected]>Cc Rafael J. Wysocki <[email protected]>
Quoted 85 lines
Cc Ben Dooks <[email protected]>Cc Mark Brown <broonie-yzvPICuk2AATkU/[email protected]>Cc Jean Delvare <[email protected]>Cc Kevin Hilman <[email protected]>--- drivers/i2c/i2c-core.c | 44 ++++++++++++++++++++++++-------------------- 1 files changed, 24 insertions(+), 20 deletions(-)drivers/i2c/i2c-core.c +24
-20@@ -197,11 +197,12 @@ static int i2c_device_pm_suspend(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->suspend ? pm->suspend (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->suspend ? pm->suspend (dev) :0 ; + }return i2c_legacy_suspend (dev,PMSG_SUSPEND ); }@@ -229,11 +230,12 @@ static int i2c_device_pm_freeze(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->freeze ? pm->freeze (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->freeze ? pm->freeze (dev) :0 ; + }return i2c_legacy_suspend (dev,PMSG_FREEZE ); }@@ -242,11 +244,12 @@ static int i2c_device_pm_thaw(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->thaw ? pm->thaw (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->thaw ? pm->thaw (dev) :0 ; + }return i2c_legacy_resume (dev); }@@ -255,11 +258,12 @@ static int i2c_device_pm_poweroff(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->poweroff ? pm->poweroff (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->poweroff ? pm->poweroff (dev) :0 ; + }return i2c_legacy_suspend (dev,PMSG_HIBERNATE ); }
A message that is not in the archive (sent off-list or not yet received): [email protected]
Jean Delvare
AppliedQuoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Rajendra Nayak
For devices which are not adapted to runtime PM a call to
pm_runtime_suspendedalways returns true.Hence the
pm_runtime_suspendedchecks below prevent legacy suspend from getting called.So do a
pm_runtime_suspendedcheck only for devices with adev_pm_opspopulated (which hence do not rely on the legacy suspend)
Quoted 14 lines
Makes sense.
Quoted 2 lines
Signed-off-by Rajendra Nayak <[email protected]>Cc Rafael J. Wysocki <[email protected]>Quoted 7 lines
Cc Ben Dooks <[email protected]>Cc Mark Brown <broonie-yzvPICuk2AATkU/[email protected]>Cc Jean Delvare <[email protected]>Cc Kevin Hilman <[email protected]>--- drivers/i2c/i2c-core.c | 44 ++++++++++++++++++++++++-------------------- 1 files changed, 24 insertions(+), 20 deletions(-)
Applied, thanks.
Signature · 1 line
Jean Delvare
Jean Delvare
AppliedQuoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Rajendra Nayak
For devices which are not adapted to runtime PM a call to
pm_runtime_suspendedalways returns true.Hence the
pm_runtime_suspendedchecks below prevent legacy suspend from getting called.So do a
pm_runtime_suspendedcheck only for devices with adev_pm_opspopulated (which hence do not rely on the legacy suspend)
Quoted 14 lines
Makes sense.
Quoted 2 lines
Signed-off-by Rajendra Nayak <[email protected]>Cc Rafael J. Wysocki <[email protected]>Quoted 7 lines
Cc Ben Dooks <[email protected]>Cc Mark Brown <[email protected]>Cc Jean Delvare <[email protected]>Cc Kevin Hilman <[email protected]>--- drivers/i2c/i2c-core.c | 44 ++++++++++++++++++++++++-------------------- 1 files changed, 24 insertions(+), 20 deletions(-)
Applied, thanks.
Signature · 1 line
Jean Delvare
Quoted 9 lines · Rajendra Nayak
For devices which are not adapted to runtime PM a call to
pm_runtime_suspendedalways returns true.Hence the
pm_runtime_suspendedchecks below prevent legacy suspend from getting called.So do a
pm_runtime_suspendedcheck only for devices with adev_pm_opspopulated (which hence do not rely on the legacy suspend)
Makes sense.
Quoted 2 lines
Signed-off-by Rajendra Nayak <[email protected]>Cc Rafael J. Wysocki <[email protected]>
Quoted 85 lines
Cc Ben Dooks <[email protected]>Cc Mark Brown <[email protected]>Cc Jean Delvare <[email protected]>Cc Kevin Hilman <[email protected]>--- drivers/i2c/i2c-core.c | 44 ++++++++++++++++++++++++-------------------- 1 files changed, 24 insertions(+), 20 deletions(-)drivers/i2c/i2c-core.c +24
-20@@ -197,11 +197,12 @@ static int i2c_device_pm_suspend(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->suspend ? pm->suspend (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->suspend ? pm->suspend (dev) :0 ; + }return i2c_legacy_suspend (dev,PMSG_SUSPEND ); }@@ -229,11 +230,12 @@ static int i2c_device_pm_freeze(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->freeze ? pm->freeze (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->freeze ? pm->freeze (dev) :0 ; + }return i2c_legacy_suspend (dev,PMSG_FREEZE ); }@@ -242,11 +244,12 @@ static int i2c_device_pm_thaw(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->thaw ? pm->thaw (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->thaw ? pm->thaw (dev) :0 ; + }return i2c_legacy_resume (dev); }@@ -255,11 +258,12 @@ static int i2c_device_pm_poweroff(struct device *dev) {const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ; -if (pm_runtime_suspended (dev)) -return 0 ; - -if (pm) -return pm->poweroff ? pm->poweroff (dev) :0 ; +if (pm) { +if (pm_runtime_suspended (dev)) +return 0 ; +else +return pm->poweroff ? pm->poweroff (dev) :0 ; + }return i2c_legacy_suspend (dev,PMSG_HIBERNATE ); }