public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v4 1/4] blk: Use macros for block device vendor/product/rev string size
@ 2017-09-10 12:12 Bin Meng
  2017-09-10 12:12 ` [U-Boot] [PATCH v4 2/4] block: ide: Fix block read/write with driver model Bin Meng
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Bin Meng @ 2017-09-10 12:12 UTC (permalink / raw)
  To: u-boot

So far these are using magic numbers. Replace them with macros.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

Changes in v4: None
Changes in v3:
- Change BLK_XXX_SIZE to not count the ending NULL

Changes in v2: None

 include/blk.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/blk.h b/include/blk.h
index a106f9c..27abfdd 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -36,6 +36,10 @@ enum if_type {
 	IF_TYPE_COUNT,			/* Number of interface types */
 };
 
+#define BLK_VEN_SIZE		40
+#define BLK_PRD_SIZE		20
+#define BLK_REV_SIZE		8
+
 /*
  * With driver model (CONFIG_BLK) this is uclass platform data, accessible
  * with dev_get_uclass_platdata(dev)
@@ -60,9 +64,9 @@ struct blk_desc {
 	lbaint_t	lba;		/* number of blocks */
 	unsigned long	blksz;		/* block size */
 	int		log2blksz;	/* for convenience: log2(blksz) */
-	char		vendor[40+1];	/* IDE model, SCSI Vendor */
-	char		product[20+1];	/* IDE Serial no, SCSI product */
-	char		revision[8+1];	/* firmware revision */
+	char		vendor[BLK_VEN_SIZE + 1]; /* device vendor string */
+	char		product[BLK_PRD_SIZE + 1]; /* device product number */
+	char		revision[BLK_REV_SIZE + 1]; /* firmware revision */
 #if CONFIG_IS_ENABLED(BLK)
 	/*
 	 * For now we have a few functions which take struct blk_desc as a
-- 
2.9.2

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

end of thread, other threads:[~2017-09-10 22:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-10 12:12 [U-Boot] [PATCH v4 1/4] blk: Use macros for block device vendor/product/rev string size Bin Meng
2017-09-10 12:12 ` [U-Boot] [PATCH v4 2/4] block: ide: Fix block read/write with driver model Bin Meng
2017-09-10 22:02   ` Tom Rini
2017-09-10 12:12 ` [U-Boot] [PATCH v4 3/4] block: ide: Don't bother to create BLK device if no CDROM inserted Bin Meng
2017-09-10 22:02   ` Tom Rini
2017-09-10 12:12 ` [U-Boot] [PATCH v4 4/4] cmd: ide: Make the first device the default one Bin Meng
2017-09-10 22:02   ` Tom Rini
2017-09-10 22:02 ` [U-Boot] [PATCH v4 1/4] blk: Use macros for block device vendor/product/rev string size Tom Rini

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