mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] mtd: m25p80: explicitly cast name pointer
@ 2015-06-26 18:59 Lucas Stach
  2015-06-26 18:59 ` [PATCH 2/4] commands: digest: fix harmless warning Lucas Stach
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Lucas Stach @ 2015-06-26 18:59 UTC (permalink / raw)
  To: barebox

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]

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 drivers/mtd/devices/m25p80.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index c941767..c2e481e 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -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 */
 
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/4] commands: digest: fix harmless warning
  2015-06-26 18:59 [PATCH 1/4] mtd: m25p80: explicitly cast name pointer Lucas Stach
@ 2015-06-26 18:59 ` Lucas Stach
  2015-06-29  5:23   ` Sascha Hauer
  2015-06-26 18:59 ` [PATCH 3/4] parameter: always build MAC dev param functions Lucas Stach
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Lucas Stach @ 2015-06-26 18:59 UTC (permalink / raw)
  To: barebox

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

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 commands/digest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/digest.c b/commands/digest.c
index 340c07a..4cc615d 100644
--- a/commands/digest.c
+++ b/commands/digest.c
@@ -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");
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/4] parameter: always build MAC dev param functions
  2015-06-26 18:59 [PATCH 1/4] mtd: m25p80: explicitly cast name pointer Lucas Stach
  2015-06-26 18:59 ` [PATCH 2/4] commands: digest: fix harmless warning Lucas Stach
@ 2015-06-26 18:59 ` Lucas Stach
  2015-06-26 18:59 ` [PATCH 4/4] mtd: spi-nor: depend on SPI Lucas Stach
  2015-06-29  5:17 ` [PATCH 1/4] mtd: m25p80: explicitly cast name pointer Sascha Hauer
  3 siblings, 0 replies; 7+ messages in thread
From: Lucas Stach @ 2015-06-26 18:59 UTC (permalink / raw)
  To: barebox

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'

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 include/net.h   | 30 ++++++++++++++++++++++++++++--
 lib/parameter.c |  2 --
 net/net.c       | 29 -----------------------------
 3 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/include/net.h b/include/net.h
index 364011b..245d2b5 100644
--- a/include/net.h
+++ b/include/net.h
@@ -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);
diff --git a/lib/parameter.c b/lib/parameter.c
index 865ad9f..f39b98d 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -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
diff --git a/net/net.c b/net/net.c
index 07350ad..867ec07 100644
--- a/net/net.c
+++ b/net/net.c
@@ -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;
 
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/4] mtd: spi-nor: depend on SPI
  2015-06-26 18:59 [PATCH 1/4] mtd: m25p80: explicitly cast name pointer Lucas Stach
  2015-06-26 18:59 ` [PATCH 2/4] commands: digest: fix harmless warning Lucas Stach
  2015-06-26 18:59 ` [PATCH 3/4] parameter: always build MAC dev param functions Lucas Stach
@ 2015-06-26 18:59 ` Lucas Stach
  2015-06-29  5:22   ` Sascha Hauer
  2015-06-29  5:17 ` [PATCH 1/4] mtd: m25p80: explicitly cast name pointer Sascha Hauer
  3 siblings, 1 reply; 7+ messages in thread
From: Lucas Stach @ 2015-06-26 18:59 UTC (permalink / raw)
  To: barebox

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 drivers/mtd/spi-nor/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
index a84591f..7594c1c 100644
--- a/drivers/mtd/spi-nor/Kconfig
+++ b/drivers/mtd/spi-nor/Kconfig
@@ -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.
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/4] mtd: m25p80: explicitly cast name pointer
  2015-06-26 18:59 [PATCH 1/4] mtd: m25p80: explicitly cast name pointer Lucas Stach
                   ` (2 preceding siblings ...)
  2015-06-26 18:59 ` [PATCH 4/4] mtd: spi-nor: depend on SPI Lucas Stach
@ 2015-06-29  5:17 ` Sascha Hauer
  3 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2015-06-29  5:17 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Fri, Jun 26, 2015 at 08:59:20PM +0200, Lucas Stach wrote:
> 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]
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
>  drivers/mtd/devices/m25p80.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
> index c941767..c2e481e 100644
> --- a/drivers/mtd/devices/m25p80.c
> +++ b/drivers/mtd/devices/m25p80.c
> @@ -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

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 4/4] mtd: spi-nor: depend on SPI
  2015-06-26 18:59 ` [PATCH 4/4] mtd: spi-nor: depend on SPI Lucas Stach
@ 2015-06-29  5:22   ` Sascha Hauer
  0 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2015-06-29  5:22 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Fri, Jun 26, 2015 at 08:59:23PM +0200, Lucas Stach wrote:
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
>  drivers/mtd/spi-nor/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
> index a84591f..7594c1c 100644
> --- a/drivers/mtd/spi-nor/Kconfig
> +++ b/drivers/mtd/spi-nor/Kconfig
> @@ -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

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 2/4] commands: digest: fix harmless warning
  2015-06-26 18:59 ` [PATCH 2/4] commands: digest: fix harmless warning Lucas Stach
@ 2015-06-29  5:23   ` Sascha Hauer
  0 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2015-06-29  5:23 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Fri, Jun 26, 2015 at 08:59:21PM +0200, Lucas Stach wrote:
> Fixes with !CONFIG_LONGHELP:
> commands/digest.c:71:13: warning:
> 'prints_algo_help' defined but not used [-Wunused-function]
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>

Applied this one and 3/4.

Sascha


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2015-06-29  5:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-26 18:59 [PATCH 1/4] mtd: m25p80: explicitly cast name pointer Lucas Stach
2015-06-26 18:59 ` [PATCH 2/4] commands: digest: fix harmless warning Lucas Stach
2015-06-29  5:23   ` Sascha Hauer
2015-06-26 18:59 ` [PATCH 3/4] parameter: always build MAC dev param functions Lucas Stach
2015-06-26 18:59 ` [PATCH 4/4] mtd: spi-nor: depend on SPI Lucas Stach
2015-06-29  5:22   ` Sascha Hauer
2015-06-29  5:17 ` [PATCH 1/4] mtd: m25p80: explicitly cast name pointer Sascha Hauer

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