mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 06/10] mci: core: use CONFIG_MCI_WRITE, not CONFIG_BLOCK_WRITE
Date: Tue, 30 Jul 2024 11:18:25 +0200	[thread overview]
Message-ID: <Zqiv4ROuyhUNQz4p@pengutronix.de> (raw)
In-Reply-To: <20240730071929.2016537-7-a.fatoum@pengutronix.de>

On Tue, Jul 30, 2024 at 09:19:25AM +0200, Ahmad Fatoum wrote:
> 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 its
> parent CONFIG_BLOCK_WRITE option.

Currently CONFIG_MCI_WRITE has no relation to CONFIG_BLOCK_WRITE.
Having CONFIG_MCI_WRITE enabled and CONFIG_BLOCK_WRITE disabled doesn't
make sense. Shouldn't CONFIG_MCI_WRITE depend on CONFIG_BLOCK_WRITE?

Also having CONFIG_BLOCK_WRITE enabled and CONFIG_MCI_WRITE disabled
allows you to support writing to block devices that are not MCI devices.
Given that the vast majority of block devices are actually MCI devices
this seems rather exotic.

Maybe we should drop CONFIG_MCI_WRITE and replace it with
CONFIG_BLOCK_WRITE, or just have

config MCI_WRITE
	bool
	default y if BLOCK_WRITE

Sascha

> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  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 f6f8a6adabb9..3a5fb0330700 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
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2024-07-30  9:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30  7:19 [PATCH 00/10] mmc: add SD/eMMC erase support Ahmad Fatoum
2024-07-30  7:19 ` [PATCH 01/10] fs: give erase() a new erase_type parameter Ahmad Fatoum
2024-07-30  8:31   ` Sascha Hauer
2024-07-30  8:32     ` Ahmad Fatoum
2024-07-30  7:19 ` [PATCH 02/10] block: factor out chunk_flush helper Ahmad Fatoum
2024-07-30  7:19 ` [PATCH 03/10] block: allow block devices to implement the cdev erase operation Ahmad Fatoum
2024-07-30  8:55   ` Sascha Hauer
2024-07-30 11:10     ` Ahmad Fatoum
2024-07-30 11:21       ` Sascha Hauer
2024-07-30  7:19 ` [PATCH 04/10] mci: turn bool members into bitfield in struct mci Ahmad Fatoum
2024-07-30  9:06   ` Sascha Hauer
2024-07-30 11:10     ` Ahmad Fatoum
2024-07-30  7:19 ` [PATCH 05/10] mci: describe more command structure in mci.h Ahmad Fatoum
2024-07-30  9:25   ` Yann Sionneau
2024-07-30 11:07     ` Ahmad Fatoum
2024-07-30  7:19 ` [PATCH 06/10] mci: core: use CONFIG_MCI_WRITE, not CONFIG_BLOCK_WRITE Ahmad Fatoum
2024-07-30  9:18   ` Sascha Hauer [this message]
2024-07-30 11:08     ` Ahmad Fatoum
2024-07-31  7:19       ` Ahmad Fatoum
2024-07-30  7:19 ` [PATCH 07/10] mci: add support for discarding write blocks Ahmad Fatoum
2024-07-30  9:23   ` Yann Sionneau
2024-07-30 11:14     ` Ahmad Fatoum
2024-07-30 10:05   ` Sascha Hauer
2024-07-30 11:17     ` Ahmad Fatoum
2024-07-30  7:19 ` [PATCH 08/10] commands: sync: add new command to flush cached writes Ahmad Fatoum
2024-07-30 10:08   ` Sascha Hauer
2024-07-30  7:19 ` [PATCH 09/10] mci: core: remove reference to SD Card from common mci_card_probe Ahmad Fatoum
2024-07-30 10:09   ` Sascha Hauer
2024-07-30  7:19 ` [PATCH 10/10] commands: blkstats: add command to print block device statistics Ahmad Fatoum

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=Zqiv4ROuyhUNQz4p@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=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