From patchwork Tue Sep 1 15:11:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 264676 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=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 12EEEC433E6 for ; Tue, 1 Sep 2020 15:54:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DAD3820767 for ; Tue, 1 Sep 2020 15:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598975687; bh=uIwk2wrXnK7VOckal4KSAC2UKUEXqrPEx2GCl3fKxic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Hz/+3EVcWbvIXw44NiFs/vm46ab5Myv55sOT3RGhooNNc/Tp8ehzBZf47WIFFdp3a neiz4qgcKMi59i3wOjcTJcH1SOLU9OZR25Ul5RJ6SrL91vGypWI6alcDXmWwceqVs0 1xkOcEhhBbUw4pH32rZs30/jC1MFaUj/Nor4BpB4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731297AbgIAPyp (ORCPT ); Tue, 1 Sep 2020 11:54:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:35604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731929AbgIAPqK (ORCPT ); Tue, 1 Sep 2020 11:46:10 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9F69E2078B; Tue, 1 Sep 2020 15:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598975170; bh=uIwk2wrXnK7VOckal4KSAC2UKUEXqrPEx2GCl3fKxic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OHWQ6VBatCl6izu7XGeIA/cECQ28cn1rlraepEW7r/0P3wb21XIgtxSju7Hq8rDfJ 0Co49pjZHOukLHvoYlwZ1mHVeoihLBeP/0EF7klC0RM1d0N1U4ZRsJFq0J+aNMDmT+ TwQjEQmHGPytzQwyM8uiHQkbkLvaRrP7ebaneEjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bastien Nocera , Alan Stern Subject: [PATCH 5.8 236/255] USB: Also match device drivers using the ->match vfunc Date: Tue, 1 Sep 2020 17:11:32 +0200 Message-Id: <20200901151012.057602221@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901151000.800754757@linuxfoundation.org> References: <20200901151000.800754757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bastien Nocera commit adb6e6ac20eedcf1dce19dc75b224e63c0828ea1 upstream. We only ever used the ID table matching before, but we should also support open-coded match functions. Fixes: 88b7381a939de ("USB: Select better matching USB drivers when available") Signed-off-by: Bastien Nocera Cc: stable Acked-by: Alan Stern Link: https://lore.kernel.org/r/20200818110445.509668-1-hadess@hadess.net Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/generic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/usb/core/generic.c +++ b/drivers/usb/core/generic.c @@ -207,8 +207,9 @@ static int __check_usb_generic(struct de return 0; if (!udrv->id_table) return 0; - - return usb_device_match_id(udev, udrv->id_table) != NULL; + if (usb_device_match_id(udev, udrv->id_table) != NULL) + return 1; + return (udrv->match && udrv->match(udev)); } static bool usb_generic_driver_match(struct usb_device *udev)