Skip to contentSkip to conversation

Initial sparse fix series

PATCH Superseded Kim Phillips 17 participants 117 messages Oct 17, 2012 – Jan 6, 2013 6 messages not in the archive Page 2 of 2

Subsystems (16)
lore
Share & tools
lore
#102 lore raw

PATCH v2 11/25 net/: sparse fixes

In reply to Kim Phillips

bootp.c:44:14: warning: symbol 'dhcp_state' was not declared. Should it be static? bootp.c:45:15: warning: symbol 'dhcp_leasetime' was not declared. Should it be static? bootp.c:46:10: warning: symbol 'NetDHCPServerIP' was not declared. Should it be static? arp.c:30:17: warning: symbol 'NetArpWaitReplyIP' was not declared. Should it be static? arp.c:37:16: warning: symbol 'NetArpTxPacket' was not declared. Should it be static? arp.c:38:17: warning: symbol 'NetArpPacketBuf' was not declared. Should it be static? atheros.c:33:19: warning: symbol 'AR8021_driver' was not declared. Should it be static? net.c:183:7: warning: symbol 'PktBuf' was not declared. Should it be static? net.c:159:21: warning: symbol 'net_state' was not declared. Should it be static? ping.c:73:6: warning: symbol 'ping_start' was not declared. Should it be static? ping.c:82:13: warning: symbol 'ping_receive' was not declared. Should it be static? tftp.c:53:7: warning: symbol 'TftpRRQTimeoutMSecs' was not declared. Should it be static? tftp.c:54:5: warning: symbol 'TftpRRQTimeoutCountMax' was not declared. Should it be static? eth.c:125:19: warning: symbol 'eth_current' was not declared. Should it be static?

Note: in the ping.c fix, commit a36b12f95a29647a06b5459198684fc142482020 "net: Move PING out of net.c" mistakenly carried the ifdef CMD_PING clause from when it was necessary to avoid warnings when it was embedded in net.c.

---
v2: no changes

 common/update.c           | 1 +
 drivers/net/phy/atheros.c | 2 +-
 include/net.h             | 9 +++++----
 net/arp.c                 | 6 +++---
 net/bootp.c               | 6 +++---
 net/net.c                 | 2 +-
 net/ping.h                | 3 ---
 net/tftp.h                | 3 +++
 8 files changed, 17 insertions(+), 15 deletions(-)
common/update.c +1 -0
index 5b1a064..94d6a82 100644
@@ -37,6 +37,7 @@
 #include <command.h>
 #include <flash.h>
 #include <net.h>
+#include <net/tftp.h>
 #include <malloc.h>
 
 /* env variable holding the location of the update file */
drivers/net/phy/atheros.c +1 -1
index 798473d..9b3808b 100644
@@ -30,7 +30,7 @@ static int ar8021_config(struct phy_device *phydev)
 	return 0;
 }
 
-struct phy_driver AR8021_driver =  {
+static struct phy_driver AR8021_driver =  {
 	.name = "AR8021",
 	.uid = 0x4dd040,
 	.mask = 0xfffff0,
include/net.h +5 -4
index 3539336..970d4d1 100644
@@ -102,12 +102,13 @@ extern int eth_register(struct eth_device* dev);/* Register network device */
 extern int eth_unregister(struct eth_device *dev);/* Remove network device */
 extern void eth_try_another(int first_restart);	/* Change the device */
 extern void eth_set_current(void);		/* set nterface to ethcur var */
+
 /* get the current device MAC */
+extern struct eth_device *eth_current;
+
 static inline __attribute__((always_inline))
 struct eth_device *eth_get_dev(void)
 {
-	extern struct eth_device *eth_current;
-
 	return eth_current;
 }
 extern struct eth_device *eth_get_dev_by_name(const char *devname);
@@ -517,10 +518,10 @@ enum net_loop_state {
 	NETLOOP_SUCCESS,
 	NETLOOP_FAIL
 };
+extern enum net_loop_state net_state;
+
 static inline void net_set_state(enum net_loop_state state)
 {
-	extern enum net_loop_state net_state;
-
 	debug_cond(DEBUG_INT_STATE, "--- NetState set to %d\n", state);
 	net_state = state;
 }
net/arp.c +3 -3
index 8e1d2ed..20c6b2d 100644
@@ -27,15 +27,15 @@
 #endif
 
 IPaddr_t	NetArpWaitPacketIP;
-IPaddr_t	NetArpWaitReplyIP;
+static IPaddr_t	NetArpWaitReplyIP;
 /* MAC address of waiting packet's destination */
 uchar	       *NetArpWaitPacketMAC;
 int		NetArpWaitTxPacketSize;
 ulong		NetArpWaitTimerStart;
 int		NetArpWaitTry;
 
-uchar	       *NetArpTxPacket;	/* THE ARP transmit packet */
-uchar		NetArpPacketBuf[PKTSIZE_ALIGN + PKTALIGN];
+static uchar   *NetArpTxPacket;	/* THE ARP transmit packet */
+static uchar	NetArpPacketBuf[PKTSIZE_ALIGN + PKTALIGN];
 
 void ArpInit(void)
 {
net/bootp.c +3 -3
index cd5c5dd..4300f1c 100644
@@ -41,9 +41,9 @@ ulong		BootpID;
 int		BootpTry;
 
 #if defined(CONFIG_CMD_DHCP)
-dhcp_state_t dhcp_state = INIT;
-unsigned long dhcp_leasetime;
-IPaddr_t NetDHCPServerIP;
+static dhcp_state_t dhcp_state = INIT;
+static unsigned long dhcp_leasetime;
+static IPaddr_t NetDHCPServerIP;
 static void DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,
 			unsigned len);
 
net/net.c +1 -1
index 569fec4..82c4cc9 100644
@@ -180,7 +180,7 @@ IPaddr_t	NetNtpServerIP;
 int		NetTimeOffset;
 #endif
 
-uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
+static uchar PktBuf[(PKTBUFSRX+1) * PKTSIZE_ALIGN + PKTALIGN];
 
 /* Receive packet */
 uchar *NetRxPackets[PKTBUFSRX];
net/ping.h +0 -3
index fd8d8d9..8c71be4 100644
@@ -8,8 +8,6 @@
  *	Copyright 2000-2002 Wolfgang Denk, wd at denx.de
  */
 
-#if defined(CONFIG_CMD_PING)
-
 #ifndef __PING_H__
 #define __PING_H__
 
@@ -31,4 +29,3 @@ void ping_start(void);
 void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len);
 
 #endif /* __PING_H__ */
-#endif
net/tftp.h +3 -0
index 18e4c9c..2b686e3 100644
@@ -22,6 +22,9 @@ void TftpStart(enum proto_t protocol);	/* Begin TFTP get/put */
 extern void TftpStartServer(void);	/* Wait for incoming TFTP put */
 #endif
 
+extern ulong TftpRRQTimeoutMSecs;
+extern int TftpRRQTimeoutCountMax;
+
 /**********************************************************************/
 
 #endif /* __TFTP_H__ */
Signature · 1 line
1.8.0
#103 lore raw

PATCH v2 12/25 drivers/net/: sparse fixes

In reply to Kim Phillips

phy.c:46:5: warning: symbol 'genphy_config_advert' was not declared. Should it be static? phy.c:121:5: warning: symbol 'genphy_setup_forced' was not declared. Should it be static? phy.c:468:5: warning: symbol 'phy_probe' was not declared. Should it be static? phy.c:491:19: warning: symbol 'get_phy_driver' was not declared. Should it be static? phy.c:508:19: warning: symbol 'phy_device_create' was not declared. Should it be static? phy.c:552:5: warning: symbol 'get_phy_id' was not declared. Should it be static? phy.c:584:19: warning: symbol 'get_phy_device' was not declared. Should it be sta vitesse.c:126:5: warning: symbol 'vsc8601_config' was not declared. Should it be static? vsc7385.c:33:5: warning: symbol 'vsc7385_upload_firmware' was not declared. Should it be static? tgec_phy.c:33:5: warning: symbol 'tgec_mdio_write' was not declared. Should it be static? tgec_phy.c:75:5: warning: symbol 'tgec_mdio_read' was not declared. Should it be static? tgec_phy.c:117:5: warning: symbol 'tgec_mdio_reset' was not declared. Should it be static? eth.c:48:6: warning: symbol 'dtsec_configure_serdes' was not declared. Should it be static? p4080.c:26:5: warning: symbol 'port_to_devdisr' was not declared. Should it be static?

---
v2: no changes

 drivers/net/fm/eth.c      |  2 +-
 drivers/net/fm/p1023.c    |  2 +-
 drivers/net/fm/p4080.c    |  2 +-
 drivers/net/fm/p5020.c    |  2 +-
 drivers/net/fm/tgec_phy.c | 10 +++++-----
 drivers/net/phy/phy.c     | 19 ++++++++++---------
 drivers/net/phy/vitesse.c |  2 +-
 drivers/net/vsc7385.c     |  1 +
 8 files changed, 21 insertions(+), 19 deletions(-)
drivers/net/fm/eth.c +1 -1
index 82c787b..54b142f 100644
@@ -46,7 +46,7 @@ static int num_controllers;
 			TBICR_FULL_DUPLEX | TBICR_SPEED1_SET)
 
 /* Configure the TBI for SGMII operation */
-void dtsec_configure_serdes(struct fm_eth *priv)
+static void dtsec_configure_serdes(struct fm_eth *priv)
 {
 #ifdef CONFIG_SYS_FMAN_V3
 	u32 value;
drivers/net/fm/p1023.c +1 -1
index 9765da5..387d2a3 100644
@@ -23,7 +23,7 @@
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
 
-u32 port_to_devdisr[] = {
+static u32 port_to_devdisr[] = {
 	[FM1_DTSEC1] = MPC85xx_DEVDISR_TSEC1,
 	[FM1_DTSEC2] = MPC85xx_DEVDISR_TSEC2,
 };
drivers/net/fm/p4080.c +1 -1
index 9dc6049..b04fd0f 100644
@@ -23,7 +23,7 @@
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
 
-u32 port_to_devdisr[] = {
+static u32 port_to_devdisr[] = {
 	[FM1_DTSEC1] = FSL_CORENET_DEVDISR2_DTSEC1_1,
 	[FM1_DTSEC2] = FSL_CORENET_DEVDISR2_DTSEC1_2,
 	[FM1_DTSEC3] = FSL_CORENET_DEVDISR2_DTSEC1_3,
drivers/net/fm/p5020.c +1 -1
index a7a6e43..5391044 100644
@@ -23,7 +23,7 @@
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
 
-u32 port_to_devdisr[] = {
+static u32 port_to_devdisr[] = {
 	[FM1_DTSEC1] = FSL_CORENET_DEVDISR2_DTSEC1_1,
 	[FM1_DTSEC2] = FSL_CORENET_DEVDISR2_DTSEC1_2,
 	[FM1_DTSEC3] = FSL_CORENET_DEVDISR2_DTSEC1_3,
drivers/net/fm/tgec_phy.c +5 -5
index 2d349ad..2be69d7 100644
@@ -30,8 +30,8 @@
  * until the write is done before it returns.  All PHY configuration has to be
  * done through the TSEC1 MIIM regs
  */
-int tgec_mdio_write(struct mii_dev *bus, int port_addr, int dev_addr,
-			int regnum, u16 value)
+static int tgec_mdio_write(struct mii_dev *bus, int port_addr, int dev_addr,
+			   int regnum, u16 value)
 {
 	u32 mdio_ctl;
 	u32 stat_val;
@@ -72,8 +72,8 @@ int tgec_mdio_write(struct mii_dev *bus, int port_addr, int dev_addr,
  * Clears miimcom first.  All PHY configuration has to be done through the
  * TSEC1 MIIM regs
  */
-int tgec_mdio_read(struct mii_dev *bus, int port_addr, int dev_addr,
-			int regnum)
+static int tgec_mdio_read(struct mii_dev *bus, int port_addr, int dev_addr,
+			  int regnum)
 {
 	u32 mdio_ctl;
 	u32 stat_val;
@@ -114,7 +114,7 @@ int tgec_mdio_read(struct mii_dev *bus, int port_addr, int dev_addr,
 	return in_be32(&regs->mdio_data) & 0xffff;
 }
 
-int tgec_mdio_reset(struct mii_dev *bus)
+static int tgec_mdio_reset(struct mii_dev *bus)
 {
 	return 0;
 }
drivers/net/phy/phy.c +10 -9
index baef60f..1ffa791 100644
@@ -43,7 +43,7 @@
  *   what is supported.  Returns < 0 on error, 0 if the PHY's advertisement
  *   hasn't changed, and > 0 if it has changed.
  */
-int genphy_config_advert(struct phy_device *phydev)
+static int genphy_config_advert(struct phy_device *phydev)
 {
 	u32 advertise;
 	int oldadv, adv;
@@ -118,7 +118,7 @@ int genphy_config_advert(struct phy_device *phydev)
  * Description: Configures MII_BMCR to force speed/duplex
  *   to the values in phydev. Assumes that the values are valid.
  */
-int genphy_setup_forced(struct phy_device *phydev)
+static int genphy_setup_forced(struct phy_device *phydev)
 {
 	int err;
 	int ctl = 0;
@@ -465,7 +465,7 @@ int phy_register(struct phy_driver *drv)
 	return 0;
 }
 
-int phy_probe(struct phy_device *phydev)
+static int phy_probe(struct phy_device *phydev)
 {
 	int err = 0;
 
@@ -488,7 +488,7 @@ static struct phy_driver *generic_for_interface(phy_interface_t interface)
 	return &genphy_driver;
 }
 
-struct phy_driver *get_phy_driver(struct phy_device *phydev,
+static struct phy_driver *get_phy_driver(struct phy_device *phydev,
 				phy_interface_t interface)
 {
 	struct list_head *entry;
@@ -505,8 +505,9 @@ struct phy_driver *get_phy_driver(struct phy_device *phydev,
 	return generic_for_interface(interface);
 }
 
-struct phy_device *phy_device_create(struct mii_dev *bus, int addr, int phy_id,
-					phy_interface_t interface)
+static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
+					    int phy_id,
+					    phy_interface_t interface)
 {
 	struct phy_device *dev;
 
@@ -549,7 +550,7 @@ struct phy_device *phy_device_create(struct mii_dev *bus, int addr, int phy_id,
  * Description: Reads the ID registers of the PHY at @addr on the
  *   @bus, stores it in @phy_id and returns zero on success.
  */
-int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
+static int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
 {
 	int phy_reg;
 
@@ -581,8 +582,8 @@ int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
  * Description: Reads the ID registers of the PHY at @addr on the
  *   @bus, then allocates and returns the phy_device to represent it.
  */
-struct phy_device *get_phy_device(struct mii_dev *bus, int addr,
-				phy_interface_t interface)
+static struct phy_device *get_phy_device(struct mii_dev *bus, int addr,
+					 phy_interface_t interface)
 {
 	u32 phy_id = 0x1fffffff;
 	int i;
drivers/net/phy/vitesse.c +1 -1
index 0a0f40d..6c5cb99 100644
@@ -123,7 +123,7 @@ static int cis8204_config(struct phy_device *phydev)
 }
 
 /* Vitesse VSC8601 */
-int vsc8601_config(struct phy_device *phydev)
+static int vsc8601_config(struct phy_device *phydev)
 {
 	/* Configure some basic stuff */
 #ifdef CONFIG_SYS_VSC8601_SKEWFIX
drivers/net/vsc7385.c +1 -0
index ada42c4..a5110e5 100644
@@ -16,6 +16,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/errno.h>
+#include "vsc7385.h"
 
 /*
  * Upload a Vitesse VSC7385 firmware image to the hardware
Signature · 1 line
1.8.0
#104 lore raw

PATCH v2 13/25 lib/zlib: sparse fixes

In reply to Kim Phillips

define Z_NULL to (void *)0 include/u-boot/zlib.h to get rid of most of the NULL pointer warnings.

inflate.c:942:1: warning: non-ANSI definition of function 'inflateEnd' inflate.c:9:1: warning: non-ANSI definition of function 'inflateReset' inflate.c:12:17: warning: Using plain integer as NULL pointer inflate.c:12:42: warning: Using plain integer as NULL pointer inflate.c:15:17: warning: Using plain integer as NULL pointer inflate.c:21:19: warning: Using plain integer as NULL pointer inflate.c:35:1: warning: non-ANSI definition of function 'inflateInit2_' inflate.c:38:20: warning: Using plain integer as NULL pointer inflate.c:41:17: warning: Using plain integer as NULL pointer inflate.c:42:17: warning: Using plain integer as NULL pointer inflate.c:50:18: warning: Using plain integer as NULL pointer inflate.c:65:23: warning: Using plain integer as NULL pointer inflate.c:69:21: warning: Using plain integer as NULL pointer inflate.c:78:1: warning: non-ANSI definition of function 'inflateInit_' inflate.c:86:1: warning: non-ANSI definition of function 'fixedtables' inflate.c:108:26: warning: Using plain integer as NULL pointer inflate.c:109:1: warning: non-ANSI definition of function 'updatewindow' inflate.c:112:30: warning: Using plain integer as NULL pointer inflate.c:339:1: warning: non-ANSI definition of function 'inflate' inflate.c:349:17: warning: Using plain integer as NULL pointer inflate.c:349:42: warning: Using plain integer as NULL pointer inflate.c:350:27: warning: Using plain integer as NULL pointer inflate.c:369:42: warning: Using plain integer as NULL pointer inflate.c:376:32: warning: Using plain integer as NULL pointer inflate.c:401:54: warning: Using plain integer as NULL pointer inflate.c:419:32: warning: Using plain integer as NULL pointer inflate.c:426:32: warning: Using plain integer as NULL pointer inflate.c:433:32: warning: Using plain integer as NULL pointer inflate.c:444:36: warning: Using plain integer as NULL pointer inflate.c:449:37: warning: Using plain integer as NULL pointer inflate.c:450:38: warning: Using plain integer as NULL pointer inflate.c:457:40: warning: Using plain integer as NULL pointer inflate.c:458:47: warning: Using plain integer as NULL pointer inflate.c:480:40: warning: Using plain integer as NULL pointer inflate.c:481:50: warning: Using plain integer as NULL pointer inflate.c:491:37: warning: Using plain integer as NULL pointer inflate.c:492:37: warning: Using plain integer as NULL pointer inflate.c:501:40: warning: Using plain integer as NULL pointer inflate.c:502:53: warning: Using plain integer as NULL pointer inflate.c:512:37: warning: Using plain integer as NULL pointer inflate.c:513:40: warning: Using plain integer as NULL pointer inflate.c:525:32: warning: Using plain integer as NULL pointer inflate.c:529:52: warning: Using plain integer as NULL pointer inflate.c:543:54: warning: Using plain integer as NULL pointer inflate.c:932:17: warning: Using plain integer as NULL pointer inflate.c:932:42: warning: Using plain integer as NULL pointer inflate.c:935:26: warning: Using plain integer as NULL pointer inflate.c:940:19: warning: Using plain integer as NULL pointer adler32.c:58:5: warning: non-ANSI definition of function 'adler32' adler32.c:81:16: warning: Using plain integer as NULL pointer zutil.c:53:9: warning: non-ANSI definition of function 'zcalloc' zutil.c:64:9: warning: non-ANSI definition of function 'zcfree' inffast.c:70:1: warning: non-ANSI definition of function 'inflate_fast' inftrees.c:33:1: warning: non-ANSI definition of function 'inflate_table'

---
v2: added checkpatch fixes.

 include/u-boot/zlib.h |  2 +-
 lib/zlib/adler32.c    |  5 +----
 lib/zlib/inffast.c    |  5 ++---
 lib/zlib/inflate.c    | 29 ++++++++---------------------
 lib/zlib/inftrees.c   | 10 +++-------
 lib/zlib/zutil.c      | 10 ++--------
 6 files changed, 17 insertions(+), 44 deletions(-)
include/u-boot/zlib.h +1 -1
index b611fe7..e23ceb5 100644
@@ -505,7 +505,7 @@ typedef gz_header FAR *gz_headerp;
 #define Z_DEFLATED   8
 /* The deflate compression method (the only one supported in this version) */
 
-#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+#define Z_NULL  (void *)0  /* for initializing zalloc, zfree, opaque */
 
                         /* basic functions */
 
lib/zlib/adler32.c +1 -4
index dc9480d..b468441 100644
@@ -54,10 +54,7 @@
 #endif
 
 /* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
-    uLong adler;
-    const Bytef *buf;
-    uInt len;
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
 {
     unsigned long sum2;
     unsigned n;
lib/zlib/inffast.c +2 -3
index 38f2f90..0700e04 100644
@@ -66,9 +66,8 @@
       requires strm->avail_out >= 258 for each loop to avoid checking for
       output space.
  */
-void inflate_fast(strm, start)
-z_streamp strm;
-unsigned start;         /* inflate()'s starting value for strm->avail_out */
+void inflate_fast(z_streamp strm, unsigned start)
+/* start: inflate()'s starting value for strm->avail_out */
 {
     struct inflate_state FAR *state;
     unsigned char FAR *in;      /* local strm->next_in */
lib/zlib/inflate.c +8 -21
index 1eef609..6411c47 100644
@@ -5,8 +5,7 @@
 local void fixedtables OF((struct inflate_state FAR *state));
 local int updatewindow OF((z_streamp strm, unsigned out));
 
-int ZEXPORT inflateReset(strm)
-z_streamp strm;
+int ZEXPORT inflateReset(z_streamp strm)
 {
     struct inflate_state FAR *state;
 
@@ -31,11 +30,8 @@ z_streamp strm;
     return Z_OK;
 }
 
-int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
-z_streamp strm;
-int windowBits;
-const char *version;
-int stream_size;
+int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version,
+			  int stream_size)
 {
     struct inflate_state FAR *state;
 
@@ -74,16 +70,12 @@ int stream_size;
     return inflateReset(strm);
 }
 
-int ZEXPORT inflateInit_(strm, version, stream_size)
-z_streamp strm;
-const char *version;
-int stream_size;
+int ZEXPORT inflateInit_(z_streamp strm, const char *version, int stream_size)
 {
     return inflateInit2_(strm, DEF_WBITS, version, stream_size);
 }
 
-local void fixedtables(state)
-struct inflate_state FAR *state;
+local void fixedtables(struct inflate_state FAR *state)
 {
     state->lencode = lenfix;
     state->lenbits = 9;
@@ -105,9 +97,7 @@ struct inflate_state FAR *state;
    output will fall in the output data, making match copies simpler and faster.
    The advantage may be dependent on the size of the processor's data caches.
  */
-local int updatewindow(strm, out)
-z_streamp strm;
-unsigned out;
+local int updatewindow(z_streamp strm, unsigned out)
 {
     struct inflate_state FAR *state;
     unsigned copy, dist;
@@ -335,9 +325,7 @@ unsigned out;
    when flush is set to Z_FINISH, inflate() cannot return Z_OK.  Instead it
    will return Z_BUF_ERROR if it has not reached the end of the stream.
  */
-int ZEXPORT inflate(strm, flush)
-z_streamp strm;
-int flush;
+int ZEXPORT inflate(z_streamp strm, int flush)
 {
     struct inflate_state FAR *state;
     unsigned char FAR *next;    /* next input */
@@ -938,8 +926,7 @@ int flush;
     return ret;
 }
 
-int ZEXPORT inflateEnd(strm)
-z_streamp strm;
+int ZEXPORT inflateEnd(z_streamp strm)
 {
     struct inflate_state FAR *state;
     if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
lib/zlib/inftrees.c +3 -7
index c6d4c03..7474a52 100644
@@ -29,13 +29,9 @@
    table index bits.  It will differ if the request is greater than the
    longest code or if it is less than the shortest code.
  */
-int inflate_table(type, lens, codes, table, bits, work)
-codetype type;
-unsigned short FAR *lens;
-unsigned codes;
-code FAR * FAR *table;
-unsigned FAR *bits;
-unsigned short FAR *work;
+int inflate_table(codetype type, unsigned short FAR *lens, unsigned codes,
+		  code FAR * FAR *table, unsigned FAR *bits,
+		  unsigned short FAR *work)
 {
     unsigned len;               /* a code's length in bits */
     unsigned sym;               /* index of code symbols */
lib/zlib/zutil.c +2 -8
index 65f9554..14f6eb1 100644
@@ -49,10 +49,7 @@ extern voidp    calloc OF((uInt items, uInt size));
 extern void     free   OF((voidpf ptr));
 #endif
 
-voidpf zcalloc (opaque, items, size)
-	voidpf opaque;
-	unsigned items;
-	unsigned size;
+voidpf zcalloc(voidpf opaque, unsigned items, unsigned size)
 {
 	if (opaque)
 		items += size - size; /* make compiler happy */
@@ -60,10 +57,7 @@ voidpf zcalloc (opaque, items, size)
 		(voidpf)calloc(items, size);
 }
 
-void  zcfree (opaque, ptr, nb)
-	voidpf opaque;
-	voidpf ptr;
-	unsigned nb;
+void  zcfree(voidpf opaque, voidpf ptr, unsigned nb)
 {
 	free(ptr);
 	if (opaque)
Signature · 1 line
1.8.0
#105 lore raw

PATCH v2 13/25 lib/zlib: sparse fixes

Dear Kim Phillips,

Quoted 2 lines · In message <[email protected]> you…

define Z_NULL to (void *)0 include/u-boot/zlib.h to get rid of most of the NULL pointer warnings.

...

include/u-boot/zlib.h typedef gz_header FAR *gz_headerp; · line 508

Quoted 2 lines
include/u-boot/zlib.h +1 -1
-#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+#define Z_NULL  (void *)0  /* for initializing zalloc, zfree, opaque */

Don't we have to put parens around such an expression?

lib/zlib/adler32.c line 57

Quoted 11 lines
lib/zlib/adler32.c +1 -4
@@ -54,10 +54,7 @@
 #endif
 
 /* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
-    uLong adler;
-    const Bytef *buf;
-    uInt len;
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)

Hm... this code has been imported from another project. This modification makes updates (or even comparing what has changed in more recent versions) much mor difficult, or even impossible
:-(

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I have a very small mind and must live with it.    -- Edsger Dijkstra
#106 lore raw

PATCH v2 13/25 lib/zlib: sparse fixes

Quoted 8 lines · On Thu, 8 Nov 2012 12:20:51 +0100 Wolfgang Denk <[email protected]> wrote:
Quoted 2 lines · In message <[email protected]> you…

define Z_NULL to (void *)0 include/u-boot/zlib.h to get rid of most of the NULL pointer warnings.

...

include/u-boot/zlib.h typedef gz_header FAR *gz_headerp; · line 508

Quoted 2 lines
include/u-boot/zlib.h +1 -1
-#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+#define Z_NULL  (void *)0  /* for initializing zalloc, zfree, opaque */

Don't we have to put parens around such an expression?

I suppose.

Quoted 5 lines
Quoted 5 lines
lib/zlib/adler32.c +0 -0
@@ -54,10 +54,7 @@
 #endif
 
Quoted 11 lines

lib/zlib/adler32.c line 57

Quoted 6 lines
lib/zlib/adler32.c +1 -4
 /* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
-    uLong adler;
-    const Bytef *buf;
-    uInt len;
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)

Hm... this code has been imported from another project. This modification makes updates (or even comparing what has changed in more recent versions) much mor difficult, or even impossible
:-(

my goal is to improve u-boot code quality by eliminating as much sparse noise as possible - most boards use this code to decompress kernels, so it's widely used. E.g., this patch removes 52 lines of sparse output. But ok, we can revert this patch and turn off checking for these files, in the form of an #ifndef __CHECKER__ at the top, with an 'imported from another project' justification comment. Would that be better?

Kim

#107 lore raw

PATCH v2 13/25 lib/zlib: sparse fixes

Quoted 31 lines · Kim Phillips
Quoted 8 lines · On Thu, 8 Nov 2012 12:20:51 +0100 Wolfgang Denk <[email protected]> wrote:
Quoted 2 lines · In message <[email protected]> you…

define Z_NULL to (void *)0 include/u-boot/zlib.h to get rid of most of the NULL pointer warnings.

...

include/u-boot/zlib.h typedef gz_header FAR *gz_headerp; · line 508

Quoted 2 lines
include/u-boot/zlib.h +1 -1
-#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+#define Z_NULL  (void *)0  /* for initializing zalloc, zfree, opaque */

Don't we have to put parens around such an expression?

I suppose.

Quoted 5 lines
Quoted 5 lines
lib/zlib/adler32.c +0 -0
@@ -54,10 +54,7 @@
 #endif
 
Quoted 11 lines

lib/zlib/adler32.c line 57

Quoted 6 lines
lib/zlib/adler32.c +1 -4
 /* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
-    uLong adler;
-    const Bytef *buf;
-    uInt len;
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)

Hm... this code has been imported from another project. This modification makes updates (or even comparing what has changed in more recent versions) much mor difficult, or even impossible
:-(

Quoted 7 lines

my goal is to improve u-boot code quality by eliminating as much sparse noise as possible - most boards use this code to decompress kernels, so it's widely used. E.g., this patch removes 52 lines of sparse output. But ok, we can revert this patch and turn off checking for these files, in the form of an #ifndef __CHECKER__ at the top, with an 'imported from another project' justification comment. Would that be better?

My memory could be faulty here, but can't we rely on the kernel here? That'll give us sparse-clean zlib, or hints on how they're keeping it in sync.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121121/bfd7e4e8/attachment.pgp>
#108 lore raw

PATCH v2 14/25 lib/vsprintf.c: sparse fixes

In reply to Kim Phillips

vsprintf.c:31:12: warning: symbol 'hex_asc' was not declared. Should it be static? vsprintf.c:398:18: warning: Using plain integer as NULL pointer

---
v2: no changes

 lib/vsprintf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/vsprintf.c +2 -2
index d762763..7215531 100644
@@ -28,7 +28,7 @@
 /* some reluctance to put this into a new limits.h, so it is here */
 #define INT_MAX		((int)(~0U>>1))
 
-const char hex_asc[] = "0123456789abcdef";
+static const char hex_asc[] = "0123456789abcdef";
 #define hex_asc_lo(x)   hex_asc[((x) & 0x0f)]
 #define hex_asc_hi(x)   hex_asc[((x) & 0xf0) >> 4]
 
@@ -395,7 +395,7 @@ static char *string(char *buf, char *end, char *s, int field_width,
 {
 	int len, i;
 
-	if (s == 0)
+	if (s == NULL)
 		s = "<NULL>";
 
 	len = strnlen(s, precision);
Signature · 1 line
1.8.0
#109 lore raw

PATCH v2 15/25 arch/powerpc/cpu/mpc8xxx/: sparse fixes

In reply to Kim Phillips

ctrl_regs.c:31:5: warning: symbol 'fsl_ddr_get_version' was not declared. Should it be static? cpu.c:135:14: warning: non-ANSI function declaration of function 'cpu_mask' cpu.c:154:18: warning: non-ANSI function declaration of function 'cpu_numcores' cpu.c:37:17: warning: symbol 'cpu_type_list' was not declared. Should it be static? cpu.c:117:17: warning: symbol 'cpu_type_unknown' was not declared. Should it be static? fsl_lbc.c:14:6: warning: symbol '__lbc_sdram_init' was not declared. Should it be static?

and:

lc_common_dimm_params.c:15:1: warning: symbol 'compute_cas_latency_ddr3' was not declared. Should it be static?

making it static produces the following compiler warning:

lc_common_dimm_params.c:15:1: warning: 'compute_cas_latency_ddr3' defined but not used [-Wunused-function]

so we protect it with the preprocessor.

---
v2: added checkpatch fixes.

 arch/powerpc/cpu/mpc8xxx/cpu.c                       | 9 +++++----
 arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c             | 2 +-
 arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c | 4 +++-
 arch/powerpc/cpu/mpc8xxx/fsl_lbc.c                   | 2 +-
 4 files changed, 10 insertions(+), 7 deletions(-)
arch/powerpc/cpu/mpc8xxx/cpu.c +5 -4
index 2c487ca..e8613be 100644
@@ -34,7 +34,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct cpu_type cpu_type_list [] = {
+static struct cpu_type cpu_type_list[] = {
 #if defined(CONFIG_MPC85xx)
 	CPU_TYPE_ENTRY(8533, 8533, 1),
 	CPU_TYPE_ENTRY(8535, 8535, 1),
@@ -125,7 +125,7 @@ u32 compute_ppc_cpumask(void)
 #define compute_ppc_cpumask()	1
 #endif /* CONFIG_SYS_FSL_QORIQ_CHASSIS2 */
 
-struct cpu_type cpu_type_unknown = CPU_TYPE_ENTRY(Unknown, Unknown, 0);
+static struct cpu_type cpu_type_unknown = CPU_TYPE_ENTRY(Unknown, Unknown, 0);
 
 struct cpu_type *identify_cpu(u32 ver)
 {
@@ -143,7 +143,7 @@ struct cpu_type *identify_cpu(u32 ver)
 /*
  * Return a 32-bit mask indicating which cores are present on this SOC.
  */
-u32 cpu_mask()
+u32 cpu_mask(void)
 {
 	ccsr_pic_t __iomem *pic = (void *)CONFIG_SYS_MPC8xxx_PIC_ADDR;
 	struct cpu_type *cpu = gd->cpu;
@@ -162,7 +162,8 @@ u32 cpu_mask()
 /*
  * Return the number of cores on this SOC.
  */
-int cpu_numcores() {
+int cpu_numcores(void)
+{
 	struct cpu_type *cpu = gd->cpu;
 
 	/*
arch/powerpc/cpu/mpc8xxx/ddr/ctrl_regs.c +1 -1
index 5928eb8..088cc0e 100644
@@ -28,7 +28,7 @@
 	#error "Undefined _DDR_ADDR"
 #endif
 
-u32 fsl_ddr_get_version(void)
+static u32 fsl_ddr_get_version(void)
 {
 	ccsr_ddr_t *ddr;
 	u32 ver_major_minor_errata;
arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c +3 -1
index 6a1f4e4..9adde31 100644
@@ -11,7 +11,8 @@
 
 #include "ddr.h"
 
-unsigned int
+#if defined(CONFIG_FSL_DDR3)
+static unsigned int
 compute_cas_latency_ddr3(const dimm_params_t *dimm_params,
 			 common_timing_params_t *outpdimm,
 			 unsigned int number_of_dimms)
@@ -65,6 +66,7 @@ compute_cas_latency_ddr3(const dimm_params_t *dimm_params,
 
 	return 0;
 }
+#endif
 
 /*
  * compute_lowest_common_dimm_parameters()
arch/powerpc/cpu/mpc8xxx/fsl_lbc.c +1 -1
index 023ac9a..c1fe579 100644
@@ -11,7 +11,7 @@
 
 #ifdef CONFIG_MPC85xx
 /* Boards should provide their own version of this if they use lbc sdram */
-void __lbc_sdram_init(void)
+static void __lbc_sdram_init(void)
 {
 	/* Do nothing */
 }
Signature · 1 line
1.8.0
#110 lore raw

PATCH v2 16/25 powerpc/mpc85xx: sparse fixes

In reply to Kim Phillips

fsl_corenet_serdes.c:485:6: warning: symbol '__soc_serdes_init' was not declared. Should it be static? cpu_init.c:185:6: warning: symbol 'invalidate_cpc' was not declared. Should it be static? bcsr.c:28:27: warning: non-ANSI function declaration of function 'enable_8568mds_duart' bcsr.c:39:33: warning: non-ANSI function declaration of function 'enable_8568mds_flash_write' bcsr.c:46:34: warning: non-ANSI function declaration of function 'disable_8568mds_flash_write' bcsr.c:53:29: warning: non-ANSI function declaration of function 'enable_8568mds_qe_mdio' bcsr.c:28:33: warning: non-ANSI function declaration of function 'enable_8569mds_flash_write' bcsr.c:33:34: warning: non-ANSI function declaration of function 'disable_8569mds_flash_write' bcsr.c:38:28: warning: non-ANSI function declaration of function 'enable_8569mds_qe_uec' bcsr.c:63:47: warning: non-ANSI function declaration of function 'disable_8569mds_brd_eeprom_write_protect' ngpixis.c:245:1: error: directive in argument list
ngpixis.c:247:1: error: directive in argument list

---
v2: fix ngpixis command help to depend on CONFIG_SYS_LONGHELP

 arch/powerpc/cpu/mpc85xx/cpu_init.c           |  2 +-
 arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c |  2 +-
 board/freescale/common/ngpixis.c              | 12 ++++++++----
 board/freescale/mpc8568mds/bcsr.c             |  8 ++++----
 board/freescale/mpc8569mds/bcsr.c             |  8 ++++----
 5 files changed, 18 insertions(+), 14 deletions(-)
arch/powerpc/cpu/mpc85xx/cpu_init.c +1 -1
index 736293c..f01804b 100644
@@ -182,7 +182,7 @@ static void enable_cpc(void)
 	printf("Corenet Platform Cache: %d KB enabled\n", size);
 }
 
-void invalidate_cpc(void)
+static void invalidate_cpc(void)
 {
 	int i;
 	cpc_corenet_t *cpc = (cpc_corenet_t *)CONFIG_SYS_FSL_CPC_ADDR;
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c +1 -1
index e6b1b1b..7f466ac 100644
@@ -489,7 +489,7 @@ static void wait_for_rstdone(unsigned int bank)
 }
 
 
-void __soc_serdes_init(void)
+static void __soc_serdes_init(void)
 {
 	/* Allow for SoC-specific initialization in <SOC>_serdes.c  */
 };
board/freescale/common/ngpixis.c +8 -4
index 276ae3c..3c75028 100644
@@ -237,13 +237,17 @@ int pixis_reset_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	return 0;
 }
 
-U_BOOT_CMD(
-	pixis_reset, CONFIG_SYS_MAXARGS, 1, pixis_reset_cmd,
-	"Reset the board using the FPGA sequencer",
+#ifdef CONFIG_SYS_LONGHELP
+static char pixis_help_text[] =
 	"- hard reset to default bank\n"
 	"pixis_reset altbank - reset to alternate bank\n"
 #ifdef DEBUG
 	"pixis_reset dump - display the PIXIS registers\n"
 #endif
-	"pixis_reset sysclk <SYSCLK_freq> - reset with SYSCLK frequency(KHz)\n"
+	"pixis_reset sysclk <SYSCLK_freq> - reset with SYSCLK frequency(KHz)\n";
+#endif
+
+U_BOOT_CMD(
+	pixis_reset, CONFIG_SYS_MAXARGS, 1, pixis_reset_cmd,
+	"Reset the board using the FPGA sequencer", pixis_help_text
 	);
board/freescale/mpc8568mds/bcsr.c +4 -4
index 30676e1..2a172cc 100644
@@ -25,7 +25,7 @@
 
 #include "bcsr.h"
 
-void enable_8568mds_duart()
+void enable_8568mds_duart(void)
 {
 	volatile uint* duart_mux	= (uint *)(CONFIG_SYS_CCSRBAR + 0xe0060);
 	volatile uint* devices		= (uint *)(CONFIG_SYS_CCSRBAR + 0xe0070);
@@ -36,21 +36,21 @@ void enable_8568mds_duart()
 	bcsr[5] |= 0x01;		/* Enable Duart in BCSR*/
 }
 
-void enable_8568mds_flash_write()
+void enable_8568mds_flash_write(void)
 {
 	volatile u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR);
 
 	bcsr[9] |= 0x01;
 }
 
-void disable_8568mds_flash_write()
+void disable_8568mds_flash_write(void)
 {
 	volatile u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR);
 
 	bcsr[9] &= ~(0x01);
 }
 
-void enable_8568mds_qe_mdio()
+void enable_8568mds_qe_mdio(void)
 {
 	u8 *bcsr = (u8 *)(CONFIG_SYS_BCSR);
 
board/freescale/mpc8569mds/bcsr.c +4 -4
index b688e5c..37d0c5f 100644
@@ -25,17 +25,17 @@
 
 #include "bcsr.h"
 
-void enable_8569mds_flash_write()
+void enable_8569mds_flash_write(void)
 {
 	setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 17), BCSR17_FLASH_nWP);
 }
 
-void disable_8569mds_flash_write()
+void disable_8569mds_flash_write(void)
 {
 	clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 17), BCSR17_FLASH_nWP);
 }
 
-void enable_8569mds_qe_uec()
+void enable_8569mds_qe_uec(void)
 {
 #if defined(CONFIG_SYS_UCC_RGMII_MODE)
 	setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 7),
@@ -60,7 +60,7 @@ void enable_8569mds_qe_uec()
 #endif
 }
 
-void disable_8569mds_brd_eeprom_write_protect()
+void disable_8569mds_brd_eeprom_write_protect(void)
 {
 	clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 7), BCSR7_BRD_WRT_PROTECT);
 }
Signature · 1 line
1.8.0
#111 lore raw

PATCH v2 17/25 powerpc/mpc83xx: sparse fixes

In reply to Kim Phillips

fdt.c:91:78: warning: Using plain integer as NULL pointer fdt.c:103:78: warning: Using plain integer as NULL pointer speed.c:55:11: warning: symbol 'corecnf_tab' was not declared. Should it be static? speed.c:519:5: warning: symbol 'do_clocks' was not declared. Should it be static? mpc8313erdb.c:73:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:74:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:75:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:76:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:79:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:80:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:81:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:82:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:85:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:86:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:87:17: warning: obsolete struct initializer, use C99 syntax mpc8313erdb.c:88:17: warning: obsolete struct initializer, use C99 syntax

---
v2: checkpatch fixes.

 arch/powerpc/cpu/mpc83xx/fdt.c            |  6 ++++--
 arch/powerpc/cpu/mpc83xx/speed.c          |  4 ++--
 board/freescale/mpc8313erdb/mpc8313erdb.c | 24 ++++++++++++------------
 3 files changed, 18 insertions(+), 16 deletions(-)
arch/powerpc/cpu/mpc83xx/fdt.c +4 -2
index 028c8f0..1f54781 100644
@@ -88,7 +88,8 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 				u32 tmp[] = { 32, 0x8, 33, 0x8, 34, 0x8 };
 
 				path = fdt_path_offset(blob, prop);
-				prop = fdt_getprop(blob, path, "interrupts", 0);
+				prop = fdt_getprop(blob, path, "interrupts",
+						   NULL);
 				if (prop)
 					fdt_setprop(blob, path, "interrupts",
 						    &tmp, sizeof(tmp));
@@ -100,7 +101,8 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 				u32 tmp[] = { 35, 0x8, 36, 0x8, 37, 0x8 };
 
 				path = fdt_path_offset(blob, prop);
-				prop = fdt_getprop(blob, path, "interrupts", 0);
+				prop = fdt_getprop(blob, path, "interrupts",
+						   NULL);
 				if (prop)
 					fdt_setprop(blob, path, "interrupts",
 						    &tmp, sizeof(tmp));
arch/powerpc/cpu/mpc83xx/speed.c +2 -2
index fb0f7aa..b8c05d1 100644
@@ -52,7 +52,7 @@ typedef struct {
 	mult_t vco_divider;
 } corecnf_t;
 
-corecnf_t corecnf_tab[] = {
+static corecnf_t corecnf_tab[] = {
 	{_byp, _byp},		/* 0x00 */
 	{_byp, _byp},		/* 0x01 */
 	{_byp, _byp},		/* 0x02 */
@@ -531,7 +531,7 @@ ulong get_ddr_freq(ulong dummy)
 	return gd->mem_clk;
 }
 
-int do_clocks (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	char buf[32];
 
board/freescale/mpc8313erdb/mpc8313erdb.c +12 -12
index 730ec4e..1071803 100644
@@ -70,22 +70,22 @@ int checkboard(void)
 #ifndef CONFIG_NAND_SPL
 static struct pci_region pci_regions[] = {
 	{
-		bus_start: CONFIG_SYS_PCI1_MEM_BASE,
-		phys_start: CONFIG_SYS_PCI1_MEM_PHYS,
-		size: CONFIG_SYS_PCI1_MEM_SIZE,
-		flags: PCI_REGION_MEM | PCI_REGION_PREFETCH
+		.bus_start = CONFIG_SYS_PCI1_MEM_BASE,
+		.phys_start = CONFIG_SYS_PCI1_MEM_PHYS,
+		.size = CONFIG_SYS_PCI1_MEM_SIZE,
+		.flags = PCI_REGION_MEM | PCI_REGION_PREFETCH
 	},
 	{
-		bus_start: CONFIG_SYS_PCI1_MMIO_BASE,
-		phys_start: CONFIG_SYS_PCI1_MMIO_PHYS,
-		size: CONFIG_SYS_PCI1_MMIO_SIZE,
-		flags: PCI_REGION_MEM
+		.bus_start = CONFIG_SYS_PCI1_MMIO_BASE,
+		.phys_start = CONFIG_SYS_PCI1_MMIO_PHYS,
+		.size = CONFIG_SYS_PCI1_MMIO_SIZE,
+		.flags = PCI_REGION_MEM
 	},
 	{
-		bus_start: CONFIG_SYS_PCI1_IO_BASE,
-		phys_start: CONFIG_SYS_PCI1_IO_PHYS,
-		size: CONFIG_SYS_PCI1_IO_SIZE,
-		flags: PCI_REGION_IO
+		.bus_start = CONFIG_SYS_PCI1_IO_BASE,
+		.phys_start = CONFIG_SYS_PCI1_IO_PHYS,
+		.size = CONFIG_SYS_PCI1_IO_SIZE,
+		.flags = PCI_REGION_IO
 	}
 };
 
Signature · 1 line
1.8.0
#112 lore raw

PATCH v2 18/25 drivers/block/: sparse fixes

In reply to Kim Phillips

sata_sil.c:371:7: warning: symbol 'sil_sata_rw_lba28' was not declared. Should it be static? sata_sil.c:399:7: warning: symbol 'sil_sata_rw_lba48' was not declared. Should it be static? sata_sil.c:429:6: warning: symbol 'sil_sata_cmd_flush_cache' was not declared. Should it be static? sata_sil.c:441:6: warning: symbol 'sil_sata_cmd_flush_cache_ext' was not declared. Should it be static? sata_sil.c:489:7: warning: symbol 'sata_read' was not declared. Should it be static? sata_sil.c:505:7: warning: symbol 'sata_write' was not declared. Should it be static? sata_sil.c:526:5: warning: symbol 'init_sata' was not declared. Should it be static? sata_sil.c:588:5: warning: symbol 'scan_sata' was not declared. Should it be static? fsl_sata.c:59:6: warning: symbol 'dprint_buffer' was not declared. Should it be static? fsl_sata.c:187:42: warning: incorrect type in assignment (different base types)
fsl_sata.c:187:42: expected unsigned int [unsigned] [usertype] cda
fsl_sata.c:187:42: got restricted __le32 [usertype] <noident>
fsl_sata.c:291:6: warning: symbol 'fsl_sata_hardware_reset' was not declared. Should it be static? fsl_sata.c:418:27: warning: incorrect type in assignment (different base types)
fsl_sata.c:418:27: expected unsigned int [unsigned] [usertype] dba
fsl_sata.c:418:27: got restricted __le32 [usertype] <noident>
fsl_sata.c:424:41: warning: incorrect type in assignment (different base types)
fsl_sata.c:424:41: expected unsigned int [unsigned] [usertype] ext_c_ddc
fsl_sata.c:424:41: got restricted __le32 [usertype] <noident>
fsl_sata.c:431:41: warning: incorrect type in assignment (different base types)
fsl_sata.c:431:41: expected unsigned int [unsigned] [usertype] ext_c_ddc
fsl_sata.c:431:41: got restricted __le32 [usertype] <noident>
fsl_sata.c:442:22: warning: incorrect type in assignment (different base types)
fsl_sata.c:442:22: expected unsigned int [unsigned] [usertype] cda
fsl_sata.c:442:22: got restricted __le32 [usertype] <noident>
fsl_sata.c:446:31: warning: incorrect type in assignment (different base types)
fsl_sata.c:446:31: expected unsigned int [unsigned] [usertype] prde_fis_len
fsl_sata.c:446:31: got restricted __le32 [usertype] <noident>
fsl_sata.c:448:22: warning: incorrect type in assignment (different base types)
fsl_sata.c:448:22: expected unsigned int [unsigned] [usertype] ttl
fsl_sata.c:448:22: got restricted __le32 [usertype] <noident>
fsl_sata.c:460:28: warning: incorrect type in assignment (different base types)
fsl_sata.c:460:28: expected unsigned int [unsigned] [usertype] attribute
fsl_sata.c:460:28: got restricted __le32 [usertype] <noident>
fsl_sata.c:623:6: warning: symbol 'fsl_sata_flush_cache' was not declared. Should it be static? fsl_sata.c:667:5: warning: symbol 'fsl_sata_rw_ncq_cmd' was not declared. Should it be static? fsl_sata.c:710:6: warning: symbol 'fsl_sata_flush_cache_ext' was not declared. Should it be static? fsl_sata.c:725:6: warning: symbol 'fsl_sata_software_reset' was not declared. Should it be static? fsl_sata.c:760:5: warning: symbol 'ata_low_level_rw_lba48' was not declared. Should it be static? fsl_sata.c:795:5: warning: symbol 'ata_low_level_rw_lba28' was not declared. Should it be static?

the following compiler warnings show up after fixing the above, so remove those three functions:

fsl_sata.c:59:13: warning: 'dprint_buffer' defined but not used [-Wunused-function] fsl_sata.c:291:13: warning: 'fsl_sata_hardware_reset' defined but not used [-Wunused-function] fsl_sata.c:726:13: warning: 'fsl_sata_software_reset' defined but not used [-Wunused-function]

Other than that, the following are fixed by __iomem annotation:

fsl_sata.c:84:39: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:84:39: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:84:39: got unsigned int volatile *addr
fsl_sata.c:172:26: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:172:26: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:172:26: got unsigned int *<noident>
fsl_sata.c:175:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:175:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:175:19: got unsigned int *<noident>
fsl_sata.c:181:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:181:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:181:19: got unsigned int *<noident>
fsl_sata.c:184:26: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:184:26: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:184:26: got unsigned int *<noident>
fsl_sata.c:186:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:186:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:186:19: got unsigned int *<noident>
fsl_sata.c:189:26: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:189:26: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:189:26: got unsigned int *<noident>
fsl_sata.c:191:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:191:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:191:19: got unsigned int *<noident>
fsl_sata.c:194:26: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:194:26: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:194:26: got unsigned int *<noident>
fsl_sata.c:195:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:195:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:195:19: got unsigned int *<noident>
fsl_sata.c:198:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:198:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:198:19: got unsigned int *<noident>
fsl_sata.c:201:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:201:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:201:19: got unsigned int *<noident>
fsl_sata.c:204:26: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:204:26: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:204:26: got unsigned int *<noident>
fsl_sata.c:205:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:205:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:205:19: got unsigned int *<noident>
fsl_sata.c:208:26: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:208:26: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:208:26: got unsigned int *<noident>
fsl_sata.c:209:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:209:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:209:19: got unsigned int *<noident>
fsl_sata.c:212:26: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:212:26: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:212:26: got unsigned int *<noident>
fsl_sata.c:213:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:213:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:213:19: got unsigned int *<noident>
fsl_sata.c:216:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:216:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:216:19: got unsigned int *<noident>
fsl_sata.c:219:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:219:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:219:19: got unsigned int *<noident>
fsl_sata.c:222:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:222:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:222:19: got unsigned int *<noident>
fsl_sata.c:225:26: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:225:26: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:225:26: got unsigned int *<noident>
fsl_sata.c:227:19: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:227:19: expected unsigned int volatile [noderef] <asn:2>*addr
fsl_sata.c:227:19: got unsigned int *<noident>
fsl_sata.c:242:26: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:242:26: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:242:26: got unsigned int *<noident>
fsl_sata.c:256:32: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:256:32: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:256:32: got unsigned int *<noident>
fsl_sata.c:262:26: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:262:26: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:262:26: got unsigned int *<noident>
fsl_sata.c:274:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:274:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:274:53: got unsigned int *<noident>
fsl_sata.c:275:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:275:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:275:53: got unsigned int *<noident>
fsl_sata.c:276:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:276:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:276:53: got unsigned int *<noident>
fsl_sata.c:277:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:277:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:277:53: got unsigned int *<noident>
fsl_sata.c:278:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:278:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:278:53: got unsigned int *<noident>
fsl_sata.c:279:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:279:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:279:53: got unsigned int *<noident>
fsl_sata.c:280:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:280:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:280:53: got unsigned int *<noident>
fsl_sata.c:281:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:281:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:281:53: got unsigned int *<noident>
fsl_sata.c:282:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:282:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:282:53: got unsigned int *<noident>
fsl_sata.c:283:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:283:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:283:53: got unsigned int *<noident>
fsl_sata.c:284:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:284:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:284:53: got unsigned int *<noident>
fsl_sata.c:285:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:285:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:285:53: got unsigned int *<noident>
fsl_sata.c:286:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:286:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:286:53: got unsigned int *<noident>
fsl_sata.c:287:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:287:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:287:53: got unsigned int *<noident>
fsl_sata.c:288:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:288:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:288:53: got unsigned int *<noident>
fsl_sata.c:289:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:289:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:289:53: got unsigned int *<noident>
fsl_sata.c:290:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:290:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:290:53: got unsigned int *<noident>
fsl_sata.c:291:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:291:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:291:53: got unsigned int *<noident>
fsl_sata.c:292:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:292:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:292:53: got unsigned int *<noident>
fsl_sata.c:293:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:293:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:293:53: got unsigned int *<noident>
fsl_sata.c:294:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:294:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:294:53: got unsigned int *<noident>
fsl_sata.c:295:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:295:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:295:53: got unsigned int *<noident>
fsl_sata.c:296:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:296:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:296:53: got unsigned int *<noident>
fsl_sata.c:297:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:297:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:297:53: got unsigned int *<noident>
fsl_sata.c:298:53: warning: incorrect type in argument 1 (different address spaces)
fsl_sata.c:298:53: expected unsigned int const volatile [noderef] <asn:2>*addr
fsl_sata.c:298:53: got unsigned int *<noident>

---
v2: checkpatch fixes.

 drivers/block/fsl_sata.c | 81 +++++++-----------------------------------------
 drivers/block/fsl_sata.h | 13 ++++----
 drivers/block/sata_sil.c | 13 ++++----
 3 files changed, 25 insertions(+), 82 deletions(-)
drivers/block/fsl_sata.c +11 -70
index fda3389..1f9d7b0 100644
@@ -56,25 +56,6 @@ static inline void sdelay(unsigned long sec)
 		mdelay(1000);
 }
 
-void dprint_buffer(unsigned char *buf, int len)
-{
-	int i, j;
-
-	i = 0;
-	j = 0;
-	printf("\n\r");
-
-	for (i = 0; i < len; i++) {
-		printf("%02x ", *buf++);
-		j++;
-		if (j == 16) {
-			printf("\n\r");
-			j = 0;
-		}
-	}
-	printf("\n\r");
-}
-
 static void fsl_sata_dump_sfis(struct sata_fis_d2h *s)
 {
 	printf("Status FIS dump:\n\r");
@@ -94,7 +75,7 @@ static void fsl_sata_dump_sfis(struct sata_fis_d2h *s)
 	printf("sector_count_exp:	%02x\n\r", s->sector_count_exp);
 }
 
-static int ata_wait_register(volatile unsigned *addr, u32 mask,
+static int ata_wait_register(unsigned __iomem *addr, u32 mask,
 			 u32 val, u32 timeout_msec)
 {
 	int i;
@@ -112,7 +93,7 @@ int init_sata(int dev)
 	cmd_hdr_tbl_t *cmd_hdr;
 	u32 cda;
 	u32 val32;
-	fsl_sata_reg_t *reg;
+	fsl_sata_reg_t __iomem *reg;
 	u32 sig;
 	int i;
 	fsl_sata_t *sata;
@@ -287,42 +268,7 @@ int init_sata(int dev)
 	return 0;
 }
 
-/* Hardware reset, like Power-on and COMRESET */
-void fsl_sata_hardware_reset(u32 reg_base)
-{
-	fsl_sata_reg_t *reg = (fsl_sata_reg_t *)reg_base;
-	u32 scontrol;
-
-	/* Disable the SATA interface and put PHY offline */
-	scontrol = in_le32(&reg->scontrol);
-	scontrol = (scontrol & 0x0f0) | 0x304;
-	out_le32(&reg->scontrol, scontrol);
-
-	/* No speed strict */
-	scontrol = in_le32(&reg->scontrol);
-	scontrol = scontrol & ~0x0f0;
-	out_le32(&reg->scontrol, scontrol);
-
-	/* Issue PHY wake/reset, Hardware_reset_asserted */
-	scontrol = in_le32(&reg->scontrol);
-	scontrol = (scontrol & 0x0f0) | 0x301;
-	out_le32(&reg->scontrol, scontrol);
-
-	mdelay(100);
-
-	/* Resume PHY, COMRESET negated, the device initialize hardware
-	 * and execute diagnostics, send good status-signature to host,
-	 * which is D2H register FIS, and then the device enter idle state.
-	 */
-	scontrol = in_le32(&reg->scontrol);
-	scontrol = (scontrol & 0x0f0) | 0x300;
-	out_le32(&reg->scontrol, scontrol);
-
-	mdelay(100);
-	return;
-}
-
-static void fsl_sata_dump_regs(fsl_sata_reg_t *reg)
+static void fsl_sata_dump_regs(fsl_sata_reg_t __iomem *reg)
 {
 	printf("\n\rSATA:           %08x\n\r", (u32)reg);
 	printf("CQR:            %08x\n\r", in_le32(&reg->cqr));
@@ -363,7 +309,7 @@ static int fsl_ata_exec_ata_cmd(struct fsl_sata *sata, struct sata_fis_h2d *cfis
 	u32 prde_count;
 	u32 val32;
 	u32 ttl;
-	fsl_sata_reg_t *reg = sata->reg_base;
+	fsl_sata_reg_t __iomem *reg = sata->reg_base;
 	int i;
 
 	/* Check xfer length */
@@ -620,7 +566,7 @@ static u32 fsl_sata_rw_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_wr
 	return blkcnt;
 }
 
-void fsl_sata_flush_cache(int dev)
+static void fsl_sata_flush_cache(int dev)
 {
 	fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
 	struct sata_fis_h2d h2d, *cfis = &h2d;
@@ -664,7 +610,8 @@ static u32 fsl_sata_rw_cmd_ext(int dev, u32 start, u32 blkcnt, u8 *buffer, int i
 	return blkcnt;
 }
 
-u32 fsl_sata_rw_ncq_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write)
+static u32 fsl_sata_rw_ncq_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer,
+			       int is_write)
 {
 	fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
 	struct sata_fis_h2d h2d, *cfis = &h2d;
@@ -707,7 +654,7 @@ u32 fsl_sata_rw_ncq_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write
 	return blkcnt;
 }
 
-void fsl_sata_flush_cache_ext(int dev)
+static void fsl_sata_flush_cache_ext(int dev)
 {
 	fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
 	struct sata_fis_h2d h2d, *cfis = &h2d;
@@ -721,12 +668,6 @@ void fsl_sata_flush_cache_ext(int dev)
 	fsl_sata_exec_cmd(sata, cfis, CMD_ATA, 0, NULL, 0);
 }
 
-/* Software reset, set SRST of the Device Control register */
-void fsl_sata_software_reset(int dev)
-{
-	return;
-}
-
 static void fsl_sata_init_wcache(int dev, u16 *id)
 {
 	fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
@@ -757,7 +698,7 @@ static int fsl_sata_get_flush_ext(int dev)
 	return sata->flush_ext;
 }
 
-u32 ata_low_level_rw_lba48(int dev, u32 blknr, lbaint_t blkcnt,
+static u32 ata_low_level_rw_lba48(int dev, u32 blknr, lbaint_t blkcnt,
 		const void *buffer, int is_write)
 {
 	u32 start, blks;
@@ -792,8 +733,8 @@ u32 ata_low_level_rw_lba48(int dev, u32 blknr, lbaint_t blkcnt,
 	return blkcnt;
 }
 
-u32 ata_low_level_rw_lba28(int dev, u32 blknr, u32 blkcnt, const void *buffer,
-		int is_write)
+static u32 ata_low_level_rw_lba28(int dev, u32 blknr, u32 blkcnt,
+				  const void *buffer, int is_write)
 {
 	u32 start, blks;
 	u8 *addr;
drivers/block/fsl_sata.h +7 -6
index cecff68..a9c27bc 100644
@@ -176,10 +176,11 @@ typedef struct fsl_sata_reg {
 * Command Header Entry
 */
 typedef struct cmd_hdr_entry {
-	u32 cda;		/* Command Descriptor Address, 4 bytes aligned */
-	u32 prde_fis_len;	/* Number of PRD entries and FIS length */
-	u32 ttl;		/* Total transfer length */
-	u32 attribute;		/* the attribute of command */
+	__le32 cda;		/* Command Descriptor Address,
+				   4 bytes aligned */
+	__le32 prde_fis_len;	/* Number of PRD entries and FIS length */
+	__le32 ttl;		/* Total transfer length */
+	__le32 attribute;	/* the attribute of command */
 } __attribute__ ((packed)) cmd_hdr_entry_t;
 
 #define SATA_HC_CMD_HDR_ENTRY_SIZE	sizeof(struct cmd_hdr_entry)
@@ -230,10 +231,10 @@ typedef struct cmd_hdr_tbl {
 * PRD entry - Physical Region Descriptor entry
 */
 typedef struct prd_entry {
-	u32 dba;	/* Data base address, 4 bytes aligned */
+	__le32 dba;	/* Data base address, 4 bytes aligned */
 	u32 res1;
 	u32 res2;
-	u32 ext_c_ddc;	/* Indirect PRD flags, snoop and data word count */
+	__le32 ext_c_ddc; /* Indirect PRD flags, snoop and data word count */
 } __attribute__ ((packed)) prd_entry_t;
 
 #define SATA_HC_CMD_DESC_PRD_SIZE	sizeof(struct prd_entry)
drivers/block/sata_sil.c +7 -6
index 245b872..b70f04d 100644
@@ -27,6 +27,7 @@
 #include <fis.h>
 #include <sata.h>
 #include <libata.h>
+#include <sata.h>
 #include "sata_sil.h"
 
 /* Convert sectorsize to wordsize */
@@ -369,8 +370,8 @@ static ulong sil_sata_rw_cmd_ext(int dev, ulong start, ulong blkcnt,
 	return blkcnt;
 }
 
-ulong sil_sata_rw_lba28(int dev, ulong blknr, lbaint_t blkcnt,
-		const void *buffer, int is_write)
+static ulong sil_sata_rw_lba28(int dev, ulong blknr, lbaint_t blkcnt,
+			       const void *buffer, int is_write)
 {
 	ulong start, blks, max_blks;
 	u8 *addr;
@@ -397,8 +398,8 @@ ulong sil_sata_rw_lba28(int dev, ulong blknr, lbaint_t blkcnt,
 	return blkcnt;
 }
 
-ulong sil_sata_rw_lba48(int dev, ulong blknr, lbaint_t blkcnt,
-		const void *buffer, int is_write)
+static ulong sil_sata_rw_lba48(int dev, ulong blknr, lbaint_t blkcnt,
+			       const void *buffer, int is_write)
 {
 	ulong start, blks, max_blks;
 	u8 *addr;
@@ -427,7 +428,7 @@ ulong sil_sata_rw_lba48(int dev, ulong blknr, lbaint_t blkcnt,
 	return blkcnt;
 }
 
-void sil_sata_cmd_flush_cache(int dev)
+static void sil_sata_cmd_flush_cache(int dev)
 {
 	struct sil_cmd_block cmdb, *pcmd = &cmdb;
 
@@ -439,7 +440,7 @@ void sil_sata_cmd_flush_cache(int dev)
 	sil_exec_cmd(dev, pcmd, 0);
 }
 
-void sil_sata_cmd_flush_cache_ext(int dev)
+static void sil_sata_cmd_flush_cache_ext(int dev)
 {
 	struct sil_cmd_block cmdb, *pcmd = &cmdb;
 
Signature · 1 line
1.8.0
#113 lore raw

PATCH v2 19/25 drivers/gpio/mpc83xx_gpio.c: sparse fixes

In reply to Kim Phillips

mpc83xx_gpio.c:166:26: warning: non-ANSI function declaration of function 'mpc83xx_gpio_init_f' mpc83xx_gpio.c:190:26: warning: non-ANSI function declaration of function 'mpc83xx_gpio_init_r'

---
v2: no changes

 drivers/gpio/mpc83xx_gpio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/mpc83xx_gpio.c +2 -2
index a9afcb2..e167852 100644
@@ -163,7 +163,7 @@ int gpio_set_value(unsigned gpio, int value)
 }
 
 /* Configure GPIO registers early */
-void mpc83xx_gpio_init_f()
+void mpc83xx_gpio_init_f(void)
 {
 	immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 
@@ -187,7 +187,7 @@ void mpc83xx_gpio_init_f()
 }
 
 /* Initialize GPIO soft-copies */
-void mpc83xx_gpio_init_r()
+void mpc83xx_gpio_init_r(void)
 {
 #if MPC83XX_GPIO_CTRLRS >= 1
 	gpio_output_value[0] = CONFIG_MPC83XX_GPIO_0_INIT_VALUE;
Signature · 1 line
1.8.0
#114 lore raw

PATCH v2 20/25 drivers/input/input.c: sparse fix

In reply to Kim Phillips

input.c:97:5: warning: symbol 'input_queue_ascii' was not declared. Should it be

---
v2: no changes

 drivers/input/input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/input.c +1 -1
index 9800667..04fa5f0 100644
@@ -110,7 +110,7 @@ static struct {
 /* Maximum number of output characters that an ANSI sequence expands to */
 #define ANSI_CHAR_MAX	3
 
-int input_queue_ascii(struct input_config *config, int ch)
+static int input_queue_ascii(struct input_config *config, int ch)
 {
 	if (config->fifo_in + 1 == INPUT_BUFFER_LEN) {
 		if (!config->fifo_out)
Signature · 1 line
1.8.0
#115 lore raw

PATCH v2 20/25 drivers/input/input.c: sparse fix

Quoted 3 lines · Kim Phillips

input.c:97:5: warning: symbol 'input_queue_ascii' was not declared. Should it be

Quoted 27 lines

---
v2: no changes

 drivers/input/input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/input.c +1 -2
index 9800667..04fa5f0 100644
@@ -110,7 +110,7 @@ static struct {
 /* Maximum number of output characters that an ANSI sequence expands to */
 #define ANSI_CHAR_MAX  3
 
-int input_queue_ascii(struct input_config *config, int ch)
+static int input_queue_ascii(struct input_config *config, int ch)
 {
        if (config->fifo_in + 1 == INPUT_BUFFER_LEN) {
                if (!config->fifo_out)
--

1.8.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#116 lore raw

PATCH v2 21/25 drivers/mmc/mmc.c: sparse fixes

In reply to Kim Phillips

mmc.c:137:5: warning: symbol 'mmc_send_cmd' was not declared. Should it be static? mmc.c:203:5: warning: symbol 'mmc_send_status' was not declared. Should it be static? mmc.c:247:5: warning: symbol 'mmc_set_blocklen' was not declared. Should it be static? mmc.c:440:5: warning: symbol 'mmc_read_blocks' was not declared. Should it be static? mmc.c:510:5: warning: symbol 'mmc_go_idle' was not declared. Should it be static? mmc.c:532:1: warning: symbol 'sd_send_op_cond' was not declared. Should it be static? mmc.c:597:5: warning: symbol 'mmc_send_op_cond' was not declared. Should it be static? mmc.c:661:5: warning: symbol 'mmc_send_ext_csd' was not declared. Should it be static? mmc.c:683:5: warning: symbol 'mmc_switch' was not declared. Should it be static? mmc.c:705:5: warning: symbol 'mmc_change_freq' was not declared. Should it be static? mmc.c:775:5: warning: symbol 'sd_switch' was not declared. Should it be static? mmc.c:796:5: warning: symbol 'sd_change_freq' was not declared. Should it be static? mmc.c:935:6: warning: symbol 'mmc_set_ios' was not declared. Should it be static? mmc.c:953:6: warning: symbol 'mmc_set_bus_width' was not declared. Should it be static? mmc.c:1108:26: warning: dubious: !x & y
mmc.c:960:5: warning: symbol 'mmc_startup' was not declared. Should it be static? mmc.c:1243:5: warning: symbol 'mmc_send_if_cond' was not declared. Should it be s

---
v2: checkpatch fix.

 drivers/mmc/mmc.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)
drivers/mmc/mmc.c +19 -18
index 5fbf956..5ffd8c5 100644
@@ -47,7 +47,8 @@ int __board_mmc_getcd(struct mmc *mmc) {
 int board_mmc_getcd(struct mmc *mmc)__attribute__((weak,
 	alias("__board_mmc_getcd")));
 
-int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
+static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
+			struct mmc_data *data)
 {
 	struct mmc_data backup;
 	int ret;
@@ -108,7 +109,7 @@ int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 	return ret;
 }
 
-int mmc_send_status(struct mmc *mmc, int timeout)
+static int mmc_send_status(struct mmc *mmc, int timeout)
 {
 	struct mmc_cmd cmd;
 	int err, retries = 5;
@@ -152,7 +153,7 @@ int mmc_send_status(struct mmc *mmc, int timeout)
 	return 0;
 }
 
-int mmc_set_blocklen(struct mmc *mmc, int len)
+static int mmc_set_blocklen(struct mmc *mmc, int len)
 {
 	struct mmc_cmd cmd;
 
@@ -345,7 +346,8 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
 	return blkcnt;
 }
 
-int mmc_read_blocks(struct mmc *mmc, void *dst, ulong start, lbaint_t blkcnt)
+static int mmc_read_blocks(struct mmc *mmc, void *dst, ulong start,
+			   lbaint_t blkcnt)
 {
 	struct mmc_cmd cmd;
 	struct mmc_data data;
@@ -415,7 +417,7 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
 	return blkcnt;
 }
 
-int mmc_go_idle(struct mmc* mmc)
+static int mmc_go_idle(struct mmc *mmc)
 {
 	struct mmc_cmd cmd;
 	int err;
@@ -436,8 +438,7 @@ int mmc_go_idle(struct mmc* mmc)
 	return 0;
 }
 
-int
-sd_send_op_cond(struct mmc *mmc)
+static int sd_send_op_cond(struct mmc *mmc)
 {
 	int timeout = 1000;
 	int err;
@@ -502,7 +503,7 @@ sd_send_op_cond(struct mmc *mmc)
 	return 0;
 }
 
-int mmc_send_op_cond(struct mmc *mmc)
+static int mmc_send_op_cond(struct mmc *mmc)
 {
 	int timeout = 10000;
 	struct mmc_cmd cmd;
@@ -566,7 +567,7 @@ int mmc_send_op_cond(struct mmc *mmc)
 }
 
 
-int mmc_send_ext_csd(struct mmc *mmc, u8 *ext_csd)
+static int mmc_send_ext_csd(struct mmc *mmc, u8 *ext_csd)
 {
 	struct mmc_cmd cmd;
 	struct mmc_data data;
@@ -588,7 +589,7 @@ int mmc_send_ext_csd(struct mmc *mmc, u8 *ext_csd)
 }
 
 
-int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value)
+static int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value)
 {
 	struct mmc_cmd cmd;
 	int timeout = 1000;
@@ -610,7 +611,7 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 value)
 
 }
 
-int mmc_change_freq(struct mmc *mmc)
+static int mmc_change_freq(struct mmc *mmc)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, 512);
 	char cardtype;
@@ -680,7 +681,7 @@ int mmc_getcd(struct mmc *mmc)
 	return cd;
 }
 
-int sd_switch(struct mmc *mmc, int mode, int group, u8 value, u8 *resp)
+static int sd_switch(struct mmc *mmc, int mode, int group, u8 value, u8 *resp)
 {
 	struct mmc_cmd cmd;
 	struct mmc_data data;
@@ -701,7 +702,7 @@ int sd_switch(struct mmc *mmc, int mode, int group, u8 value, u8 *resp)
 }
 
 
-int sd_change_freq(struct mmc *mmc)
+static int sd_change_freq(struct mmc *mmc)
 {
 	int err;
 	struct mmc_cmd cmd;
@@ -840,7 +841,7 @@ static const int multipliers[] = {
 	80,
 };
 
-void mmc_set_ios(struct mmc *mmc)
+static void mmc_set_ios(struct mmc *mmc)
 {
 	mmc->set_ios(mmc);
 }
@@ -858,14 +859,14 @@ void mmc_set_clock(struct mmc *mmc, uint clock)
 	mmc_set_ios(mmc);
 }
 
-void mmc_set_bus_width(struct mmc *mmc, uint width)
+static void mmc_set_bus_width(struct mmc *mmc, uint width)
 {
 	mmc->bus_width = width;
 
 	mmc_set_ios(mmc);
 }
 
-int mmc_startup(struct mmc *mmc)
+static int mmc_startup(struct mmc *mmc)
 {
 	int err, width;
 	uint mult, freq;
@@ -1013,7 +1014,7 @@ int mmc_startup(struct mmc *mmc)
 	if (!IS_SD(mmc) && (mmc->version >= MMC_VERSION_4)) {
 		/* check  ext_csd version and capacity */
 		err = mmc_send_ext_csd(mmc, ext_csd);
-		if (!err & (ext_csd[EXT_CSD_REV] >= 2)) {
+		if (!err && (ext_csd[EXT_CSD_REV] >= 2)) {
 			/*
 			 * According to the JEDEC Standard, the value of
 			 * ext_csd's capacity is valid if the value is more
@@ -1148,7 +1149,7 @@ int mmc_startup(struct mmc *mmc)
 	return 0;
 }
 
-int mmc_send_if_cond(struct mmc *mmc)
+static int mmc_send_if_cond(struct mmc *mmc)
 {
 	struct mmc_cmd cmd;
 	int err;
Signature · 1 line
1.8.0
#117 lore raw

PATCH v2 22/25 drivers/mmc/fsl_esdhc.c: sparse fixes

In reply to Kim Phillips

fsl_esdhc.c:71:6: warning: symbol 'esdhc_xfertyp' was not declared. Should it be static? fsl_esdhc.c:413:6: warning: symbol 'set_sysctl' was not declared. Should it be st

---
v2: no changes

 drivers/mmc/fsl_esdhc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/fsl_esdhc.c +2 -2
index 3f8d30d..301dd8c 100644
@@ -68,7 +68,7 @@ struct fsl_esdhc {
 };
 
 /* Return the XFERTYP flags for a given command and data packet */
-uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)
+static uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)
 {
 	uint xfertyp = 0;
 
@@ -410,7 +410,7 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 	return 0;
 }
 
-void set_sysctl(struct mmc *mmc, uint clock)
+static void set_sysctl(struct mmc *mmc, uint clock)
 {
 	int sdhc_clk = gd->sdhc_clk;
 	int div, pre_div;
Signature · 1 line
1.8.0
#118 lore raw

PATCH v2 23/25 drivers/mtd/cfi_flash.c: sparse fixes

In reply to Kim Phillips

cfi_flash.c:756:43: warning: Using plain integer as NULL pointer cfi_flash.c:1150:52: warning: cast to non-scalar
cfi_flash.c:1433:46: warning: cast truncates bits from constant value (890089 becomes 89) cfi_flash.c:1490:61: warning: cast truncates bits from constant value (1f001f becomes 1f) cfi_flash.c:1508:61: warning: cast truncates bits from constant value (10001 becomes 1) cfi_flash.c:1738:63: warning: cast truncates bits from constant value (10001 becomes 1) cfi_flash.c:1857:6: warning: symbol '__flash_cmd_reset' was not declared. Should it be static?

---
v2: checkpatch fixes.

 drivers/mtd/cfi_flash.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/mtd/cfi_flash.c +13 -9
index 43140f3..b2dfc53 100644
@@ -752,8 +752,8 @@ static void flash_add_byte (flash_info_t * info, cfiword_t * cword, uchar c)
  */
 static flash_sect_t find_sector (flash_info_t * info, ulong addr)
 {
-	static flash_sect_t saved_sector = 0; /* previously found sector */
-	static flash_info_t *saved_info = 0; /* previously used flash bank */
+	static flash_sect_t saved_sector; /* previously found sector */
+	static flash_info_t *saved_info; /* previously used flash bank */
 	flash_sect_t sector = saved_sector;
 
 	if ((info != saved_info) || (sector >= info->sector_count))
@@ -1147,8 +1147,9 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 			}
 
 			if (use_flash_status_poll(info)) {
-				cfiword_t cword = (cfiword_t)0xffffffffffffffffULL;
+				cfiword_t cword;
 				void *dest;
+				cword.ll = 0xffffffffffffffffULL;
 				dest = flash_map(info, sect, 0);
 				st = flash_status_poll(info, &cword, dest,
 						       info->erase_blk_tout, "erase");
@@ -1430,8 +1431,8 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
 
 static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot)
 {
-	if ((info->manufacturer_id == (uchar)INTEL_MANUFACT) &&
-		(info->device_id == NUMONYX_256MBIT)) {
+	if (info->manufacturer_id == ((INTEL_MANUFACT & FLASH_VENDMASK) >> 16)
+	    && info->device_id == NUMONYX_256MBIT) {
 		/*
 		 * see errata called
 		 * "Numonyx Axcell P33/P30 Specification Update" :)
@@ -1487,7 +1488,8 @@ int flash_real_protect (flash_info_t * info, long sector, int prot)
 		case CFI_CMDSET_AMD_EXTENDED:
 		case CFI_CMDSET_AMD_STANDARD:
 			/* U-Boot only checks the first byte */
-			if (info->manufacturer_id == (uchar)ATM_MANUFACT) {
+			if (info->manufacturer_id ==
+			    ((ATM_MANUFACT & FLASH_VENDMASK) >> 16)) {
 				if (prot) {
 					flash_unlock_seq (info, 0);
 					flash_write_cmd (info, 0,
@@ -1505,7 +1507,8 @@ int flash_real_protect (flash_info_t * info, long sector, int prot)
 							0, ATM_CMD_UNLOCK_SECT);
 				}
 			}
-			if (info->manufacturer_id == (uchar)AMD_MANUFACT) {
+			if (info->manufacturer_id ==
+			    ((AMD_MANUFACT & FLASH_VENDMASK) >> 16)) {
 				int flag = disable_interrupts();
 				int lock_flag;
 
@@ -1735,7 +1738,8 @@ static int cmdset_amd_init(flash_info_t *info, struct cfi_qry *qry)
 	flash_write_cmd(info, 0, info->cfi_offset, FLASH_CMD_CFI);
 
 #ifdef CONFIG_SYS_FLASH_PROTECTION
-	if (info->ext_addr && info->manufacturer_id == (uchar)AMD_MANUFACT) {
+	if (info->ext_addr && info->manufacturer_id ==
+	    ((AMD_MANUFACT & FLASH_VENDMASK) >> 16)) {
 		ushort spus;
 
 		/* read sector protect/unprotect scheme */
@@ -1854,7 +1858,7 @@ static void flash_read_cfi (flash_info_t *info, void *buf,
 		p[i] = flash_read_uchar(info, start + i);
 }
 
-void __flash_cmd_reset(flash_info_t *info)
+static void __flash_cmd_reset(flash_info_t *info)
 {
 	/*
 	 * We do not yet know what kind of commandset to use, so we issue
Signature · 1 line
1.8.0
#119 lore raw

PATCH v2 24/25 drivers/mtd/nand: sparse fixes

In reply to Kim Phillips

nand_ecc.c:82:5: warning: symbol 'nand_calculate_ecc' was not declared. Should it be static? nand_ecc.c:155:5: warning: symbol 'nand_correct_data' was not declared. Should it be static? nand_base.c:2854:1: error: directive in argument list
nand_base.c:2856:1: error: directive in argument list

---
v2: re-worked based upon input from Scott, checkpatch fixes.

 drivers/mtd/nand/nand_base.c | 13 +++++++------
 drivers/mtd/nand/nand_ecc.c  |  1 +
 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/mtd/nand/nand_base.c +7 -6
index 71f5027..d3b71a5 100644
@@ -2601,6 +2601,7 @@ static const struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 						  int *maf_id, int *dev_id,
 						  const struct nand_flash_dev *type)
 {
+	const char *name;
 	int i, maf_idx;
 	u8 id_data[8];
 	int ret;
@@ -2848,14 +2849,14 @@ ident_done:
 		chip->cmdfunc = nand_command_lp;
 
 	/* TODO onfi flash name */
-	MTDDEBUG (MTD_DEBUG_LEVEL0, "NAND device: Manufacturer ID:"
-		" 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
-		nand_manuf_ids[maf_idx].name,
+	name = type->name;
 #ifdef CONFIG_SYS_NAND_ONFI_DETECTION
-		chip->onfi_version ? chip->onfi_params.model : type->name);
-#else
-		type->name);
+	if (chip->onfi_version)
+		name = chip->onfi_params.model;
 #endif
+	MTDDEBUG(MTD_DEBUG_LEVEL0, "NAND device: Manufacturer ID:"
+		 " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
+		 nand_manuf_ids[maf_idx].name, name);
 
 	return type;
 }
drivers/mtd/nand/nand_ecc.c +1 -0
index 81f0e08..097cf62 100644
@@ -39,6 +39,7 @@
 
 #include <asm/errno.h>
 #include <linux/mtd/mtd.h>
+#include <linux/mtd/nand_ecc.h>
 
 /* The PPC4xx NDFC uses Smart Media (SMC) bytes order */
 #ifdef CONFIG_NAND_NDFC
Signature · 1 line
1.8.0
#120 lore raw

PATCH v2 24/25 drivers/mtd/nand: sparse fixes

Quoted 7 lines · Kim Phillips

nand_ecc.c:82:5: warning: symbol 'nand_calculate_ecc' was not declared. Should it be static?
nand_ecc.c:155:5: warning: symbol 'nand_correct_data' was not declared. Should it be static?
nand_base.c:2854:1: error: directive in argument list nand_base.c:2856:1: error: directive in argument list

Quoted 7 lines

---
v2: re-worked based upon input from Scott, checkpatch fixes.

 drivers/mtd/nand/nand_base.c | 13 +++++++------
 drivers/mtd/nand/nand_ecc.c  |  1 +
 2 files changed, 8 insertions(+), 6 deletions(-)

-Scott

#121 lore raw

PATCH v2 25/25 drivers/serial/serial_ns16550.c: sparse fixes

In reply to Kim Phillips

---
v2: checkpatch fixes.

 drivers/serial/serial_ns16550.c | 42 ++++++++++++++++++++++++++---------------
 1 file changed, 27 insertions(+), 15 deletions(-)
drivers/serial/serial_ns16550.c +27 -15
index 4176e25..bf280ba 100644
@@ -78,21 +78,33 @@ static NS16550_t serial_ports[4] = {
 
 /* Multi serial device functions */
 #define DECLARE_ESERIAL_FUNCTIONS(port) \
-    static int  eserial##port##_init (void) {\
-	int clock_divisor; \
-	clock_divisor = calc_divisor(serial_ports[port-1]); \
-	NS16550_init(serial_ports[port-1], clock_divisor); \
-	return(0);}\
-    static void eserial##port##_setbrg (void) {\
-	serial_setbrg_dev(port);}\
-    static int  eserial##port##_getc (void) {\
-	return serial_getc_dev(port);}\
-    static int  eserial##port##_tstc (void) {\
-	return serial_tstc_dev(port);}\
-    static void eserial##port##_putc (const char c) {\
-	serial_putc_dev(port, c);}\
-    static void eserial##port##_puts (const char *s) {\
-	serial_puts_dev(port, s);}
+	static int  eserial##port##_init(void) \
+	{ \
+		int clock_divisor; \
+		clock_divisor = calc_divisor(serial_ports[port-1]); \
+		NS16550_init(serial_ports[port-1], clock_divisor); \
+		return 0 ; \
+	} \
+	static void eserial##port##_setbrg(void) \
+	{ \
+		serial_setbrg_dev(port); \
+	} \
+	static int  eserial##port##_getc(void) \
+	{ \
+		return serial_getc_dev(port); \
+	} \
+	static int  eserial##port##_tstc(void) \
+	{ \
+		return serial_tstc_dev(port); \
+	} \
+	static void eserial##port##_putc(const char c) \
+	{ \
+		serial_putc_dev(port, c); \
+	} \
+	static void eserial##port##_puts(const char *s) \
+	{ \
+		serial_puts_dev(port, s); \
+	}
 
 /* Serial device descriptor */
 #define INIT_ESERIAL_STRUCTURE(port, __name) {	\
Signature · 1 line
1.8.0
#122 lore raw

v2 cover Initial sparse fix series

In reply to Kim Phillips
Quoted 46 lines · Kim Phillips

[v2 summary: zero inter-commit build errors on all power, arm, and mips boards (which means some patches got merged into patch #1), checkpatch fixes, and postponement of the libfdt changes, primarily to get the bulk of these in during this merge window]

This 25-patch series only begins to address making u-boot source more 'sparseable,' or sparse-clean, ultimately to catch type, address space, and endianness mismatches and generally improve code quality. E.g., a couple of endianness bugs are found in of_bus_default_translate() and fdt_get_base_address() (not includeded in this v2 series - fixes pending libfdt patch for dtc).

Patch 1 adds endianness attributes to byteorder.h helpers, e.g., cpu_to_be32(). This is required for correct operation and prevents sparse from emitting false-positives. It comes with the side effect of breaking many builds, because u-boot has various places where attributes were being defined differently, so it includes fixes for those.

Patches 2-5 fix issues where u-boot had imported linux header code and the importer simply force-#defined sparse-specific attributes to nothing, to allow u-boot to build without redefined warnings.

Patches 6-7 are general sparse fixes to common powerpc areas.

Patches 8-10 are general sparse fixes to common header areas (e.g., patch 8 changes the long-standing u-boot image header types to __be32, as per u-boot image definition).

Patches 11-12 addresses sparse fixes for the net subsystem.

Patches 13-14 do the same for lib/.

Patches 15-17 for Power Arch's mpc8xxx, 83xx, and 85xx subsystems.

Last but not least, patches 18-25 attempt to clean up various drivers.

Note that the two libfdt patches present in series one are omitted here for u-boot merge window, they will be resubmitted after dtc have merged a libfdt-dependent patch.

For authors of new patches not willing to sift through the still quite large sparse output for their board/platform, though interested in what sparse has to say about their new code, it is recommended to build with make C=1 after changes such that sparse output will only include newly built code.

Quoted 6 lines

fyi, I've pushed the series onto the u-boot-mpc83xx tree, 'sparsefixes' branch:

http://git.denx.de/u-boot.git/?p=u-boot/u-boot-mpc83xx.git;a=shortlog;h=refs/heads/sparsefixes

All power, arm, mips boards tested.

With a small change in #1 so that it applied correctly, applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121104/6ae94488/attachment.pgp>