public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Ray Chi <raychi@google.com>
Cc: mathias.nyman@intel.com, stern@rowland.harvard.edu,
	badhri@google.com, albertccwang@google.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] usb: xhci: add check_init_status hook support
Date: Tue, 16 Aug 2022 10:57:27 +0200	[thread overview]
Message-ID: <Yvtb93dhvhTS5xYB@kroah.com> (raw)
In-Reply-To: <20220816083854.1491886-3-raychi@google.com>

On Tue, Aug 16, 2022 at 04:38:54PM +0800, Ray Chi wrote:
> In general, xHCI didn't do anything for port initialization. However,
> there are some requirement or limitation on various platforms, so
> vendors need to do some error handlings if the device connected to a
> broken USB accessory.
> 
> This patch also add the hook to xhci_driver_overrides so that vendors
> can add their specific protection easily if needed.
> 
> Signed-off-by: Ray Chi <raychi@google.com>
> ---
>  drivers/usb/host/xhci.c | 17 +++++++++++++++++
>  drivers/usb/host/xhci.h |  1 +
>  2 files changed, 18 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 65858f607437..f237af9d6e2e 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -4358,6 +4358,20 @@ static int xhci_enable_device(struct usb_hcd *hcd, struct usb_device *udev)
>  	return xhci_setup_device(hcd, udev, SETUP_CONTEXT_ONLY);
>  }
>  
> +/*
> + * The function could get the status of port initialization.
> + */
> +static int xhci_check_init_status(struct usb_hcd *hcd, struct usb_device *udev, int r)
> +{
> +	/*
> +	 * In general, this function is not necessory. Some platforms may
> +	 * need doing error handling when the port initialization takes a
> +	 * long time to do. The device can use the override callback to
> +	 * do specific handlings.
> +	 */
> +	return 0;
> +}

For obvious technical and legal reasons, we are not allowed to add
"hooks" to the kernel where there are no in-kernel users.  Nor would you
want us to do so.

So I really do not understand this patch series at all.

What driver wants to do odd things here?  What needs to happen that the
in-tree drivers are not doing properly?  Why not get the needed fixes in
the in-kernel drivers instead of trying to add random hooks that some
out-of-tree code would use instead.

confused,

greg k-h

  reply	other threads:[~2022-08-16  9:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  8:38 [PATCH 0/2] Provide a hook to check port init status Ray Chi
2022-08-16  8:38 ` [PATCH 1/2] usb: core: add " Ray Chi
2022-08-16 13:53   ` Alan Stern
2022-08-16  8:38 ` [PATCH 2/2] usb: xhci: add check_init_status hook support Ray Chi
2022-08-16  8:57   ` Greg KH [this message]
2022-08-22 15:42     ` Ray Chi

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=Yvtb93dhvhTS5xYB@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=albertccwang@google.com \
    --cc=badhri@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=raychi@google.com \
    --cc=stern@rowland.harvard.edu \
    /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