#include <linux/config.h> /* for CONFIG_PCI */
#include <linux/delay.h>
#include <linux/init.h>
+#include <linux/bitops.h>
-#include <asm/bitops.h>
#include <asm/io.h>
#include "hp100.h"
u_char bus;
struct pci_dev *pci_dev;
short mem_mapped; /* memory mapped access */
- void *mem_ptr_virt; /* virtual memory mapped area, maybe NULL */
+ void __iomem *mem_ptr_virt; /* virtual memory mapped area, maybe NULL */
unsigned long mem_ptr_phys; /* physical memory mapped area */
short lan_type; /* 10Mb/s, 100Mb/s or -1 (error) */
int hub_status; /* was login to hub successful? */
static int hp100_priority_tx = HP100_DEFAULT_PRIORITY_TX;
static int hp100_mode = 1;
-MODULE_PARM(hp100_rx_ratio, "1i");
-MODULE_PARM(hp100_priority_tx, "1i");
-MODULE_PARM(hp100_mode, "1i");
+module_param(hp100_rx_ratio, int, 0);
+module_param(hp100_priority_tx, int, 0);
+module_param(hp100_mode, int, 0);
/*
* prototypes
* address - Jean II */
static inline dma_addr_t virt_to_whatever(struct net_device *dev, u32 * ptr)
{
- return ((u_long) ptr) +
- ((struct hp100_private *) (dev->priv))->whatever_offset;
+ struct hp100_private *lp = netdev_priv(dev);
+ return ((u_long) ptr) + lp->whatever_offset;
+}
+
+static inline u_int pdl_map_data(struct hp100_private *lp, void *data)
+{
+ return pci_map_single(lp->pci_dev, data,
+ MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE);
}
/* TODO: This function should not really be needed in a good design... */
* Read board id and convert to string.
* Effectively same code as decode_eisa_sig
*/
-static __init const char *hp100_read_id(int ioaddr)
+static __devinit const char *hp100_read_id(int ioaddr)
{
int i;
static char str[HP100_SIG_LEN];
}
#endif
-static int __init hp100_probe1(struct net_device *dev, int ioaddr,
- u_char bus, struct pci_dev *pci_dev)
+static int __devinit hp100_probe1(struct net_device *dev, int ioaddr,
+ u_char bus, struct pci_dev *pci_dev)
{
int i;
int err = -ENODEV;
u_short local_mode, lsw;
short mem_mapped;
unsigned long mem_ptr_phys;
- void **mem_ptr_virt;
+ void __iomem *mem_ptr_virt;
struct hp100_private *lp;
#ifdef HP100_DEBUG_B
}
/* Initialise the "private" data structure for this card. */
- lp = (struct hp100_private *) dev->priv;
+ lp = netdev_priv(dev);
spin_lock_init(&lp->lock);
strlcpy(lp->id, eid, HP100_SIG_LEN);
static void hp100_hwinit(struct net_device *dev)
{
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
hp100_outw(0x4202, TRACE);
static void hp100_mmuinit(struct net_device *dev)
{
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
int i;
#ifdef HP100_DEBUG_B
static int hp100_open(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
int ioaddr = dev->base_addr;
#endif
static int hp100_close(struct net_device *dev)
{
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
hp100_outw(0x4205, TRACE);
*/
static void hp100_init_pdls(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
hp100_ring_t *ringptr;
u_int *pageptr; /* Warning : increment by 4 - Jean II */
int i;
/* Conversion to new PCI API : map skbuf data to PCI bus.
* Doc says it's OK for EISA as well - Jean II */
ringptr->pdl[0] = 0x00020000; /* Write PDH */
- ringptr->pdl[3] = ((u_int) pci_map_single(((struct hp100_private *) (dev->priv))->pci_dev, ringptr->skb->data, MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE));
+ ringptr->pdl[3] = pdl_map_data(netdev_priv(dev),
+ ringptr->skb->data);
ringptr->pdl[4] = MAX_ETHER_SIZE; /* Length of Data */
#ifdef HP100_DEBUG_BM
{
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
hp100_ring_t *ringptr;
#ifdef HP100_DEBUG_B
static void hp100_BM_shutdown(struct net_device *dev)
{
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
unsigned long time;
#ifdef HP100_DEBUG_B
static int hp100_check_lan(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
if (lp->lan_type < 0) { /* no LAN type detected yet? */
hp100_stop_interface(dev);
unsigned long flags;
int i, ok_flag;
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
hp100_ring_t *ringptr;
#ifdef HP100_DEBUG_B
*/
static void hp100_clean_txring(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
int ioaddr = dev->base_addr;
int donecount;
int i, ok_flag;
int ioaddr = dev->base_addr;
u_short val;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
hp100_outw(0x4212, TRACE);
{
int packets, pkt_len;
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
u_int header;
struct sk_buff *skb;
static void hp100_rx_bm(struct net_device *dev)
{
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
hp100_ring_t *ptr;
u_int header;
int pkt_len;
{
unsigned long flags;
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
hp100_outw(0x4215, TRACE);
{
int ioaddr = dev->base_addr;
u_short val;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
hp100_outw(0x4216, TRACE);
#ifdef HP100_DEBUG_B
int ioaddr = dev->base_addr;
#endif
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
int ioaddr = dev->base_addr;
{
unsigned long flags;
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
hp100_outw(0x4218, TRACE);
static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device *) dev_id;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
int ioaddr;
u_int val;
{
unsigned long flags;
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
hp100_outw(0x4220, TRACE);
static void hp100_stop_interface(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
int ioaddr = dev->base_addr;
u_int val;
{
int ioaddr = dev->base_addr;
u_short val_VG, val_10;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
hp100_outw(0x4223, TRACE);
static int hp100_down_vg_link(struct net_device *dev)
{
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
int ioaddr = dev->base_addr;
unsigned long time;
long savelan, newlan;
static int hp100_login_to_vg_hub(struct net_device *dev, u_short force_relogin)
{
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
u_short val = 0;
unsigned long time;
int startst;
static void hp100_cascade_reset(struct net_device *dev, u_short enable)
{
int ioaddr = dev->base_addr;
- struct hp100_private *lp = (struct hp100_private *) dev->priv;
+ struct hp100_private *lp = netdev_priv(dev);
#ifdef HP100_DEBUG_B
hp100_outw(0x4226, TRACE);
static void cleanup_dev(struct net_device *d)
{
- struct hp100_private *p = (struct hp100_private *) d->priv;
+ struct hp100_private *p = netdev_priv(d);
unregister_netdev(d);
release_region(d->base_addr, HP100_REGION_SIZE);
#define HP100_DEVICES 5
/* Parameters set by insmod */
static int hp100_port[HP100_DEVICES] = { 0, [1 ... (HP100_DEVICES-1)] = -1 };
-MODULE_PARM(hp100_port, "1-" __MODULE_STRING(HP100_DEVICES) "i");
+module_param_array(hp100_port, int, NULL, 0);
/* List of devices */
static struct net_device *hp100_devlist[HP100_DEVICES];