From patchwork Thu Oct 14 14:30:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 12558671 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FCBCC433EF for ; Thu, 14 Oct 2021 14:31:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 695316109E for ; Thu, 14 Oct 2021 14:31:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231475AbhJNOdF (ORCPT ); Thu, 14 Oct 2021 10:33:05 -0400 Received: from mail-bn7nam10on2065.outbound.protection.outlook.com ([40.107.92.65]:13281 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231822AbhJNOdD (ORCPT ); Thu, 14 Oct 2021 10:33:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TdtIS+EB/Edm9oWpLUXeHL23zkKHsAj+tq3lrYIf4hzKqOCe93Tp4ILj7NqMWrQeL0AJESL6ovutucOd9bvsrtR+Um+CIQ1ossE2MfjrwaT9QzBh+bdTd0a7nvZvhpJDaVcN4+cbBZwYau4HR7gUsoLTb9dUx1u/JndufQdF1sokoqUCs7bk0lGW/IqgfYWS+4OZy1wPToKkDAs9Yu7GO+6bi0S5Vj/ST0MftwrDeUX7ljyN1lhu+Eo24unfTmzskrJfxZp2FGwYFeZB5FoqPq7lVTUVu6x0UYXY4EsEXb/bOwWuB59zt3DCowjVS98ma9MXyRZ6q2iKxruVIuSEnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pk1JgEHAcQHubNtfRRkcleaHDt09SGba+15Hd9l57yg=; b=HuGKWDRM/SK72aQ3jJeHOuhu9x9Yilr1ESqPmp4ts2q0t7irXHMe8VE6Rx7ysNcRHSy2N85x+bK0i6UztIkw0j0A9CF0FLmfYthBe3BfRBuPZD9DCa0kVOadcnpeAgJt2hfgllyfT91eNEOxGFxX5e+Ib+uzB6Isfo7uafpaXtsubGJVba7cThsVgvAPpJENf2R8qTsa7IpyBZdJwnHQi+4AFSF+xez4E25+FdmiuoIDyMCHnoSkRE9NQn2qwN0y1f7nVVySQUoDvn8TLiGJS4ktHBZRBVdXKSMKS2WghXaLqxhf/jHhgxZmBFepkNbTNPZ8jCB3imzkNFk5yfVVlw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pk1JgEHAcQHubNtfRRkcleaHDt09SGba+15Hd9l57yg=; b=CrnnS9bBy4myWYrj7Y/yxT1b/KTWysj1CsAD7okaDacUmLrfm4HV9pPE87dG2oemU5AIAAju73ZOrCJSM54/tMYXf72kBA8z7N5Q44wIjMUyaAIVthY8NlgWRWXEjD1Fa0dd8smbXBh0U2IxvQjpTdzBB0gQ/nEmX6lCKekl2n8= Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by PH0PR11MB5643.namprd11.prod.outlook.com (2603:10b6:510:d5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Thu, 14 Oct 2021 14:30:54 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::31cb:3b13:b0e8:d8f4]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::31cb:3b13:b0e8:d8f4%9]) with mapi id 15.20.4587.026; Thu, 14 Oct 2021 14:30:54 +0000 From: Jerome Pouiller To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, Kalle Valo , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [RFC PATCH 1/2] mmc: rewrite mmc_fixup_device() Date: Thu, 14 Oct 2021 16:30:30 +0200 Message-Id: <20211014143031.1313783-2-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014143031.1313783-1-Jerome.Pouiller@silabs.com> References: <20211014143031.1313783-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PAZP264CA0161.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f9::20) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 Received: from pc-42.silabs.com (37.71.187.125) by PAZP264CA0161.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Thu, 14 Oct 2021 14:30:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a16c88a5-dd1b-4dfd-9a3f-08d98f1f3aa1 X-MS-TrafficTypeDiagnostic: PH0PR11MB5643: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2201; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OdoUgd9tarnmP79aKPuNdlh/BZPjGKqSrrS1aPxMxvcBNE+3BjywGSDfrbHimoXxYzqgTnZGSVsEfcpjjGu7h+TcWjIc1ewiW9d0vrlyQEbENI4aGLE7ARpSmwSplkADU+gL/ZpzasYmS+KZT7lsAxnrrXwm0lH383lkqBzJCxh4mOu97xOhicHYy2rAqaZ6hAsRtxf9BbnZFWAOAU6+oc3vHOE2mlxg6jGJ7rApaRVZW7g/haOIlNx1HTCFggBwnBHUA47TD7VLP6ijHY1Cad24AtOSom76Ws3UAGOaZvEexMKyJ+oTu+W7Aa2tuNKWw90SIfzDM9FI6Ulq6xPDDGWeG2F/0AvG0oq1l9YljgXgqyHV9rV/OefEvMFO7nPNIvc4PaJpEgZkCjmak0qnubJTQzkcKvYuN7Bc2nAvVuVJUBIDox8lG/7UbFNgFGZoJcxoJav+rKx8X7sUPeZddOMQVVTFwC1mpPs7PaLkScnXjb0BID/eB13alLo1GF/cw0XmYCZ1qDITfevqUiy/H484/f7lcocFq/8K8/KcqWMIXXBtPShTm7JlN5jXVYzIrdm9CYKZeYQQzBwJhLM291tW9CAoJOU6ISXljeU/RcLjLrOzCVoY4ge+1+3qv/9Pd3tFf8eYqf2F4qqAi/8o4AQKt0HuSlXQTvK0FrlnD7X/JlG3bOMxcjeypSYIoDLtz9L0vvHWHPemNPiQ7YsKyA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5657.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(6486002)(38350700002)(7696005)(508600001)(186003)(8676002)(316002)(956004)(38100700002)(6916009)(54906003)(66476007)(2906002)(6666004)(86362001)(36756003)(107886003)(8936002)(4326008)(26005)(66946007)(83380400001)(1076003)(2616005)(66556008)(52116002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?p3NBVIdsy8felA0SgwExwcxMqzrS?= =?utf-8?q?5V/+jypjpri2nv5ajTLufRck7QdEsbQtEXbvRBo4y0ia8+xruuAQsUf80hCaEv7yr?= =?utf-8?q?4lxNxbuFFs9cp5Y+4pJU9L+Yx+0DJFVlFD8FNdaiYdKpzJ988LlHbHXqG1XRZDMxh?= =?utf-8?q?unDitTNiDPpKur4QcbP0IPmOsgeeD0a4B1n0WgbT9mUFHi/od/KbbwFoWtutiC+y8?= =?utf-8?q?oPPYTruOHaOrfd16ExykD4MEmYboaZOwOsi0qeQVJ2Jm65XrnY8XerJpZvI24hNwi?= =?utf-8?q?7qtQABHS80UtAWEtqyK4AR5C62HvyzSde4UyjO+MM1bzfG3O+OUGH2DwSmeSRd0gl?= =?utf-8?q?h4DXfeVEN0qg9QK7bUtYxTi4oej43FbvmJtYnKA03ci0FWtJoa2yRw/tCvACiEf03?= =?utf-8?q?UP8+zuTRmP1vLhGx/hHWZMXcBfa4FPfUVAagnBdOvV8UJjAveShNN+G7VFnS+P4D4?= =?utf-8?q?8IwJtWZH83y4THBwx8rZ+Qu+R2HJHvjQDYo7l3GEuib3cwS6OkBF4hwYvS2k0k5EX?= =?utf-8?q?sJlcpx2s1WpC9a4y+ip/RnGiFo7Tt5UF+qg4opxR+ABqW9ltQ+7ewZpXoS/uSC9z5?= =?utf-8?q?55LHEJ3UGjvjyVZ2eFZzy6vGWCCSu9b2G4x0eLw290cSblJoJ9/IzOophKkIM5KYC?= =?utf-8?q?cLcfigYcm67Ay6cvdE8dloHpppVyLKMCwJnPcLF0FOM9ieTW4+MFqfVNxKBAh/45V?= =?utf-8?q?jQPwfKfD6xrkjdF5wDtAdtT10npJMfLanazvctxRnboQYyNQjzF7cinyIwlxjmUof?= =?utf-8?q?QW2/F318eJbZQnIDLLtFtjUXWqsHBVelbSBYyRPQiN5HuSw7tFuokSBGmOjF+Ila6?= =?utf-8?q?n53pEC6PbpvT78ya9EmsE6tJh3zGy1YZLvmh3PtfVoYIMNThe2lAMvgxsOa9YB5kQ?= =?utf-8?q?klOxE/810+mnVPlRnlnGbcX8mfcWIy5MT5q1R+gzVE6Helv2SBmrUUz8moVJu5UE5?= =?utf-8?q?BqVeNeSHKU05l5c9JUFqd1oKRL+4GkV/q+MFP//RNnQNQAH9xayJ9MHXX78vcttir?= =?utf-8?q?K5nMSFN2pCvQS4RPRgsdkXkKDUwTJ4gKqT6X67k+tLJX6DBno2DOZ01uciQJHLgOh?= =?utf-8?q?VvZk6voRVd73z22VAyDgsWvZCNdpUy6U+MJbgeReglul+SUCPHJIA/CMONDUwG3iN?= =?utf-8?q?a2wI0aKJS4IBcRNlKsCFeBetxOgaFCjiOtPBRyg2dDNBb/tvOUH6HUxHtFytj2gS9?= =?utf-8?q?Jd4MRaZ6PkE5Yi7elrLd4bdBRcXkFupI6y6gT918Ld+DlH0Z3TYUNyYz98e/YJ5d8?= =?utf-8?q?Sj1TMN+kPou30Kqk?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: a16c88a5-dd1b-4dfd-9a3f-08d98f1f3aa1 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 14:30:54.1556 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /WXOoEAAzcgulNmR12oO8A6aOkWINWvt1Pg5gTRYnpgp3gq8pZzz0+ihw5jh54AMJo8+OkVqC48i7T6QMNcMDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5643 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Currently, mmc_fixup_device() is a bit difficult to read because of particularly long condition. Signed-off-by: Jérôme Pouiller --- drivers/mmc/core/quirks.h | 41 +++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h index d68e6e513a4f..c7ef2d14b359 100644 --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h @@ -152,22 +152,29 @@ static inline void mmc_fixup_device(struct mmc_card *card, u64 rev = cid_rev_card(card); for (f = table; f->vendor_fixup; f++) { - if ((f->manfid == CID_MANFID_ANY || - f->manfid == card->cid.manfid) && - (f->oemid == CID_OEMID_ANY || - f->oemid == card->cid.oemid) && - (f->name == CID_NAME_ANY || - !strncmp(f->name, card->cid.prod_name, - sizeof(card->cid.prod_name))) && - (f->cis_vendor == card->cis.vendor || - f->cis_vendor == (u16) SDIO_ANY_ID) && - (f->cis_device == card->cis.device || - f->cis_device == (u16) SDIO_ANY_ID) && - (f->ext_csd_rev == EXT_CSD_REV_ANY || - f->ext_csd_rev == card->ext_csd.rev) && - rev >= f->rev_start && rev <= f->rev_end) { - dev_dbg(&card->dev, "calling %ps\n", f->vendor_fixup); - f->vendor_fixup(card, f->data); - } + if (f->manfid != CID_MANFID_ANY && + f->manfid != card->cid.manfid) + continue; + if (f->oemid != CID_OEMID_ANY && + f->oemid != card->cid.oemid) + continue; + if (f->name != CID_NAME_ANY && + strncmp(f->name, card->cid.prod_name, + sizeof(card->cid.prod_name))) + continue; + if (f->cis_vendor != (u16)SDIO_ANY_ID && + f->cis_vendor != card->cis.vendor) + continue; + if (f->cis_device != (u16)SDIO_ANY_ID && + f->cis_device != card->cis.device) + continue; + if (f->ext_csd_rev != EXT_CSD_REV_ANY && + f->ext_csd_rev != card->ext_csd.rev) + continue; + if (rev < f->rev_start || rev > f->rev_end) + continue; + + dev_dbg(&card->dev, "calling %ps\n", f->vendor_fixup); + f->vendor_fixup(card, f->data); } } From patchwork Thu Oct 14 14:30:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 12558673 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5377AC4332F for ; Thu, 14 Oct 2021 14:31:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3CD3661151 for ; Thu, 14 Oct 2021 14:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231861AbhJNOdH (ORCPT ); Thu, 14 Oct 2021 10:33:07 -0400 Received: from mail-bn8nam08on2051.outbound.protection.outlook.com ([40.107.100.51]:59393 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231826AbhJNOdE (ORCPT ); Thu, 14 Oct 2021 10:33:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HZMVhpT/xPrQs+1sbAKP0cBgvSYRIYXhdaKpO8kQ6DEk+FGqkCI5qoIrA6LErhf4vK3/AVIPNE1+9aNCapE5EjY6gWT73mPbjsitxoI5d/KfvQiJCcCfMNS6dCAAYxdnM4Wjk9m7xC9dj0arXLbvx9amqkChg2o/NqGEIiC+PERGXXdQ83iaH0JDgkLxXAmzySUPJMs5uq7Ts1C5eb+pw6hsaHr89nPkyxFNx3pSlQRILDK02xyFXVZ5uyk2et2ZePg2YNMlOBIGEUzEUNYikzlx5+L4wIdXr29rD5zep5GhDN6EOctZc3z/2IkKBbnjQ1dQCOR/gBe5E2RkfYLG+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RHLhGUr47mbss20fprjnXML/wDBRZ+cnYgR/gwb5xvs=; b=D9KfcLqW1fVQdwum4IZ9v0HmUqGI+zhTSw07y58Fjw8/lag7fM8v5avxymZo64Fk+h/ZK6ywlJdpY4qBkh/K+TCbnajKtYpm1bkZDHFO0Vp1KFmgmichNQdo6uBH2xHUDNj8jZyEd5dkJ3136GmxzYMCQcvzqt/N8zqMC5DcniP9tK9SKIm0ZSNu+yvENIy/JaW6sQfeD4aAfjLkPlVWEToKw7M36UYFBvl0mzEBc6yn5VVbAUHXSc3DL6ZkbguvsoatQQOgyW+tYI95iZQogHyKLHxuFyU0EYfwIbJVIF3mCSLh6Za961axkLi2u+3JUIwstiWiBbBDs2WhItCKeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RHLhGUr47mbss20fprjnXML/wDBRZ+cnYgR/gwb5xvs=; b=nKHA1s+aOPkH5cEYJykH3tPRiQBZ1vGr5u91zXutE8VMfQ3N8vdakZqXQEUqr9/vl26ffwQvq9RT9ir/uTxLe97HwY2Ib2QrrT4X3pI93RvEuD/lNVagL2DNEot1t9u0LfzkFm38WWaapohK9V44Za+icvjwO49hNhVI0hGNApA= Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none;linaro.org; dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by PH0PR11MB5660.namprd11.prod.outlook.com (2603:10b6:510:d5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Thu, 14 Oct 2021 14:30:56 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::31cb:3b13:b0e8:d8f4]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::31cb:3b13:b0e8:d8f4%9]) with mapi id 15.20.4587.026; Thu, 14 Oct 2021 14:30:56 +0000 From: Jerome Pouiller To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, Kalle Valo , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [RFC PATCH 2/2] mmc: allow to match the device tree to apply quirks Date: Thu, 14 Oct 2021 16:30:31 +0200 Message-Id: <20211014143031.1313783-3-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211014143031.1313783-1-Jerome.Pouiller@silabs.com> References: <20211014143031.1313783-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PAZP264CA0161.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f9::20) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 Received: from pc-42.silabs.com (37.71.187.125) by PAZP264CA0161.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1f9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.15 via Frontend Transport; Thu, 14 Oct 2021 14:30:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ab732ae-e2bf-44c5-8172-08d98f1f3bc6 X-MS-TrafficTypeDiagnostic: PH0PR11MB5660: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vvk7qAABwjGq1/DVzdZoCb6Ph6GuLeRKx5Om/aut26nkUK7P2VEeDYsYWhc0nGtouDzhOvjYpgxVFJlh5dwgt86QsbLQvuReYP5tkz+PfcVI/gwf0AA9I3pMhmSYqSdLFuw7LdCp4W7Xd97DDLKAUxYfL8zG3+E7mgmA7SYltR6ISyJyPi56ZIwmeFpGogHEF4CkYt78CwKw9/OGv4n7f8xqn4EYH+1exlTZ4r5MpGj0xpfIbPCYOZbMIVlg/IZ5raxVsfUYw+Sm2gN1R4E/8U8GDxFq3p/AFHegtysdjqj4gHKiKj2j0VVQ8KP9kzpkrh2rsnNRPha1PvqNzcEjo7pFzSO1ZRWdE1kcSsZIqPvuQWXsvAN8sGAv/gjJ7+2Va65FGrEXgkhXjAZctY8EvaRWtnHJ11APHJu2ktcjIsx5E5bfiaxQfq2Wl9YymAXxnY8C+Py1ahLj0j9pC7SWiPBeZMhv6LspOp2BjG1M0wpL91PBvYctuU9MzfBWytXDBlWvbkXxfGmWW3LxHgCyRZS6p4wWXRNimMF8Hl0E2zzn8fqz0MQiEbcJa8EXE4K+FWvdm9qOd7lJJ6v/9Yll+ftUKoU8tJT+oBW5R4x3UF0i2PTFXEBrSBV3yaV8Cteep1K0yAsvLR2UATAtUFzSH4m8lq5PEPY1o5qaeyhcv4k77p4qnzPWek/JImxJ6WxyLXtWpYkdy2k9yNKUIpVhvA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5657.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(54906003)(8936002)(66476007)(956004)(2616005)(36756003)(6486002)(508600001)(107886003)(4326008)(6666004)(26005)(316002)(7696005)(66556008)(5660300002)(186003)(6916009)(1076003)(2906002)(52116002)(38100700002)(8676002)(86362001)(38350700002)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?e1kSvW6TT1B0200Hba3E3Wbl98Nc?= =?utf-8?q?lPucwm9Et2pnQheMB8sJlYkC2RP4AFeglx940SJXXacgn3OD8sSRUPnKkgPxgyXJA?= =?utf-8?q?HcLeNa5Z0olRZYxHCnGfC6WBnbhHJVxFnwOsOGqec9Hy1pi6luCAPAlTC1N3XFrLT?= =?utf-8?q?IhsnNTdlXhQZEx1cILdTX7Q+17NOuDhOGdRM2cJR/EpVDfZls2H3wb7DAZ68mV5mW?= =?utf-8?q?BdVIHyBWP0/RC4WyZXcfcTMCnsvcEoxTzSyKRO4hOqg5m1zmn53CGjX7yilk4S22R?= =?utf-8?q?YW8UndqlTqOBKB+gFCtaKrmcaO0RqAMotHg0hbl0ArwFaDaz/gqVQK9VSsANFWMW3?= =?utf-8?q?nv59tJ9StNGz3L8pCiTvrEzyQtiMVU6Xa9hWTeNgYsZLXZk1vqm9HhaVVqr9ow6Ma?= =?utf-8?q?lQYtI3PStVbvZHKlwvuGKusMP3BMEsTKYgy7StemR0FaG6yFhhoZ5pwhTAy9c6E1U?= =?utf-8?q?UH2cdcOwbEEpjOR++JAc/RGSAqxhNin+57k17elbNsQUi13EFqNs/1we1bqA1Ih0b?= =?utf-8?q?H+k6gFENIrWBIbQllBsipeUOmXIHlXCwu7Hq2DG5lm1ZbV302M/E8HlF7Zf0JjbJn?= =?utf-8?q?ETUK3UGwupeGQshYXH86a8bKkzdOrTwEbXQcbK1lUZS/Qu/K9haBn59Wy6Egd/FbS?= =?utf-8?q?5LKX+XU353v79pN3UcFdwot3kc/khiYQWrQB+v8+DJPwvn6ntYmhr75EpIyJE89O7?= =?utf-8?q?bPuZOMewVPW8Nltm0SmJOc+bfN8YauA9111webi4/ySp6v2swUPn/EV2Zb2/qF5Dy?= =?utf-8?q?hp8UISKJHmnYPWNjZLMuodBJFiOZAoMl3h1ZVV/SNO9P1ut5vokM5iQrDcdXCvU6T?= =?utf-8?q?KfOv6/LrB7a+OtjAYpCi7W6Vz+E6rlV15llS2YOzmHsPFFygNTfzkX7Vm3eQBese0?= =?utf-8?q?pACoYDHCHvn6oYX1YNAn8gFcHSwshgZUDFKgDgyGgjB25L4iV+yvYQcVeS+ZgRTiD?= =?utf-8?q?S2OkY+NZk5RQNsavUavNNZBUqj8sc0ip5zIQGYRFfVyJKL1DpxrO83+4tXhOgluY4?= =?utf-8?q?k3oUjPbF/dZcMzy+dreAadF07afY8wjI3lEn5geYXOShb7HgdvoH3FDg06HTNhHLy?= =?utf-8?q?3ftd21SdsHBgVbuEJx7xcqCw31aUD2IxVuDDJAfInAHZauYHg8yCrJhGiqYHpTx8Z?= =?utf-8?q?b5nQZetMmqO5NlwZgptCsWvnXFGKT+9BD8WD3ZcNTnaKqYB3FkHzRdLXHImpwMwof?= =?utf-8?q?87hAKyNP5LS8y4P5xqn+gwT8h/C++pNDqIBOMuSsqtZm9AkBmfH3ho5Jh41DaTFBn?= =?utf-8?q?LKGC6c0s6h/Smq4U?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ab732ae-e2bf-44c5-8172-08d98f1f3bc6 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2021 14:30:56.0503 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nLeMYgC1GJh5XJD+DyNrOXczWEgW4iRiRBD1mtQ0Up188nY7BivGn/s96MatxI07QnE/QUrqdl7G4bMN6w5dxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5660 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller MMC subsystem provides a way to apply quirks when a device match some properties (VID, PID, etc...) Unfortunately, some SDIO devices does not comply with the SDIO specification and does not provide reliable VID/PID (eg. Silabs WF200). So, the drivers for these devices rely on device tree to identify the device. This patch allows the MMC to also rely on the device tree to apply a quirk. Signed-off-by: Jérôme Pouiller --- drivers/mmc/core/card.h | 3 +++ drivers/mmc/core/quirks.h | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h index 7bd392d55cfa..2f73f8567e14 100644 --- a/drivers/mmc/core/card.h +++ b/drivers/mmc/core/card.h @@ -59,6 +59,9 @@ struct mmc_fixup { /* for MMC cards */ unsigned int ext_csd_rev; + /* Match against functions declared in device tree */ + const char *const *of_compatible; + void (*vendor_fixup)(struct mmc_card *card, int data); int data; }; diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h index c7ef2d14b359..ef368386e711 100644 --- a/drivers/mmc/core/quirks.h +++ b/drivers/mmc/core/quirks.h @@ -10,6 +10,7 @@ * */ +#include #include #include "card.h" @@ -145,6 +146,20 @@ static const struct mmc_fixup __maybe_unused sdio_fixup_methods[] = { END_FIXUP }; +static inline bool mmc_fixup_of_compatible_match(struct mmc_card *card, + const char *const *compat_list) +{ + struct device_node *of_node; + int i; + + for (i = 0; i < 7; i++) { + of_node = mmc_of_find_child_device(card->host, i); + if (of_node && of_device_compatible_match(of_node, compat_list)) + return true; + } + return false; +} + static inline void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) { @@ -173,6 +188,9 @@ static inline void mmc_fixup_device(struct mmc_card *card, continue; if (rev < f->rev_start || rev > f->rev_end) continue; + if (f->of_compatible != NULL && + !mmc_fixup_of_compatible_match(card, f->of_compatible)) + continue; dev_dbg(&card->dev, "calling %ps\n", f->vendor_fixup); f->vendor_fixup(card, f->data);