summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@conectiva.com.br>2003-05-15 14:54:47 -0300
committerArnaldo Carvalho de Melo <acme@conectiva.com.br>2003-05-15 14:54:47 -0300
commit652fb4118862e26bb820ddd08de8fcf7fd2a974f (patch)
tree50687472380bab9b3a6765841fd81358f1c559dd /drivers
parent41d0ff2ee195e5bce56d51efa50a82c6f491eace (diff)
o wan/cycx: typedef cleanup
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wan/cycx_drv.c20
-rw-r--r--drivers/net/wan/cycx_main.c22
-rw-r--r--drivers/net/wan/cycx_x25.c92
3 files changed, 69 insertions, 65 deletions
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
index e0d39d202b53..e10f8a3ee046 100644
--- a/drivers/net/wan/cycx_drv.c
+++ b/drivers/net/wan/cycx_drv.c
@@ -73,7 +73,7 @@ int init_module(void);
void cleanup_module(void);
/* Hardware-specific functions */
-static int load_cyc2x(cycxhw_t *hw, cfm_t *cfm, u32 len);
+static int load_cyc2x(cycxhw_t *hw, struct cycx_firmware *cfm, u32 len);
static void cycx_bootcfg(cycxhw_t *hw);
static int reset_cyc2x(u32 addr);
@@ -398,10 +398,10 @@ static int cycx_code_boot(u32 addr, u8 *code, u32 len)
/* Load adapter from the memory image of the CYCX firmware module.
* o verify firmware integrity and compatibility
* o start adapter up */
-static int load_cyc2x(cycxhw_t *hw, cfm_t *cfm, u32 len)
+static int load_cyc2x(cycxhw_t *hw, struct cycx_firmware *cfm, u32 len)
{
int i, j;
- cycx_header_t *img_hdr;
+ struct cycx_fw_header *img_hdr;
u8 *reset_image,
*data_image,
*code_image;
@@ -430,17 +430,18 @@ static int load_cyc2x(cycxhw_t *hw, cfm_t *cfm, u32 len)
}
/* Verify firmware module length and checksum */
- cksum = checksum((u8*)&cfm->info, sizeof(cfm_info_t) +
- cfm->info.codesize);
+ cksum = checksum((u8*)&cfm->info, sizeof(struct cycx_fw_info) +
+ cfm->info.codesize);
/*
FIXME cfm->info.codesize is off by 2
- if (((len - sizeof(cfm_t) - 1) != cfm->info.codesize) ||
+ if (((len - sizeof(struct cycx_firmware) - 1) != cfm->info.codesize) ||
*/
if (cksum != cfm->checksum) {
printk(KERN_ERR "%s:%s: firmware corrupted!\n",
modname, __FUNCTION__);
printk(KERN_ERR " cdsize = 0x%x (expected 0x%lx)\n",
- len - sizeof(cfm_t) - 1, cfm->info.codesize);
+ len - sizeof(struct cycx_firmware) - 1,
+ cfm->info.codesize);
printk(KERN_ERR " chksum = 0x%x (expected 0x%x)\n",
cksum, cfm->checksum);
return -EINVAL;
@@ -448,14 +449,15 @@ static int load_cyc2x(cycxhw_t *hw, cfm_t *cfm, u32 len)
/* If everything is ok, set reset, data and code pointers */
- img_hdr = (cycx_header_t*)(((u8*)cfm) + sizeof(cfm_t) - 1);
+ img_hdr = (struct cycx_fw_header *)(((u8 *)cfm) +
+ sizeof(struct cycx_firmware) - 1);
#ifdef FIRMWARE_DEBUG
printk(KERN_INFO "%s:%s: image sizes\n", __FUNCTION__, modname);
printk(KERN_INFO " reset=%lu\n", img_hdr->reset_size);
printk(KERN_INFO " data=%lu\n", img_hdr->data_size);
printk(KERN_INFO " code=%lu\n", img_hdr->code_size);
#endif
- reset_image = ((u8 *)img_hdr) + sizeof(cycx_header_t);
+ reset_image = ((u8 *)img_hdr) + sizeof(struct cycx_fw_header);
data_image = reset_image + img_hdr->reset_size;
code_image = data_image + img_hdr->data_size;
diff --git a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c
index 61f31efaef1c..b945dccb1578 100644
--- a/drivers/net/wan/cycx_main.c
+++ b/drivers/net/wan/cycx_main.c
@@ -87,7 +87,7 @@ static char fullname[] = "CYCLOM 2X(tm) Sync Card Driver";
static char copyright[] = "(c) 1998-2001 Arnaldo Carvalho de Melo "
"<acme@conectiva.com.br>";
static int ncards = CONFIG_CYCLOMX_CARDS;
-static cycx_t *card_array; /* adapter data space */
+static struct cycx_device *card_array; /* adapter data space */
/* Kernel Loadable Module Entry Points */
@@ -113,15 +113,15 @@ int __init cyclomx_init (void)
/* Verify number of cards and allocate adapter data space */
ncards = min_t(int, ncards, MAX_CARDS);
ncards = max_t(int, ncards, 1);
- card_array = kmalloc(sizeof(cycx_t) * ncards, GFP_KERNEL);
+ card_array = kmalloc(sizeof(struct cycx_device) * ncards, GFP_KERNEL);
if (!card_array)
goto out;
- memset(card_array, 0, sizeof(cycx_t) * ncards);
+ memset(card_array, 0, sizeof(struct cycx_device) * ncards);
/* Register adapters with WAN router */
for (cnt = 0; cnt < ncards; ++cnt) {
- cycx_t *card = &card_array[cnt];
+ struct cycx_device *card = &card_array[cnt];
struct wan_device *wandev = &card->wandev;
sprintf(card->devname, "%s%d", drvname, cnt + 1);
@@ -161,7 +161,7 @@ static void __exit cyclomx_cleanup (void)
int i = 0;
for (; i < ncards; ++i) {
- cycx_t *card = &card_array[i];
+ struct cycx_device *card = &card_array[i];
unregister_wan_device(card->devname);
}
@@ -184,7 +184,7 @@ static void __exit cyclomx_cleanup (void)
static int setup(struct wan_device *wandev, wandev_conf_t *conf)
{
int err = -EFAULT;
- cycx_t *card;
+ struct cycx_device *card;
int irq;
/* Sanity checks */
@@ -276,7 +276,7 @@ out_irq:
static int shutdown(struct wan_device *wandev)
{
int ret = -EFAULT;
- cycx_t *card;
+ struct cycx_device *card;
/* sanity checks */
if (!wandev || !wandev->private)
@@ -318,7 +318,7 @@ static int ioctl(struct wan_device *wandev, unsigned cmd, unsigned long arg)
*/
static irqreturn_t cycx_isr (int irq, void *dev_id, struct pt_regs *regs)
{
- cycx_t *card = (cycx_t *)dev_id;
+ struct cycx_device *card = (struct cycx_device *)dev_id;
if (!card || card->wandev.state == WAN_UNCONFIGURED)
goto out;
@@ -341,7 +341,7 @@ out: return IRQ_NONE;
* have to call MOD_INC_USE_COUNT, but cannot include 'module.h' where it's
* defined more than once into the same kernel module.
*/
-void cyclomx_mod_inc_use_count (cycx_t *card)
+void cyclomx_mod_inc_use_count(struct cycx_device *card)
{
++card->open_cnt;
MOD_INC_USE_COUNT;
@@ -353,14 +353,14 @@ void cyclomx_mod_inc_use_count (cycx_t *card)
* have to call MOD_DEC_USE_COUNT, but cannot include 'module.h' where it's
* defined more than once into the same kernel module.
*/
-void cyclomx_mod_dec_use_count (cycx_t *card)
+void cyclomx_mod_dec_use_count(struct cycx_device *card)
{
--card->open_cnt;
MOD_DEC_USE_COUNT;
}
/* Set WAN device state. */
-void cyclomx_set_state (cycx_t *card, int state)
+void cyclomx_set_state(struct cycx_device *card, int state)
{
unsigned long flags;
char *string_state = NULL;
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c
index 8a2a802e3ff7..090c417c0f7f 100644
--- a/drivers/net/wan/cycx_x25.c
+++ b/drivers/net/wan/cycx_x25.c
@@ -114,7 +114,7 @@ typedef struct x25_channel {
u8 drop_sequence; /* mark sequence for dropping */
u32 idle_tmout; /* sec, before disconnecting */
struct sk_buff *rx_skb; /* receive socket buffer */
- cycx_t *card; /* -> owner */
+ struct cycx_device *card; /* -> owner */
struct net_device_stats ifstats;/* interface statistics */
} x25_channel_t;
@@ -137,24 +137,24 @@ static int if_init (struct net_device *dev),
static struct net_device_stats * if_stats (struct net_device *dev);
/* Interrupt handlers */
-static void cyx_isr (cycx_t *card),
- tx_intr (cycx_t *card, TX25Cmd *cmd),
- rx_intr (cycx_t *card, TX25Cmd *cmd),
- log_intr (cycx_t *card, TX25Cmd *cmd),
- stat_intr (cycx_t *card, TX25Cmd *cmd),
- connect_confirm_intr (cycx_t *card, TX25Cmd *cmd),
- disconnect_confirm_intr (cycx_t *card, TX25Cmd *cmd),
- connect_intr (cycx_t *card, TX25Cmd *cmd),
- disconnect_intr (cycx_t *card, TX25Cmd *cmd),
- spur_intr (cycx_t *card, TX25Cmd *cmd);
+static void cyx_isr(struct cycx_device *card),
+ tx_intr(struct cycx_device *card, TX25Cmd *cmd),
+ rx_intr(struct cycx_device *card, TX25Cmd *cmd),
+ log_intr(struct cycx_device *card, TX25Cmd *cmd),
+ stat_intr(struct cycx_device *card, TX25Cmd *cmd),
+ connect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd),
+ disconnect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd),
+ connect_intr(struct cycx_device *card, TX25Cmd *cmd),
+ disconnect_intr(struct cycx_device *card, TX25Cmd *cmd),
+ spur_intr(struct cycx_device *card, TX25Cmd *cmd);
/* X.25 firmware interface functions */
-static int x25_configure (cycx_t *card, TX25Config *conf),
- x25_get_stats (cycx_t *card),
- x25_send (cycx_t *card, u8 link, u8 lcn, u8 bitm, int len,
- void *buf),
- x25_connect_response (cycx_t *card, x25_channel_t *chan),
- x25_disconnect_response (cycx_t *card, u8 link, u8 lcn);
+static int x25_configure(struct cycx_device *card, TX25Config *conf),
+ x25_get_stats(struct cycx_device *card),
+ x25_send(struct cycx_device *card, u8 link, u8 lcn, u8 bitm, int len,
+ void *buf),
+ x25_connect_response(struct cycx_device *card, x25_channel_t *chan),
+ x25_disconnect_response(struct cycx_device *card, u8 link, u8 lcn);
/* channel functions */
static int chan_connect (struct net_device *dev),
@@ -201,7 +201,7 @@ static void x25_dump_devs(struct wan_device *wandev);
*
* Return: 0 o.k.
* < 0 failure. */
-int cyx_init (cycx_t *card, wandev_conf_t *conf)
+int cyx_init(struct cycx_device *card, wandev_conf_t *conf)
{
TX25Config cfg;
@@ -346,7 +346,7 @@ static int update(struct wan_device *wandev)
static int new_if(struct wan_device *wandev, struct net_device *dev,
wanif_conf_t *conf)
{
- cycx_t *card = wandev->private;
+ struct cycx_device *card = wandev->private;
x25_channel_t *chan;
int err = 0;
@@ -461,7 +461,7 @@ static int del_if(struct wan_device *wandev, struct net_device *dev)
static int if_init (struct net_device *dev)
{
x25_channel_t *chan = dev->priv;
- cycx_t *card = chan->card;
+ struct cycx_device *card = chan->card;
struct wan_device *wandev = &card->wandev;
/* Initialize device driver entry points */
@@ -506,7 +506,7 @@ static int if_init (struct net_device *dev)
static int if_open (struct net_device *dev)
{
x25_channel_t *chan = dev->priv;
- cycx_t *card = chan->card;
+ struct cycx_device *card = chan->card;
if (netif_running(dev))
return -EBUSY; /* only one open is allowed */
@@ -523,7 +523,7 @@ static int if_open (struct net_device *dev)
static int if_close (struct net_device *dev)
{
x25_channel_t *chan = dev->priv;
- cycx_t *card = chan->card;
+ struct cycx_device *card = chan->card;
netif_stop_queue(dev);
@@ -577,7 +577,7 @@ static int if_rebuild_hdr (struct sk_buff *skb)
static int if_send (struct sk_buff *skb, struct net_device *dev)
{
x25_channel_t *chan = dev->priv;
- cycx_t *card = chan->card;
+ struct cycx_device *card = chan->card;
if (!chan->svc)
chan->protocol = skb->protocol;
@@ -657,7 +657,7 @@ static struct net_device_stats *if_stats (struct net_device *dev)
/* Interrupt Handlers */
/* X.25 Interrupt Service Routine. */
-static void cyx_isr (cycx_t *card)
+static void cyx_isr(struct cycx_device *card)
{
TX25Cmd cmd;
u16 z = 0;
@@ -709,7 +709,7 @@ static void cyx_isr (cycx_t *card)
/* Transmit interrupt handler.
* o Release socket buffer
* o Clear 'tbusy' flag */
-static void tx_intr (cycx_t *card, TX25Cmd *cmd)
+static void tx_intr(struct cycx_device *card, TX25Cmd *cmd)
{
struct net_device *dev;
struct wan_device *wandev = &card->wandev;
@@ -740,7 +740,7 @@ static void tx_intr (cycx_t *card, TX25Cmd *cmd)
* expected on this channel.
* 2. If something goes wrong and X.25 packet has to be dropped (e.g. no
* socket buffers available) the whole packet sequence must be discarded. */
-static void rx_intr (cycx_t *card, TX25Cmd *cmd)
+static void rx_intr(struct cycx_device *card, TX25Cmd *cmd)
{
struct wan_device *wandev = &card->wandev;
struct net_device *dev;
@@ -824,7 +824,7 @@ static void rx_intr (cycx_t *card, TX25Cmd *cmd)
}
/* Connect interrupt handler. */
-static void connect_intr (cycx_t *card, TX25Cmd *cmd)
+static void connect_intr(struct cycx_device *card, TX25Cmd *cmd)
{
struct wan_device *wandev = &card->wandev;
struct net_device *dev = NULL;
@@ -866,7 +866,7 @@ static void connect_intr (cycx_t *card, TX25Cmd *cmd)
}
/* Connect confirm interrupt handler. */
-static void connect_confirm_intr (cycx_t *card, TX25Cmd *cmd)
+static void connect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd)
{
struct wan_device *wandev = &card->wandev;
struct net_device *dev;
@@ -893,7 +893,7 @@ static void connect_confirm_intr (cycx_t *card, TX25Cmd *cmd)
}
/* Disconnect confirm interrupt handler. */
-static void disconnect_confirm_intr (cycx_t *card, TX25Cmd *cmd)
+static void disconnect_confirm_intr(struct cycx_device *card, TX25Cmd *cmd)
{
struct wan_device *wandev = &card->wandev;
struct net_device *dev;
@@ -913,7 +913,7 @@ static void disconnect_confirm_intr (cycx_t *card, TX25Cmd *cmd)
}
/* disconnect interrupt handler. */
-static void disconnect_intr (cycx_t *card, TX25Cmd *cmd)
+static void disconnect_intr(struct cycx_device *card, TX25Cmd *cmd)
{
struct wan_device *wandev = &card->wandev;
struct net_device *dev;
@@ -932,7 +932,7 @@ static void disconnect_intr (cycx_t *card, TX25Cmd *cmd)
}
/* LOG interrupt handler. */
-static void log_intr (cycx_t *card, TX25Cmd *cmd)
+static void log_intr(struct cycx_device *card, TX25Cmd *cmd)
{
#if CYCLOMX_X25_DEBUG
char bf[20];
@@ -960,7 +960,7 @@ static void log_intr (cycx_t *card, TX25Cmd *cmd)
}
/* STATISTIC interrupt handler. */
-static void stat_intr (cycx_t *card, TX25Cmd *cmd)
+static void stat_intr(struct cycx_device *card, TX25Cmd *cmd)
{
cycx_peek(&card->hw, cmd->buf, &card->u.x.stats,
sizeof(card->u.x.stats));
@@ -973,7 +973,7 @@ static void stat_intr (cycx_t *card, TX25Cmd *cmd)
/* Spurious interrupt handler.
* o print a warning
* If number of spurious interrupts exceeded some limit, then ??? */
-static void spur_intr (cycx_t *card, TX25Cmd *cmd)
+static void spur_intr(struct cycx_device *card, TX25Cmd *cmd)
{
printk(KERN_INFO "%s: spurious interrupt (0x%X)!\n",
card->devname, cmd->command);
@@ -998,8 +998,8 @@ static void hex_dump(char *msg, unsigned char *p, int len)
/* Cyclom 2X Firmware-Specific Functions */
/* Exec X.25 command. */
-static int x25_exec (cycx_t *card, int command, int link,
- void *d1, int len1, void *d2, int len2)
+static int x25_exec(struct cycx_device *card, int command, int link,
+ void *d1, int len1, void *d2, int len2)
{
TX25Cmd c;
unsigned long flags;
@@ -1046,7 +1046,7 @@ static int x25_exec (cycx_t *card, int command, int link,
}
/* Configure adapter. */
-static int x25_configure (cycx_t *card, TX25Config *conf)
+static int x25_configure(struct cycx_device *card, TX25Config *conf)
{
struct {
u16 nlinks;
@@ -1075,7 +1075,7 @@ static int x25_configure (cycx_t *card, TX25Config *conf)
}
/* Get protocol statistics. */
-static int x25_get_stats (cycx_t *card)
+static int x25_get_stats(struct cycx_device *card)
{
/* the firmware expects 20 in the size field!!!
thanks to Daniela */
@@ -1156,7 +1156,7 @@ static void nibble_to_byte(u8 *s, u8 *d, u8 len, u8 nibble)
}
/* Place X.25 call. */
-static int x25_place_call (cycx_t *card, x25_channel_t *chan)
+static int x25_place_call(struct cycx_device *card, x25_channel_t *chan)
{
int err = 0,
len;
@@ -1202,7 +1202,7 @@ static int x25_place_call (cycx_t *card, x25_channel_t *chan)
}
/* Place X.25 CONNECT RESPONSE. */
-static int x25_connect_response (cycx_t *card, x25_channel_t *chan)
+static int x25_connect_response(struct cycx_device *card, x25_channel_t *chan)
{
u8 d[8];
@@ -1216,7 +1216,7 @@ static int x25_connect_response (cycx_t *card, x25_channel_t *chan)
}
/* Place X.25 DISCONNECT RESPONSE. */
-static int x25_disconnect_response (cycx_t *card, u8 link, u8 lcn)
+static int x25_disconnect_response(struct cycx_device *card, u8 link, u8 lcn)
{
char d[5];
@@ -1229,7 +1229,8 @@ static int x25_disconnect_response (cycx_t *card, u8 link, u8 lcn)
}
/* Clear X.25 call. */
-static int x25_clear_call (cycx_t *card, u8 link, u8 lcn, u8 cause, u8 diagn)
+static int x25_clear_call(struct cycx_device *card, u8 link, u8 lcn, u8 cause,
+ u8 diagn)
{
u8 d[7];
@@ -1244,7 +1245,8 @@ static int x25_clear_call (cycx_t *card, u8 link, u8 lcn, u8 cause, u8 diagn)
}
/* Send X.25 data packet. */
-static int x25_send (cycx_t *card, u8 link, u8 lcn, u8 bitm, int len, void *buf)
+static int x25_send(struct cycx_device *card, u8 link, u8 lcn, u8 bitm, int len,
+ void *buf)
{
u8 d[] = "?\xFF\x10??";
@@ -1298,7 +1300,7 @@ static struct net_device *get_dev_by_dte_addr(struct wan_device *wandev,
static int chan_connect (struct net_device *dev)
{
x25_channel_t *chan = dev->priv;
- cycx_t *card = chan->card;
+ struct cycx_device *card = chan->card;
if (chan->svc) {
if (!chan->addr[0])
@@ -1348,7 +1350,7 @@ static void chan_timer (unsigned long d)
static void set_chan_state (struct net_device *dev, u8 state)
{
x25_channel_t *chan = dev->priv;
- cycx_t *card = chan->card;
+ struct cycx_device *card = chan->card;
unsigned long flags;
char *string_state = NULL;
@@ -1417,7 +1419,7 @@ static void set_chan_state (struct net_device *dev, u8 state)
static int chan_send (struct net_device *dev, struct sk_buff *skb)
{
x25_channel_t *chan = dev->priv;
- cycx_t *card = chan->card;
+ struct cycx_device *card = chan->card;
int bitm = 0; /* final packet */
unsigned len = skb->len;