Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3443324rwb; Tue, 16 Aug 2022 03:12:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR726EpQ9VBuB7tokYwq93bOUKK9/F5oEK5wh1wCtmcAOlsaZAwQRzxNkBr1ImHUKk2OVv1F X-Received: by 2002:a05:6a00:2a05:b0:52e:6c05:9b84 with SMTP id ce5-20020a056a002a0500b0052e6c059b84mr19854778pfb.77.1660644731179; Tue, 16 Aug 2022 03:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660644731; cv=none; d=google.com; s=arc-20160816; b=Km987bodZvRRcwSEYb28/0r9AYz8ztTqN4+1ErY5RCnSL0pbiZ7V1DUz3kz56fQLE5 KAENZtt/JznkIh6uLsHOeX1rHxe0NbcteqCC/0uZW+WgIHLL+v0TNe5PngtXctaqi4Xy 1Pf97tZppigcNIS5VvZ5zHeKJ2Wmi2jMV66QW61zug79FvV/hECisq78Zuh7OqFeQtby Np0b/7onhhmC5A4x3ZzB8uSuj55lCYr5rLFJGQWep5/Du/NQrKzskR2lfRl94EHZw8f3 4dPcZv2u9tCYL/lOEtr5Pj0X7PCgp8qoC5s5z3qeUGFqvv89YYLoF2xfW7ObvGTKN8AP meTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EpgM/1rOyyiDfYt0K6aR7G0u2kgxl1iRwXGAfQLMGnM=; b=H3HntTi3tQUiQhAX10Teg0cp6kJQCB2//cby6qRw+o+/eG/rsRxyW53uREZ/kBj9iE wYiaWmIA1f8x9LP8VuWbK9QsnZdZIU7PHv6qcLMxKC/fMuwLw+hu4NUpqc1a/yKjXdHK r3+GMxxQmQPMI0EN20y/4LXSuuX7M1l65l+s6DIXa1flYA5vfs7fzio6+DUmi6KuFG0K EyvwbCLmvTm6CTOgVGjj8/o7DLXUYBGSa9qiqCHiQUm1X9NaPhZWlEtoAWl5PZqGhahz 3MOuhybAoH23Waav7NNctOaz9aczK38UHv/7n7OqT9akh19f06MBstLARz2u5i9ga/bH aNIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gqFe9agb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020aa78886000000b0051b79672ca1si12677993pfe.123.2022.08.16.03.12.00; Tue, 16 Aug 2022 03:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gqFe9agb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233904AbiHPJnN (ORCPT + 99 others); Tue, 16 Aug 2022 05:43:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233786AbiHPJme (ORCPT ); Tue, 16 Aug 2022 05:42:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4491BC135; Tue, 16 Aug 2022 01:57:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E3E3611EB; Tue, 16 Aug 2022 08:57:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 599EDC433D6; Tue, 16 Aug 2022 08:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660640250; bh=3/vRXYAeMjGp2cIzyMyjGYylVgkaUhI3NpSv+xA0dq4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gqFe9agbbvtCsrWNJWcll49KYAKUy7ea26mAaQYWKRttNVaDZC3PUfrglC9+8CD+3 8yrxf/GxjIHZ2nd8CDVAAgSXgqtoTizgsfg6DFiOKHo1LRiQxxnFmqaFlNzwh40zyx ieVcYlvsHcSAoYhQ7oWJDVOF7qkWMkh4x6bLg+fE= Date: Tue, 16 Aug 2022 10:57:27 +0200 From: Greg KH To: Ray Chi 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 Message-ID: References: <20220816083854.1491886-1-raychi@google.com> <20220816083854.1491886-3-raychi@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220816083854.1491886-3-raychi@google.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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