From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 424FDC47404 for ; Wed, 9 Oct 2019 18:24:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F41520B7C for ; Wed, 9 Oct 2019 18:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731254AbfJISYW (ORCPT ); Wed, 9 Oct 2019 14:24:22 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:59097 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731134AbfJISYW (ORCPT ); Wed, 9 Oct 2019 14:24:22 -0400 X-Originating-IP: 83.155.44.161 Received: from classic (mon69-7-83-155-44-161.fbx.proxad.net [83.155.44.161]) (Authenticated sender: hadess@hadess.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id D68EE1BF207; Wed, 9 Oct 2019 18:24:19 +0000 (UTC) Message-ID: <0661117fc2ff5f926443513c6685b72b8f371d14.camel@hadess.net> Subject: Re: [PATCH 4/5] USB: Select better matching USB drivers when available From: Bastien Nocera To: Alan Stern Cc: linux-usb@vger.kernel.org, Greg Kroah-Hartman , Benjamin Tissoires Date: Wed, 09 Oct 2019 20:24:19 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Wed, 2019-10-09 at 13:28 -0400, Alan Stern wrote: > No, that's not quite it. > > Here's what should happen when the subclass driver is being probed: > First, call the generic_probe routine, and return immediately if that > fails. Then call the subclass driver's probe routine. If that gets > an > error, fail the probe call but tell the device core that the device > is > now bound to the generic driver, not to the subclass driver. So, something like that, on top of the existing patches? (I'm not sure whether device_driver_attach is the correct call to use here). - if (udriver->probe) - return udriver->probe(udev); - return 0; + if (!udriver->probe) + return 0; + error = udriver->probe(udev); + if (error == -ENODEV && + udrv != &usb_generic_driver) + return device_driver_attach(usb_generic_driver.drvwrap.driver, dev); + return error; Anything else in this patch series? I was concerned about the naming for "generic_init" in patch 2 ("subclass"). If there's nothing, I'll test and respin the patchset with the above changes tomorrow. Cheers