Skip to contentSkip to conversation

mtd: m25p80: explicitly cast name pointer

PATCH In review Lucas Stach 2 participants 7 messages Jun 26, 2015 – Jun 29, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 mtd: m25p80: explicitly cast name pointer

Fixes:
drivers/mtd/devices/m25p80.c: In function 'm25p_probe':
drivers/mtd/devices/m25p80.c:271:14: warning:
assignment discards 'const' qualifier from pointer target type [enabled by default]

---
 drivers/mtd/devices/m25p80.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/devices/m25p80.c +1 -1
index c941767..c2e481e 100644
@@ -268,7 +268,7 @@ static int m25p_probe(struct device_d *dev)
 	else if (data && data->name)
 		flash_name = data->name;
 	else if (dev->id_entry)
-		flash_name = dev->id_entry->name;
+		flash_name = (char *)dev->id_entry->name;
 	else
 		flash_name = NULL; /* auto-detect */
 
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/4 commands: digest: fix harmless warning

Fixes with !CONFIG_LONGHELP:
commands/digest.c:71:13: warning:
'prints_algo_help' defined but not used [-Wunused-function]

---
 commands/digest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
commands/digest.c +1 -1
index 340c07a..4cc615d 100644
@@ -68,7 +68,7 @@ err:
 	return ret;
 }
 
-static void prints_algo_help(void)
+static void __maybe_unused prints_algo_help(void)
 {
 	puts("\navailable algo:\n");
 	digest_algo_prints("\t");
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

Re: [PATCH 2/4] commands: digest: fix harmless warning

Quoted 5 lines · Lucas Stach

Fixes with !CONFIG_LONGHELP:
commands/digest.c:71:13: warning:
'prints_algo_help' defined but not used [-Wunused-function]

Applied this one and 3/4.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 3/4 parameter: always build MAC dev param functions

In reply to Lucas Stach

The MAC dev parameter functions would only be built when CONFIG_NET is set. This was okay as long as only network devices were using MAC dev params. This has changed with the merge of the state framework, so always compile them in if CONFIG_PARAMETER is set.

This moves some trivial functions to the header, to avoid the need to also build net/eth.c in that case.

Fixes:
common/built-in.o: In function `state_mac_create':
common/state.c:387: undefined reference to `dev_add_param_mac'

---
 include/net.h   | 30 ++++++++++++++++++++++++++++--
 lib/parameter.c |  2 --
 net/net.c       | 29 -----------------------------
 3 files changed, 28 insertions(+), 33 deletions(-)
include/net.h +28 -2
index 364011b..245d2b5 100644
@@ -310,8 +310,34 @@ int string_to_ip(const char *s, IPaddr_t *ip);
 IPaddr_t getenv_ip(const char *name);
 int setenv_ip(const char *name, IPaddr_t ip);
 
-int string_to_ethaddr(const char *str, u8 enetaddr[6]);
-void ethaddr_to_string(const u8 enetaddr[6], char *str);
+static inline int string_to_ethaddr(const char *str, u8 enetaddr[6])
+{
+	int reg;
+	char *e;
+
+	if (!str || strlen(str) != 17) {
+		memset(enetaddr, 0, 6);
+		return -EINVAL;
+	}
+
+	if (str[2] != ':' || str[5] != ':' || str[8] != ':' ||
+	    str[11] != ':' || str[14] != ':')
+		return -EINVAL;
+
+	for (reg = 0; reg < 6; ++reg) {
+		enetaddr[reg] = simple_strtoul (str, &e, 16);
+		str = e + 1;
+	}
+
+	return 0;
+}
+
+static inline void ethaddr_to_string(const u8 enetaddr[6], char *str)
+{
+	sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x",
+		enetaddr[0], enetaddr[1], enetaddr[2], enetaddr[3],
+		enetaddr[4], enetaddr[5]);
+}
 
 #ifdef CONFIG_NET_RESOLV
 IPaddr_t resolv(char *host);
lib/parameter.c +0 -2
index 865ad9f..f39b98d 100644
@@ -575,7 +575,6 @@ struct param_d *dev_add_param_llint_ro(struct device_d *dev, const char *name,
 	return &piro->param;
 }
 
-#ifdef CONFIG_NET
 struct param_ip {
 	struct param_d param;
 	IPaddr_t *ip;
@@ -739,7 +738,6 @@ struct param_d *dev_add_param_mac(struct device_d *dev, const char *name,
 
 	return &pm->param;
 }
-#endif
 
 /**
  * dev_remove_param - remove a parameter from a device and free its
net/net.c +0 -29
index 07350ad..867ec07 100644
@@ -136,35 +136,6 @@ void print_IPaddr (IPaddr_t x)
 	puts(ip_to_string(x));
 }
 
-int string_to_ethaddr(const char *str, u8 enetaddr[6])
-{
-	int reg;
-	char *e;
-
-        if (!str || strlen(str) != 17) {
-		memset(enetaddr, 0, 6);
-		return -EINVAL;
-	}
-
-        if (str[2] != ':' || str[5] != ':' || str[8] != ':' ||
-                        str[11] != ':' || str[14] != ':')
-                return -EINVAL;
-
-	for (reg = 0; reg < 6; ++reg) {
-		enetaddr[reg] = simple_strtoul (str, &e, 16);
-			str = e + 1;
-	}
-
-	return 0;
-}
-
-void ethaddr_to_string(const u8 enetaddr[6], char *str)
-{
-	sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x",
-		 enetaddr[0], enetaddr[1], enetaddr[2], enetaddr[3],
-		 enetaddr[4], enetaddr[5]);
-}
-
 static unsigned char *arp_ether;
 static IPaddr_t arp_wait_ip;
 
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 4/4 mtd: spi-nor: depend on SPI

In reply to Lucas Stach
---
 drivers/mtd/spi-nor/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi-nor/Kconfig +1 -0
index a84591f..7594c1c 100644
@@ -1,6 +1,7 @@
 menuconfig MTD_SPI_NOR
 	tristate "SPI-NOR device support"
 	depends on MTD
+	depends on SPI
 	help
 	  This is the framework for the SPI NOR which can be used by the SPI
 	  device drivers and the SPI-NOR device driver.
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

Re: [PATCH 4/4] mtd: spi-nor: depend on SPI

Quoted 10 lines · Lucas Stach
---
 drivers/mtd/spi-nor/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi-nor/Kconfig +0 -0
index a84591f..7594c1c 100644

drivers/mtd/spi-nor/Kconfig line 4

Quoted 4 lines
drivers/mtd/spi-nor/Kconfig +1 -0
@@ -1,6 +1,7 @@
 menuconfig MTD_SPI_NOR
 	tristate "SPI-NOR device support"
 	depends on MTD
+	depends on SPI

Nope. MTD_SPI_NOR is library code only which can be used without SPI, see the cadence-quadspi driver. It's the m25p80 driver which needs SPI.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw
In reply to Lucas Stach
Quoted 15 lines · Lucas Stach

Fixes:
drivers/mtd/devices/m25p80.c: In function 'm25p_probe':
drivers/mtd/devices/m25p80.c:271:14: warning:
assignment discards 'const' qualifier from pointer target type [enabled by default]

---
 drivers/mtd/devices/m25p80.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/devices/m25p80.c +0 -0
index c941767..c2e481e 100644

drivers/mtd/devices/m25p80.c static int m25p_probe(struct device_d *dev) · line 271

Quoted 5 lines
drivers/mtd/devices/m25p80.c +1 -1
@@ -268,7 +268,7 @@ static int m25p_probe(struct device_d *dev)
 	else if (data && data->name)
 		flash_name = data->name;
 	else if (dev->id_entry)
-		flash_name = dev->id_entry->name;
+		flash_name = (char *)dev->id_entry->name;

Rather than patching the warning away we should make the add_mtd_device devname argument const, see the patch I just sent.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox