--- zzzz-none-000/linux-4.1.52/drivers/usb/storage/usb.c 2018-05-28 02:26:45.000000000 +0000 +++ bcm63-7530ax-731/linux-4.1.52/drivers/usb/storage/usb.c 2022-03-02 11:37:13.000000000 +0000 @@ -58,6 +58,10 @@ #include #include +#if defined(CONFIG_BCM_KF_USB_STORAGE) +#include +#endif + #include #include #include @@ -76,12 +80,21 @@ #include "uas-detect.h" #endif +/* == 20180328 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"); +/* == 20160222 AVM/VGJ 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"); @@ -795,6 +808,14 @@ "Unable to start control thread\n"); return PTR_ERR(th); } +#if defined(CONFIG_BCM_KF_USB_STORAGE) + /*convert the thread to realtime RR thread */ + { + struct sched_param param; + param.sched_priority = BCM_RTPRIO_DATA; + sched_setscheduler(th, SCHED_RR, ¶m); + } +#endif us->ctl_thread = th; return 0; @@ -847,19 +868,33 @@ wake_up(&us->delay_wait); } + /* == 20171214 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); + /* == 20171214 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. */ + /* == 20171214 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. @@ -910,6 +945,9 @@ /* Should we unbind if no devices were detected? */ usb_autopm_put_interface(us->pusb_intf); + /* == 20171214 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); } @@ -1085,6 +1123,23 @@ int result; int size; +#if 1 + /* == 20160222 AVM/VGJ - CHANGESET: STICK_AND_SURF == + * 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; + } + } +#endif + /* If uas is enabled and this device can do uas then ignore it. */ #if IS_ENABLED(CONFIG_USB_UAS) if (uas_use_uas_driver(intf, id, NULL))