diff options
| -rw-r--r-- | drivers/mfd/rtsx_usb.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c index 210d1f85679e..ede50244f265 100644 --- a/drivers/mfd/rtsx_usb.c +++ b/drivers/mfd/rtsx_usb.c | |||
| @@ -681,9 +681,27 @@ static void rtsx_usb_disconnect(struct usb_interface *intf) | |||
| 681 | #ifdef CONFIG_PM | 681 | #ifdef CONFIG_PM |
| 682 | static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message) | 682 | static int rtsx_usb_suspend(struct usb_interface *intf, pm_message_t message) |
| 683 | { | 683 | { |
| 684 | struct rtsx_ucr *ucr = | ||
| 685 | (struct rtsx_ucr *)usb_get_intfdata(intf); | ||
| 686 | u16 val = 0; | ||
| 687 | |||
| 684 | dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n", | 688 | dev_dbg(&intf->dev, "%s called with pm message 0x%04x\n", |
| 685 | __func__, message.event); | 689 | __func__, message.event); |
| 686 | 690 | ||
| 691 | if (PMSG_IS_AUTO(message)) { | ||
| 692 | if (mutex_trylock(&ucr->dev_mutex)) { | ||
| 693 | rtsx_usb_get_card_status(ucr, &val); | ||
| 694 | mutex_unlock(&ucr->dev_mutex); | ||
| 695 | |||
| 696 | /* Defer the autosuspend if card exists */ | ||
| 697 | if (val & (SD_CD | MS_CD)) | ||
| 698 | return -EAGAIN; | ||
| 699 | } else { | ||
| 700 | /* There is an ongoing operation*/ | ||
| 701 | return -EAGAIN; | ||
| 702 | } | ||
| 703 | } | ||
| 704 | |||
| 687 | return 0; | 705 | return 0; |
| 688 | } | 706 | } |
| 689 | 707 | ||
