Commit 1ef020bf authored by Randy Dunlap's avatar Randy Dunlap Committed by Jeff Garzik

[PATCH] use netdev_priv() in net/tulip drivers

parent 88f0a524
No related merge requests found
......@@ -29,7 +29,7 @@ static u16 t21142_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, };
void t21142_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int csr12 = inl(ioaddr + CSR12);
int next_tick = 60*HZ;
......@@ -103,7 +103,7 @@ void t21142_timer(unsigned long data)
void t21142_start_nway(struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int csr14 = ((tp->sym_advertise & 0x0780) << 9) |
((tp->sym_advertise & 0x0020) << 1) | 0xffbf;
......@@ -131,7 +131,7 @@ void t21142_start_nway(struct net_device *dev)
void t21142_lnk_change(struct net_device *dev, int csr5)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int csr12 = inl(ioaddr + CSR12);
......
This diff is collapsed.
......@@ -392,7 +392,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
}
/* Init system & device */
db = dev->priv;
db = netdev_priv(dev);
/* Allocate Tx/Rx descriptor memory */
db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr);
......@@ -466,7 +466,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
static void __devexit dmfe_remove_one (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct dmfe_board_info *db = dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
DMFE_DBUG(0, "dmfe_remove_one()", 0);
......@@ -494,7 +494,7 @@ static void __devexit dmfe_remove_one (struct pci_dev *pdev)
static int dmfe_open(struct DEVICE *dev)
{
int ret;
struct dmfe_board_info *db = dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
DMFE_DBUG(0, "dmfe_open", 0);
......@@ -552,7 +552,7 @@ static int dmfe_open(struct DEVICE *dev)
static void dmfe_init_dm910x(struct DEVICE *dev)
{
struct dmfe_board_info *db = dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
unsigned long ioaddr = db->ioaddr;
DMFE_DBUG(0, "dmfe_init_dm910x()", 0);
......@@ -618,7 +618,7 @@ static void dmfe_init_dm910x(struct DEVICE *dev)
static int dmfe_start_xmit(struct sk_buff *skb, struct DEVICE *dev)
{
struct dmfe_board_info *db = dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
struct tx_desc *txptr;
unsigned long flags;
......@@ -687,7 +687,7 @@ static int dmfe_start_xmit(struct sk_buff *skb, struct DEVICE *dev)
static int dmfe_stop(struct DEVICE *dev)
{
struct dmfe_board_info *db = dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
DMFE_DBUG(0, "dmfe_stop", 0);
......@@ -730,7 +730,7 @@ static int dmfe_stop(struct DEVICE *dev)
static irqreturn_t dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
struct DEVICE *dev = dev_id;
struct dmfe_board_info *db = (struct dmfe_board_info *) dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
unsigned long flags;
......@@ -957,7 +957,7 @@ static void dmfe_rx_packet(struct DEVICE *dev, struct dmfe_board_info * db)
static struct net_device_stats * dmfe_get_stats(struct DEVICE *dev)
{
struct dmfe_board_info *db = (struct dmfe_board_info *)dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
DMFE_DBUG(0, "dmfe_get_stats", 0);
return &db->stats;
......@@ -970,7 +970,7 @@ static struct net_device_stats * dmfe_get_stats(struct DEVICE *dev)
static void dmfe_set_filter_mode(struct DEVICE * dev)
{
struct dmfe_board_info *db = dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
unsigned long flags;
DMFE_DBUG(0, "dmfe_set_filter_mode()", 0);
......@@ -1003,7 +1003,7 @@ static void dmfe_set_filter_mode(struct DEVICE * dev)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
struct dmfe_board_info *np = dev->priv;
struct dmfe_board_info *np = netdev_priv(dev);
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
......@@ -1028,7 +1028,7 @@ static void dmfe_timer(unsigned long data)
u32 tmp_cr8;
unsigned char tmp_cr12;
struct DEVICE *dev = (struct DEVICE *) data;
struct dmfe_board_info *db = (struct dmfe_board_info *) dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
unsigned long flags;
DMFE_DBUG(0, "dmfe_timer()", 0);
......@@ -1160,7 +1160,7 @@ static void dmfe_timer(unsigned long data)
static void dmfe_dynamic_reset(struct DEVICE *dev)
{
struct dmfe_board_info *db = dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
DMFE_DBUG(0, "dmfe_dynamic_reset()", 0);
......@@ -1358,7 +1358,7 @@ static void dm9132_id_table(struct DEVICE *dev, int mc_cnt)
static void send_filter_frame(struct DEVICE *dev, int mc_cnt)
{
struct dmfe_board_info *db = dev->priv;
struct dmfe_board_info *db = netdev_priv(dev);
struct dev_mc_list *mcptr;
struct tx_desc *txptr;
u16 * addrptr;
......
......@@ -136,7 +136,7 @@ void __devinit tulip_parse_eeprom(struct net_device *dev)
static struct mediatable *last_mediatable;
static unsigned char *last_ee_data;
static int controller_index;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
unsigned char *ee_data = tp->eeprom;
int i;
......
......@@ -63,7 +63,7 @@ unsigned int mit_table[MIT_SIZE+1] =
int tulip_refill_rx(struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
int entry;
int refilled = 0;
......@@ -109,7 +109,7 @@ void oom_timer(unsigned long data)
int tulip_poll(struct net_device *dev, int *budget)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
int entry = tp->cur_rx % RX_RING_SIZE;
int rx_work_limit = *budget;
int received = 0;
......@@ -354,7 +354,7 @@ int tulip_poll(struct net_device *dev, int *budget)
static int tulip_rx(struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
int entry = tp->cur_rx % RX_RING_SIZE;
int rx_work_limit = tp->dirty_rx + RX_RING_SIZE - tp->cur_rx;
int received = 0;
......@@ -465,7 +465,7 @@ static inline unsigned int phy_interrupt (struct net_device *dev)
{
#ifdef __hppa__
int csr12 = inl(dev->base_addr + CSR12) & 0xff;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
if (csr12 != tp->csr12_shadow) {
/* ack interrupt */
......@@ -490,7 +490,7 @@ static inline unsigned int phy_interrupt (struct net_device *dev)
irqreturn_t tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device *)dev_instance;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int csr5;
int missed;
......
......@@ -48,7 +48,7 @@ static const unsigned char comet_miireg2offset[32] = {
int tulip_mdio_read(struct net_device *dev, int phy_id, int location)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
int i;
int read_cmd = (0xf6 << 10) | ((phy_id & 0x1f) << 5) | location;
int retval = 0;
......@@ -111,7 +111,7 @@ int tulip_mdio_read(struct net_device *dev, int phy_id, int location)
void tulip_mdio_write(struct net_device *dev, int phy_id, int location, int val)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
int i;
int cmd = (0x5002 << 16) | ((phy_id & 0x1f) << 23) | (location<<18) | (val & 0xffff);
long ioaddr = dev->base_addr;
......@@ -171,7 +171,7 @@ void tulip_mdio_write(struct net_device *dev, int phy_id, int location, int val)
void tulip_select_media(struct net_device *dev, int startup)
{
long ioaddr = dev->base_addr;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
struct mediatable *mtable = tp->mtable;
u32 new_csr6;
int i;
......@@ -374,7 +374,7 @@ void tulip_select_media(struct net_device *dev, int startup)
*/
int tulip_check_duplex(struct net_device *dev)
{
struct tulip_private *tp = dev->priv;
struct tulip_private *tp = netdev_priv(dev);
unsigned int bmsr, lpa, negotiated, new_csr6;
bmsr = tulip_mdio_read(dev, tp->phys[0], MII_BMSR);
......@@ -420,7 +420,7 @@ int tulip_check_duplex(struct net_device *dev)
void __devinit tulip_find_mii (struct net_device *dev, int board_idx)
{
struct tulip_private *tp = dev->priv;
struct tulip_private *tp = netdev_priv(dev);
int phyn, phy_idx = 0;
int mii_reg0;
int mii_advert;
......
......@@ -20,7 +20,7 @@
void pnic_do_nway(struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
u32 phy_reg = inl(ioaddr + 0xB8);
u32 new_csr6 = tp->csr6 & ~0x40C40200;
......@@ -53,7 +53,7 @@ void pnic_do_nway(struct net_device *dev)
void pnic_lnk_change(struct net_device *dev, int csr5)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int phy_reg = inl(ioaddr + 0xB8);
......@@ -89,7 +89,7 @@ void pnic_lnk_change(struct net_device *dev, int csr5)
void pnic_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int next_tick = 60*HZ;
......
......@@ -84,7 +84,7 @@
void pnic2_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int next_tick = 60*HZ;
......@@ -100,7 +100,7 @@ void pnic2_timer(unsigned long data)
void pnic2_start_nway(struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int csr14;
int csr12;
......@@ -175,7 +175,7 @@ void pnic2_start_nway(struct net_device *dev)
void pnic2_lnk_change(struct net_device *dev, int csr5)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int csr14;
......
......@@ -20,7 +20,7 @@
void tulip_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
u32 csr12 = inl(ioaddr + CSR12);
int next_tick = 2*HZ;
......@@ -135,7 +135,7 @@ void tulip_timer(unsigned long data)
void mxic_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int next_tick = 60*HZ;
......@@ -152,7 +152,7 @@ void mxic_timer(unsigned long data)
void comet_timer(unsigned long data)
{
struct net_device *dev = (struct net_device *)data;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int next_tick = 60*HZ;
......
......@@ -276,7 +276,7 @@ static void tulip_set_power_state (struct tulip_private *tp,
static void tulip_up(struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int next_tick = 3*HZ;
int i;
......@@ -499,7 +499,7 @@ tulip_open(struct net_device *dev)
static void tulip_tx_timeout(struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
unsigned long flags;
......@@ -587,7 +587,7 @@ static void tulip_tx_timeout(struct net_device *dev)
/* Initialize the Rx and Tx rings, along with various 'dev' bits. */
static void tulip_init_ring(struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
int i;
tp->susp_rx = 0;
......@@ -638,7 +638,7 @@ static void tulip_init_ring(struct net_device *dev)
static int
tulip_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
int entry;
u32 flag;
dma_addr_t mapping;
......@@ -724,7 +724,7 @@ static void tulip_clean_tx_ring(struct tulip_private *tp)
static void tulip_down (struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct tulip_private *tp = (struct tulip_private *) dev->priv;
struct tulip_private *tp = netdev_priv(dev);
unsigned long flags;
del_timer_sync (&tp->timer);
......@@ -764,7 +764,7 @@ static void tulip_down (struct net_device *dev)
static int tulip_close (struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct tulip_private *tp = (struct tulip_private *) dev->priv;
struct tulip_private *tp = netdev_priv(dev);
int i;
netif_stop_queue (dev);
......@@ -811,7 +811,7 @@ static int tulip_close (struct net_device *dev)
static struct net_device_stats *tulip_get_stats(struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
if (netif_running(dev)) {
......@@ -830,7 +830,7 @@ static struct net_device_stats *tulip_get_stats(struct net_device *dev)
static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
{
struct tulip_private *np = dev->priv;
struct tulip_private *np = netdev_priv(dev);
u32 ethcmd;
if (copy_from_user(&ethcmd, useraddr, sizeof(ethcmd)))
......@@ -855,7 +855,7 @@ static int netdev_ethtool_ioctl(struct net_device *dev, void *useraddr)
/* Provide ioctl() calls to examine the MII xcvr state. */
static int private_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
{
struct tulip_private *tp = dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
struct mii_ioctl_data *data = (struct mii_ioctl_data *) & rq->ifr_data;
const unsigned int phy_idx = 0;
......@@ -964,7 +964,7 @@ static int private_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
u16 hash_table[32];
struct dev_mc_list *mclist;
int i;
......@@ -995,7 +995,7 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
struct dev_mc_list *mclist;
int i;
u16 *eaddrs;
......@@ -1023,7 +1023,7 @@ static void build_setup_frame_perfect(u16 *setup_frm, struct net_device *dev)
static void set_rx_mode(struct net_device *dev)
{
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct tulip_private *tp = netdev_priv(dev);
long ioaddr = dev->base_addr;
int csr6;
......@@ -1150,7 +1150,7 @@ static void set_rx_mode(struct net_device *dev)
static void __devinit tulip_mwi_config (struct pci_dev *pdev,
struct net_device *dev)
{
struct tulip_private *tp = dev->priv;
struct tulip_private *tp = netdev_priv(dev);
u8 cache;
u16 pci_command;
u32 csr0;
......@@ -1373,7 +1373,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
* initialize private data structure 'tp'
* it is zeroed and aligned in alloc_etherdev
*/
tp = dev->priv;
tp = netdev_priv(dev);
tp->rx_ring = pci_alloc_consistent(pdev,
sizeof(struct tulip_rx_desc) * RX_RING_SIZE +
......@@ -1756,7 +1756,7 @@ static void __devexit tulip_remove_one (struct pci_dev *pdev)
if (!dev)
return;
tp = dev->priv;
tp = netdev_priv(dev);
pci_free_consistent (pdev,
sizeof (struct tulip_rx_desc) * RX_RING_SIZE +
sizeof (struct tulip_tx_desc) * TX_RING_SIZE,
......
......@@ -178,7 +178,7 @@ static void print_binary(unsigned int number)
static void netdev_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
struct xircom_private *private = dev->priv;
struct xircom_private *private = netdev_priv(dev);
strcpy(info->driver, "xircom_cb");
strcpy(info->bus_info, pci_name(private->pdev));
......@@ -235,7 +235,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
printk(KERN_ERR "xircom_probe: failed to allocate etherdev\n");
goto device_fail;
}
private = dev->priv;
private = netdev_priv(dev);
/* Allocate the send/receive buffers */
private->rx_buffer = pci_alloc_consistent(pdev,8192,&private->rx_dma_handle);
......@@ -312,7 +312,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
static void __devexit xircom_remove(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct xircom_private *card = dev->priv;
struct xircom_private *card = netdev_priv(dev);
enter("xircom_remove");
pci_free_consistent(pdev,8192,card->rx_buffer,card->rx_dma_handle);
......@@ -328,7 +328,7 @@ static void __devexit xircom_remove(struct pci_dev *pdev)
static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device *) dev_instance;
struct xircom_private *card = (struct xircom_private *) dev->priv;
struct xircom_private *card = netdev_priv(dev);
unsigned int status;
int i;
......@@ -385,7 +385,7 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
int desc;
enter("xircom_start_xmit");
card = (struct xircom_private*)dev->priv;
card = netdev_priv(dev);
spin_lock_irqsave(&card->lock,flags);
/* First see if we can free some descriptors */
......@@ -444,7 +444,7 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
static int xircom_open(struct net_device *dev)
{
struct xircom_private *xp = (struct xircom_private *) dev->priv;
struct xircom_private *xp = netdev_priv(dev);
int retval;
enter("xircom_open");
printk(KERN_INFO "xircom cardbus adaptor found, registering as %s, using irq %i \n",dev->name,dev->irq);
......@@ -466,7 +466,7 @@ static int xircom_close(struct net_device *dev)
unsigned long flags;
enter("xircom_close");
card = dev->priv;
card = netdev_priv(dev);
netif_stop_queue(dev); /* we don't want new packets */
......@@ -495,7 +495,7 @@ static int xircom_close(struct net_device *dev)
static struct net_device_stats *xircom_get_stats(struct net_device *dev)
{
struct xircom_private *card = (struct xircom_private *)dev->priv;
struct xircom_private *card = netdev_priv(dev);
return &card->stats;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment