netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netxen: deinline and sparse fix
@ 2007-07-05 23:13 Stephen Hemminger
  2007-07-06  6:16 ` Dhananjay Phadke
  2007-07-10 16:42 ` Jeff Garzik
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Hemminger @ 2007-07-05 23:13 UTC (permalink / raw)
  To: Dhananjay Phadke, Jeff Garzik; +Cc: netdev

Get rid of dubious casts to (void *) which causes a sparse warning.
And move largeish function from inline to the one file that uses the code,
the compiler can then decide to inline it.

Compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

---
 drivers/net/netxen/netxen_nic.h      |  103 -----------------------------------
 drivers/net/netxen/netxen_nic_main.c |   97 ++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 103 deletions(-)

--- a/drivers/net/netxen/netxen_nic.h	2007-07-05 14:21:36.000000000 -0700
+++ b/drivers/net/netxen/netxen_nic.h	2007-07-05 16:09:01.000000000 -0700
@@ -1097,109 +1097,6 @@ int netxen_nic_change_mtu(struct net_dev
 int netxen_nic_set_mac(struct net_device *netdev, void *p);
 struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev);
 
-static inline void netxen_nic_disable_int(struct netxen_adapter *adapter)
-{
-	uint32_t	mask = 0x7ff;
-	int retries = 32;
-
-	DPRINTK(1, INFO, "Entered ISR Disable \n");
-
-	switch (adapter->portnum) {
-	case 0:
-		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
-		break;
-	case 1:
-		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
-		break;
-	case 2:
-		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
-		break;
-	case 3:
-		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
-		break;
-	}
-
-	if (adapter->intr_scheme != -1 &&
-		adapter->intr_scheme != INTR_SCHEME_PERPORT) {
-		writel(mask,
-			(void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
-	}
-
-	/* Window = 0 or 1 */
-	if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
-		do {
-			writel(0xffffffff, (void *)
-				(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_STATUS)));
-			mask = readl((void *)
-					(pci_base_offset(adapter, ISR_INT_VECTOR)));
-			if (!(mask & 0x80))
-				break;
-			udelay(10);
-		} while (--retries);
-
-		if (!retries) {
-			printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n",
-					netxen_nic_driver_name);
-		}
-	}
-
-	DPRINTK(1, INFO, "Done with Disable Int\n");
-
-	return;
-}
-
-static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
-{
-	u32 mask;
-
-	DPRINTK(1, INFO, "Entered ISR Enable \n");
-
-	if (adapter->intr_scheme != -1 &&
-		adapter->intr_scheme != INTR_SCHEME_PERPORT) {
-		switch (adapter->ahw.board_type) {
-		case NETXEN_NIC_GBE:
-			mask  =  0x77b;
-			break;
-		case NETXEN_NIC_XGBE:
-			mask  =  0x77f;
-			break;
-		default:
-			mask  =  0x7ff;
-			break;
-		}
-
-		writel(mask,
-			(void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
-	}
-	switch (adapter->portnum) {
-	case 0:
-		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
-		break;
-	case 1:
-		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
-		break;
-	case 2:
-		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
-		break;
-	case 3:
-		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
-		break;
-	}
-
-	if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
-		mask = 0xbff;
-		if (adapter->intr_scheme != -1 &&
-			adapter->intr_scheme != INTR_SCHEME_PERPORT) {
-			writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
-		}
-		writel(mask,
-			(void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK)));
-	}
-
-	DPRINTK(1, INFO, "Done with enable Int\n");
-
-	return;
-}
 
 /*
  * NetXen Board information
--- a/drivers/net/netxen/netxen_nic_main.c	2007-07-05 15:17:32.000000000 -0700
+++ b/drivers/net/netxen/netxen_nic_main.c	2007-07-05 16:09:59.000000000 -0700
@@ -156,6 +156,103 @@ static inline void netxen_nic_update_cmd
 #define	ADAPTER_LIST_SIZE 12
 int netxen_cards_found;
 
+static void netxen_nic_disable_int(struct netxen_adapter *adapter)
+{
+	uint32_t	mask = 0x7ff;
+	int retries = 32;
+
+	DPRINTK(1, INFO, "Entered ISR Disable \n");
+
+	switch (adapter->portnum) {
+	case 0:
+		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
+		break;
+	case 1:
+		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
+		break;
+	case 2:
+		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
+		break;
+	case 3:
+		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
+		break;
+	}
+
+	if (adapter->intr_scheme != -1 &&
+	    adapter->intr_scheme != INTR_SCHEME_PERPORT)
+		writel(mask,PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
+
+	/* Window = 0 or 1 */
+	if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
+		do {
+			writel(0xffffffff,
+			       PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_STATUS));
+			mask = readl(pci_base_offset(adapter, ISR_INT_VECTOR));
+			if (!(mask & 0x80))
+				break;
+			udelay(10);
+		} while (--retries);
+
+		if (!retries) {
+			printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n",
+					netxen_nic_driver_name);
+		}
+	}
+
+	DPRINTK(1, INFO, "Done with Disable Int\n");
+}
+
+static void netxen_nic_enable_int(struct netxen_adapter *adapter)
+{
+	u32 mask;
+
+	DPRINTK(1, INFO, "Entered ISR Enable \n");
+
+	if (adapter->intr_scheme != -1 &&
+		adapter->intr_scheme != INTR_SCHEME_PERPORT) {
+		switch (adapter->ahw.board_type) {
+		case NETXEN_NIC_GBE:
+			mask  =  0x77b;
+			break;
+		case NETXEN_NIC_XGBE:
+			mask  =  0x77f;
+			break;
+		default:
+			mask  =  0x7ff;
+			break;
+		}
+
+		writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
+	}
+
+	switch (adapter->portnum) {
+	case 0:
+		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
+		break;
+	case 1:
+		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
+		break;
+	case 2:
+		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
+		break;
+	case 3:
+		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
+		break;
+	}
+
+	if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
+		mask = 0xbff;
+		if (adapter->intr_scheme != -1 &&
+			adapter->intr_scheme != INTR_SCHEME_PERPORT) {
+			writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
+		}
+		writel(mask,
+		       PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK));
+	}
+
+	DPRINTK(1, INFO, "Done with enable Int\n");
+}
+
 /*
  * netxen_nic_probe()
  *

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

* Re: [PATCH] netxen: deinline and sparse fix
  2007-07-05 23:13 [PATCH] netxen: deinline and sparse fix Stephen Hemminger
@ 2007-07-06  6:16 ` Dhananjay Phadke
  2007-07-10 16:42 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Dhananjay Phadke @ 2007-07-06  6:16 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Jeff Garzik, netdev

Yes those functions are large enough to be de-inlined. I would like to
shrink those to functions, by replacing the switch blocks with a simple
macros, since the mask registers are contiguous.

Will repost a patch based on your patch, after a bit of testing.

Thanks,
-Dhananjay

Stephen Hemminger wrote:
> Get rid of dubious casts to (void *) which causes a sparse warning.
> And move largeish function from inline to the one file that uses the code,
> the compiler can then decide to inline it.
> 
> Compile tested only.
> 
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
> 
> ---
>  drivers/net/netxen/netxen_nic.h      |  103 -----------------------------------
>  drivers/net/netxen/netxen_nic_main.c |   97 ++++++++++++++++++++++++++++++++
>  2 files changed, 97 insertions(+), 103 deletions(-)
> 
> --- a/drivers/net/netxen/netxen_nic.h	2007-07-05 14:21:36.000000000 -0700
> +++ b/drivers/net/netxen/netxen_nic.h	2007-07-05 16:09:01.000000000 -0700
> @@ -1097,109 +1097,6 @@ int netxen_nic_change_mtu(struct net_dev
>  int netxen_nic_set_mac(struct net_device *netdev, void *p);
>  struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev);
>  
> -static inline void netxen_nic_disable_int(struct netxen_adapter *adapter)
> -{
> -	uint32_t	mask = 0x7ff;
> -	int retries = 32;
> -
> -	DPRINTK(1, INFO, "Entered ISR Disable \n");
> -
> -	switch (adapter->portnum) {
> -	case 0:
> -		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
> -		break;
> -	case 1:
> -		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
> -		break;
> -	case 2:
> -		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
> -		break;
> -	case 3:
> -		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
> -		break;
> -	}
> -
> -	if (adapter->intr_scheme != -1 &&
> -		adapter->intr_scheme != INTR_SCHEME_PERPORT) {
> -		writel(mask,
> -			(void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
> -	}
> -
> -	/* Window = 0 or 1 */
> -	if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
> -		do {
> -			writel(0xffffffff, (void *)
> -				(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_STATUS)));
> -			mask = readl((void *)
> -					(pci_base_offset(adapter, ISR_INT_VECTOR)));
> -			if (!(mask & 0x80))
> -				break;
> -			udelay(10);
> -		} while (--retries);
> -
> -		if (!retries) {
> -			printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n",
> -					netxen_nic_driver_name);
> -		}
> -	}
> -
> -	DPRINTK(1, INFO, "Done with Disable Int\n");
> -
> -	return;
> -}
> -
> -static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
> -{
> -	u32 mask;
> -
> -	DPRINTK(1, INFO, "Entered ISR Enable \n");
> -
> -	if (adapter->intr_scheme != -1 &&
> -		adapter->intr_scheme != INTR_SCHEME_PERPORT) {
> -		switch (adapter->ahw.board_type) {
> -		case NETXEN_NIC_GBE:
> -			mask  =  0x77b;
> -			break;
> -		case NETXEN_NIC_XGBE:
> -			mask  =  0x77f;
> -			break;
> -		default:
> -			mask  =  0x7ff;
> -			break;
> -		}
> -
> -		writel(mask,
> -			(void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
> -	}
> -	switch (adapter->portnum) {
> -	case 0:
> -		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
> -		break;
> -	case 1:
> -		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
> -		break;
> -	case 2:
> -		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
> -		break;
> -	case 3:
> -		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
> -		break;
> -	}
> -
> -	if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
> -		mask = 0xbff;
> -		if (adapter->intr_scheme != -1 &&
> -			adapter->intr_scheme != INTR_SCHEME_PERPORT) {
> -			writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
> -		}
> -		writel(mask,
> -			(void *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK)));
> -	}
> -
> -	DPRINTK(1, INFO, "Done with enable Int\n");
> -
> -	return;
> -}
>  
>  /*
>   * NetXen Board information
> --- a/drivers/net/netxen/netxen_nic_main.c	2007-07-05 15:17:32.000000000 -0700
> +++ b/drivers/net/netxen/netxen_nic_main.c	2007-07-05 16:09:59.000000000 -0700
> @@ -156,6 +156,103 @@ static inline void netxen_nic_update_cmd
>  #define	ADAPTER_LIST_SIZE 12
>  int netxen_cards_found;
>  
> +static void netxen_nic_disable_int(struct netxen_adapter *adapter)
> +{
> +	uint32_t	mask = 0x7ff;
> +	int retries = 32;
> +
> +	DPRINTK(1, INFO, "Entered ISR Disable \n");
> +
> +	switch (adapter->portnum) {
> +	case 0:
> +		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
> +		break;
> +	case 1:
> +		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
> +		break;
> +	case 2:
> +		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
> +		break;
> +	case 3:
> +		writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
> +		break;
> +	}
> +
> +	if (adapter->intr_scheme != -1 &&
> +	    adapter->intr_scheme != INTR_SCHEME_PERPORT)
> +		writel(mask,PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
> +
> +	/* Window = 0 or 1 */
> +	if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
> +		do {
> +			writel(0xffffffff,
> +			       PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_STATUS));
> +			mask = readl(pci_base_offset(adapter, ISR_INT_VECTOR));
> +			if (!(mask & 0x80))
> +				break;
> +			udelay(10);
> +		} while (--retries);
> +
> +		if (!retries) {
> +			printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n",
> +					netxen_nic_driver_name);
> +		}
> +	}
> +
> +	DPRINTK(1, INFO, "Done with Disable Int\n");
> +}
> +
> +static void netxen_nic_enable_int(struct netxen_adapter *adapter)
> +{
> +	u32 mask;
> +
> +	DPRINTK(1, INFO, "Entered ISR Enable \n");
> +
> +	if (adapter->intr_scheme != -1 &&
> +		adapter->intr_scheme != INTR_SCHEME_PERPORT) {
> +		switch (adapter->ahw.board_type) {
> +		case NETXEN_NIC_GBE:
> +			mask  =  0x77b;
> +			break;
> +		case NETXEN_NIC_XGBE:
> +			mask  =  0x77f;
> +			break;
> +		default:
> +			mask  =  0x7ff;
> +			break;
> +		}
> +
> +		writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
> +	}
> +
> +	switch (adapter->portnum) {
> +	case 0:
> +		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0));
> +		break;
> +	case 1:
> +		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1));
> +		break;
> +	case 2:
> +		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2));
> +		break;
> +	case 3:
> +		writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3));
> +		break;
> +	}
> +
> +	if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
> +		mask = 0xbff;
> +		if (adapter->intr_scheme != -1 &&
> +			adapter->intr_scheme != INTR_SCHEME_PERPORT) {
> +			writel(0X0, NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
> +		}
> +		writel(mask,
> +		       PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK));
> +	}
> +
> +	DPRINTK(1, INFO, "Done with enable Int\n");
> +}
> +
>  /*
>   * netxen_nic_probe()
>   *

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

* Re: [PATCH] netxen: deinline and sparse fix
  2007-07-05 23:13 [PATCH] netxen: deinline and sparse fix Stephen Hemminger
  2007-07-06  6:16 ` Dhananjay Phadke
@ 2007-07-10 16:42 ` Jeff Garzik
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2007-07-10 16:42 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Dhananjay Phadke, netdev

Stephen Hemminger wrote:
> Get rid of dubious casts to (void *) which causes a sparse warning.
> And move largeish function from inline to the one file that uses the code,
> the compiler can then decide to inline it.
> 
> Compile tested only.
> 
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

applied



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

end of thread, other threads:[~2007-07-10 16:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-05 23:13 [PATCH] netxen: deinline and sparse fix Stephen Hemminger
2007-07-06  6:16 ` Dhananjay Phadke
2007-07-10 16:42 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).