--- zzzz-none-000/linux-3.10.107/drivers/usb/storage/usb.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/drivers/usb/storage/usb.c 2021-11-10 11:53:55.000000000 +0000 @@ -73,12 +73,21 @@ #include "sierra_ms.h" #include "option_ms.h" +/* == 20170208 AVM/VGJ - Include AVM USB Suspend functions == */ +#include "../core/usb.h" + /* Some informational data */ MODULE_AUTHOR("Matthew Dharm "); MODULE_DESCRIPTION("USB Mass Storage driver for Linux"); MODULE_LICENSE("GPL"); +/* == 20150923 AVM/WK need delay for UMTS modeswitch ==*/ +#if defined (CONFIG_USB_SERIAL_OPTION) || defined (CONFIG_USB_SERIAL_OPTION_MODULE) +static unsigned int delay_use = 5; +#else static unsigned int delay_use = 1; +#endif + module_param(delay_use, uint, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device"); @@ -824,19 +833,33 @@ wake_up(&us->delay_wait); } + /* == 20170208 AVM/VGJ - Inc USB use counter -> prevents suspension + * Restore incremented counter to prevent suspension by default ==*/ + avm_usb_suspend_get_locked(us->pusb_dev); + /* Prevent SCSI scanning (if it hasn't started yet) * or wait for the SCSI-scanning routine to stop. */ cancel_delayed_work_sync(&us->scan_dwork); /* Balance autopm calls if scanning was cancelled */ - if (test_bit(US_FLIDX_SCAN_PENDING, &us->dflags)) + if (test_bit(US_FLIDX_SCAN_PENDING, &us->dflags)) { usb_autopm_put_interface_no_suspend(us->pusb_intf); + /* == 20170208 AVM/VGJ - Dec USB use counter -> Driver was not yet probed ==*/ + avm_usb_suspend_put_locked(us->pusb_dev); + } /* Removing the host will perform an orderly shutdown: caches * synchronized, disks spun down, etc. */ + /* == 20171124 AVM/WKR - FIX: Prevent deadlock with suspend_put in invoke_transport() == */ +#if defined (CONFIG_AVM_USB_SUSPEND) + usb_unlock_device(us->pusb_dev); +#endif scsi_remove_host(host); +#if defined (CONFIG_AVM_USB_SUSPEND) + usb_lock_device(us->pusb_dev); +#endif /* Prevent any new commands from being accepted and cut short * reset delays. @@ -879,6 +902,9 @@ /* Should we unbind if no devices were detected? */ usb_autopm_put_interface(us->pusb_intf); + /* == 20170208 AVM/VGJ - Dec USB use counter -> allows suspension + * Inc is done in usbcore to prevent suspension by default ==*/ + avm_usb_suspend_put(us->pusb_dev); clear_bit(US_FLIDX_SCAN_PENDING, &us->dflags); } @@ -1036,6 +1062,22 @@ int result; int size; + + /* == AVM/WK 20150309 Patch from AVM Kernel 2.6.32 + * Filter out all AVM (057C) mass storage devices... + */ + { + struct usb_device *udev; + #define AVM_VENDOR_ID 0x057C + udev = interface_to_usbdev(intf); + if (le16_to_cpu(udev->descriptor.idVendor) == AVM_VENDOR_ID) { + printk (KERN_INFO "USB Mass Storage device (%04x:%04x) ignored!\n", + le16_to_cpu(udev->descriptor.idVendor), + le16_to_cpu(udev->descriptor.idProduct)); + return -ENODEV; + } + } + /* * If the device isn't standard (is handled by a subdriver * module) then don't accept it.