Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2648486pxb; Fri, 5 Nov 2021 02:12:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXsDcOO7KGFMdqfhJVeXFAfjOTUTuj7W3X/qU7RGNtnm6DWWt/FWN76PgkoGWmgw6ry/WS X-Received: by 2002:a05:6e02:12ce:: with SMTP id i14mr22876945ilm.45.1636103540740; Fri, 05 Nov 2021 02:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636103540; cv=none; d=google.com; s=arc-20160816; b=VqV6RudaHATFoDV4T9YllSF1D7WRtXzPAyDuYT3mEXC4eiW4VSM9jREIsDZ5qY6TTj 48734QbsE4xv0ez3Y3vm+ADa1kkVKibqCbc36WS802Gx3lpbh8NkO19wdn0LZsCE4sjK OA3zgbwQdrDQVySZkuaPLxDhkYwVyV8r4w4SEYNtPooLLnVBjxf8wM/Sq9D4edufnvMd fK962+sHIyKI7GlFCDbGU53LodLaU6WdHCet8no2xuKh7NydPjzrJT6pXik4GiB8Je2T KEV5dntGkO0tdgIXbN+6NCLrR3o9MWyt4XUEM1pykHtDdZR6fVIkd+9lZ4eqMHGz/29R pHcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NRefWqSNfVqu2r1kOvp1l5SvRCw5vKgppbt4PGzWMrM=; b=aIyBJi+byoqV8+s+pirsHMyE1J583MZdybTdaPL6XKH4GMdghJf6B8KVR49nX89utT GbVQAu+j78TeXol2Nqy2K0VANeAZcrl1VMnqPPT4yzzQdjqP9Zj525Q4/ckeozIYUW4L N2Th+LHU5X4htwI+wW4rS3XM23C7UGyoiO4JwSPgA8twdwsF2jWmWP63VD60q82wWIOF Vjg1ijkq6Slanq8MEUaLfp2OzwpmrS9ml5BpQCQ61BuEu/PBoXphmffegH53ZWDM20+z 0+VMMD/yO/Em3axs4zwqq0w9yq2ENjrRuyM1bLSxkUz5mO694ZkJAC/cvwP6GNI2kqFz nDcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=syBMySvZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o7si10836264ilo.75.2021.11.05.02.12.08; Fri, 05 Nov 2021 02:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=syBMySvZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232693AbhKEJIr (ORCPT + 99 others); Fri, 5 Nov 2021 05:08:47 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.83]:36498 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229971AbhKEJIo (ORCPT ); Fri, 5 Nov 2021 05:08:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1636103153; s=strato-dkim-0002; d=goldelico.com; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=NRefWqSNfVqu2r1kOvp1l5SvRCw5vKgppbt4PGzWMrM=; b=syBMySvZJ4fuodKUh5AI4UyIN04jneOFFXYldCP6X7lENeQJtACsqZdSV/z2I73CkA HryKOcay6Uy2jRpAWW/yPnBPMNYgbgMXV8jp1lKt5ori1C7iS+appxJfaQubUW0qsua2 xki8/0V3rwJkbs04kp+tPaa3RGUqcoZv4uM6GXAXFA9p37hhvBJR8eXHGKA5goexmIYq r6bwSAe1GLXZJmbKNVSQMpY/CQ9K1xbe99mnEe710ICrWX8jGvCU1bqpQ5hFR73nWv/G I54Wxswq3ftQh7sYWyZ5QiA1q2eJ3+uQAmxKau0Ory2MflCKPY5WQknuTiahPiQb8/jp 87Nw== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMhflhwDubTJ9o12DNOsPj0lByOdfL1X0" X-RZG-CLASS-ID: mo00 Received: from iMac.fritz.box by smtp.strato.de (RZmta 47.34.1 DYNA|AUTH) with ESMTPSA id 902c63xA595q8uK (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 5 Nov 2021 10:05:52 +0100 (CET) From: "H. Nikolaus Schaller" To: Ulf Hansson , =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= , Avri Altman , Shawn Lin , Linus Walleij , Tony Lindgren , Bean Huo Cc: notasas@gmail.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, kernel@pyra-handheld.com Subject: [RFC v4 1/6] mmc: core: rewrite mmc_fixup_device() Date: Fri, 5 Nov 2021 10:05:46 +0100 Message-Id: X-Mailer: git-send-email 2.33.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 d68e6e513a4f4..c7ef2d14b359f 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); } } -- 2.33.0