[PATCH v2 07/10] mci: core: use CONFIG_MCI_WRITE, not CONFIG_BLOCK_WRITE

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jul 31 01:05:07 PDT 2024


There's a more specific CONFIG_MCI_WRITE that's so far only used to
remove write support for in the Atmel MCI driver. We should use the same
symbol also to remove support in the MCI core instead of relying on the
CONFIG_BLOCK_WRITE option that's selected transitively by it.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
  - mention in commit message that MCI_WRITE selects BLOCK_WRITE
    indirectly
---
 drivers/mci/mci-core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 410c47fbcfc6..984294bfc107 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1801,8 +1801,8 @@ static int mci_blk_part_switch(struct mci_part *part)
  *
  * This routine expects the buffer has the correct size to read all data!
  */
-static int __maybe_unused mci_sd_write(struct block_device *blk,
-				const void *buffer, sector_t block, blkcnt_t num_blocks)
+static int mci_sd_write(struct block_device *blk,
+			const void *buffer, sector_t block, blkcnt_t num_blocks)
 {
 	struct mci_part *part = container_of(blk, struct mci_part, blk);
 	struct mci *mci = part->mci;
@@ -2179,9 +2179,7 @@ static int mci_check_if_already_initialized(struct mci *mci)
 
 static struct block_device_ops mci_ops = {
 	.read = mci_sd_read,
-#ifdef CONFIG_BLOCK_WRITE
-	.write = mci_sd_write,
-#endif
+	.write = IS_ENABLED(CONFIG_MCI_WRITE) ? mci_sd_write : NULL,
 };
 
 static int mci_set_boot(struct param_d *param, void *priv)
-- 
2.39.2




More information about the barebox mailing list