Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5749df14 authored by Jiri Kosina's avatar Jiri Kosina Committed by Greg Kroah-Hartman
Browse files

Staging: cxt1e1: remove all code dependent on LINUX_VERSION_CODE



Remove all code which is dead for in-kernel driver due to being
ifdefed by LINUX_VERSION_CODE.

While at it, also remove surrounding code which is commented out,
or '#if 1' nops.

Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 41a38d9e
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -122,19 +122,7 @@ watchdog_func (unsigned long arg)
            pr_warning("%s: drvr not available (%x)\n", __func__, drvr_state);
        return;
    }
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
    /* Initialize the tq entry only the first time */
    if (wd->init_tq)
    {
        wd->init_tq = 0;
        wd->tq.routine = wd->func;
        wd->tq.sync = 0;
        wd->tq.data = wd->softc;
    }
    schedule_task (&wd->tq);
#else
    schedule_work (&wd->work);
#endif
    mod_timer (&wd->h, jiffies + wd->ticks);
}

+0 −6
Original line number Diff line number Diff line
@@ -305,15 +305,9 @@ c4hw_attach_all (void)
    error_flag = 0;
    prep_hdw_info ();
    /*** scan PCI bus for all possible boards */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    while ((pdev = pci_get_device (PCI_VENDOR_ID_CONEXANT,
                                    PCI_DEVICE_ID_CN8474,
                                    pdev)))
#else
    while ((pdev = pci_find_device (PCI_VENDOR_ID_CONEXANT,
                                    PCI_DEVICE_ID_CN8474,
                                    pdev)))
#endif
    {
        if (c4_hdw_init (pdev, found))
            found++;
+0 −123
Original line number Diff line number Diff line
@@ -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,7 +316,6 @@ chan_close (struct net_device * ndev)
    module_put (THIS_MODULE);
    return 0;
}
#endif


#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
@@ -435,11 +354,7 @@ 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 */
@@ -455,16 +370,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)
@@ -527,13 +438,9 @@ 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;
@@ -823,18 +730,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 +782,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 +792,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 +1224,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
+0 −204
Original line number Diff line number Diff line
@@ -405,7 +405,6 @@ musycc_update_tx_thp (mch_t * ch)
}


#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
/*
 * This is the workq task executed by the OS when our queue_work() is
 * scheduled and run.  It can fire off either RX or TX ACTIVATION depending
@@ -515,7 +514,6 @@ musycc_wq_chan_restart (void *arg) /* channel private structure */
#endif
    }
}
#endif


 /*
@@ -531,7 +529,6 @@ musycc_chan_restart (mch_t * ch)
            ch->channum, ch->txd_irq_srv, ch->txd_irq_srv->status);
#endif

#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
    /* 2.6 - find next unprocessed message, then set TX thp to it */
#ifdef RLD_RESTART_DEBUG
    pr_info(">> musycc_chan_restart: scheduling Chan %x workQ @ %p\n", ch->channum, &ch->ch_work);
@@ -539,51 +536,9 @@ musycc_chan_restart (mch_t * ch)
    c4_wk_chan_restart (ch);        /* work queue mechanism fires off: Ref:
                                     * musycc_wq_chan_restart () */

#else


    /* 2.4 - find next unprocessed message, then set TX thp to it */
#ifdef RLD_RESTART_DEBUG
    pr_info(">> musycc_chan_restart: scheduling Chan %x start_tx %x\n", ch->channum, ch->ch_start_tx);
#endif
    /* restart transmission from background loop */
    ch->up->up->wd_notify = WD_NOTIFY_1TX;
#endif
}


#if 0
void
musycc_cleanup (ci_t * ci)
{
    mpi_t      *pi;
    int         i, j;

    /* free up driver resources */
    ci->state = C_INIT;             /* mark as hardware not available */

    for (i = 0; i < ci->max_ports; i++)
    {
        pi = &ci->port[i];
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
        c4_wq_port_cleanup (pi);
#endif
        for (j = 0; j < MUSYCC_NCHANS; j++)
        {
            if (pi->chan[j])
                OS_kfree (pi->chan[j]); /* free mch_t struct */
        }
        OS_kfree (pi->regram_saved);
    }
#if 0
    /* obsolete - watchdog is now static w/in ci_t */
    OS_free_watchdog (ci->wd);
#endif
    OS_kfree (ci->iqd_p_saved);
    OS_kfree (ci);
}
#endif

void
rld_put_led (mpi_t * pi, u_int32_t ledval)
{
@@ -2008,37 +1963,13 @@ musycc_start_xmit (ci_t * ci, int channum, void *mem_token)
    atomic_add (len, &ci->tx_pending);
    ch->s.tx_packets++;
    ch->s.tx_bytes += len;
#if 0
    spin_unlock_irqrestore (&ch->ch_txlock, flags);   /* allow pending
                                                       * interrupt to sneak
                                                       * thru */
#endif

    /*
     * If an ONR was seen, then channel requires poking to restart
     * transmission.
     */
    if (ch->ch_start_tx)
    {
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,41)
        SD_SEM_TAKE (&ci->sem_wdbusy, "_wd_");  /* only 1 thru here, per
                                                 * board */
        if ((ch->ch_start_tx == CH_START_TX_ONR) && (ch->p.chan_mode == CFG_CH_PROTO_TRANS))
        {
            /* ONR restart transmission from background loop */
            ci->wd_notify = WD_NOTIFY_ONR;      /* enabled global watchdog
                                                 * scan-thru  */
        } else
        {
            /* start first transmission from background loop */
            ci->wd_notify = WD_NOTIFY_1TX;      /* enabled global watchdog
                                                 * scan-thru  */
        }
        musycc_chan_restart (ch);
        SD_SEM_GIVE (&ci->sem_wdbusy);
#else
        musycc_chan_restart (ch);
#endif
    }
#ifdef SBE_WAN256T3_ENABLE
    wan256t3_led (ci, LED_TX, LEDV_G);
@@ -2047,139 +1978,4 @@ musycc_start_xmit (ci_t * ci, int channum, void *mem_token)
}


#if 0
int
musycc_set_chan (ci_t * ci, int channum, struct sbecom_chan_param * p)
{
    mch_t      *ch;
    int         rok = 0;
    int         n = 0;

    if (channum < 0 || channum >= (MUSYCC_NPORTS * MUSYCC_NCHANS))      /* sanity chk param */
        return ECHRNG;
    if (!(ch = sd_find_chan (ci, channum)))
        return ENOENT;
    if (ch->channum != p->channum)
        return EINVAL;
    if (sd_line_is_ok (ch->user))
    {
        rok = 1;
        sd_line_is_down (ch->user);
    }
    if (ch->state == UP &&          /* bring down in current configuration */
        (ch->p.status != p->status ||
         ch->p.chan_mode != p->chan_mode ||
         ch->p.intr_mask != p->intr_mask ||
         ch->txd_free < ch->txd_num))
    {
        if ((n = musycc_chan_down (ci, channum)))
            return n;
        if (ch->p.mode_56k != p->mode_56k)
        {
            ch->p = *p;             /* copy in new parameters */
            musycc_update_timeslots (&ci->port[ch->channum / MUSYCC_NCHANS]);
        } else
            ch->p = *p;             /* copy in new parameters */
        if ((n = musycc_chan_up (ci, channum)))
            return n;
        sd_enable_xmit (ch->user);  /* re-enable to catch flow controlled
                                     * channel */
    } else
    {
        if (ch->p.mode_56k != p->mode_56k)
        {
            ch->p = *p;             /* copy in new parameters */
            musycc_update_timeslots (&ci->port[ch->channum / MUSYCC_NCHANS]);
        } else
            ch->p = *p;             /* copy in new parameters */
    }

    if (rok)
        sd_line_is_up (ch->user);
    return 0;
}
#endif


int
musycc_get_chan (ci_t * ci, int channum, struct sbecom_chan_param * p)
{
    mch_t      *ch;

#if 0
    if (channum < 0 || channum >= (MUSYCC_NPORTS * MUSYCC_NCHANS))      /* sanity chk param */
        return ECHRNG;
#endif
    if (!(ch = sd_find_chan (ci, channum)))
        return ENOENT;
    *p = ch->p;
    return 0;
}


int
musycc_get_chan_stats (ci_t * ci, int channum, struct sbecom_chan_stats * p)
{
    mch_t      *ch;

    if (channum < 0 || channum >= (MUSYCC_NPORTS * MUSYCC_NCHANS))      /* sanity chk param */
        return ECHRNG;
    if (!(ch = sd_find_chan (ci, channum)))
        return ENOENT;
    *p = ch->s;
    p->tx_pending = atomic_read (&ch->tx_pending);
    return 0;
}



#ifdef SBE_WAN256T3_ENABLE
int
musycc_chan_down (ci_t * ci, int channum)
{
    mch_t      *ch;
    mpi_t      *pi;
    int         i, gchan;

    if (!(ch = sd_find_chan (ci, channum)))
        return EINVAL;
    pi = ch->up;
    gchan = ch->gchan;

    /* Deactivate the channel */
    musycc_serv_req (pi, SR_CHANNEL_DEACTIVATE | SR_RX_DIRECTION | gchan);
    ch->ch_start_rx = 0;
    musycc_serv_req (pi, SR_CHANNEL_DEACTIVATE | SR_TX_DIRECTION | gchan);
    ch->ch_start_tx = 0;

    if (ch->state == DOWN)
        return 0;
    ch->state = DOWN;

    pi->regram->thp[gchan] = 0;
    pi->regram->tmp[gchan] = 0;
    pi->regram->rhp[gchan] = 0;
    pi->regram->rmp[gchan] = 0;
    FLUSH_MEM_WRITE ();
    for (i = 0; i < ch->txd_num; i++)
    {
        if (ch->mdt[i].mem_token != 0)
            OS_mem_token_free (ch->mdt[i].mem_token);
    }

    for (i = 0; i < ch->rxd_num; i++)
    {
        if (ch->mdr[i].mem_token != 0)
            OS_mem_token_free (ch->mdr[i].mem_token);
    }

    OS_kfree (ch->mdt);
    ch->mdt = 0;
    OS_kfree (ch->mdr);
    ch->mdr = 0;

    return 0;
}
#endif

/*** End-of-File ***/
+0 −4
Original line number Diff line number Diff line
@@ -500,11 +500,7 @@ pmc_init_seeprom (u_int32_t addr, u_int32_t serialNum)
    time_t      createTime;
    int         i;

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
    createTime = CURRENT_TIME;
#else
    createTime = get_seconds ();
#endif

    /* use template data */
    for (i = 0; i < sizeof (FLD_TYPE2); ++i)
Loading