Commit 922b81b8 authored by Daeseok Youn's avatar Daeseok Youn Committed by Greg Kroah-Hartman

staging: cxt1e1: remove space between function name and parenthesis

clean up checkpatch.pl warnings in linux.c:
 WARNING: space prohibited between function name
 and open parenthesis '('
Signed-off-by: default avatarDaeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 53261926
...@@ -56,30 +56,30 @@ ...@@ -56,30 +56,30 @@
/*******************************************************************/ /*******************************************************************/
/* forward references */ /* forward references */
status_t c4_chan_work_init (mpi_t *, mch_t *); status_t c4_chan_work_init(mpi_t *, mch_t *);
void musycc_wq_chan_restart (void *); void musycc_wq_chan_restart(void *);
status_t __init c4_init (ci_t *, u_char *, u_char *); status_t __init c4_init(ci_t *, u_char *, u_char *);
status_t __init c4_init2 (ci_t *); status_t __init c4_init2(ci_t *);
ci_t *__init c4_new (void *); ci_t *__init c4_new(void *);
int __init c4hw_attach_all (void); int __init c4hw_attach_all(void);
void __init hdw_sn_get (hdw_info_t *, int); void __init hdw_sn_get(hdw_info_t *, int);
#ifdef CONFIG_SBE_PMCC4_NCOMM #ifdef CONFIG_SBE_PMCC4_NCOMM
irqreturn_t c4_ebus_intr_th_handler (void *); irqreturn_t c4_ebus_intr_th_handler(void *);
#endif #endif
int c4_frame_rw (ci_t *, struct sbecom_port_param *); int c4_frame_rw(ci_t *, struct sbecom_port_param *);
status_t c4_get_port (ci_t *, int); status_t c4_get_port(ci_t *, int);
int c4_loop_port (ci_t *, int, u_int8_t); int c4_loop_port(ci_t *, int, u_int8_t);
int c4_musycc_rw (ci_t *, struct c4_musycc_param *); int c4_musycc_rw(ci_t *, struct c4_musycc_param *);
int c4_new_chan (ci_t *, int, int, void *); int c4_new_chan(ci_t *, int, int, void *);
status_t c4_set_port (ci_t *, int); status_t c4_set_port(ci_t *, int);
int c4_pld_rw (ci_t *, struct sbecom_port_param *); int c4_pld_rw(ci_t *, struct sbecom_port_param *);
void cleanup_devs (void); void cleanup_devs(void);
void cleanup_ioremap (void); void cleanup_ioremap(void);
status_t musycc_chan_down (ci_t *, int); status_t musycc_chan_down(ci_t *, int);
irqreturn_t musycc_intr_th_handler (void *); irqreturn_t musycc_intr_th_handler(void *);
int musycc_start_xmit (ci_t *, int, void *); int musycc_start_xmit(ci_t *, int, void *);
extern char pmcc4_OSSI_release[]; extern char pmcc4_OSSI_release[];
extern ci_t *CI; extern ci_t *CI;
...@@ -94,9 +94,9 @@ extern struct s_hdw_info hdw_info[]; ...@@ -94,9 +94,9 @@ extern struct s_hdw_info hdw_info[];
#if _v7_hdlc_ #if _v7_hdlc_
#define V7(x) (x ## _v7) #define V7(x) (x ## _v7)
extern int hdlc_netif_rx_v7 (hdlc_device *, struct sk_buff *); extern int hdlc_netif_rx_v7(hdlc_device *, struct sk_buff *);
extern int register_hdlc_device_v7 (hdlc_device *); extern int register_hdlc_device_v7(hdlc_device *);
extern int unregister_hdlc_device_v7 (hdlc_device *); extern int unregister_hdlc_device_v7(hdlc_device *);
#else #else
#define V7(x) x #define V7(x) x
...@@ -128,27 +128,27 @@ module_param(max_rxdesc_used, int, 0444); ...@@ -128,27 +128,27 @@ module_param(max_rxdesc_used, int, 0444);
/****************************************************************************/ /****************************************************************************/
void * void *
getuserbychan (int channum) getuserbychan(int channum)
{ {
mch_t *ch; mch_t *ch;
ch = c4_find_chan (channum); ch = c4_find_chan(channum);
return ch ? ch->user : NULL; return ch ? ch->user : NULL;
} }
char * char *
get_hdlc_name (hdlc_device *hdlc) get_hdlc_name(hdlc_device *hdlc)
{ {
struct c4_priv *priv = hdlc->priv; struct c4_priv *priv = hdlc->priv;
struct net_device *dev = getuserbychan (priv->channum); struct net_device *dev = getuserbychan(priv->channum);
return dev->name; return dev->name;
} }
static status_t static status_t
mkret (int bsd) mkret(int bsd)
{ {
if (bsd > 0) if (bsd > 0)
return -bsd; return -bsd;
...@@ -179,7 +179,7 @@ mkret (int bsd) ...@@ -179,7 +179,7 @@ mkret (int bsd)
* within a port's group. * within a port's group.
*/ */
void void
c4_wk_chan_restart (mch_t *ch) c4_wk_chan_restart(mch_t *ch)
{ {
mpi_t *pi = ch->up; mpi_t *pi = ch->up;
...@@ -190,20 +190,20 @@ c4_wk_chan_restart (mch_t *ch) ...@@ -190,20 +190,20 @@ c4_wk_chan_restart (mch_t *ch)
/* create new entry w/in workqueue for this channel and let'er rip */ /* create new entry w/in workqueue for this channel and let'er rip */
/** queue_work (struct workqueue_struct *queue, /** queue_work(struct workqueue_struct *queue,
** struct work_struct *work); ** struct work_struct *work);
**/ **/
queue_work (pi->wq_port, &ch->ch_work); queue_work(pi->wq_port, &ch->ch_work);
} }
status_t status_t
c4_wk_chan_init (mpi_t *pi, mch_t *ch) c4_wk_chan_init(mpi_t *pi, mch_t *ch)
{ {
/* /*
* this will be used to restart a stopped channel * this will be used to restart a stopped channel
*/ */
/** INIT_WORK (struct work_struct *work, /** INIT_WORK(struct work_struct *work,
** void (*function)(void *), ** void (*function)(void *),
** void *data); ** void *data);
**/ **/
...@@ -212,7 +212,7 @@ c4_wk_chan_init (mpi_t *pi, mch_t *ch) ...@@ -212,7 +212,7 @@ c4_wk_chan_init (mpi_t *pi, mch_t *ch)
} }
status_t status_t
c4_wq_port_init (mpi_t *pi) c4_wq_port_init(mpi_t *pi)
{ {
char name[16], *np; /* NOTE: name of the queue limited by system char name[16], *np; /* NOTE: name of the queue limited by system
...@@ -222,20 +222,20 @@ c4_wq_port_init (mpi_t *pi) ...@@ -222,20 +222,20 @@ c4_wq_port_init (mpi_t *pi)
return 0; /* already initialized */ return 0; /* already initialized */
np = name; np = name;
memset (name, 0, 16); memset(name, 0, 16);
sprintf (np, "%s%d", pi->up->devname, pi->portnum); /* IE pmcc4-01) */ sprintf(np, "%s%d", pi->up->devname, pi->portnum); /* IE pmcc4-01) */
#ifdef RLD_RESTART_DEBUG #ifdef RLD_RESTART_DEBUG
pr_info(">> %s: creating workqueue <%s> for Port %d.\n", pr_info(">> %s: creating workqueue <%s> for Port %d.\n",
__func__, name, pi->portnum); /* RLD DEBUG */ __func__, name, pi->portnum); /* RLD DEBUG */
#endif #endif
if (!(pi->wq_port = create_singlethread_workqueue (name))) if (!(pi->wq_port = create_singlethread_workqueue(name)))
return -ENOMEM; return -ENOMEM;
return 0; /* success */ return 0; /* success */
} }
void void
c4_wq_port_cleanup (mpi_t *pi) c4_wq_port_cleanup(mpi_t *pi)
{ {
/* /*
* PORT POINT: cannot call this if WQ is statically allocated w/in * PORT POINT: cannot call this if WQ is statically allocated w/in
...@@ -243,7 +243,7 @@ c4_wq_port_cleanup (mpi_t *pi) ...@@ -243,7 +243,7 @@ c4_wq_port_cleanup (mpi_t *pi)
*/ */
if (pi->wq_port) if (pi->wq_port)
{ {
destroy_workqueue (pi->wq_port); /* this also calls destroy_workqueue(pi->wq_port); /* this also calls
* flush_workqueue() */ * flush_workqueue() */
pi->wq_port = NULL; pi->wq_port = NULL;
} }
...@@ -252,7 +252,7 @@ c4_wq_port_cleanup (mpi_t *pi) ...@@ -252,7 +252,7 @@ c4_wq_port_cleanup (mpi_t *pi)
/***************************************************************************/ /***************************************************************************/
irqreturn_t irqreturn_t
c4_linux_interrupt (int irq, void *dev_instance) c4_linux_interrupt(int irq, void *dev_instance)
{ {
struct net_device *ndev = dev_instance; struct net_device *ndev = dev_instance;
...@@ -262,7 +262,7 @@ c4_linux_interrupt (int irq, void *dev_instance) ...@@ -262,7 +262,7 @@ c4_linux_interrupt (int irq, void *dev_instance)
#ifdef CONFIG_SBE_PMCC4_NCOMM #ifdef CONFIG_SBE_PMCC4_NCOMM
irqreturn_t irqreturn_t
c4_ebus_interrupt (int irq, void *dev_instance) c4_ebus_interrupt(int irq, void *dev_instance)
{ {
struct net_device *ndev = dev_instance; struct net_device *ndev = dev_instance;
...@@ -272,7 +272,7 @@ c4_ebus_interrupt (int irq, void *dev_instance) ...@@ -272,7 +272,7 @@ c4_ebus_interrupt (int irq, void *dev_instance)
static int static int
void_open (struct net_device *ndev) void_open(struct net_device *ndev)
{ {
pr_info("%s: trying to open master device !\n", ndev->name); pr_info("%s: trying to open master device !\n", ndev->name);
return -1; return -1;
...@@ -280,48 +280,48 @@ void_open (struct net_device *ndev) ...@@ -280,48 +280,48 @@ void_open (struct net_device *ndev)
static int static int
chan_open (struct net_device *ndev) chan_open(struct net_device *ndev)
{ {
hdlc_device *hdlc = dev_to_hdlc (ndev); hdlc_device *hdlc = dev_to_hdlc(ndev);
const struct c4_priv *priv = hdlc->priv; const struct c4_priv *priv = hdlc->priv;
int ret; int ret;
if ((ret = hdlc_open (ndev))) if ((ret = hdlc_open(ndev)))
{ {
pr_info("hdlc_open failure, err %d.\n", ret); pr_info("hdlc_open failure, err %d.\n", ret);
return ret; return ret;
} }
if ((ret = c4_chan_up (priv->ci, priv->channum))) if ((ret = c4_chan_up(priv->ci, priv->channum)))
return -ret; return -ret;
try_module_get (THIS_MODULE); try_module_get(THIS_MODULE);
netif_start_queue (ndev); netif_start_queue(ndev);
return 0; /* no error = success */ return 0; /* no error = success */
} }
static int static int
chan_close (struct net_device *ndev) chan_close(struct net_device *ndev)
{ {
hdlc_device *hdlc = dev_to_hdlc (ndev); hdlc_device *hdlc = dev_to_hdlc(ndev);
const struct c4_priv *priv = hdlc->priv; const struct c4_priv *priv = hdlc->priv;
netif_stop_queue (ndev); netif_stop_queue(ndev);
musycc_chan_down ((ci_t *) 0, priv->channum); musycc_chan_down((ci_t *) 0, priv->channum);
hdlc_close (ndev); hdlc_close(ndev);
module_put (THIS_MODULE); module_put(THIS_MODULE);
return 0; return 0;
} }
static int static int
chan_dev_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) chan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{ {
return hdlc_ioctl (dev, ifr, cmd); return hdlc_ioctl(dev, ifr, cmd);
} }
static int static int
chan_attach_noop (struct net_device *ndev, unsigned short foo_1, unsigned short foo_2) chan_attach_noop(struct net_device *ndev, unsigned short foo_1, unsigned short foo_2)
{ {
return 0; /* our driver has nothing to do here, show's return 0; /* our driver has nothing to do here, show's
* over, go home */ * over, go home */
...@@ -329,7 +329,7 @@ chan_attach_noop (struct net_device *ndev, unsigned short foo_1, unsigned short ...@@ -329,7 +329,7 @@ chan_attach_noop (struct net_device *ndev, unsigned short foo_1, unsigned short
static struct net_device_stats * static struct net_device_stats *
chan_get_stats (struct net_device *ndev) chan_get_stats(struct net_device *ndev)
{ {
mch_t *ch; mch_t *ch;
struct net_device_stats *nstats; struct net_device_stats *nstats;
...@@ -339,18 +339,18 @@ chan_get_stats (struct net_device *ndev) ...@@ -339,18 +339,18 @@ chan_get_stats (struct net_device *ndev)
{ {
struct c4_priv *priv; struct c4_priv *priv;
priv = (struct c4_priv *) dev_to_hdlc (ndev)->priv; priv = (struct c4_priv *)dev_to_hdlc(ndev)->priv;
channum = priv->channum; channum = priv->channum;
} }
ch = c4_find_chan (channum); ch = c4_find_chan(channum);
if (ch == NULL) if (ch == NULL)
return NULL; return NULL;
nstats = &ndev->stats; nstats = &ndev->stats;
stats = &ch->s; stats = &ch->s;
memset (nstats, 0, sizeof (struct net_device_stats)); memset(nstats, 0, sizeof(struct net_device_stats));
nstats->rx_packets = stats->rx_packets; nstats->rx_packets = stats->rx_packets;
nstats->tx_packets = stats->tx_packets; nstats->tx_packets = stats->tx_packets;
nstats->rx_bytes = stats->rx_bytes; nstats->rx_bytes = stats->rx_bytes;
...@@ -382,23 +382,23 @@ chan_get_stats (struct net_device *ndev) ...@@ -382,23 +382,23 @@ chan_get_stats (struct net_device *ndev)
static ci_t * static ci_t *
get_ci_by_dev (struct net_device *ndev) get_ci_by_dev(struct net_device *ndev)
{ {
return (ci_t *)(netdev_priv(ndev)); return (ci_t *)(netdev_priv(ndev));
} }
static int static int
c4_linux_xmit (struct sk_buff *skb, struct net_device *ndev) c4_linux_xmit(struct sk_buff *skb, struct net_device *ndev)
{ {
const struct c4_priv *priv; const struct c4_priv *priv;
int rval; int rval;
hdlc_device *hdlc = dev_to_hdlc (ndev); hdlc_device *hdlc = dev_to_hdlc(ndev);
priv = hdlc->priv; priv = hdlc->priv;
rval = musycc_start_xmit (priv->ci, priv->channum, skb); rval = musycc_start_xmit(priv->ci, priv->channum, skb);
return rval; return rval;
} }
...@@ -411,7 +411,7 @@ static const struct net_device_ops chan_ops = { ...@@ -411,7 +411,7 @@ static const struct net_device_ops chan_ops = {
}; };
static struct net_device * static struct net_device *
create_chan (struct net_device *ndev, ci_t *ci, create_chan(struct net_device *ndev, ci_t *ci,
struct sbecom_chan_param *cp) struct sbecom_chan_param *cp)
{ {
hdlc_device *hdlc; hdlc_device *hdlc;
...@@ -419,55 +419,55 @@ create_chan (struct net_device *ndev, ci_t *ci, ...@@ -419,55 +419,55 @@ create_chan (struct net_device *ndev, ci_t *ci,
hdw_info_t *hi; hdw_info_t *hi;
int ret; int ret;
if (c4_find_chan (cp->channum)) if (c4_find_chan(cp->channum))
return NULL; /* channel already exists */ return NULL; /* channel already exists */
{ {
struct c4_priv *priv; struct c4_priv *priv;
/* allocate then fill in private data structure */ /* allocate then fill in private data structure */
priv = OS_kmalloc (sizeof (struct c4_priv)); priv = OS_kmalloc(sizeof(struct c4_priv));
if (!priv) if (!priv)
{ {
pr_warning("%s: no memory for net_device !\n", ci->devname); pr_warning("%s: no memory for net_device !\n", ci->devname);
return NULL; return NULL;
} }
dev = alloc_hdlcdev (priv); dev = alloc_hdlcdev(priv);
if (!dev) if (!dev)
{ {
pr_warning("%s: no memory for hdlc_device !\n", ci->devname); pr_warning("%s: no memory for hdlc_device !\n", ci->devname);
OS_kfree (priv); OS_kfree(priv);
return NULL; return NULL;
} }
priv->ci = ci; priv->ci = ci;
priv->channum = cp->channum; priv->channum = cp->channum;
} }
hdlc = dev_to_hdlc (dev); hdlc = dev_to_hdlc(dev);
dev->base_addr = 0; /* not I/O mapped */ dev->base_addr = 0; /* not I/O mapped */
dev->irq = ndev->irq; dev->irq = ndev->irq;
dev->type = ARPHRD_RAWHDLC; dev->type = ARPHRD_RAWHDLC;
*dev->name = 0; /* default ifconfig name = "hdlc" */ *dev->name = 0; /* default ifconfig name = "hdlc" */
hi = (hdw_info_t *) ci->hdw_info; hi = (hdw_info_t *)ci->hdw_info;
if (hi->mfg_info_sts == EEPROM_OK) if (hi->mfg_info_sts == EEPROM_OK)
{ {
switch (hi->promfmt) switch (hi->promfmt)
{ {
case PROM_FORMAT_TYPE1: case PROM_FORMAT_TYPE1:
memcpy (dev->dev_addr, (FLD_TYPE1 *) (hi->mfg_info.pft1.Serial), 6); memcpy(dev->dev_addr, (FLD_TYPE1 *) (hi->mfg_info.pft1.Serial), 6);
break; break;
case PROM_FORMAT_TYPE2: case PROM_FORMAT_TYPE2:
memcpy (dev->dev_addr, (FLD_TYPE2 *) (hi->mfg_info.pft2.Serial), 6); memcpy(dev->dev_addr, (FLD_TYPE2 *) (hi->mfg_info.pft2.Serial), 6);
break; break;
default: default:
memset (dev->dev_addr, 0, 6); memset(dev->dev_addr, 0, 6);
break; break;
} }
} else } else
{ {
memset (dev->dev_addr, 0, 6); memset(dev->dev_addr, 0, 6);
} }
hdlc->xmit = c4_linux_xmit; hdlc->xmit = c4_linux_xmit;
...@@ -484,18 +484,18 @@ create_chan (struct net_device *ndev, ci_t *ci, ...@@ -484,18 +484,18 @@ create_chan (struct net_device *ndev, ci_t *ci,
hdlc->attach = chan_attach_noop; hdlc->attach = chan_attach_noop;
rtnl_unlock (); /* needed due to Ioctl calling sequence */ rtnl_unlock(); /* needed due to Ioctl calling sequence */
ret = register_hdlc_device (dev); ret = register_hdlc_device(dev);
/* NOTE: <stats> setting must occur AFTER registration in order to "take" */ /* NOTE: <stats> setting must occur AFTER registration in order to "take" */
dev->tx_queue_len = MAX_DEFAULT_IFQLEN; dev->tx_queue_len = MAX_DEFAULT_IFQLEN;
rtnl_lock (); /* needed due to Ioctl calling sequence */ rtnl_lock(); /* needed due to Ioctl calling sequence */
if (ret) if (ret)
{ {
if (cxt1e1_log_level >= LOG_WARN) if (cxt1e1_log_level >= LOG_WARN)
pr_info("%s: create_chan[%d] registration error = %d.\n", pr_info("%s: create_chan[%d] registration error = %d.\n",
ci->devname, cp->channum, ret); ci->devname, cp->channum, ret);
free_netdev (dev); /* cleanup */ free_netdev(dev); /* cleanup */
return NULL; /* failed to register */ return NULL; /* failed to register */
} }
return dev; return dev;
...@@ -504,160 +504,160 @@ create_chan (struct net_device *ndev, ci_t *ci, ...@@ -504,160 +504,160 @@ create_chan (struct net_device *ndev, ci_t *ci,
/* the idea here is to get port information and pass it back (using pointer) */ /* the idea here is to get port information and pass it back (using pointer) */
static status_t static status_t
do_get_port (struct net_device *ndev, void *data) do_get_port(struct net_device *ndev, void *data)
{ {
int ret; int ret;
ci_t *ci; /* ci stands for card information */ ci_t *ci; /* ci stands for card information */
struct sbecom_port_param pp;/* copy data to kernel land */ struct sbecom_port_param pp;/* copy data to kernel land */
if (copy_from_user (&pp, data, sizeof (struct sbecom_port_param))) if (copy_from_user(&pp, data, sizeof(struct sbecom_port_param)))
return -EFAULT; return -EFAULT;
if (pp.portnum >= MUSYCC_NPORTS) if (pp.portnum >= MUSYCC_NPORTS)
return -EFAULT; return -EFAULT;
ci = get_ci_by_dev (ndev); ci = get_ci_by_dev(ndev);
if (!ci) if (!ci)
return -EINVAL; /* get card info */ return -EINVAL; /* get card info */
ret = mkret (c4_get_port (ci, pp.portnum)); ret = mkret(c4_get_port(ci, pp.portnum));
if (ret) if (ret)
return ret; return ret;
if (copy_to_user (data, &ci->port[pp.portnum].p, if (copy_to_user(data, &ci->port[pp.portnum].p,
sizeof (struct sbecom_port_param))) sizeof(struct sbecom_port_param)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
/* this function copys the user data and then calls the real action function */ /* this function copys the user data and then calls the real action function */
static status_t static status_t
do_set_port (struct net_device *ndev, void *data) do_set_port(struct net_device *ndev, void *data)
{ {
ci_t *ci; /* ci stands for card information */ ci_t *ci; /* ci stands for card information */
struct sbecom_port_param pp;/* copy data to kernel land */ struct sbecom_port_param pp;/* copy data to kernel land */
if (copy_from_user (&pp, data, sizeof (struct sbecom_port_param))) if (copy_from_user(&pp, data, sizeof(struct sbecom_port_param)))
return -EFAULT; return -EFAULT;
if (pp.portnum >= MUSYCC_NPORTS) if (pp.portnum >= MUSYCC_NPORTS)
return -EFAULT; return -EFAULT;
ci = get_ci_by_dev (ndev); ci = get_ci_by_dev(ndev);
if (!ci) if (!ci)
return -EINVAL; /* get card info */ return -EINVAL; /* get card info */
if (pp.portnum >= ci->max_port) /* sanity check */ if (pp.portnum >= ci->max_port) /* sanity check */
return -ENXIO; return -ENXIO;
memcpy (&ci->port[pp.portnum].p, &pp, sizeof (struct sbecom_port_param)); memcpy(&ci->port[pp.portnum].p, &pp, sizeof(struct sbecom_port_param));
return mkret (c4_set_port (ci, pp.portnum)); return mkret(c4_set_port(ci, pp.portnum));
} }
/* work the port loopback mode as per directed */ /* work the port loopback mode as per directed */
static status_t static status_t
do_port_loop (struct net_device *ndev, void *data) do_port_loop(struct net_device *ndev, void *data)
{ {
struct sbecom_port_param pp; struct sbecom_port_param pp;
ci_t *ci; ci_t *ci;
if (copy_from_user (&pp, data, sizeof (struct sbecom_port_param))) if (copy_from_user(&pp, data, sizeof(struct sbecom_port_param)))
return -EFAULT; return -EFAULT;
ci = get_ci_by_dev (ndev); ci = get_ci_by_dev(ndev);
if (!ci) if (!ci)
return -EINVAL; return -EINVAL;
return mkret (c4_loop_port (ci, pp.portnum, pp.port_mode)); return mkret(c4_loop_port(ci, pp.portnum, pp.port_mode));
} }
/* set the specified register with the given value / or just read it */ /* set the specified register with the given value / or just read it */
static status_t static status_t
do_framer_rw (struct net_device *ndev, void *data) do_framer_rw(struct net_device *ndev, void *data)
{ {
struct sbecom_port_param pp; struct sbecom_port_param pp;
ci_t *ci; ci_t *ci;
int ret; int ret;
if (copy_from_user (&pp, data, sizeof (struct sbecom_port_param))) if (copy_from_user(&pp, data, sizeof(struct sbecom_port_param)))
return -EFAULT; return -EFAULT;
ci = get_ci_by_dev (ndev); ci = get_ci_by_dev(ndev);
if (!ci) if (!ci)
return -EINVAL; return -EINVAL;
ret = mkret (c4_frame_rw (ci, &pp)); ret = mkret(c4_frame_rw(ci, &pp));
if (ret) if (ret)
return ret; return ret;
if (copy_to_user (data, &pp, sizeof (struct sbecom_port_param))) if (copy_to_user(data, &pp, sizeof(struct sbecom_port_param)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
/* set the specified register with the given value / or just read it */ /* set the specified register with the given value / or just read it */
static status_t static status_t
do_pld_rw (struct net_device *ndev, void *data) do_pld_rw(struct net_device *ndev, void *data)
{ {
struct sbecom_port_param pp; struct sbecom_port_param pp;
ci_t *ci; ci_t *ci;
int ret; int ret;
if (copy_from_user (&pp, data, sizeof (struct sbecom_port_param))) if (copy_from_user(&pp, data, sizeof(struct sbecom_port_param)))
return -EFAULT; return -EFAULT;
ci = get_ci_by_dev (ndev); ci = get_ci_by_dev(ndev);
if (!ci) if (!ci)
return -EINVAL; return -EINVAL;
ret = mkret (c4_pld_rw (ci, &pp)); ret = mkret(c4_pld_rw(ci, &pp));
if (ret) if (ret)
return ret; return ret;
if (copy_to_user (data, &pp, sizeof (struct sbecom_port_param))) if (copy_to_user(data, &pp, sizeof(struct sbecom_port_param)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
/* set the specified register with the given value / or just read it */ /* set the specified register with the given value / or just read it */
static status_t static status_t
do_musycc_rw (struct net_device *ndev, void *data) do_musycc_rw(struct net_device *ndev, void *data)
{ {
struct c4_musycc_param mp; struct c4_musycc_param mp;
ci_t *ci; ci_t *ci;
int ret; int ret;
if (copy_from_user (&mp, data, sizeof (struct c4_musycc_param))) if (copy_from_user(&mp, data, sizeof(struct c4_musycc_param)))
return -EFAULT; return -EFAULT;
ci = get_ci_by_dev (ndev); ci = get_ci_by_dev(ndev);
if (!ci) if (!ci)
return -EINVAL; return -EINVAL;
ret = mkret (c4_musycc_rw (ci, &mp)); ret = mkret(c4_musycc_rw(ci, &mp));
if (ret) if (ret)
return ret; return ret;
if (copy_to_user (data, &mp, sizeof (struct c4_musycc_param))) if (copy_to_user(data, &mp, sizeof(struct c4_musycc_param)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
static status_t static status_t
do_get_chan (struct net_device *ndev, void *data) do_get_chan(struct net_device *ndev, void *data)
{ {
struct sbecom_chan_param cp; struct sbecom_chan_param cp;
int ret; int ret;
if (copy_from_user (&cp, data, if (copy_from_user(&cp, data,
sizeof (struct sbecom_chan_param))) sizeof(struct sbecom_chan_param)))
return -EFAULT; return -EFAULT;
if ((ret = mkret (c4_get_chan (cp.channum, &cp)))) if ((ret = mkret(c4_get_chan(cp.channum, &cp))))
return ret; return ret;
if (copy_to_user (data, &cp, sizeof (struct sbecom_chan_param))) if (copy_to_user(data, &cp, sizeof(struct sbecom_chan_param)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
static status_t static status_t
do_set_chan (struct net_device *ndev, void *data) do_set_chan(struct net_device *ndev, void *data)
{ {
struct sbecom_chan_param cp; struct sbecom_chan_param cp;
int ret; int ret;
ci_t *ci; ci_t *ci;
if (copy_from_user (&cp, data, sizeof (struct sbecom_chan_param))) if (copy_from_user(&cp, data, sizeof(struct sbecom_chan_param)))
return -EFAULT; return -EFAULT;
ci = get_ci_by_dev (ndev); ci = get_ci_by_dev(ndev);
if (!ci) if (!ci)
return -EINVAL; return -EINVAL;
switch (ret = mkret (c4_set_chan (cp.channum, &cp))) switch (ret = mkret(c4_set_chan(cp.channum, &cp)))
{ {
case 0: case 0:
return 0; return 0;
...@@ -667,66 +667,66 @@ do_set_chan (struct net_device *ndev, void *data) ...@@ -667,66 +667,66 @@ do_set_chan (struct net_device *ndev, void *data)
} }
static status_t static status_t
do_create_chan (struct net_device *ndev, void *data) do_create_chan(struct net_device *ndev, void *data)
{ {
ci_t *ci; ci_t *ci;
struct net_device *dev; struct net_device *dev;
struct sbecom_chan_param cp; struct sbecom_chan_param cp;
int ret; int ret;
if (copy_from_user (&cp, data, sizeof (struct sbecom_chan_param))) if (copy_from_user(&cp, data, sizeof(struct sbecom_chan_param)))
return -EFAULT; return -EFAULT;
ci = get_ci_by_dev (ndev); ci = get_ci_by_dev(ndev);
if (!ci) if (!ci)
return -EINVAL; return -EINVAL;
dev = create_chan (ndev, ci, &cp); dev = create_chan(ndev, ci, &cp);
if (!dev) if (!dev)
return -EBUSY; return -EBUSY;
ret = mkret (c4_new_chan (ci, cp.port, cp.channum, dev)); ret = mkret(c4_new_chan(ci, cp.port, cp.channum, dev));
if (ret) if (ret)
{ {
rtnl_unlock (); /* needed due to Ioctl calling sequence */ rtnl_unlock(); /* needed due to Ioctl calling sequence */
unregister_hdlc_device (dev); unregister_hdlc_device(dev);
rtnl_lock (); /* needed due to Ioctl calling sequence */ rtnl_lock(); /* needed due to Ioctl calling sequence */
free_netdev (dev); free_netdev(dev);
} }
return ret; return ret;
} }
static status_t static status_t
do_get_chan_stats (struct net_device *ndev, void *data) do_get_chan_stats(struct net_device *ndev, void *data)
{ {
struct c4_chan_stats_wrap ccs; struct c4_chan_stats_wrap ccs;
int ret; int ret;
if (copy_from_user (&ccs, data, if (copy_from_user(&ccs, data,
sizeof (struct c4_chan_stats_wrap))) sizeof(struct c4_chan_stats_wrap)))
return -EFAULT; return -EFAULT;
switch (ret = mkret (c4_get_chan_stats (ccs.channum, &ccs.stats))) switch (ret = mkret(c4_get_chan_stats(ccs.channum, &ccs.stats)))
{ {
case 0: case 0:
break; break;
default: default:
return ret; return ret;
} }
if (copy_to_user (data, &ccs, if (copy_to_user(data, &ccs,
sizeof (struct c4_chan_stats_wrap))) sizeof(struct c4_chan_stats_wrap)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
static status_t static status_t
do_set_loglevel (struct net_device *ndev, void *data) do_set_loglevel(struct net_device *ndev, void *data)
{ {
unsigned int cxt1e1_log_level; unsigned int cxt1e1_log_level;
if (copy_from_user (&cxt1e1_log_level, data, sizeof (int))) if (copy_from_user(&cxt1e1_log_level, data, sizeof(int)))
return -EFAULT; return -EFAULT;
sbecom_set_loglevel (cxt1e1_log_level); sbecom_set_loglevel(cxt1e1_log_level);
return 0; return 0;
} }
static status_t static status_t
do_deluser (struct net_device *ndev, int lockit) do_deluser(struct net_device *ndev, int lockit)
{ {
if (ndev->flags & IFF_UP) if (ndev->flags & IFF_UP)
return -EBUSY; return -EBUSY;
...@@ -737,51 +737,51 @@ do_deluser (struct net_device *ndev, int lockit) ...@@ -737,51 +737,51 @@ do_deluser (struct net_device *ndev, int lockit)
const struct c4_priv *priv; const struct c4_priv *priv;
int channum; int channum;
priv = (struct c4_priv *) dev_to_hdlc (ndev)->priv; priv = (struct c4_priv *)dev_to_hdlc(ndev)->priv;
ci = priv->ci; ci = priv->ci;
channum = priv->channum; channum = priv->channum;
ch = c4_find_chan (channum); ch = c4_find_chan(channum);
if (ch == NULL) if (ch == NULL)
return -ENOENT; return -ENOENT;
ch->user = NULL; /* will be freed, below */ ch->user = NULL; /* will be freed, below */
} }
if (lockit) if (lockit)
rtnl_unlock (); /* needed if Ioctl calling sequence */ rtnl_unlock(); /* needed if Ioctl calling sequence */
unregister_hdlc_device (ndev); unregister_hdlc_device(ndev);
if (lockit) if (lockit)
rtnl_lock (); /* needed if Ioctl calling sequence */ rtnl_lock(); /* needed if Ioctl calling sequence */
free_netdev (ndev); free_netdev(ndev);
return 0; return 0;
} }
int int
do_del_chan (struct net_device *musycc_dev, void *data) do_del_chan(struct net_device *musycc_dev, void *data)
{ {
struct sbecom_chan_param cp; struct sbecom_chan_param cp;
char buf[sizeof (CHANNAME) + 3]; char buf[sizeof(CHANNAME) + 3];
struct net_device *dev; struct net_device *dev;
int ret; int ret;
if (copy_from_user (&cp, data, if (copy_from_user(&cp, data,
sizeof (struct sbecom_chan_param))) sizeof(struct sbecom_chan_param)))
return -EFAULT; return -EFAULT;
if (cp.channum > 999) if (cp.channum > 999)
return -EINVAL; return -EINVAL;
snprintf (buf, sizeof(buf), CHANNAME "%d", cp.channum); snprintf(buf, sizeof(buf), CHANNAME "%d", cp.channum);
dev = __dev_get_by_name(&init_net, buf); dev = __dev_get_by_name(&init_net, buf);
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
ret = do_deluser (dev, 1); ret = do_deluser(dev, 1);
if (ret) if (ret)
return ret; return ret;
return c4_del_chan (cp.channum); return c4_del_chan(cp.channum);
} }
int c4_reset_board (void *); int c4_reset_board(void *);
int int
do_reset (struct net_device *musycc_dev, void *data) do_reset(struct net_device *musycc_dev, void *data)
{ {
const struct c4_priv *priv; const struct c4_priv *priv;
int i; int i;
...@@ -789,38 +789,38 @@ do_reset (struct net_device *musycc_dev, void *data) ...@@ -789,38 +789,38 @@ do_reset (struct net_device *musycc_dev, void *data)
for (i = 0; i < 128; i++) for (i = 0; i < 128; i++)
{ {
struct net_device *ndev; struct net_device *ndev;
char buf[sizeof (CHANNAME) + 3]; char buf[sizeof(CHANNAME) + 3];
sprintf (buf, CHANNAME "%d", i); sprintf(buf, CHANNAME "%d", i);
ndev = __dev_get_by_name(&init_net, buf); ndev = __dev_get_by_name(&init_net, buf);
if (!ndev) if (!ndev)
continue; continue;
priv = dev_to_hdlc (ndev)->priv; priv = dev_to_hdlc(ndev)->priv;
if ((unsigned long) (priv->ci) == if ((unsigned long) (priv->ci) ==
(unsigned long) (netdev_priv(musycc_dev))) (unsigned long) (netdev_priv(musycc_dev)))
{ {
ndev->flags &= ~IFF_UP; ndev->flags &= ~IFF_UP;
netif_stop_queue (ndev); netif_stop_queue(ndev);
do_deluser (ndev, 1); do_deluser(ndev, 1);
} }
} }
return 0; return 0;
} }
int int
do_reset_chan_stats (struct net_device *musycc_dev, void *data) do_reset_chan_stats(struct net_device *musycc_dev, void *data)
{ {
struct sbecom_chan_param cp; struct sbecom_chan_param cp;
if (copy_from_user (&cp, data, if (copy_from_user(&cp, data,
sizeof (struct sbecom_chan_param))) sizeof(struct sbecom_chan_param)))
return -EFAULT; return -EFAULT;
return mkret (c4_del_chan_stats (cp.channum)); return mkret(c4_del_chan_stats(cp.channum));
} }
static status_t static status_t
c4_ioctl (struct net_device *ndev, struct ifreq *ifr, int cmd) c4_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd)
{ {
ci_t *ci; ci_t *ci;
void *data; void *data;
...@@ -845,29 +845,29 @@ c4_ioctl (struct net_device *ndev, struct ifreq *ifr, int cmd) ...@@ -845,29 +845,29 @@ c4_ioctl (struct net_device *ndev, struct ifreq *ifr, int cmd)
} arg; } arg;
if (!capable (CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (cmd != SIOCDEVPRIVATE + 15) if (cmd != SIOCDEVPRIVATE + 15)
return -EINVAL; return -EINVAL;
if (!(ci = get_ci_by_dev (ndev))) if (!(ci = get_ci_by_dev(ndev)))
return -EINVAL; return -EINVAL;
if (ci->state != C_RUNNING) if (ci->state != C_RUNNING)
return -ENODEV; return -ENODEV;
if (copy_from_user (&iocmd, ifr->ifr_data, sizeof (iocmd))) if (copy_from_user(&iocmd, ifr->ifr_data, sizeof(iocmd)))
return -EFAULT; return -EFAULT;
#if 0 #if 0
if (copy_from_user (&len, ifr->ifr_data + sizeof (iocmd), sizeof (len))) if (copy_from_user(&len, ifr->ifr_data + sizeof(iocmd), sizeof(len)))
return -EFAULT; return -EFAULT;
#endif #endif
#if 0 #if 0
pr_info("c4_ioctl: iocmd %x, dir %x type %x nr %x iolen %d.\n", iocmd, pr_info("c4_ioctl: iocmd %x, dir %x type %x nr %x iolen %d.\n", iocmd,
_IOC_DIR (iocmd), _IOC_TYPE (iocmd), _IOC_NR (iocmd), _IOC_DIR(iocmd), _IOC_TYPE(iocmd), _IOC_NR(iocmd),
_IOC_SIZE (iocmd)); _IOC_SIZE(iocmd));
#endif #endif
iolen = _IOC_SIZE (iocmd); iolen = _IOC_SIZE(iocmd);
data = ifr->ifr_data + sizeof (iocmd); data = ifr->ifr_data + sizeof(iocmd);
if (copy_from_user (&arg, data, iolen)) if (copy_from_user(&arg, data, iolen))
return -EFAULT; return -EFAULT;
ret = 0; ret = 0;
...@@ -875,55 +875,55 @@ c4_ioctl (struct net_device *ndev, struct ifreq *ifr, int cmd) ...@@ -875,55 +875,55 @@ c4_ioctl (struct net_device *ndev, struct ifreq *ifr, int cmd)
{ {
case SBE_IOC_PORT_GET: case SBE_IOC_PORT_GET:
//pr_info(">> SBE_IOC_PORT_GET Ioctl...\n"); //pr_info(">> SBE_IOC_PORT_GET Ioctl...\n");
ret = do_get_port (ndev, data); ret = do_get_port(ndev, data);
break; break;
case SBE_IOC_PORT_SET: case SBE_IOC_PORT_SET:
//pr_info(">> SBE_IOC_PORT_SET Ioctl...\n"); //pr_info(">> SBE_IOC_PORT_SET Ioctl...\n");
ret = do_set_port (ndev, data); ret = do_set_port(ndev, data);
break; break;
case SBE_IOC_CHAN_GET: case SBE_IOC_CHAN_GET:
//pr_info(">> SBE_IOC_CHAN_GET Ioctl...\n"); //pr_info(">> SBE_IOC_CHAN_GET Ioctl...\n");
ret = do_get_chan (ndev, data); ret = do_get_chan(ndev, data);
break; break;
case SBE_IOC_CHAN_SET: case SBE_IOC_CHAN_SET:
//pr_info(">> SBE_IOC_CHAN_SET Ioctl...\n"); //pr_info(">> SBE_IOC_CHAN_SET Ioctl...\n");
ret = do_set_chan (ndev, data); ret = do_set_chan(ndev, data);
break; break;
case C4_DEL_CHAN: case C4_DEL_CHAN:
//pr_info(">> C4_DEL_CHAN Ioctl...\n"); //pr_info(">> C4_DEL_CHAN Ioctl...\n");
ret = do_del_chan (ndev, data); ret = do_del_chan(ndev, data);
break; break;
case SBE_IOC_CHAN_NEW: case SBE_IOC_CHAN_NEW:
ret = do_create_chan (ndev, data); ret = do_create_chan(ndev, data);
break; break;
case SBE_IOC_CHAN_GET_STAT: case SBE_IOC_CHAN_GET_STAT:
ret = do_get_chan_stats (ndev, data); ret = do_get_chan_stats(ndev, data);
break; break;
case SBE_IOC_LOGLEVEL: case SBE_IOC_LOGLEVEL:
ret = do_set_loglevel (ndev, data); ret = do_set_loglevel(ndev, data);
break; break;
case SBE_IOC_RESET_DEV: case SBE_IOC_RESET_DEV:
ret = do_reset (ndev, data); ret = do_reset(ndev, data);
break; break;
case SBE_IOC_CHAN_DEL_STAT: case SBE_IOC_CHAN_DEL_STAT:
ret = do_reset_chan_stats (ndev, data); ret = do_reset_chan_stats(ndev, data);
break; break;
case C4_LOOP_PORT: case C4_LOOP_PORT:
ret = do_port_loop (ndev, data); ret = do_port_loop(ndev, data);
break; break;
case C4_RW_FRMR: case C4_RW_FRMR:
ret = do_framer_rw (ndev, data); ret = do_framer_rw(ndev, data);
break; break;
case C4_RW_MSYC: case C4_RW_MSYC:
ret = do_musycc_rw (ndev, data); ret = do_musycc_rw(ndev, data);
break; break;
case C4_RW_PLD: case C4_RW_PLD:
ret = do_pld_rw (ndev, data); ret = do_pld_rw(ndev, data);
break; break;
case SBE_IOC_IID_GET: case SBE_IOC_IID_GET:
ret = (iolen == sizeof (struct sbe_iid_info)) ? c4_get_iidinfo (ci, &arg.u.iip) : -EFAULT; ret = (iolen == sizeof(struct sbe_iid_info)) ? c4_get_iidinfo(ci, &arg.u.iip) : -EFAULT;
if (ret == 0) /* no error, copy data */ if (ret == 0) /* no error, copy data */
if (copy_to_user (data, &arg, iolen)) if (copy_to_user(data, &arg, iolen))
return -EFAULT; return -EFAULT;
break; break;
default: default:
...@@ -931,7 +931,7 @@ c4_ioctl (struct net_device *ndev, struct ifreq *ifr, int cmd) ...@@ -931,7 +931,7 @@ c4_ioctl (struct net_device *ndev, struct ifreq *ifr, int cmd)
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
return mkret (ret); return mkret(ret);
} }
static const struct net_device_ops c4_ops = { static const struct net_device_ops c4_ops = {
...@@ -947,7 +947,7 @@ static void c4_setup(struct net_device *dev) ...@@ -947,7 +947,7 @@ static void c4_setup(struct net_device *dev)
} }
struct net_device *__init struct net_device *__init
c4_add_dev (hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1,
int irq0, int irq1) int irq0, int irq1)
{ {
struct net_device *ndev; struct net_device *ndev;
...@@ -972,28 +972,28 @@ c4_add_dev (hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, ...@@ -972,28 +972,28 @@ c4_add_dev (hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1,
if (!CI) if (!CI)
CI = ci; /* DEBUG, only board 0 usage */ CI = ci; /* DEBUG, only board 0 usage */
strcpy (ci->devname, hi->devname); strcpy(ci->devname, hi->devname);
ci->release = &pmcc4_OSSI_release[0]; ci->release = &pmcc4_OSSI_release[0];
/* tasklet */ /* tasklet */
#if defined(SBE_ISR_TASKLET) #if defined(SBE_ISR_TASKLET)
tasklet_init (&ci->ci_musycc_isr_tasklet, tasklet_init(&ci->ci_musycc_isr_tasklet,
(void (*) (unsigned long)) musycc_intr_bh_tasklet, (void (*) (unsigned long)) musycc_intr_bh_tasklet,
(unsigned long) ci); (unsigned long) ci);
if (atomic_read (&ci->ci_musycc_isr_tasklet.count) == 0) if (atomic_read(&ci->ci_musycc_isr_tasklet.count) == 0)
tasklet_disable_nosync (&ci->ci_musycc_isr_tasklet); tasklet_disable_nosync(&ci->ci_musycc_isr_tasklet);
#elif defined(SBE_ISR_IMMEDIATE) #elif defined(SBE_ISR_IMMEDIATE)
ci->ci_musycc_isr_tq.routine = (void *) (unsigned long) musycc_intr_bh_tasklet; ci->ci_musycc_isr_tq.routine = (void *)(unsigned long)musycc_intr_bh_tasklet;
ci->ci_musycc_isr_tq.data = ci; ci->ci_musycc_isr_tq.data = ci;
#endif #endif
if (register_netdev (ndev) || if (register_netdev(ndev) ||
(c4_init (ci, (u_char *) f0, (u_char *) f1) != SBE_DRVR_SUCCESS)) (c4_init(ci, (u_char *) f0, (u_char *) f1) != SBE_DRVR_SUCCESS))
{ {
OS_kfree (netdev_priv(ndev)); OS_kfree(netdev_priv(ndev));
OS_kfree (ndev); OS_kfree(ndev);
error_flag = ENODEV; error_flag = ENODEV;
return NULL; return NULL;
} }
...@@ -1012,25 +1012,25 @@ c4_add_dev (hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, ...@@ -1012,25 +1012,25 @@ c4_add_dev (hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1,
* extern void free_irq(unsigned int irq, void *dev_id); * extern void free_irq(unsigned int irq, void *dev_id);
**************************************************************/ **************************************************************/
if (request_irq (irq0, &c4_linux_interrupt, if (request_irq(irq0, &c4_linux_interrupt,
IRQF_SHARED, IRQF_SHARED,
ndev->name, ndev)) ndev->name, ndev))
{ {
pr_warning("%s: MUSYCC could not get irq: %d\n", ndev->name, irq0); pr_warning("%s: MUSYCC could not get irq: %d\n", ndev->name, irq0);
unregister_netdev (ndev); unregister_netdev(ndev);
OS_kfree (netdev_priv(ndev)); OS_kfree(netdev_priv(ndev));
OS_kfree (ndev); OS_kfree(ndev);
error_flag = EIO; error_flag = EIO;
return NULL; return NULL;
} }
#ifdef CONFIG_SBE_PMCC4_NCOMM #ifdef CONFIG_SBE_PMCC4_NCOMM
if (request_irq (irq1, &c4_ebus_interrupt, IRQF_SHARED, ndev->name, ndev)) if (request_irq(irq1, &c4_ebus_interrupt, IRQF_SHARED, ndev->name, ndev))
{ {
pr_warning("%s: EBUS could not get irq: %d\n", hi->devname, irq1); pr_warning("%s: EBUS could not get irq: %d\n", hi->devname, irq1);
unregister_netdev (ndev); unregister_netdev(ndev);
free_irq (irq0, ndev); free_irq(irq0, ndev);
OS_kfree (netdev_priv(ndev)); OS_kfree(netdev_priv(ndev));
OS_kfree (ndev); OS_kfree(ndev);
error_flag = EIO; error_flag = EIO;
return NULL; return NULL;
} }
...@@ -1041,67 +1041,67 @@ c4_add_dev (hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, ...@@ -1041,67 +1041,67 @@ c4_add_dev (hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1,
{ {
u_int32_t tmp; u_int32_t tmp;
hdw_sn_get (hi, brdno); /* also sets PROM format type (promfmt) hdw_sn_get(hi, brdno); /* also sets PROM format type (promfmt)
* for later usage */ * for later usage */
switch (hi->promfmt) switch (hi->promfmt)
{ {
case PROM_FORMAT_TYPE1: case PROM_FORMAT_TYPE1:
memcpy (ndev->dev_addr, (FLD_TYPE1 *) (hi->mfg_info.pft1.Serial), 6); memcpy(ndev->dev_addr, (FLD_TYPE1 *) (hi->mfg_info.pft1.Serial), 6);
memcpy (&tmp, (FLD_TYPE1 *) (hi->mfg_info.pft1.Id), 4); /* unaligned data memcpy(&tmp, (FLD_TYPE1 *) (hi->mfg_info.pft1.Id), 4); /* unaligned data
* acquisition */ * acquisition */
ci->brd_id = cpu_to_be32 (tmp); ci->brd_id = cpu_to_be32(tmp);
break; break;
case PROM_FORMAT_TYPE2: case PROM_FORMAT_TYPE2:
memcpy (ndev->dev_addr, (FLD_TYPE2 *) (hi->mfg_info.pft2.Serial), 6); memcpy(ndev->dev_addr, (FLD_TYPE2 *) (hi->mfg_info.pft2.Serial), 6);
memcpy (&tmp, (FLD_TYPE2 *) (hi->mfg_info.pft2.Id), 4); /* unaligned data memcpy(&tmp, (FLD_TYPE2 *) (hi->mfg_info.pft2.Id), 4); /* unaligned data
* acquisition */ * acquisition */
ci->brd_id = cpu_to_be32 (tmp); ci->brd_id = cpu_to_be32(tmp);
break; break;
default: default:
ci->brd_id = 0; ci->brd_id = 0;
memset (ndev->dev_addr, 0, 6); memset(ndev->dev_addr, 0, 6);
break; break;
} }
#if 1 #if 1
sbeid_set_hdwbid (ci); /* requires bid to be preset */ sbeid_set_hdwbid(ci); /* requires bid to be preset */
#else #else
sbeid_set_bdtype (ci); /* requires hdw_bid to be preset */ sbeid_set_bdtype(ci); /* requires hdw_bid to be preset */
#endif #endif
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
sbecom_proc_brd_init (ci); sbecom_proc_brd_init(ci);
#endif #endif
#if defined(SBE_ISR_TASKLET) #if defined(SBE_ISR_TASKLET)
tasklet_enable (&ci->ci_musycc_isr_tasklet); tasklet_enable(&ci->ci_musycc_isr_tasklet);
#endif #endif
if ((error_flag = c4_init2 (ci)) != SBE_DRVR_SUCCESS) if ((error_flag = c4_init2(ci)) != SBE_DRVR_SUCCESS)
{ {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
sbecom_proc_brd_cleanup (ci); sbecom_proc_brd_cleanup(ci);
#endif #endif
unregister_netdev (ndev); unregister_netdev(ndev);
free_irq (irq1, ndev); free_irq(irq1, ndev);
free_irq (irq0, ndev); free_irq(irq0, ndev);
OS_kfree (netdev_priv(ndev)); OS_kfree(netdev_priv(ndev));
OS_kfree (ndev); OS_kfree(ndev);
return NULL; /* failure, error_flag is set */ return NULL; /* failure, error_flag is set */
} }
return ndev; return ndev;
} }
static int __init static int __init
c4_mod_init (void) c4_mod_init(void)
{ {
int rtn; int rtn;
pr_warning("%s\n", pmcc4_OSSI_release); pr_warning("%s\n", pmcc4_OSSI_release);
if ((rtn = c4hw_attach_all ())) if ((rtn = c4hw_attach_all()))
return -rtn; /* installation failure - see system log */ return -rtn; /* installation failure - see system log */
/* housekeeping notifications */ /* housekeeping notifications */
...@@ -1138,7 +1138,7 @@ c4_mod_init (void) ...@@ -1138,7 +1138,7 @@ c4_mod_init (void)
*/ */
static void __exit static void __exit
cleanup_hdlc (void) cleanup_hdlc(void)
{ {
hdw_info_t *hi; hdw_info_t *hi;
ci_t *ci; ci_t *ci;
...@@ -1154,7 +1154,7 @@ cleanup_hdlc (void) ...@@ -1154,7 +1154,7 @@ cleanup_hdlc (void)
for (k = 0; k < MUSYCC_NCHANS; k++) for (k = 0; k < MUSYCC_NCHANS; k++)
if ((ndev = ci->port[j].chan[k]->user)) if ((ndev = ci->port[j].chan[k]->user))
{ {
do_deluser (ndev, 0); do_deluser(ndev, 0);
} }
} }
} }
...@@ -1162,7 +1162,7 @@ cleanup_hdlc (void) ...@@ -1162,7 +1162,7 @@ cleanup_hdlc (void)
static void __exit static void __exit
c4_mod_remove (void) c4_mod_remove(void)
{ {
cleanup_hdlc(); /* delete any missed channels */ cleanup_hdlc(); /* delete any missed channels */
cleanup_devs(); cleanup_devs();
...@@ -1171,13 +1171,13 @@ c4_mod_remove (void) ...@@ -1171,13 +1171,13 @@ c4_mod_remove (void)
pr_info("SBE - driver removed.\n"); pr_info("SBE - driver removed.\n");
} }
module_init (c4_mod_init); module_init(c4_mod_init);
module_exit (c4_mod_remove); module_exit(c4_mod_remove);
MODULE_AUTHOR ("SBE Technical Services <support@sbei.com>"); MODULE_AUTHOR("SBE Technical Services <support@sbei.com>");
MODULE_DESCRIPTION ("wanPCI-CxT1E1 Generic HDLC WAN Driver module"); MODULE_DESCRIPTION("wanPCI-CxT1E1 Generic HDLC WAN Driver module");
#ifdef MODULE_LICENSE #ifdef MODULE_LICENSE
MODULE_LICENSE ("GPL"); MODULE_LICENSE("GPL");
#endif #endif
/*** End-of-File ***/ /*** End-of-File ***/
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