[PATCH] NetXen: driver cleanup, removed unnecessary __iomem type casts
Signed-off-by: Amit S. Kale <amitkale@netxen.com> netxen_nic.h | 38 ++++++++------------------------------ netxen_nic_ethtool.c | 5 ++--- netxen_nic_hw.c | 12 +++++------- netxen_nic_main.c | 8 +++----- 4 files changed, 18 insertions(+), 45 deletions(-) Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
e8a2b6a420
commit
71bd7877d4
@ -343,7 +343,6 @@ typedef enum {
|
|||||||
NETXEN_BRDTYPE_P2_SB31_10G_HMEZ = 0x000e,
|
NETXEN_BRDTYPE_P2_SB31_10G_HMEZ = 0x000e,
|
||||||
NETXEN_BRDTYPE_P2_SB31_10G_CX4 = 0x000f
|
NETXEN_BRDTYPE_P2_SB31_10G_CX4 = 0x000f
|
||||||
} netxen_brdtype_t;
|
} netxen_brdtype_t;
|
||||||
#define NUM_SUPPORTED_BOARDS (sizeof(netxen_boards)/sizeof(netxen_brdinfo_t))
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NETXEN_BRDMFG_INVENTEC = 1
|
NETXEN_BRDMFG_INVENTEC = 1
|
||||||
@ -937,9 +936,7 @@ static inline void netxen_nic_disable_int(struct netxen_adapter *adapter)
|
|||||||
/*
|
/*
|
||||||
* ISR_INT_MASK: Can be read from window 0 or 1.
|
* ISR_INT_MASK: Can be read from window 0 or 1.
|
||||||
*/
|
*/
|
||||||
writel(0x7ff,
|
writel(0x7ff, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
|
||||||
(void __iomem
|
|
||||||
*)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -959,14 +956,12 @@ static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
writel(mask,
|
writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
|
||||||
(void __iomem
|
|
||||||
*)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
|
|
||||||
|
|
||||||
if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
|
if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
|
||||||
mask = 0xbff;
|
mask = 0xbff;
|
||||||
writel(mask, (void __iomem *)
|
writel(mask, PCI_OFFSET_SECOND_RANGE(adapter,
|
||||||
(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK)));
|
ISR_INT_TARGET_MASK));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -975,13 +970,13 @@ static inline void netxen_nic_enable_int(struct netxen_adapter *adapter)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define NETXEN_MAX_SHORT_NAME 16
|
#define NETXEN_MAX_SHORT_NAME 16
|
||||||
typedef struct {
|
struct netxen_brdinfo {
|
||||||
netxen_brdtype_t brdtype; /* type of board */
|
netxen_brdtype_t brdtype; /* type of board */
|
||||||
long ports; /* max no of physical ports */
|
long ports; /* max no of physical ports */
|
||||||
char short_name[NETXEN_MAX_SHORT_NAME];
|
char short_name[NETXEN_MAX_SHORT_NAME];
|
||||||
} netxen_brdinfo_t;
|
};
|
||||||
|
|
||||||
static const netxen_brdinfo_t netxen_boards[] = {
|
static const struct netxen_brdinfo netxen_boards[] = {
|
||||||
{NETXEN_BRDTYPE_P2_SB31_10G_CX4, 1, "XGb CX4"},
|
{NETXEN_BRDTYPE_P2_SB31_10G_CX4, 1, "XGb CX4"},
|
||||||
{NETXEN_BRDTYPE_P2_SB31_10G_HMEZ, 1, "XGb HMEZ"},
|
{NETXEN_BRDTYPE_P2_SB31_10G_HMEZ, 1, "XGb HMEZ"},
|
||||||
{NETXEN_BRDTYPE_P2_SB31_10G_IMEZ, 2, "XGb IMEZ"},
|
{NETXEN_BRDTYPE_P2_SB31_10G_IMEZ, 2, "XGb IMEZ"},
|
||||||
@ -990,24 +985,7 @@ static const netxen_brdinfo_t netxen_boards[] = {
|
|||||||
{NETXEN_BRDTYPE_P2_SB31_2G, 2, "Dual Gb"},
|
{NETXEN_BRDTYPE_P2_SB31_2G, 2, "Dual Gb"},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_SUPPORTED_BOARDS (sizeof(netxen_boards)/sizeof(netxen_brdinfo_t))
|
#define NUM_SUPPORTED_BOARDS (sizeof(netxen_boards)/sizeof(struct netxen_brdinfo))
|
||||||
|
|
||||||
static inline void get_brd_ports_name_by_type(u32 type, int *ports, char *name)
|
|
||||||
{
|
|
||||||
int i, found = 0;
|
|
||||||
for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) {
|
|
||||||
if (netxen_boards[i].brdtype == type) {
|
|
||||||
*ports = netxen_boards[i].ports;
|
|
||||||
strcpy(name, netxen_boards[i].short_name);
|
|
||||||
found = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found) {
|
|
||||||
*ports = 0;
|
|
||||||
name = "Unknown";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void get_brd_port_by_type(u32 type, int *ports)
|
static inline void get_brd_port_by_type(u32 type, int *ports)
|
||||||
{
|
{
|
||||||
|
@ -139,8 +139,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
|
|||||||
{
|
{
|
||||||
struct netxen_port *port = netdev_priv(dev);
|
struct netxen_port *port = netdev_priv(dev);
|
||||||
struct netxen_adapter *adapter = port->adapter;
|
struct netxen_adapter *adapter = port->adapter;
|
||||||
struct netxen_board_info *boardinfo;
|
struct netxen_board_info *boardinfo = &adapter->ahw.boardcfg;
|
||||||
boardinfo = &adapter->ahw.boardcfg;
|
|
||||||
|
|
||||||
/* read which mode */
|
/* read which mode */
|
||||||
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
|
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
|
||||||
@ -208,7 +207,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
|
|||||||
ecmd->autoneg = AUTONEG_DISABLE;
|
ecmd->autoneg = AUTONEG_DISABLE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk("ERROR: Unsupported board model %d\n",
|
printk(KERN_ERR "netxen-nic: Unsupported board model %d\n",
|
||||||
(netxen_brdtype_t) boardinfo->board_type);
|
(netxen_brdtype_t) boardinfo->board_type);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
@ -275,10 +275,8 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
|
|||||||
rcv_desc->desc_head = (struct rcv_desc *)addr;
|
rcv_desc->desc_head = (struct rcv_desc *)addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = netxen_alloc(adapter->ahw.pdev,
|
addr = netxen_alloc(adapter->ahw.pdev, STATUS_DESC_RINGSIZE,
|
||||||
STATUS_DESC_RINGSIZE,
|
&recv_ctx->rcv_status_desc_phys_addr,
|
||||||
&recv_ctx->
|
|
||||||
rcv_status_desc_phys_addr,
|
|
||||||
&recv_ctx->rcv_status_desc_pdev);
|
&recv_ctx->rcv_status_desc_pdev);
|
||||||
if (addr == NULL) {
|
if (addr == NULL) {
|
||||||
DPRINTK(ERR, "bad return from"
|
DPRINTK(ERR, "bad return from"
|
||||||
@ -675,7 +673,7 @@ void netxen_nic_write_w0(struct netxen_adapter *adapter, u32 index, u32 value)
|
|||||||
void __iomem *addr;
|
void __iomem *addr;
|
||||||
|
|
||||||
netxen_nic_pci_change_crbwindow(adapter, 0);
|
netxen_nic_pci_change_crbwindow(adapter, 0);
|
||||||
addr = (void __iomem *)(pci_base_offset(adapter, index));
|
addr = pci_base_offset(adapter, index);
|
||||||
writel(value, addr);
|
writel(value, addr);
|
||||||
netxen_nic_pci_change_crbwindow(adapter, 1);
|
netxen_nic_pci_change_crbwindow(adapter, 1);
|
||||||
}
|
}
|
||||||
@ -685,7 +683,7 @@ void netxen_nic_read_w0(struct netxen_adapter *adapter, u32 index, u32 * value)
|
|||||||
{
|
{
|
||||||
void __iomem *addr;
|
void __iomem *addr;
|
||||||
|
|
||||||
addr = (void __iomem *)(pci_base_offset(adapter, index));
|
addr = pci_base_offset(adapter, index);
|
||||||
|
|
||||||
netxen_nic_pci_change_crbwindow(adapter, 0);
|
netxen_nic_pci_change_crbwindow(adapter, 0);
|
||||||
*value = readl(addr);
|
*value = readl(addr);
|
||||||
@ -865,7 +863,7 @@ netxen_crb_writelit_adapter(struct netxen_adapter *adapter, unsigned long off,
|
|||||||
writel(data, NETXEN_CRB_NORMALIZE(adapter, off));
|
writel(data, NETXEN_CRB_NORMALIZE(adapter, off));
|
||||||
} else {
|
} else {
|
||||||
netxen_nic_pci_change_crbwindow(adapter, 0);
|
netxen_nic_pci_change_crbwindow(adapter, 0);
|
||||||
addr = (void __iomem *)(pci_base_offset(adapter, off));
|
addr = pci_base_offset(adapter, off);
|
||||||
writel(data, addr);
|
writel(data, addr);
|
||||||
netxen_nic_pci_change_crbwindow(adapter, 1);
|
netxen_nic_pci_change_crbwindow(adapter, 1);
|
||||||
}
|
}
|
||||||
|
@ -969,11 +969,9 @@ netxen_handle_int(struct netxen_adapter *adapter, struct net_device *netdev)
|
|||||||
netxen_nic_disable_int(adapter);
|
netxen_nic_disable_int(adapter);
|
||||||
/* Window = 0 or 1 */
|
/* Window = 0 or 1 */
|
||||||
do {
|
do {
|
||||||
writel(0xffffffff, (void __iomem *)
|
writel(0xffffffff, PCI_OFFSET_SECOND_RANGE(adapter,
|
||||||
(PCI_OFFSET_SECOND_RANGE
|
ISR_INT_TARGET_STATUS));
|
||||||
(adapter, ISR_INT_TARGET_STATUS)));
|
mask = readl(pci_base_offset(adapter, ISR_INT_VECTOR));
|
||||||
mask = readl((void __iomem *)
|
|
||||||
pci_base_offset(adapter, ISR_INT_VECTOR));
|
|
||||||
} while (((mask & 0x80) != 0) && (++count < 32));
|
} while (((mask & 0x80) != 0) && (++count < 32));
|
||||||
if ((mask & 0x80) != 0)
|
if ((mask & 0x80) != 0)
|
||||||
printk("Could not disable interrupt completely\n");
|
printk("Could not disable interrupt completely\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user