Skip to contentSkip to conversation

Kconfig: Drop CONFIG_EMAC_MDIO_PHY_NUM

PATCH New Tom Rini 3 participants 17 messages May 10, 2017 – May 25, 2017

Subsystems (2)
lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/8 Kconfig: Drop CONFIG_EMAC_MDIO_PHY_NUM

This particular macro hasn't been used in the code for some time, remove these references that were missed.

---
 include/configs/calimain.h       | 1 -
 include/configs/ea20.h           | 1 -
 include/configs/omapl138_lcdk.h  | 1 -
 include/configs/tam3517-common.h | 1 -
 scripts/config_whitelist.txt     | 1 -
 5 files changed, 5 deletions(-)
include/configs/calimain.h +0 -1
index 425a38f55197..6e2fd3356323 100644
@@ -176,7 +176,6 @@
  * Network & Ethernet Configuration
  */
 #ifdef CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	1
 #define CONFIG_MII
 #define CONFIG_BOOTP_DNS
 #define CONFIG_BOOTP_DNS2
include/configs/ea20.h +0 -1
index 75100718831d..3a5b5c7285d5 100644
@@ -79,7 +79,6 @@
  * Network & Ethernet Configuration
  */
 #ifdef CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	0
 #define CONFIG_MII
 #define CONFIG_BOOTP_DNS
 #define CONFIG_BOOTP_DNS2
include/configs/omapl138_lcdk.h +0 -1
index 4efddb620746..0cc0042bca3b 100644
@@ -227,7 +227,6 @@
  * Network & Ethernet Configuration
  */
 #ifdef CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM	7
 #define CONFIG_MII
 #undef	CONFIG_DRIVER_TI_EMAC_USE_RMII
 #define CONFIG_BOOTP_DEFAULT
include/configs/tam3517-common.h +0 -1
index b1625b779c10..0bdf52eb684a 100644
@@ -169,7 +169,6 @@
 #define CONFIG_DRIVER_TI_EMAC
 #define CONFIG_DRIVER_TI_EMAC_USE_RMII
 #define CONFIG_MII
-#define CONFIG_EMAC_MDIO_PHY_NUM	0
 #define CONFIG_BOOTP_DNS
 #define CONFIG_BOOTP_DNS2
 #define CONFIG_BOOTP_SEND_HOSTNAME
scripts/config_whitelist.txt +0 -1
index cd0165f9344d..76d2b5a8e8a9 100644
@@ -776,7 +776,6 @@ CONFIG_EHCI_MMIO_BIG_ENDIAN
 CONFIG_EHCI_MXS_PORT0
 CONFIG_EHCI_MXS_PORT1
 CONFIG_ELBC_NAND_SPL_STATIC_PGSIZE
-CONFIG_EMAC_MDIO_PHY_NUM
 CONFIG_EMAC_NR_START
 CONFIG_EMAC_PHY_MODE
 CONFIG_EMIF4
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/8 cmd/bdinfo.c: Fix unused function warning

On most architectures we do not call print_std_bdinfo() so mark it with __maybe_unused. Reported by clang-3.8.

---
 cmd/bdinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/bdinfo.c +1 -1
index ff3cce05f989..41ab8e8089fa 100644
@@ -157,7 +157,7 @@ static inline void print_baudrate(void)
 #endif
 }
 
-static inline void print_std_bdinfo(const bd_t *bd)
+static inline void __maybe_unused print_std_bdinfo(const bd_t *bd)
 {
 	print_bi_boot_params(bd);
 	print_bi_mem(bd);
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 3/8 cmd/io.c: Fix comparison of unsigned expression warning

In reply to Tom Rini

The function cmd_get_data_size() returns an int and not unsigned. So we should assign it to an int rather than unsigned so that we can later compare the return value. Reported by clang-3.8.

---
 cmd/io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cmd/io.c +2 -1
index c59148f413cf..ad05f7ca5a32 100644
@@ -46,7 +46,8 @@ int do_io_iod(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 
 int do_io_iow(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 {
-	ulong addr, size, val;
+	ulong addr, val;
+	int size;
 
 	if (argc != 3)
 		return CMD_RET_USAGE;
Signature · 1 line
1.9.1
author
#6 lore raw

PATCH 4/8 cmd/led.c: Remove unnecessary check on 'cmd' value

In reply to Tom Rini

We first check that if argc is less than 2 we return CMD_RET_USAGE. We then see if argc is greater than 2 and if so call get_led_cmd() to set 'cmd' and otherwise set it to LEDST_COUNT (which will always be positive as it's an enum with 0 already assigned). Therefore the test on if cmd is less than 0 will always be false and simply be omitted. Reported by clang-3.8.

---
 cmd/led.c | 2 --
 1 file changed, 2 deletions(-)
cmd/led.c +0 -2
index 84173f86f228..bdfb16c0e098 100644
@@ -90,8 +90,6 @@ int do_led(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return list_leds();
 
 	cmd = argc > 2 ? get_led_cmd(argv[2]) : LEDST_COUNT;
-	if (cmd < 0)
-		return CMD_RET_USAGE;
 #ifdef CONFIG_LED_BLINK
 	if (cmd == LEDST_BLINK) {
 		if (argc < 4)
Signature · 1 line
1.9.1
author
#8 lore raw

PATCH 5/8 gpio-uclass.c: Fix comparison of unsigned expression warning

In reply to Tom Rini

We declare that gpio_base (which is the base for counting gpios, not an address) is unsigned. Therefore the comparison with >= 0 is always true. As the desire is to allow for this base number to be 0, we can just drop this check. Reported by clang-3.8.

---
 drivers/gpio/gpio-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-uclass.c +1 -1
index 9ab9df4ce7a6..ba4804083daa 100644
@@ -68,7 +68,7 @@ int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc)
 		if (numeric != -1) {
 			offset = numeric - uc_priv->gpio_base;
 			/* Allow GPIOs to be numbered from 0 */
-			if (offset >= 0 && offset < uc_priv->gpio_count)
+			if (offset < uc_priv->gpio_count)
 				break;
 		}
 
Signature · 1 line
1.9.1
author
#11 lore raw

PATCH 6/8 mmc: Change 'part_config' to be a u8 not char.

In reply to Tom Rini

In some places we check if part_config is set to MMCPART_NOAVAILABLE (0xff). With part_config being a char this is always false. We should be using a u8 to store this value instead, after a quick consultation with the Linux Kernel. Reported by clang-3.8.

Cc Jaehoon Chung <[email protected]>
---
 include/mmc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/mmc.h +1 -1
index fad12d608cef..00576fa3d0a3 100644
@@ -430,7 +430,7 @@ struct mmc {
 	u8 part_support;
 	u8 part_attr;
 	u8 wr_rel_set;
-	char part_config;
+	u8 part_config;
 	uint tran_speed;
 	uint read_bl_len;
 	uint write_bl_len;
Signature · 1 line
1.9.1
author
#13 lore raw

PATCH 7/8 drivers/power/regulator/max77686.c: Fix comparisons of unsigned expressions

In reply to Tom Rini

Inside of max77686_buck_volt2hex/max77686_buck_hex2volt/max77686_ldo_volt2hex we check that the value we calculate is >= 0 however we declare 'hex' as unsigned int making these always true. Mark these as 'int' instead. We also move hex_max to int as they are constants that are 0x3f/0xff. Given that the above functions are marked as returning an int, make the variables we assign their return value to also be int to be able to catch the error condition now. Reported by clang-3.8.

Cc Jaehoon Chung <[email protected]>
---
 drivers/power/regulator/max77686.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/power/regulator/max77686.c +8 -8
index 7479af734ade..5e5815f39789 100644
@@ -71,8 +71,8 @@ static const char max77686_buck_out[] = {
 
 static int max77686_buck_volt2hex(int buck, int uV)
 {
-	unsigned int hex = 0;
-	unsigned int hex_max = 0;
+	int hex = 0;
+	int hex_max = 0;
 
 	switch (buck) {
 	case 2:
@@ -105,7 +105,7 @@ static int max77686_buck_volt2hex(int buck, int uV)
 static int max77686_buck_hex2volt(int buck, int hex)
 {
 	unsigned uV = 0;
-	unsigned int hex_max = 0;
+	int hex_max = 0;
 
 	if (hex < 0)
 		goto bad_hex;
@@ -140,7 +140,7 @@ bad_hex:
 
 static int max77686_ldo_volt2hex(int ldo, int uV)
 {
-	unsigned int hex = 0;
+	int hex = 0;
 
 	switch (ldo) {
 	case 1:
@@ -319,9 +319,9 @@ static int max77686_ldo_modes(int ldo, struct dm_regulator_mode **modesp,
 
 static int max77686_ldo_val(struct udevice *dev, int op, int *uV)
 {
-	unsigned int hex, adr;
+	unsigned int adr;
 	unsigned char val;
-	int ldo, ret;
+	int hex, ldo, ret;
 
 	if (op == PMIC_OP_GET)
 		*uV = 0;
@@ -360,9 +360,9 @@ static int max77686_ldo_val(struct udevice *dev, int op, int *uV)
 
 static int max77686_buck_val(struct udevice *dev, int op, int *uV)
 {
-	unsigned int hex, mask, adr;
+	unsigned int mask, adr;
 	unsigned char val;
-	int buck, ret;
+	int hex, buck, ret;
 
 	buck = dev->driver_data;
 	if (buck < 1 || buck > MAX77686_BUCK_NUM) {
Signature · 1 line
1.9.1
author
#15 lore raw

PATCH 8/8 tpm: Fix comparison of unsigned expression warning

In reply to Tom Rini

The function tpm_xfer returns int so make 'err' be int rather than uint32_t so that we can catch an error condition. Reported by clang-3.8.

---
 lib/tpm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/tpm.c +1 -2
index cd7f88f2204e..fb520e3d733c 100644
@@ -230,10 +230,9 @@ static uint32_t tpm_sendrecv_command(const void *command,
 		void *response, size_t *size_ptr)
 {
 	struct udevice *dev;
-	int ret;
+	int err, ret;
 	uint8_t response_buffer[COMMAND_BUFFER_SIZE];
 	size_t response_length;
-	uint32_t err;
 
 	if (response) {
 		response_length = *size_ptr;
Signature · 1 line
1.9.1
#9 lore raw

PATCH 5/8 gpio-uclass.c: Fix comparison of unsigned expression warning

In reply to Tom Rini
Quoted 6 lines · Tom Rini

We declare that gpio_base (which is the base for counting gpios, not an address) is unsigned. Therefore the comparison with >= 0 is always true. As the desire is to allow for this base number to be 0, we can just drop this check. Reported by clang-3.8.

Quoted 6 lines
---
 drivers/gpio/gpio-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
author
#1 lore raw

PATCH 1/8 Kconfig: Drop CONFIG_EMAC_MDIO_PHY_NUM

In reply to Tom Rini
Quoted 4 lines · Tom Rini

This particular macro hasn't been used in the code for some time, remove these references that were missed.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/896c1b3c/attachment.sig>
author
#3 lore raw

PATCH 2/8 cmd/bdinfo.c: Fix unused function warning

In reply to Tom Rini
Quoted 4 lines · Tom Rini

On most architectures we do not call print_std_bdinfo() so mark it with __maybe_unused. Reported by clang-3.8.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/c609f636/attachment.sig>
author
#5 lore raw

PATCH 3/8 cmd/io.c: Fix comparison of unsigned expression warning

In reply to Tom Rini
Quoted 5 lines · Tom Rini

The function cmd_get_data_size() returns an int and not unsigned. So we should assign it to an int rather than unsigned so that we can later compare the return value. Reported by clang-3.8.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/c405f1e2/attachment.sig>
author
#7 lore raw

PATCH 4/8 cmd/led.c: Remove unnecessary check on 'cmd' value

In reply to Tom Rini
Quoted 8 lines · Tom Rini

We first check that if argc is less than 2 we return CMD_RET_USAGE. We then see if argc is greater than 2 and if so call get_led_cmd() to set 'cmd' and otherwise set it to LEDST_COUNT (which will always be positive as it's an enum with 0 already assigned). Therefore the test on if cmd is less than 0 will always be false and simply be omitted. Reported by clang-3.8.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/3d8a1cd7/attachment.sig>
author
#10 lore raw

PATCH 5/8 gpio-uclass.c: Fix comparison of unsigned expression warning

In reply to Tom Rini
Quoted 8 lines · Tom Rini

We declare that gpio_base (which is the base for counting gpios, not an address) is unsigned. Therefore the comparison with >= 0 is always true. As the desire is to allow for this base number to be 0, we can just drop this check. Reported by clang-3.8.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/a2e5629c/attachment.sig>
author
#16 lore raw

PATCH 8/8 tpm: Fix comparison of unsigned expression warning

In reply to Tom Rini
Quoted 5 lines · Tom Rini

The function tpm_xfer returns int so make 'err' be int rather than uint32_t so that we can catch an error condition. Reported by clang-3.8.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170512/304cc495/attachment.sig>
#12 lore raw

PATCH 6/8 mmc: Change 'part_config' to be a u8 not char.

In reply to Tom Rini

Hi Tom,

Quoted 7 lines · Tom Rini

In some places we check if part_config is set to MMCPART_NOAVAILABLE (0xff). With part_config being a char this is always false. We should be using a u8 to store this value instead, after a quick consultation with the Linux Kernel. Reported by clang-3.8.

Cc Jaehoon Chung <[email protected]>

Applied to u-boot-mmc. Thanks!

Quoted 18 lines
---
 include/mmc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/mmc.h +1 -1
index fad12d608cef..00576fa3d0a3 100644
@@ -430,7 +430,7 @@ struct mmc {
 	u8 part_support;
 	u8 part_attr;
 	u8 wr_rel_set;
-	char part_config;
+	u8 part_config;
 	uint tran_speed;
 	uint read_bl_len;
 	uint write_bl_len;
#14 lore raw

PATCH 7/8 drivers/power/regulator/max77686.c: Fix comparisons of unsigned expressions

In reply to Tom Rini
Quoted 11 lines · Tom Rini

Inside of max77686_buck_volt2hex/max77686_buck_hex2volt/max77686_ldo_volt2hex we check that the value we calculate is >= 0 however we declare 'hex' as unsigned int making these always true. Mark these as 'int' instead. We also move hex_max to int as they are constants that are 0x3f/0xff. Given that the above functions are marked as returning an int, make the variables we assign their return value to also be int to be able to catch the error condition now. Reported by clang-3.8.

Cc Jaehoon Chung <[email protected]>

Applied to u-boot-mmc for pmic. Thanks.

Quoted 62 lines
---
 drivers/power/regulator/max77686.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/power/regulator/max77686.c +8 -8
index 7479af734ade..5e5815f39789 100644
@@ -71,8 +71,8 @@ static const char max77686_buck_out[] = {
 
 static int max77686_buck_volt2hex(int buck, int uV)
 {
-	unsigned int hex = 0;
-	unsigned int hex_max = 0;
+	int hex = 0;
+	int hex_max = 0;
 
 	switch (buck) {
 	case 2:
@@ -105,7 +105,7 @@ static int max77686_buck_volt2hex(int buck, int uV)
 static int max77686_buck_hex2volt(int buck, int hex)
 {
 	unsigned uV = 0;
-	unsigned int hex_max = 0;
+	int hex_max = 0;
 
 	if (hex < 0)
 		goto bad_hex;
@@ -140,7 +140,7 @@ bad_hex:
 
 static int max77686_ldo_volt2hex(int ldo, int uV)
 {
-	unsigned int hex = 0;
+	int hex = 0;
 
 	switch (ldo) {
 	case 1:
@@ -319,9 +319,9 @@ static int max77686_ldo_modes(int ldo, struct dm_regulator_mode **modesp,
 
 static int max77686_ldo_val(struct udevice *dev, int op, int *uV)
 {
-	unsigned int hex, adr;
+	unsigned int adr;
 	unsigned char val;
-	int ldo, ret;
+	int hex, ldo, ret;
 
 	if (op == PMIC_OP_GET)
 		*uV = 0;
@@ -360,9 +360,9 @@ static int max77686_ldo_val(struct udevice *dev, int op, int *uV)
 
 static int max77686_buck_val(struct udevice *dev, int op, int *uV)
 {
-	unsigned int hex, mask, adr;
+	unsigned int mask, adr;
 	unsigned char val;
-	int buck, ret;
+	int hex, buck, ret;
 
 	buck = dev->driver_data;
 	if (buck < 1 || buck > MAX77686_BUCK_NUM) {