[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e9b86c6f569b4b2f399bd1b8c6af34fed7878f7e.1636103151.git.hns@goldelico.com>
Date: Fri, 5 Nov 2021 10:05:46 +0100
From: "H. Nikolaus Schaller" <hns@...delico.com>
To: Ulf Hansson <ulf.hansson@...aro.org>,
Jérôme Pouiller
<jerome.pouiller@...abs.com>, Avri Altman <avri.altman@....com>,
Shawn Lin <shawn.lin@...k-chips.com>,
Linus Walleij <linus.walleij@...aro.org>,
Tony Lindgren <tony@...mide.com>, Bean Huo <beanhuo@...ron.com>
Cc: notasas@...il.com, linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org, letux-kernel@...nphoenux.org,
kernel@...a-handheld.com
Subject: [RFC v4 1/6] mmc: core: rewrite mmc_fixup_device()
From: Jérôme Pouiller <jerome.pouiller@...abs.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@...abs.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
Powered by blists - more mailing lists