From: "Greg KH (gregkh@linuxfoundation.org)" <gregkh@linuxfoundation.org>
To: "Schmid, Carsten" <Carsten_Schmid@mentor.com>
Cc: USB list <linux-usb@vger.kernel.org>,
Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: Re: [PATCH for 4.14] xhci: add xhci_get_virt_ep() helper
Date: Mon, 26 Jul 2021 12:05:00 +0200 [thread overview]
Message-ID: <YP6IzGT6gZNgudI6@kroah.com> (raw)
In-Reply-To: <3c42fbd4599a4a3e8b065418592973d9@SVR-IES-MBX-03.mgc.mentorg.com>
On Mon, Jul 26, 2021 at 09:11:30AM +0000, Schmid, Carsten wrote:
> From 804d2db49c8db94ff4652f13826a2c74dac33941 Mon Sep 17 00:00:00 2001
> From: Mathias Nyman <mathias.nyman@linux.intel.com>
> Date: Fri, 29 Jan 2021 15:00:22 +0200
> Subject: [PATCH] xhci: add xhci_get_virt_ep() helper
>
> [commit b1adc42d440df3233255e313a45ab7e9b2b74096 upstream]
>
> In several event handlers we need to find the right endpoint
> structure from slot_id and ep_index in the event.
>
> Add a helper for this, check that slot_id and ep_index are valid.
>
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> Link: https://lore.kernel.org/r/20210129130044.206855-6-mathias.nyman@linux.intel.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Carsten Schmid <carsten_schmid@mentor.com>
> ---
> Rationale:
> From mail thread " Possible race in 4.14 xhci stack"
> Searched for fix that Mathias Nyman mentioned.
> Fix didn't apply on 4.14 directly, needed some small adaption.
> Result provided here.
> @Greg: Patch is for 4.14, not tested if applies on other kernels.
> ---
> drivers/usb/host/xhci-ring.c | 58 ++++++++++++++++++++++++++++--------
> drivers/usb/host/xhci.h | 3 +-
> 2 files changed, 47 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index 9828c1eff9a5..ce5deac93418 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -444,6 +444,26 @@ static void ring_doorbell_for_active_rings(struct xhci_hcd *xhci,
> }
> }
>
> +static struct xhci_virt_ep *xhci_get_virt_ep(struct xhci_hcd *xhci,
> + unsigned int slot_id,
> + unsigned int ep_index)
> +{
> +if (slot_id == 0 || slot_id >= MAX_HC_SLOTS) {
> +xhci_warn(xhci, "Invalid slot_id %u\n", slot_id);
> +return NULL;
> +}
> +if (ep_index >= EP_CTX_PER_DEV) {
> +xhci_warn(xhci, "Invalid endpoint index %u\n", ep_index);
> +return NULL;
> +}
> +if (!xhci->devs[slot_id]) {
> +xhci_warn(xhci, "No xhci virt device for slot_id %u\n", slot_id);
> +return NULL;
> +}
> +
> +return &xhci->devs[slot_id]->eps[ep_index];
> +}
> +
Also, the patch is corrupted and can not be applied, even if I wanted to
:(
So can you fix that up when you resend all of the other versions too?
thanks,
greg k-h
next prev parent reply other threads:[~2021-07-26 10:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 9:11 [PATCH for 4.14] xhci: add xhci_get_virt_ep() helper Schmid, Carsten
2021-07-26 9:19 ` Greg KH (gregkh@linuxfoundation.org)
2021-07-26 9:32 ` Schmid, Carsten
2021-07-26 10:05 ` Greg KH (gregkh@linuxfoundation.org) [this message]
2021-07-26 10:13 ` Schmid, Carsten
2021-07-26 10:16 ` Greg KH (gregkh@linuxfoundation.org)
2021-07-26 12:22 ` Schmid, Carsten
2021-07-26 12:26 ` Felipe Balbi
2021-07-26 12:51 ` Greg KH (gregkh@linuxfoundation.org)
2021-07-26 12:59 ` Greg KH (gregkh@linuxfoundation.org)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YP6IzGT6gZNgudI6@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Carsten_Schmid@mentor.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox