[PATCH 3/9] mci: move mci_setup_cmd definition into header

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Apr 21 22:26:29 PDT 2025


For use outside of mci-core, e.g. in PBL drivers, move the helper
function into the header.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/mci/mci-core.c | 15 ---------------
 include/mci.h          | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 5ab07d09c546..9a8e1ce656b5 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -97,21 +97,6 @@ static int mci_send_cmd_retry(struct mci *mci, struct mci_cmd *cmd,
 	return ret;
 }
 
-/**
- * @param p Command definition to setup
- * @param cmd Valid SD/MMC command (refer MMC_CMD_* / SD_CMD_*)
- * @param arg Argument for the command (optional)
- * @param response Command's response type (refer MMC_RSP_*)
- *
- * Note: When calling, the 'response' must match command's requirements
- */
-static void mci_setup_cmd(struct mci_cmd *p, unsigned cmd, unsigned arg, unsigned response)
-{
-	p->cmdidx = cmd;
-	p->cmdarg = arg;
-	p->resp_type = response;
-}
-
 /**
  * configure optional DSR value
  * @param mci_dev MCI instance
diff --git a/include/mci.h b/include/mci.h
index 43a0b0131572..10bba878a8f9 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -480,6 +480,22 @@ struct mci_cmd {
 	unsigned response[4];	/**< card's response */
 };
 
+/**
+ * @param p Command definition to setup
+ * @param cmd Valid SD/MMC command (refer MMC_CMD_* / SD_CMD_*)
+ * @param arg Argument for the command (optional)
+ * @param response Command's response type (refer MMC_RSP_*)
+ *
+ * Note: When calling, the 'response' must match command's requirements
+ */
+static inline void mci_setup_cmd(struct mci_cmd *p, unsigned cmd,
+				 unsigned arg, unsigned response)
+{
+	p->cmdidx = cmd;
+	p->cmdarg = arg;
+	p->resp_type = response;
+}
+
 /** data information to be used with some SD/MMC commands */
 struct mci_data {
 	union {
-- 
2.39.5




More information about the barebox mailing list