diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 13927d54cb4e..9b3cac13a4a8 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -197,11 +197,12 @@ static int i2c_device_pm_suspend(struct device *dev) | |||
197 | { | 197 | { |
198 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 198 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
199 | 199 | ||
200 | if (pm_runtime_suspended(dev)) | 200 | if (pm) { |
201 | return 0; | 201 | if (pm_runtime_suspended(dev)) |
202 | 202 | return 0; | |
203 | if (pm) | 203 | else |
204 | return pm->suspend ? pm->suspend(dev) : 0; | 204 | return pm->suspend ? pm->suspend(dev) : 0; |
205 | } | ||
205 | 206 | ||
206 | return i2c_legacy_suspend(dev, PMSG_SUSPEND); | 207 | return i2c_legacy_suspend(dev, PMSG_SUSPEND); |
207 | } | 208 | } |
@@ -223,11 +224,12 @@ static int i2c_device_pm_freeze(struct device *dev) | |||
223 | { | 224 | { |
224 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 225 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
225 | 226 | ||
226 | if (pm_runtime_suspended(dev)) | 227 | if (pm) { |
227 | return 0; | 228 | if (pm_runtime_suspended(dev)) |
228 | 229 | return 0; | |
229 | if (pm) | 230 | else |
230 | return pm->freeze ? pm->freeze(dev) : 0; | 231 | return pm->freeze ? pm->freeze(dev) : 0; |
232 | } | ||
231 | 233 | ||
232 | return i2c_legacy_suspend(dev, PMSG_FREEZE); | 234 | return i2c_legacy_suspend(dev, PMSG_FREEZE); |
233 | } | 235 | } |
@@ -236,11 +238,12 @@ static int i2c_device_pm_thaw(struct device *dev) | |||
236 | { | 238 | { |
237 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 239 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
238 | 240 | ||
239 | if (pm_runtime_suspended(dev)) | 241 | if (pm) { |
240 | return 0; | 242 | if (pm_runtime_suspended(dev)) |
241 | 243 | return 0; | |
242 | if (pm) | 244 | else |
243 | return pm->thaw ? pm->thaw(dev) : 0; | 245 | return pm->thaw ? pm->thaw(dev) : 0; |
246 | } | ||
244 | 247 | ||
245 | return i2c_legacy_resume(dev); | 248 | return i2c_legacy_resume(dev); |
246 | } | 249 | } |
@@ -249,11 +252,12 @@ static int i2c_device_pm_poweroff(struct device *dev) | |||
249 | { | 252 | { |
250 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 253 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
251 | 254 | ||
252 | if (pm_runtime_suspended(dev)) | 255 | if (pm) { |
253 | return 0; | 256 | if (pm_runtime_suspended(dev)) |
254 | 257 | return 0; | |
255 | if (pm) | 258 | else |
256 | return pm->poweroff ? pm->poweroff(dev) : 0; | 259 | return pm->poweroff ? pm->poweroff(dev) : 0; |
260 | } | ||
257 | 261 | ||
258 | return i2c_legacy_suspend(dev, PMSG_HIBERNATE); | 262 | return i2c_legacy_suspend(dev, PMSG_HIBERNATE); |
259 | } | 263 | } |