mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] mci: core: use SECTOR_SIZE instead of direct 512
@ 2020-03-30 14:32 Ahmad Fatoum
  2020-03-31  5:14 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2020-03-30 14:32 UTC (permalink / raw)
  To: barebox

Instead of hardcoding the 512 byte constant, use the symbolic
SECTOR_SIZE.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/mci/mci-core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 34aaee54f9ed..f3718327f18d 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -156,7 +156,7 @@ static int mci_block_write(struct mci *mci, const void *src, int blocknum,
 		mmccmd = MMC_CMD_WRITE_SINGLE_BLOCK;
 
 	if ((unsigned long)src & 0x3) {
-		memcpy(sector_buf, src, 512);
+		memcpy(sector_buf, src, SECTOR_SIZE);
 		buf = sector_buf;
 	} else {
 		buf = src;
@@ -1360,9 +1360,9 @@ static int mci_sd_read(struct block_device *blk, void *buffer, int block,
 	dev_dbg(&mci->dev, "%s: Read %d block(s), starting at %d\n",
 		__func__, num_blocks, block);
 
-	if (mci->read_bl_len != 512) {
-		dev_dbg(&mci->dev, "MMC/SD block size is not 512 bytes (its %u bytes instead)\n",
-				mci->read_bl_len);
+	if (mci->read_bl_len != SECTOR_SIZE) {
+		dev_dbg(&mci->dev, "MMC/SD block size is not %d bytes (its %u bytes instead)\n",
+				SECTOR_SIZE, mci->read_bl_len);
 		return -EINVAL;
 	}
 
@@ -1789,7 +1789,7 @@ static int mci_set_probe(struct param_d *param, void *priv)
 
 static int mci_init(void)
 {
-	sector_buf = xmemalign(32, 512);
+	sector_buf = xmemalign(32, SECTOR_SIZE);
 
 	return 0;
 }
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] mci: core: use SECTOR_SIZE instead of direct 512
  2020-03-30 14:32 [PATCH 1/2] mci: core: use SECTOR_SIZE instead of direct 512 Ahmad Fatoum
@ 2020-03-31  5:14 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2020-03-31  5:14 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Mar 30, 2020 at 04:32:58PM +0200, Ahmad Fatoum wrote:
> Instead of hardcoding the 512 byte constant, use the symbolic
> SECTOR_SIZE.
> 
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
>  drivers/mci/mci-core.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Applied, thanks

Sascha


-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-31  5:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 14:32 [PATCH 1/2] mci: core: use SECTOR_SIZE instead of direct 512 Ahmad Fatoum
2020-03-31  5:14 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox