irda: convert smsc driver to net_device_ops
authorStephen Hemminger <shemminger@vyatta.com>
Fri, 20 Mar 2009 19:35:42 +0000 (19:35 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Mar 2009 02:33:47 +0000 (19:33 -0700)
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/irda/smsc-ircc2.c

index dd73cce10991b10f07058a9e68464cd827419f2e..59d79807b4d506e4bdca343b8cab1e6fa771d478 100644 (file)
@@ -486,6 +486,26 @@ static int __init smsc_ircc_init(void)
        return ret;
 }
 
+static int smsc_ircc_net_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+       struct smsc_ircc_cb *self = netdev_priv(dev);
+
+       if (self->io.speed > 115200)
+               return  smsc_ircc_hard_xmit_fir(skb, dev);
+       else
+               return  smsc_ircc_hard_xmit_sir(skb, dev);
+}
+
+static const struct net_device_ops smsc_ircc_netdev_ops = {
+       .ndo_open       = smsc_ircc_net_open,
+       .ndo_stop       = smsc_ircc_net_close,
+       .ndo_do_ioctl   = smsc_ircc_net_ioctl,
+       .ndo_start_xmit = smsc_ircc_net_xmit,
+#if SMSC_IRCC2_C_NET_TIMEOUT
+       .ndo_tx_timeout = smsc_ircc_timeout,
+#endif
+};
+
 /*
  * Function smsc_ircc_open (firbase, sirbase, dma, irq)
  *
@@ -519,14 +539,10 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
                goto err_out1;
        }
 
-       dev->hard_start_xmit = smsc_ircc_hard_xmit_sir;
 #if SMSC_IRCC2_C_NET_TIMEOUT
-       dev->tx_timeout      = smsc_ircc_timeout;
        dev->watchdog_timeo  = HZ * 2;  /* Allow enough time for speed change */
 #endif
-       dev->open            = smsc_ircc_net_open;
-       dev->stop            = smsc_ircc_net_close;
-       dev->do_ioctl        = smsc_ircc_net_ioctl;
+       dev->netdev_ops = &smsc_ircc_netdev_ops;
 
        self = netdev_priv(dev);
        self->netdev = dev;
@@ -995,9 +1011,6 @@ static void smsc_ircc_fir_start(struct smsc_ircc_cb *self)
 
        /* Reset everything */
 
-       /* Install FIR transmit handler */
-       dev->hard_start_xmit = smsc_ircc_hard_xmit_fir;
-
        /* Clear FIFO */
        outb(inb(fir_base + IRCC_LCR_A) | IRCC_LCR_A_FIFO_RESET, fir_base + IRCC_LCR_A);
 
@@ -1894,7 +1907,6 @@ static void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
        IRDA_ASSERT(self != NULL, return;);
        dev = self->netdev;
        IRDA_ASSERT(dev != NULL, return;);
-       dev->hard_start_xmit = &smsc_ircc_hard_xmit_sir;
 
        fir_base = self->io.fir_base;
        sir_base = self->io.sir_base;