Commit 909cca8c authored by David S. Miller's avatar David S. Miller

Merge branch 'hostess_sv11-cleanups'

Peng Li says:

====================
net: hostess_sv11: clean up some code style issues

This patchset clean up some code style issues.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a778e93d 7d40bfc1
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /* Comtrol SV11 card driver
* Comtrol SV11 card driver
* *
* This is a slightly odd Z85230 synchronous driver. All you need to * This is a slightly odd Z85230 synchronous driver. All you need to
* know basically is * know basically is
...@@ -9,7 +8,7 @@ ...@@ -9,7 +8,7 @@
* *
* It supports DMA using two DMA channels in SYNC mode. The driver doesn't * It supports DMA using two DMA channels in SYNC mode. The driver doesn't
* use these facilities * use these facilities
* *
* The control port is at io+1, the data at io+3 and turning off the DMA * The control port is at io+1, the data at io+3 and turning off the DMA
* is done by writing 0 to io+4 * is done by writing 0 to io+4
* *
...@@ -44,17 +43,15 @@ ...@@ -44,17 +43,15 @@
static int dma; static int dma;
/* /* Network driver support routines
* Network driver support routines
*/ */
static inline struct z8530_dev* dev_to_sv(struct net_device *dev) static inline struct z8530_dev *dev_to_sv(struct net_device *dev)
{ {
return (struct z8530_dev *)dev_to_hdlc(dev)->priv; return (struct z8530_dev *)dev_to_hdlc(dev)->priv;
} }
/* /* Frame receive. Simple for our card as we do HDLC and there
* Frame receive. Simple for our card as we do HDLC and there
* is no funny garbage involved * is no funny garbage involved
*/ */
...@@ -65,15 +62,13 @@ static void hostess_input(struct z8530_channel *c, struct sk_buff *skb) ...@@ -65,15 +62,13 @@ static void hostess_input(struct z8530_channel *c, struct sk_buff *skb)
skb->protocol = hdlc_type_trans(skb, c->netdevice); skb->protocol = hdlc_type_trans(skb, c->netdevice);
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->dev = c->netdevice; skb->dev = c->netdevice;
/* /* Send it to the PPP layer. We don't have time to process
* Send it to the PPP layer. We don't have time to process
* it right now. * it right now.
*/ */
netif_rx(skb); netif_rx(skb);
} }
/* /* We've been placed in the UP state
* We've been placed in the UP state
*/ */
static int hostess_open(struct net_device *d) static int hostess_open(struct net_device *d)
...@@ -81,19 +76,18 @@ static int hostess_open(struct net_device *d) ...@@ -81,19 +76,18 @@ static int hostess_open(struct net_device *d)
struct z8530_dev *sv11 = dev_to_sv(d); struct z8530_dev *sv11 = dev_to_sv(d);
int err = -1; int err = -1;
/* /* Link layer up
* Link layer up
*/ */
switch (dma) { switch (dma) {
case 0: case 0:
err = z8530_sync_open(d, &sv11->chanA); err = z8530_sync_open(d, &sv11->chanA);
break; break;
case 1: case 1:
err = z8530_sync_dma_open(d, &sv11->chanA); err = z8530_sync_dma_open(d, &sv11->chanA);
break; break;
case 2: case 2:
err = z8530_sync_txdma_open(d, &sv11->chanA); err = z8530_sync_txdma_open(d, &sv11->chanA);
break; break;
} }
if (err) if (err)
...@@ -102,15 +96,15 @@ static int hostess_open(struct net_device *d) ...@@ -102,15 +96,15 @@ static int hostess_open(struct net_device *d)
err = hdlc_open(d); err = hdlc_open(d);
if (err) { if (err) {
switch (dma) { switch (dma) {
case 0: case 0:
z8530_sync_close(d, &sv11->chanA); z8530_sync_close(d, &sv11->chanA);
break; break;
case 1: case 1:
z8530_sync_dma_close(d, &sv11->chanA); z8530_sync_dma_close(d, &sv11->chanA);
break; break;
case 2: case 2:
z8530_sync_txdma_close(d, &sv11->chanA); z8530_sync_txdma_close(d, &sv11->chanA);
break; break;
} }
return err; return err;
} }
...@@ -127,8 +121,7 @@ static int hostess_open(struct net_device *d) ...@@ -127,8 +121,7 @@ static int hostess_open(struct net_device *d)
static int hostess_close(struct net_device *d) static int hostess_close(struct net_device *d)
{ {
struct z8530_dev *sv11 = dev_to_sv(d); struct z8530_dev *sv11 = dev_to_sv(d);
/* /* Discard new frames
* Discard new frames
*/ */
sv11->chanA.rx_function = z8530_null_rx; sv11->chanA.rx_function = z8530_null_rx;
...@@ -136,32 +129,29 @@ static int hostess_close(struct net_device *d) ...@@ -136,32 +129,29 @@ static int hostess_close(struct net_device *d)
netif_stop_queue(d); netif_stop_queue(d);
switch (dma) { switch (dma) {
case 0: case 0:
z8530_sync_close(d, &sv11->chanA); z8530_sync_close(d, &sv11->chanA);
break; break;
case 1: case 1:
z8530_sync_dma_close(d, &sv11->chanA); z8530_sync_dma_close(d, &sv11->chanA);
break; break;
case 2: case 2:
z8530_sync_txdma_close(d, &sv11->chanA); z8530_sync_txdma_close(d, &sv11->chanA);
break; break;
} }
return 0; return 0;
} }
static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd) static int hostess_ioctl(struct net_device *d, struct ifreq *ifr, int cmd)
{ {
/* struct z8530_dev *sv11=dev_to_sv(d);
z8530_ioctl(d,&sv11->chanA,ifr,cmd) */
return hdlc_ioctl(d, ifr, cmd); return hdlc_ioctl(d, ifr, cmd);
} }
/* /* Passed network frames, fire them downwind.
* Passed network frames, fire them downwind.
*/ */
static netdev_tx_t hostess_queue_xmit(struct sk_buff *skb, static netdev_tx_t hostess_queue_xmit(struct sk_buff *skb,
struct net_device *d) struct net_device *d)
{ {
return z8530_queue_xmit(&dev_to_sv(d)->chanA, skb); return z8530_queue_xmit(&dev_to_sv(d)->chanA, skb);
} }
...@@ -174,8 +164,7 @@ static int hostess_attach(struct net_device *dev, unsigned short encoding, ...@@ -174,8 +164,7 @@ static int hostess_attach(struct net_device *dev, unsigned short encoding,
return -EINVAL; return -EINVAL;
} }
/* /* Description block for a Comtrol Hostess SV11 card
* Description block for a Comtrol Hostess SV11 card
*/ */
static const struct net_device_ops hostess_ops = { static const struct net_device_ops hostess_ops = {
...@@ -189,8 +178,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq) ...@@ -189,8 +178,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
{ {
struct z8530_dev *sv; struct z8530_dev *sv;
struct net_device *netdev; struct net_device *netdev;
/* /* Get the needed I/O space
* Get the needed I/O space
*/ */
if (!request_region(iobase, 8, "Comtrol SV11")) { if (!request_region(iobase, 8, "Comtrol SV11")) {
...@@ -202,8 +190,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq) ...@@ -202,8 +190,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
if (!sv) if (!sv)
goto err_kzalloc; goto err_kzalloc;
/* /* Stuff in the I/O addressing
* Stuff in the I/O addressing
*/ */
sv->active = 0; sv->active = 0;
...@@ -218,7 +205,8 @@ static struct z8530_dev *sv11_init(int iobase, int irq) ...@@ -218,7 +205,8 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
outb(0, iobase + 4); /* DMA off */ outb(0, iobase + 4); /* DMA off */
/* We want a fast IRQ for this device. Actually we'd like an even faster /* We want a fast IRQ for this device. Actually we'd like an even faster
IRQ ;) - This is one driver RtLinux is made for */ * IRQ ;) - This is one driver RtLinux is made for
*/
if (request_irq(irq, z8530_interrupt, 0, if (request_irq(irq, z8530_interrupt, 0,
"Hostess SV11", sv) < 0) { "Hostess SV11", sv) < 0) {
...@@ -232,8 +220,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq) ...@@ -232,8 +220,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
sv->chanB.dev = sv; sv->chanB.dev = sv;
if (dma) { if (dma) {
/* /* You can have DMA off or 1 and 3 thats the lot
* You can have DMA off or 1 and 3 thats the lot
* on the Comtrol. * on the Comtrol.
*/ */
sv->chanA.txdma = 3; sv->chanA.txdma = 3;
...@@ -248,11 +235,11 @@ static struct z8530_dev *sv11_init(int iobase, int irq) ...@@ -248,11 +235,11 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
} }
/* Kill our private IRQ line the hostess can end up chattering /* Kill our private IRQ line the hostess can end up chattering
until the configuration is set */ * until the configuration is set
*/
disable_irq(irq); disable_irq(irq);
/* /* Begin normal initialise
* Begin normal initialise
*/ */
if (z8530_init(sv)) { if (z8530_init(sv)) {
...@@ -268,8 +255,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq) ...@@ -268,8 +255,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
enable_irq(irq); enable_irq(irq);
/* /* Now we can take the IRQ
* Now we can take the IRQ
*/ */
sv->chanA.netdevice = netdev = alloc_hdlcdev(sv); sv->chanA.netdevice = netdev = alloc_hdlcdev(sv);
...@@ -340,7 +326,8 @@ static struct z8530_dev *sv11_unit; ...@@ -340,7 +326,8 @@ static struct z8530_dev *sv11_unit;
int init_module(void) int init_module(void)
{ {
if ((sv11_unit = sv11_init(io, irq)) == NULL) sv11_unit = sv11_init(io, irq);
if (!sv11_unit)
return -ENODEV; return -ENODEV;
return 0; return 0;
} }
......
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