--- zzzz-none-000/linux-4.19.183/drivers/usb/storage/usb.c 2021-03-24 10:07:39.000000000 +0000 +++ bcm63-7530ax-756/linux-4.19.183/drivers/usb/storage/usb.c 2023-06-28 08:54:20.000000000 +0000 @@ -60,6 +60,9 @@ #include "uas-detect.h" #endif +/* == 20180328 AVM/VGJ - Include AVM USB Suspend functions == */ +#include "../core/usb.h" + #define DRV_NAME "usb-storage" /* Some informational data */ @@ -850,6 +853,11 @@ 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. @@ -857,14 +865,24 @@ 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 @@ -919,6 +937,10 @@ /* 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); } @@ -1100,6 +1122,21 @@ int result; int size; + /* == 20160222 AVM/VGJ - CHANGESET: STICK_AND_SURF == + * Filter out all AVM (057C) mass storage devices... + */ + if (IS_ENABLED(CONFIG_AVM_KERNEL)) { + struct usb_device *udev; + #define AVM_VENDOR_ID 0x057C + udev = interface_to_usbdev(intf); + if (le16_to_cpu(udev->descriptor.idVendor) == AVM_VENDOR_ID) { + pr_info("USB Mass Storage device (%04x:%04x) ignored!\n", + le16_to_cpu(udev->descriptor.idVendor), + le16_to_cpu(udev->descriptor.idProduct)); + return -ENODEV; + } + } + /* 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))