Commit f3abe2e5 authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Ulf Hansson

mmc: core: rewrite mmc_fixup_device()

Currently, mmc_fixup_device() is a bit difficult to read because of
particularly long condition.
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Signed-off-by: default avatarH. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/6515c1e8b3aa69ad273726f6e877d85c20f286ad.1636564631.git.hns@goldelico.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent e315b1f3
...@@ -152,22 +152,29 @@ static inline void mmc_fixup_device(struct mmc_card *card, ...@@ -152,22 +152,29 @@ static inline void mmc_fixup_device(struct mmc_card *card,
u64 rev = cid_rev_card(card); u64 rev = cid_rev_card(card);
for (f = table; f->vendor_fixup; f++) { for (f = table; f->vendor_fixup; f++) {
if ((f->manfid == CID_MANFID_ANY || if (f->manfid != CID_MANFID_ANY &&
f->manfid == card->cid.manfid) && f->manfid != card->cid.manfid)
(f->oemid == CID_OEMID_ANY || continue;
f->oemid == card->cid.oemid) && if (f->oemid != CID_OEMID_ANY &&
(f->name == CID_NAME_ANY || f->oemid != card->cid.oemid)
!strncmp(f->name, card->cid.prod_name, continue;
sizeof(card->cid.prod_name))) && if (f->name != CID_NAME_ANY &&
(f->cis_vendor == card->cis.vendor || strncmp(f->name, card->cid.prod_name,
f->cis_vendor == (u16) SDIO_ANY_ID) && sizeof(card->cid.prod_name)))
(f->cis_device == card->cis.device || continue;
f->cis_device == (u16) SDIO_ANY_ID) && if (f->cis_vendor != (u16)SDIO_ANY_ID &&
(f->ext_csd_rev == EXT_CSD_REV_ANY || f->cis_vendor != card->cis.vendor)
f->ext_csd_rev == card->ext_csd.rev) && continue;
rev >= f->rev_start && rev <= f->rev_end) { if (f->cis_device != (u16)SDIO_ANY_ID &&
dev_dbg(&card->dev, "calling %ps\n", f->vendor_fixup); f->cis_device != card->cis.device)
f->vendor_fixup(card, f->data); 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);
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment