Skip to contentSkip to conversation

bna: make ethtool_ops and strings const

PATCH Applied Stephen Hemminger 3 participants 5 messages Jan 4, 2012 – Jan 5, 2012 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/2 bna: make ethtool_ops and strings const

drivers/net/ethernet/brocade/bna/bnad_ethtool.c +2 -2
@@ -38,7 +38,7 @@
 	sizeof(struct bnad_drv_stats) / sizeof(u64) +		\
 	offsetof(struct bfi_enet_stats, rxf_stats[0]) / sizeof(u64))
 
-static char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = {
+static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = {
 	"rx_packets",
 	"tx_packets",
 	"rx_bytes",
@@ -1072,7 +1072,7 @@ done:
 	return ret;
 }
 
-static struct ethtool_ops bnad_ethtool_ops = {
+static const struct ethtool_ops bnad_ethtool_ops = {
 	.get_settings = bnad_get_settings,
 	.set_settings = bnad_set_settings,
 	.get_drvinfo = bnad_get_drvinfo,
#4 lore raw

PATCH 2/2 bna: fix sparse warnings/errors

In reply to a message not in the archive

This fixes a several sparse warnings.
* the __iomem tag was being used incorrectly (needs to be a prefix)
* several variables should have been static since local to one file
* the firmware was not being forwared declared
and was const one place and not the other

---
 drivers/net/ethernet/brocade/bna/bna_types.h |    6 +++---
 drivers/net/ethernet/brocade/bna/bnad.c      |    6 +++---
 drivers/net/ethernet/brocade/bna/bnad.h      |    2 +-
 drivers/net/ethernet/brocade/bna/cna_fwimg.c |    1 +
 4 files changed, 8 insertions(+), 7 deletions(-)
drivers/net/ethernet/brocade/bna/bnad.c +3 -3
@@ -53,9 +53,9 @@ MODULE_PARM_DESC(bna_debugfs_enable, "En
  * Global variables
  */
 u32 bnad_rxqs_per_cq = 2;
-u32 bna_id;
-struct mutex bnad_list_mutex;
-LIST_HEAD(bnad_list);
+static u32 bna_id;
+static struct mutex bnad_list_mutex;
+static LIST_HEAD(bnad_list);
 static const u8 bnad_bcast_addr[] =  {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
 /*
drivers/net/ethernet/brocade/bna/bna_types.h +3 -3
@@ -427,7 +427,7 @@ struct bna_ethport {
 
 /* Doorbell structure */
 struct bna_ib_dbell {
-	void *__iomem doorbell_addr;
+	void __iomem   *doorbell_addr;
 	u32		doorbell_ack;
 };
 
@@ -463,7 +463,7 @@ struct bna_tcb {
 	u32		consumer_index;
 	volatile u32	*hw_consumer_index;
 	u32		q_depth;
-	void *__iomem q_dbell;
+	void __iomem   *q_dbell;
 	struct bna_ib_dbell *i_dbell;
 	int			page_idx;
 	int			page_count;
@@ -599,7 +599,7 @@ struct bna_rcb {
 	u32		producer_index;
 	u32		consumer_index;
 	u32		q_depth;
-	void *__iomem q_dbell;
+	void __iomem   *q_dbell;
 	int			page_idx;
 	int			page_count;
 	/* Control path */
drivers/net/ethernet/brocade/bna/bnad.h +1 -1
@@ -347,7 +347,7 @@ struct bnad_drvinfo {
 /*
  * EXTERN VARIABLES
  */
-extern struct firmware *bfi_fw;
+extern const struct firmware *bfi_fw;
 extern u32		bnad_rxqs_per_cq;
 
 /*
drivers/net/ethernet/brocade/bna/cna_fwimg.c +1 -0
@@ -16,6 +16,7 @@
  * www.brocade.com
  */
 #include <linux/firmware.h>
+#include "bnad.h"
 #include "bfi.h"
 #include "cna.h"
 
maintainer Applied
#5 lore raw

Re: [PATCH 2/2] bna: fix sparse warnings/errors

From: Stephen Hemminger <[email protected]>
Date: Wed, 04 Jan 2012 15:02:24 -0800

Quoted 7 lines

This fixes a several sparse warnings.
* the __iomem tag was being used incorrectly (needs to be a prefix)
* several variables should have been static since local to one file
* the firmware was not being forwared declared
and was const one place and not the other

Applied.