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); } }