All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: "Ulf Hansson" <ulf.hansson@linaro.org>,
	"Jérôme Pouiller" <jerome.pouiller@silabs.com>,
	"Avri Altman" <avri.altman@wdc.com>,
	"Shawn Lin" <shawn.lin@rock-chips.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Tony Lindgren" <tony@atomide.com>,
	"Bean Huo" <beanhuo@micron.com>,
	"H. Nikolaus Schaller" <hns@goldelico.com>,
	"Kiwoong Kim" <kwmad.kim@samsung.com>,
	"Tian Tao" <tiantao6@hisilicon.com>,
	"Andreas Kemnade" <andreas@kemnade.info>,
	"Yang Li" <abaci-bugfix@linux.alibaba.com>
Cc: notasas@gmail.com, linux-mmc@vger.kernel.org,
	linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org,
	kernel@pyra-handheld.com, linux-omap@vger.kernel.org
Subject: [PATCH 1/5] mmc: core: rewrite mmc_fixup_device()
Date: Tue,  9 Nov 2021 11:59:04 +0100	[thread overview]
Message-ID: <6515c1e8b3aa69ad273726f6e877d85c20f286ad.1636455548.git.hns@goldelico.com> (raw)
In-Reply-To: <cover.1636455548.git.hns@goldelico.com>

From: Jérôme Pouiller <jerome.pouiller@silabs.com>

Currently, mmc_fixup_device() is a bit difficult to read because of
particularly long condition.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 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


  reply	other threads:[~2021-11-09 10:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 10:59 [PATCH 0/5] mmc: core: extend mmc_fixup_device and transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
2021-11-09 10:59 ` H. Nikolaus Schaller [this message]
2021-11-09 10:59 ` [PATCH 2/5] mmc: core: allow to match the device tree to apply quirks H. Nikolaus Schaller
2021-11-09 11:20   ` Jérôme Pouiller
2021-11-09 10:59 ` [PATCH 3/5] mmc: core: provide macro and table " H. Nikolaus Schaller
2021-11-09 11:21   ` Jérôme Pouiller
2021-11-09 10:59 ` [PATCH 4/5] mmc: core: transplant ti,wl1251 quirks from to be retired omap_hsmmc H. Nikolaus Schaller
2021-11-09 10:59 ` [PATCH 5/5] mmc: host: omap_hsmmc: revert special init for wl1251 H. Nikolaus Schaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6515c1e8b3aa69ad273726f6e877d85c20f286ad.1636455548.git.hns@goldelico.com \
    --to=hns@goldelico.com \
    --cc=abaci-bugfix@linux.alibaba.com \
    --cc=andreas@kemnade.info \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=jerome.pouiller@silabs.com \
    --cc=kernel@pyra-handheld.com \
    --cc=kwmad.kim@samsung.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=notasas@gmail.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=tiantao6@hisilicon.com \
    --cc=tony@atomide.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.