Commit 40881456 authored by Alexander Viro's avatar Alexander Viro Committed by Stephen Hemminger

[wan hdlc] hdlc->attach() switched to net_device.

parent 11b2884f
...@@ -364,7 +364,7 @@ static void dscc4_release_ring(struct dscc4_dev_priv *); ...@@ -364,7 +364,7 @@ static void dscc4_release_ring(struct dscc4_dev_priv *);
static void dscc4_timer(unsigned long); static void dscc4_timer(unsigned long);
static void dscc4_tx_timeout(struct net_device *); static void dscc4_tx_timeout(struct net_device *);
static irqreturn_t dscc4_irq(int irq, void *dev_id, struct pt_regs *ptregs); static irqreturn_t dscc4_irq(int irq, void *dev_id, struct pt_regs *ptregs);
static int dscc4_hdlc_attach(hdlc_device *, unsigned short, unsigned short); static int dscc4_hdlc_attach(struct net_device *, unsigned short, unsigned short);
static int dscc4_set_iface(struct dscc4_dev_priv *, struct net_device *); static int dscc4_set_iface(struct dscc4_dev_priv *, struct net_device *);
static inline int dscc4_set_quartz(struct dscc4_dev_priv *, int); static inline int dscc4_set_quartz(struct dscc4_dev_priv *, int);
#ifdef DSCC4_POLLING #ifdef DSCC4_POLLING
...@@ -1986,10 +1986,9 @@ static void __devexit dscc4_remove_one(struct pci_dev *pdev) ...@@ -1986,10 +1986,9 @@ static void __devexit dscc4_remove_one(struct pci_dev *pdev)
pci_resource_len(pdev, 0)); pci_resource_len(pdev, 0));
} }
static int dscc4_hdlc_attach(hdlc_device *hdlc, unsigned short encoding, static int dscc4_hdlc_attach(struct net_device *dev, unsigned short encoding,
unsigned short parity) unsigned short parity)
{ {
struct net_device *dev = hdlc_to_dev(hdlc);
struct dscc4_dev_priv *dpriv = dscc4_priv(dev); struct dscc4_dev_priv *dpriv = dscc4_priv(dev);
if (encoding != ENCODING_NRZ && if (encoding != ENCODING_NRZ &&
......
...@@ -1331,7 +1331,7 @@ fst_close ( struct net_device *dev ) ...@@ -1331,7 +1331,7 @@ fst_close ( struct net_device *dev )
} }
static int static int
fst_attach ( hdlc_device *hdlc, unsigned short encoding, unsigned short parity ) fst_attach ( struct net_device *dev, unsigned short encoding, unsigned short parity )
{ {
/* Setting currently fixed in FarSync card so we check and forget */ /* Setting currently fixed in FarSync card so we check and forget */
if ( encoding != ENCODING_NRZ || parity != PARITY_CRC16_PR1_CCITT ) if ( encoding != ENCODING_NRZ || parity != PARITY_CRC16_PR1_CCITT )
......
...@@ -115,22 +115,11 @@ static inline int sca_intr_status(card_t *card) ...@@ -115,22 +115,11 @@ static inline int sca_intr_status(card_t *card)
return result; return result;
} }
static inline port_t* hdlc_to_port(hdlc_device *hdlc)
{
return (port_t*)hdlc;
}
static inline port_t* dev_to_port(struct net_device *dev) static inline port_t* dev_to_port(struct net_device *dev)
{ {
return hdlc_to_port(dev_to_hdlc(dev)); return (port_t *)(dev_to_hdlc(dev));
} }
static inline u16 next_desc(port_t *port, u16 desc, int transmit) static inline u16 next_desc(port_t *port, u16 desc, int transmit)
{ {
return (desc + 1) % (transmit ? port_to_card(port)->tx_ring_buffers return (desc + 1) % (transmit ? port_to_card(port)->tx_ring_buffers
...@@ -639,7 +628,7 @@ static void sca_close(struct net_device *dev) ...@@ -639,7 +628,7 @@ static void sca_close(struct net_device *dev)
static int sca_attach(hdlc_device *hdlc, unsigned short encoding, static int sca_attach(struct net_device *dev, unsigned short encoding,
unsigned short parity) unsigned short parity)
{ {
if (encoding != ENCODING_NRZ && if (encoding != ENCODING_NRZ &&
...@@ -660,8 +649,8 @@ static int sca_attach(hdlc_device *hdlc, unsigned short encoding, ...@@ -660,8 +649,8 @@ static int sca_attach(hdlc_device *hdlc, unsigned short encoding,
parity != PARITY_CRC16_PR1_CCITT) parity != PARITY_CRC16_PR1_CCITT)
return -EINVAL; return -EINVAL;
hdlc_to_port(hdlc)->encoding = encoding; dev_to_port(dev)->encoding = encoding;
hdlc_to_port(hdlc)->parity = parity; dev_to_port(dev)->parity = parity;
return 0; return 0;
} }
......
...@@ -295,7 +295,7 @@ int hdlc_cisco_ioctl(hdlc_device *hdlc, struct ifreq *ifr) ...@@ -295,7 +295,7 @@ int hdlc_cisco_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
new_settings.timeout < 2) new_settings.timeout < 2)
return -EINVAL; return -EINVAL;
result=hdlc->attach(hdlc, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT);
if (result) if (result)
return result; return result;
......
...@@ -1163,7 +1163,7 @@ int hdlc_fr_ioctl(hdlc_device *hdlc, struct ifreq *ifr) ...@@ -1163,7 +1163,7 @@ int hdlc_fr_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
new_settings.dce != 1)) new_settings.dce != 1))
return -EINVAL; return -EINVAL;
result=hdlc->attach(hdlc, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT);
if (result) if (result)
return result; return result;
......
...@@ -93,7 +93,7 @@ int hdlc_ppp_ioctl(hdlc_device *hdlc, struct ifreq *ifr) ...@@ -93,7 +93,7 @@ int hdlc_ppp_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
/* no settable parameters */ /* no settable parameters */
result=hdlc->attach(hdlc, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT);
if (result) if (result)
return result; return result;
......
...@@ -67,7 +67,7 @@ int hdlc_raw_ioctl(hdlc_device *hdlc, struct ifreq *ifr) ...@@ -67,7 +67,7 @@ int hdlc_raw_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
if (new_settings.parity == PARITY_DEFAULT) if (new_settings.parity == PARITY_DEFAULT)
new_settings.parity = PARITY_CRC16_PR1_CCITT; new_settings.parity = PARITY_CRC16_PR1_CCITT;
result = hdlc->attach(hdlc, new_settings.encoding, result = hdlc->attach(dev, new_settings.encoding,
new_settings.parity); new_settings.parity);
if (result) if (result)
return result; return result;
......
...@@ -81,7 +81,7 @@ int hdlc_raw_eth_ioctl(hdlc_device *hdlc, struct ifreq *ifr) ...@@ -81,7 +81,7 @@ int hdlc_raw_eth_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
if (new_settings.parity == PARITY_DEFAULT) if (new_settings.parity == PARITY_DEFAULT)
new_settings.parity = PARITY_CRC16_PR1_CCITT; new_settings.parity = PARITY_CRC16_PR1_CCITT;
result = hdlc->attach(hdlc, new_settings.encoding, result = hdlc->attach(dev, new_settings.encoding,
new_settings.parity); new_settings.parity);
if (result) if (result)
return result; return result;
......
...@@ -203,7 +203,7 @@ int hdlc_x25_ioctl(hdlc_device *hdlc, struct ifreq *ifr) ...@@ -203,7 +203,7 @@ int hdlc_x25_ioctl(hdlc_device *hdlc, struct ifreq *ifr)
if(dev->flags & IFF_UP) if(dev->flags & IFF_UP)
return -EBUSY; return -EBUSY;
result=hdlc->attach(hdlc, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT); result=hdlc->attach(dev, ENCODING_NRZ,PARITY_CRC16_PR1_CCITT);
if (result) if (result)
return result; return result;
......
...@@ -290,7 +290,7 @@ static int clock_rate_calc(uclong, uclong, int *); ...@@ -290,7 +290,7 @@ static int clock_rate_calc(uclong, uclong, int *);
static uclong detect_ram(pc300_t *); static uclong detect_ram(pc300_t *);
static void plx_init(pc300_t *); static void plx_init(pc300_t *);
static void cpc_trace(struct net_device *, struct sk_buff *, char); static void cpc_trace(struct net_device *, struct sk_buff *, char);
static int cpc_attach(hdlc_device *, unsigned short, unsigned short); static int cpc_attach(struct net_device *, unsigned short, unsigned short);
#ifdef CONFIG_PC300_MLPPP #ifdef CONFIG_PC300_MLPPP
void cpc_tty_init(pc300dev_t * dev); void cpc_tty_init(pc300dev_t * dev);
...@@ -3064,10 +3064,9 @@ int tx_config(pc300dev_t * d) ...@@ -3064,10 +3064,9 @@ int tx_config(pc300dev_t * d)
return 0; return 0;
} }
static int cpc_attach(hdlc_device * hdlc, unsigned short encoding, static int cpc_attach(struct net_device *dev, unsigned short encoding,
unsigned short parity) unsigned short parity)
{ {
struct net_device * dev = hdlc_to_dev(hdlc);
pc300dev_t *d = (pc300dev_t *)dev->priv; pc300dev_t *d = (pc300dev_t *)dev->priv;
pc300ch_t *chan = (pc300ch_t *)d->chan; pc300ch_t *chan = (pc300ch_t *)d->chan;
pc300_t *card = (pc300_t *)chan->card; pc300_t *card = (pc300_t *)chan->card;
......
...@@ -338,10 +338,10 @@ static int wanxl_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -338,10 +338,10 @@ static int wanxl_xmit(struct sk_buff *skb, struct net_device *dev)
static int wanxl_attach(hdlc_device *hdlc, unsigned short encoding, static int wanxl_attach(struct net_device *dev, unsigned short encoding,
unsigned short parity) unsigned short parity)
{ {
port_t *port = hdlc_to_port(hdlc); port_t *port = hdlc_to_port(dev_to_hdlc(dev));
if (encoding != ENCODING_NRZ && if (encoding != ENCODING_NRZ &&
encoding != ENCODING_NRZI) encoding != ENCODING_NRZI)
......
...@@ -100,7 +100,7 @@ typedef struct hdlc_device_struct { ...@@ -100,7 +100,7 @@ typedef struct hdlc_device_struct {
struct net_device_stats stats; struct net_device_stats stats;
/* used by HDLC layer to take control over HDLC device from hw driver*/ /* used by HDLC layer to take control over HDLC device from hw driver*/
int (*attach)(struct hdlc_device_struct *hdlc, int (*attach)(struct net_device *dev,
unsigned short encoding, unsigned short parity); unsigned short encoding, unsigned short parity);
/* hardware driver must handle this instead of dev->hard_start_xmit */ /* hardware driver must handle this instead of dev->hard_start_xmit */
......
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