diff mbox series

[U-Boot,v2,1/4] blk: Use macros for block device vendor/product/rev string size

Message ID 1504516087-9984-1-git-send-email-bmeng.cn@gmail.com
State Superseded
Delegated to: Tom Rini
Headers show
Series [U-Boot,v2,1/4] blk: Use macros for block device vendor/product/rev string size | expand

Commit Message

Bin Meng Sept. 4, 2017, 9:08 a.m. UTC
So far these are using magic numbers. Replace them with macros.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

Changes in v2: None

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

Comments

Simon Glass Sept. 5, 2017, 8:56 a.m. UTC | #1
On 4 September 2017 at 17:08, Bin Meng <bmeng.cn@gmail.com> wrote:
> So far these are using magic numbers. Replace them with macros.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v2: None
>
>  include/blk.h | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/include/blk.h b/include/blk.h
index a106f9c..fced138 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		41
+#define BLK_PRD_SIZE		21
+#define BLK_REV_SIZE		9
+
 /*
  * 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];	/* device vendor string */
+	char		product[BLK_PRD_SIZE];	/* device product number */
+	char		revision[BLK_REV_SIZE];	/* firmware revision */
 #if CONFIG_IS_ENABLED(BLK)
 	/*
 	 * For now we have a few functions which take struct blk_desc as a