Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp391296pxb; Wed, 3 Nov 2021 06:03:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjVORoLeppMoL/oqiDLqzUEGmDYnMH6QeTFNhmh4yezDmiMbc8eSob1AfgpNToTd0htoQL X-Received: by 2002:a17:906:4f05:: with SMTP id t5mr2468494eju.68.1635944608097; Wed, 03 Nov 2021 06:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635944608; cv=none; d=google.com; s=arc-20160816; b=VNoTnSALpW1NxA4PrtLOjUT8VREEbBDymrQyTGIjcUmy1SRgjYUlaHsLx3YnJGcT3q QTgYPubo1F+eCkOBLTPIZgVfhbCbJTqHy4YvgJc4XicNqJOs9jOtwLpYTC46EUZ7dRO5 9xOJnyap/F+pY9BdYiutvFIvpsm+pD7qdv3n3zrpY1cAXoQan7TEkggVPLQdDxyXj/tj GjTs21EWA51TIhkCxXLxvgh1p3ddD3WN+JGnWEuVUwdqSD7Yuj5SgmXUVncnO79Z/sz+ cYU0Bi3EUUm6QtDrRk4WEzpLUKiupMCJhpQPE8SnK8hH7ClvEvObwvZKzz8pj/3TWnqL YpBg== 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=psM/tH8gMQpzXfA2mc7gSggBt4x0WQ90C4gqxam/ysuT1cWo9k8FXF3PAjukdc1bhA iqkx16mtZ6mXTQwBVz/ixxc1Ds3ZhWwPV05YNvpHqcHmWNzgRhvOQOOQjwLObl3XEHRz xNnho7jlXNZUU/7m04S2q6QA1sUlnIiT1BHdxfs/ihbEVgO6429xWsUPFiNDTUogIheU vwM52OIFKm5DcBxJQIfVVZ5PgFX+B+6X+42RrrJ7ebXavyKzc+txRMeYvCLqQ/bgPSx1 KaE6r/vRPIZyWMLidqg4pOiA/Zp5wMXd+lcMsI0uX5oBBFO05fEm4DxsGuK5MM6G1azd 3TTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=swr+AY5a; 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 u23si3239941eds.163.2021.11.03.06.03.02; Wed, 03 Nov 2021 06:03:28 -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=swr+AY5a; 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 S231476AbhKCNDc (ORCPT + 99 others); Wed, 3 Nov 2021 09:03:32 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.84]:33507 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbhKCNDb (ORCPT ); Wed, 3 Nov 2021 09:03:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1635944423; 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=swr+AY5aO8HcOXV4wJszRc4HnthjWF0b2FKrlTSrjN9ChW/r/Jij990ZoMX3AgH1ca 5vY1B2zJ/vGmmFCagqIYITrilYKba0omMIwHk3ED/ux7nGdwopby4/IP8dHbb24PS4ib lIdKC7gt1Vs4vUgv6ePtWBtJE9sptGvuTdZjSf3YPvdQwEVfmGZGRxMpVD/YmQO8L0C2 4/pjP40253kBb98GUSlgsQkVFWkNGmAPjOJA2znp1esSyHMIJMo6Xh11SzYIeVYL6CuP yEso+kKxSXOId89aFQfwpoGq1j0/WBnhXyCZqRQrIP4HPYRUJzBkpGvdxlrSsiCOtn7r rtpQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMhflhwDubTJ9o1OAA2UMf2MwPVbgc7na" X-RZG-CLASS-ID: mo00 Received: from iMac.fritz.box by smtp.strato.de (RZmta 47.34.1 DYNA|AUTH) with ESMTPSA id 902c63xA3D0J0Ea (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Wed, 3 Nov 2021 14:00:19 +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 v3 1/6] mmc: core: rewrite mmc_fixup_device() Date: Wed, 3 Nov 2021 14:00:09 +0100 Message-Id: <10f243eccdca10ee34b09fb626500f4a56da914a.1635944413.git.hns@goldelico.com> 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