public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Josua Mayer <josua@solid-run.com>
To: u-boot@lists.denx.de
Cc: Josua Mayer <josua@solid-run.com>, Simon Glass <sjg@chromium.org>,
	Stefan Roese <sr@denx.de>,
	Sven Auhagen <Sven.Auhagen@voleatech.de>
Subject: [PATCH 08/12] cmd: tlv_eeprom: clean up two defines for one thing
Date: Mon,  2 May 2022 17:18:34 +0300	[thread overview]
Message-ID: <20220502141838.15912-9-josua@solid-run.com> (raw)
In-Reply-To: <20220502141838.15912-1-josua@solid-run.com>

MAX_TLV_DEVICES defined in C, and TLV_MAX_DEVICES defined in the header
serve the same purpose. Replace all occurences of the former by the
latter.

Signed-off-by: Josua Mayer <josua@solid-run.com>
---
 cmd/tlv_eeprom.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c
index f51a9666bf..c110927cb5 100644
--- a/cmd/tlv_eeprom.c
+++ b/cmd/tlv_eeprom.c
@@ -25,8 +25,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define MAX_TLV_DEVICES	2
-
 /* File scope function prototypes */
 static int read_eeprom(int devnum, u8 *eeprom);
 static void show_eeprom(int devnum, u8 *eeprom);
@@ -39,7 +37,7 @@ static void show_tlv_devices(int current_dev);
 /* The EERPOM contents after being read into memory */
 static u8 eeprom[TLV_INFO_MAX_LEN];
 
-static struct udevice *tlv_devices[MAX_TLV_DEVICES];
+static struct udevice *tlv_devices[TLV_MAX_DEVICES];
 
 #define to_header(p) ((struct tlvinfo_header *)p)
 #define to_entry(p) ((struct tlvinfo_tlv *)p)
@@ -873,7 +871,7 @@ static void show_tlv_devices(int current_dev)
 {
 	unsigned int dev;
 
-	for (dev = 0; dev < MAX_TLV_DEVICES; dev++)
+	for (dev = 0; dev < TLV_MAX_DEVICES; dev++)
 		if (exists_tlv_eeprom(dev))
 			printf("TLV: %u%s\n", dev,
 			       (dev == current_dev) ? " (*)" : "");
@@ -890,7 +888,7 @@ static int find_tlv_devices(struct udevice **tlv_devices_p)
 			ret = uclass_next_device_check(&dev)) {
 		if (ret == 0)
 			tlv_devices_p[count_dev++] = dev;
-		if (count_dev >= MAX_TLV_DEVICES)
+		if (count_dev >= TLV_MAX_DEVICES)
 			break;
 	}
 
@@ -899,7 +897,7 @@ static int find_tlv_devices(struct udevice **tlv_devices_p)
 
 static struct udevice *find_tlv_device_by_index(int dev_num)
 {
-	struct udevice *local_tlv_devices[MAX_TLV_DEVICES] = {};
+	struct udevice *local_tlv_devices[TLV_MAX_DEVICES] = {};
 	struct udevice **tlv_devices_p;
 	int ret;
 
@@ -926,7 +924,7 @@ int read_tlv_eeprom(void *eeprom, int offset, int len, int dev_num)
 {
 	struct udevice *dev;
 
-	if (dev_num >= MAX_TLV_DEVICES)
+	if (dev_num >= TLV_MAX_DEVICES)
 		return -EINVAL;
 
 	dev = find_tlv_device_by_index(dev_num);
-- 
2.34.1


  parent reply	other threads:[~2022-05-02 14:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 14:18 [PATCH 00/12] split tlv_eeprom command into a separate library Josua Mayer
2022-05-02 14:18 ` [PATCH 01/12] cmd: tlv_eeprom: remove use of global variable current_dev Josua Mayer
2022-05-03  6:09   ` Stefan Roese
2022-05-03  6:52     ` Josua Mayer
2022-05-02 14:18 ` [PATCH 02/12] cmd: tlv_eeprom: remove use of global variable has_been_read Josua Mayer
2022-05-03  6:11   ` Stefan Roese
2022-05-02 14:18 ` [PATCH 03/12] cmd: tlv_eeprom: do_tlv_eeprom: stop using non-api read_eeprom function Josua Mayer
2022-05-03  6:12   ` Stefan Roese
2022-05-02 14:18 ` [PATCH 04/12] cmd: tlv_eeprom: convert functions used by command to api functions Josua Mayer
2022-05-03  6:16   ` Stefan Roese
2022-05-03  7:17     ` Josua Mayer
2022-05-03 10:54       ` Stefan Roese
2022-05-03 19:09         ` Josua Mayer
2022-05-05  5:09           ` Stefan Roese
2022-05-02 14:18 ` [PATCH 05/12] cmd: tlv_eeprom: remove empty function implementations from header Josua Mayer
2022-05-02 14:18 ` [PATCH 06/12] cmd: tlv_eeprom: move missing declarations and defines to header Josua Mayer
2022-05-02 14:18 ` [PATCH 07/12] cmd: tlv_eeprom: hide access to static tlv_devices array behind accessor Josua Mayer
2022-05-02 14:18 ` Josua Mayer [this message]
2022-05-02 14:18 ` [PATCH 09/12] cmd: tlv_eeprom: add my copyright Josua Mayer
2022-05-02 14:18 ` [PATCH 10/12] cmd: tlv_eeprom: split off tlv library from command Josua Mayer
2022-05-02 14:18 ` [PATCH 11/12] arm: mvebu: clearfog: enable tlv library for spl in favour of eeprom cmd Josua Mayer
2022-05-02 14:18 ` [PATCH 12/12] lib: tlv_eeprom: add function for reading one entry into a C string Josua Mayer

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=20220502141838.15912-9-josua@solid-run.com \
    --to=josua@solid-run.com \
    --cc=Sven.Auhagen@voleatech.de \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /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