mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 2/5] mci: introduce new dedicated enum mmc_bus_width type
Date: Tue, 18 Apr 2023 11:30:37 +0200	[thread overview]
Message-ID: <20230418093040.1865982-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230418093040.1865982-1-a.fatoum@pengutronix.de>

To make it clearer that a bus width of 8 is not equal to integer 8,
let's give it a dedicated type. No functional change.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - new patch
---
 drivers/mci/mci-core.c |  6 +++---
 include/mci.h          | 20 ++++++++++----------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index f647cae8203b..2abed0011722 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -864,7 +864,7 @@ static void mci_set_clock(struct mci *mci, unsigned clock)
  * @param mci MCI instance
  * @param width New interface bit width (1, 4 or 8)
  */
-static void mci_set_bus_width(struct mci *mci, unsigned width)
+static void mci_set_bus_width(struct mci *mci, enum mci_bus_width width)
 {
 	struct mci_host *host = mci->host;
 
@@ -1055,7 +1055,7 @@ static void mci_extract_card_dsr_imp_from_csd(struct mci *mci)
 	mci->dsr_imp = UNSTUFF_BITS(mci->csd, 76, 1);
 }
 
-static int mmc_compare_ext_csds(struct mci *mci, unsigned bus_width)
+static int mmc_compare_ext_csds(struct mci *mci, enum mci_bus_width bus_width)
 {
 	u8 *bw_ext_csd;
 	int err;
@@ -1176,7 +1176,7 @@ static int mci_startup_mmc(struct mci *mci)
 		EXT_CSD_BUS_WIDTH_4,
 		EXT_CSD_BUS_WIDTH_8,
 	};
-	static unsigned bus_widths[] = {
+	static enum mci_bus_width bus_widths[] = {
 		MMC_BUS_WIDTH_4,
 		MMC_BUS_WIDTH_8,
 	};
diff --git a/include/mci.h b/include/mci.h
index c38567303241..a3f6d619b361 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -410,16 +410,16 @@ enum mci_timing {
 	MMC_TIMING_MMC_HS400	= 8,
 };
 
-struct mci_ios {
-	unsigned int	clock;			/* clock rate */
-
-	unsigned char	bus_width;		/* data bus width */
-
-#define MMC_BUS_WIDTH_1		0
-#define MMC_BUS_WIDTH_4		2
-#define MMC_BUS_WIDTH_8		3
+enum mci_bus_width {
+	MMC_BUS_WIDTH_1		= 0,
+	MMC_BUS_WIDTH_4		= 2,
+	MMC_BUS_WIDTH_8		= 3,
+};
 
-	enum mci_timing	timing;			/* timing specification used */
+struct mci_ios {
+	unsigned int		clock;			/* clock rate */
+	enum mci_bus_width	bus_width;		/* data bus width */
+	enum mci_timing		timing;			/* timing specification used */
 };
 
 struct mci;
@@ -434,7 +434,7 @@ struct mci_host {
 	unsigned f_min;		/**< host interface lower limit */
 	unsigned f_max;		/**< host interface upper limit */
 	unsigned clock;		/**< Current clock used to talk to the card */
-	unsigned bus_width;	/**< used data bus width to the card */
+	enum mci_bus_width bus_width;	/**< used data bus width to the card */
 	enum mci_timing timing;	/**< used timing specification to the card */
 	unsigned max_req_size;
 	unsigned dsr_val;	/**< optional dsr value */
-- 
2.39.2




  reply	other threads:[~2023-04-18  9:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18  9:30 [PATCH v2 1/5] mci: core: drop unused DDR/SDR constants Ahmad Fatoum
2023-04-18  9:30 ` Ahmad Fatoum [this message]
2023-04-18  9:30 ` [PATCH v2 3/5] mci: core: factor out MMC bus width selection for reuse Ahmad Fatoum
2023-04-18  9:30 ` [PATCH v2 4/5] mci: add eMMC DDR52 support Ahmad Fatoum
2023-04-18  9:30 ` [PATCH v2 5/5] mci: imx-esdhc: add uSDHC " Ahmad Fatoum
2023-04-21  6:29 ` [PATCH v2 1/5] mci: core: drop unused DDR/SDR constants Sascha Hauer

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=20230418093040.1865982-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox