Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85560c4a authored by Champion Chen's avatar Champion Chen Committed by Marcel Holtmann
Browse files

Bluetooth: Fix issue with USB suspend in btusb driver



Suspend could fail for some platforms because
btusb_suspend==> btusb_stop_traffic ==> usb_kill_anchored_urbs.

When btusb_bulk_complete returns before system suspend and resubmits
an URB, the system cannot enter suspend state.

Signed-off-by: default avatarChampion Chen <champion_chen@realsil.com.cn>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org
parent e1e930f5
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -331,6 +331,9 @@ static void btusb_intr_complete(struct urb *urb)
			BT_ERR("%s corrupted event packet", hdev->name);
			BT_ERR("%s corrupted event packet", hdev->name);
			hdev->stat.err_rx++;
			hdev->stat.err_rx++;
		}
		}
	} else if (urb->status == -ENOENT) {
		/* Avoid suspend failed when usb_kill_urb */
		return;
	}
	}


	if (!test_bit(BTUSB_INTR_RUNNING, &data->flags))
	if (!test_bit(BTUSB_INTR_RUNNING, &data->flags))
@@ -419,6 +422,9 @@ static void btusb_bulk_complete(struct urb *urb)
			BT_ERR("%s corrupted ACL packet", hdev->name);
			BT_ERR("%s corrupted ACL packet", hdev->name);
			hdev->stat.err_rx++;
			hdev->stat.err_rx++;
		}
		}
	} else if (urb->status == -ENOENT) {
		/* Avoid suspend failed when usb_kill_urb */
		return;
	}
	}


	if (!test_bit(BTUSB_BULK_RUNNING, &data->flags))
	if (!test_bit(BTUSB_BULK_RUNNING, &data->flags))
@@ -513,6 +519,9 @@ static void btusb_isoc_complete(struct urb *urb)
				hdev->stat.err_rx++;
				hdev->stat.err_rx++;
			}
			}
		}
		}
	} else if (urb->status == -ENOENT) {
		/* Avoid suspend failed when usb_kill_urb */
		return;
	}
	}


	if (!test_bit(BTUSB_ISOC_RUNNING, &data->flags))
	if (!test_bit(BTUSB_ISOC_RUNNING, &data->flags))