Merge branch 'message-callback' into kbuild/kconfig
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / cxt1e1 / linux.c
index 134e7568024b86b97ac1b0e3088d8bd96f3e608d..eb0f4bdf6273474d64d3e0f6307d87b56d715fe6 100644 (file)
@@ -142,10 +142,6 @@ getuserbychan (int channum)
 }
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#define DEV_TO_PRIV(dev) ( * (struct c4_priv **) ((hdlc_device*)(dev)+1))
-#else
-
 char       *
 get_hdlc_name (hdlc_device * hdlc)
 {
@@ -154,7 +150,6 @@ get_hdlc_name (hdlc_device * hdlc)
 
     return dev->name;
 }
-#endif
 
 
 static      status_t
@@ -167,7 +162,6 @@ mkret (int bsd)
 }
 
 /***************************************************************************/
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
 #include <linux/workqueue.h>
 
 /***
@@ -259,7 +253,6 @@ c4_wq_port_cleanup (mpi_t * pi)
         pi->wq_port = 0;
     }
 }
-#endif
 
 /***************************************************************************/
 
@@ -291,48 +284,6 @@ void_open (struct net_device * ndev)
 }
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-
-/** Linux 2.4.18-19 **/
-STATIC int
-chan_open (hdlc_device * hdlc)
-{
-    status_t    ret;
-
-    if ((ret = c4_chan_up (DEV_TO_PRIV (hdlc)->ci, DEV_TO_PRIV (hdlc)->channum)))
-        return -ret;
-    MOD_INC_USE_COUNT;
-    netif_start_queue (hdlc_to_dev (hdlc));
-    return 0;                       /* no error = success */
-}
-
-#else
-
-/** Linux 2.4.20 and higher **/
-STATIC int
-chan_open (struct net_device * ndev)
-{
-    hdlc_device *hdlc = dev_to_hdlc (ndev);
-    status_t    ret;
-
-    hdlc->proto = IF_PROTO_HDLC;
-    if ((ret = hdlc_open (hdlc)))
-    {
-        pr_info("hdlc_open failure, err %d.\n", ret);
-        return ret;
-    }
-    if ((ret = c4_chan_up (DEV_TO_PRIV (hdlc)->ci, DEV_TO_PRIV (hdlc)->channum)))
-        return -ret;
-    MOD_INC_USE_COUNT;
-    netif_start_queue (hdlc_to_dev (hdlc));
-    return 0;                       /* no error = success */
-}
-#endif
-
-#else
-
-/** Linux 2.6 **/
 STATIC int
 chan_open (struct net_device * ndev)
 {
@@ -351,39 +302,8 @@ chan_open (struct net_device * ndev)
     netif_start_queue (ndev);
     return 0;                       /* no error = success */
 }
-#endif
-
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-
-/** Linux 2.4.18-19 **/
-STATIC void
-chan_close (hdlc_device * hdlc)
-{
-    netif_stop_queue (hdlc_to_dev (hdlc));
-    musycc_chan_down ((ci_t *) 0, DEV_TO_PRIV (hdlc)->channum);
-    MOD_DEC_USE_COUNT;
-}
-#else
-
-/** Linux 2.4.20 and higher **/
-STATIC int
-chan_close (struct net_device * ndev)
-{
-    hdlc_device *hdlc = dev_to_hdlc (ndev);
-
-    netif_stop_queue (hdlc_to_dev (hdlc));
-    musycc_chan_down ((ci_t *) 0, DEV_TO_PRIV (hdlc)->channum);
-    hdlc_close (hdlc);
-    MOD_DEC_USE_COUNT;
-    return 0;
-}
-#endif
 
-#else
 
-/** Linux 2.6 **/
 STATIC int
 chan_close (struct net_device * ndev)
 {
@@ -396,37 +316,8 @@ chan_close (struct net_device * ndev)
     module_put (THIS_MODULE);
     return 0;
 }
-#endif
-
-
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-
-/** Linux 2.4.18-19 **/
-STATIC int
-chan_ioctl (hdlc_device * hdlc, struct ifreq * ifr, int cmd)
-{
-    if (cmd == HDLCSCLOCK)
-    {
-        ifr->ifr_ifru.ifru_ivalue = LINE_DEFAULT;
-        return 0;
-    }
-    return -EINVAL;
-}
-#endif
 
 
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-STATIC int
-chan_dev_ioctl (struct net_device * hdlc, struct ifreq * ifr, int cmd)
-{
-    if (cmd == HDLCSCLOCK)
-    {
-        ifr->ifr_ifru.ifru_ivalue = LINE_DEFAULT;
-        return 0;
-    }
-    return -EINVAL;
-}
-#else
 STATIC int
 chan_dev_ioctl (struct net_device * dev, struct ifreq * ifr, int cmd)
 {
@@ -435,16 +326,11 @@ chan_dev_ioctl (struct net_device * dev, struct ifreq * ifr, int cmd)
 
 
 STATIC int
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-chan_attach_noop (hdlc_device * hdlc, unsigned short foo_1, unsigned short foo_2)
-#else
 chan_attach_noop (struct net_device * ndev, unsigned short foo_1, unsigned short foo_2)
-#endif
 {
     return 0;                   /* our driver has nothing to do here, show's
                                  * over, go home */
 }
-#endif
 
 
 STATIC struct net_device_stats *
@@ -455,16 +341,12 @@ chan_get_stats (struct net_device * ndev)
     struct sbecom_chan_stats *stats;
     int         channum;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-    channum = DEV_TO_PRIV (ndev)->channum;
-#else
     {
         struct c4_priv *priv;
 
         priv = (struct c4_priv *) dev_to_hdlc (ndev)->priv;
         channum = priv->channum;
     }
-#endif
 
     ch = c4_find_chan (channum);
     if (ch == NULL)
@@ -511,34 +393,19 @@ get_ci_by_dev (struct net_device * ndev)
 }
 
 
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-STATIC int
-c4_linux_xmit (hdlc_device * hdlc, struct sk_buff * skb)
-{
-    int         rval;
-
-    rval = musycc_start_xmit (DEV_TO_PRIV (hdlc)->ci, DEV_TO_PRIV (hdlc)->channum, skb);
-    return -rval;
-}
-#else                           /* new */
 STATIC int
 c4_linux_xmit (struct sk_buff * skb, struct net_device * ndev)
 {
     const struct c4_priv *priv;
     int         rval;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-    priv = DEV_TO_PRIV (ndev);
-#else
     hdlc_device *hdlc = dev_to_hdlc (ndev);
 
     priv = hdlc->priv;
-#endif
 
     rval = musycc_start_xmit (priv->ci, priv->channum, skb);
     return -rval;
 }
-#endif                          /* GENERIC_HDLC_VERSION */
 
 static const struct net_device_ops chan_ops = {
        .ndo_open       = chan_open,
@@ -823,18 +690,10 @@ do_create_chan (struct net_device * ndev, void *data)
     ret = mkret (c4_new_chan (ci, cp.port, cp.channum, dev));
     if (ret)
     {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-        rtnl_unlock ();             /* needed due to Ioctl calling sequence */
-        V7 (unregister_hdlc_device) (dev_to_hdlc (dev));
-        rtnl_lock ();               /* needed due to Ioctl calling sequence */
-        OS_kfree (DEV_TO_PRIV (dev));
-        OS_kfree (dev);
-#else
         rtnl_unlock ();             /* needed due to Ioctl calling sequence */
         unregister_hdlc_device (dev);
         rtnl_lock ();               /* needed due to Ioctl calling sequence */
         free_netdev (dev);
-#endif
     }
     return ret;
 }
@@ -883,11 +742,7 @@ do_deluser (struct net_device * ndev, int lockit)
         const struct c4_priv *priv;
         int         channum;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-        priv = DEV_TO_PRIV (ndev);
-#else
         priv = (struct c4_priv *) dev_to_hdlc (ndev)->priv;
-#endif
         ci = priv->ci;
         channum = priv->channum;
 
@@ -897,22 +752,12 @@ do_deluser (struct net_device * ndev, int lockit)
         ch->user = 0;               /* will be freed, below */
     }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-    if (lockit)
-        rtnl_unlock ();             /* needed if Ioctl calling sequence */
-    V7 (unregister_hdlc_device) (dev_to_hdlc (ndev));
-    if (lockit)
-        rtnl_lock ();               /* needed if Ioctl calling sequence */
-    OS_kfree (DEV_TO_PRIV (ndev));
-    OS_kfree (ndev);
-#else
     if (lockit)
         rtnl_unlock ();             /* needed if Ioctl calling sequence */
     unregister_hdlc_device (ndev);
     if (lockit)
         rtnl_lock ();               /* needed if Ioctl calling sequence */
     free_netdev (ndev);
-#endif
     return 0;
 }
 
@@ -1339,14 +1184,6 @@ c4_mod_remove (void)
 module_init (c4_mod_init);
 module_exit (c4_mod_remove);
 
-#ifndef SBE_INCLUDE_SYMBOLS
-#ifndef CONFIG_SBE_WANC24_NCOMM
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-EXPORT_NO_SYMBOLS;
-#endif
-#endif
-#endif
-
 MODULE_AUTHOR ("SBE Technical Services <support@sbei.com>");
 MODULE_DESCRIPTION ("wanPCI-CxT1E1 Generic HDLC WAN Driver module");
 #ifdef MODULE_LICENSE