diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-01-08 14:08:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-08 14:08:25 -0500 |
commit | 9fd7a1d92b4462acaa460bb0f58b12ede6ffe6b9 (patch) | |
tree | 16b4dd7ddca6cca4cdcb4a5d76643284c627ccaf /drivers/net/wimax/i2400m/usb.c | |
parent | a2e9da4b09c99857080afd2e8143f70bc03ebe9b (diff) |
i2400m/usb: wrap USB power saving in #ifdef CONFIG_PM
Current code was assuming PM was always enabled, which is not
correct. Code which accesses members in the struct usb_device that are
dependant on CONFIG_PM must be protected the same.
Reported by Randy Dunlap from a build error in the linux-next tree on
07/01/2009.
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wimax/i2400m/usb.c')
-rw-r--r-- | drivers/net/wimax/i2400m/usb.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c index 6d4b65fd9c17..c6d93465c7e2 100644 --- a/drivers/net/wimax/i2400m/usb.c +++ b/drivers/net/wimax/i2400m/usb.c | |||
@@ -397,11 +397,13 @@ int i2400mu_probe(struct usb_interface *iface, | |||
397 | i2400m->bus_fw_name = I2400MU_FW_FILE_NAME; | 397 | i2400m->bus_fw_name = I2400MU_FW_FILE_NAME; |
398 | i2400m->bus_bm_mac_addr_impaired = 0; | 398 | i2400m->bus_bm_mac_addr_impaired = 0; |
399 | 399 | ||
400 | #ifdef CONFIG_PM | ||
400 | iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */ | 401 | iface->needs_remote_wakeup = 1; /* autosuspend (15s delay) */ |
401 | device_init_wakeup(dev, 1); | 402 | device_init_wakeup(dev, 1); |
402 | usb_autopm_enable(i2400mu->usb_iface); | 403 | usb_autopm_enable(i2400mu->usb_iface); |
403 | usb_dev->autosuspend_delay = 15 * HZ; | 404 | usb_dev->autosuspend_delay = 15 * HZ; |
404 | usb_dev->autosuspend_disabled = 0; | 405 | usb_dev->autosuspend_disabled = 0; |
406 | #endif | ||
405 | 407 | ||
406 | result = i2400m_setup(i2400m, I2400M_BRI_MAC_REINIT); | 408 | result = i2400m_setup(i2400m, I2400M_BRI_MAC_REINIT); |
407 | if (result < 0) { | 409 | if (result < 0) { |
@@ -493,7 +495,9 @@ int i2400mu_suspend(struct usb_interface *iface, pm_message_t pm_msg) | |||
493 | int result = 0; | 495 | int result = 0; |
494 | struct device *dev = &iface->dev; | 496 | struct device *dev = &iface->dev; |
495 | struct i2400mu *i2400mu = usb_get_intfdata(iface); | 497 | struct i2400mu *i2400mu = usb_get_intfdata(iface); |
498 | #ifdef CONFIG_PM | ||
496 | struct usb_device *usb_dev = i2400mu->usb_dev; | 499 | struct usb_device *usb_dev = i2400mu->usb_dev; |
500 | #endif | ||
497 | struct i2400m *i2400m = &i2400mu->i2400m; | 501 | struct i2400m *i2400m = &i2400mu->i2400m; |
498 | 502 | ||
499 | d_fnstart(3, dev, "(iface %p pm_msg %u)\n", iface, pm_msg.event); | 503 | d_fnstart(3, dev, "(iface %p pm_msg %u)\n", iface, pm_msg.event); |
@@ -503,11 +507,13 @@ int i2400mu_suspend(struct usb_interface *iface, pm_message_t pm_msg) | |||
503 | atomic_dec(&i2400mu->do_autopm); | 507 | atomic_dec(&i2400mu->do_autopm); |
504 | result = i2400m_cmd_enter_powersave(i2400m); | 508 | result = i2400m_cmd_enter_powersave(i2400m); |
505 | atomic_inc(&i2400mu->do_autopm); | 509 | atomic_inc(&i2400mu->do_autopm); |
510 | #ifdef CONFIG_PM | ||
506 | if (result < 0 && usb_dev->auto_pm == 0) { | 511 | if (result < 0 && usb_dev->auto_pm == 0) { |
507 | /* System suspend, can't fail */ | 512 | /* System suspend, can't fail */ |
508 | dev_err(dev, "failed to suspend, will reset on resume\n"); | 513 | dev_err(dev, "failed to suspend, will reset on resume\n"); |
509 | result = 0; | 514 | result = 0; |
510 | } | 515 | } |
516 | #endif | ||
511 | if (result < 0) | 517 | if (result < 0) |
512 | goto error_enter_powersave; | 518 | goto error_enter_powersave; |
513 | i2400mu_notification_release(i2400mu); | 519 | i2400mu_notification_release(i2400mu); |