* is already swapping a shared buffer won't make things any worse.
*/
static char *stli_tmpwritebuf;
+static DECLARE_MUTEX(stli_tmpwritesem);
#define STLI_TXBUFSIZE 4096
MODULE_LICENSE("GPL");
-module_param_array(board0, charp, NULL, 0);
+MODULE_PARM(board0, "1-3s");
MODULE_PARM_DESC(board0, "Board 0 config -> name[,ioaddr[,memaddr]");
-module_param_array(board1, charp, NULL, 0);
+MODULE_PARM(board1, "1-3s");
MODULE_PARM_DESC(board1, "Board 1 config -> name[,ioaddr[,memaddr]");
-module_param_array(board2, charp, NULL, 0);
+MODULE_PARM(board2, "1-3s");
MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,memaddr]");
-module_param_array(board3, charp, NULL, 0);
+MODULE_PARM(board3, "1-3s");
MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]");
#endif
static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp);
static int stli_getportstruct(stliport_t __user *arg);
static int stli_getbrdstruct(stlibrd_t __user *arg);
+static void *stli_memalloc(int len);
static stlibrd_t *stli_allocbrd(void);
static void stli_ecpinit(stlibrd_t *brdp);
/*****************************************************************************/
+/*
+ * Local driver kernel malloc routine.
+ */
+
+static void *stli_memalloc(int len)
+{
+ return((void *) kmalloc(len, GFP_KERNEL));
+}
+
+/*****************************************************************************/
+
static int stli_open(struct tty_struct *tty, struct file *filp)
{
stlibrd_t *brdp;
#endif
for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) {
- portp = kzalloc(sizeof(stliport_t), GFP_KERNEL);
- if (!portp) {
+ portp = (stliport_t *) stli_memalloc(sizeof(stliport_t));
+ if (portp == (stliport_t *) NULL) {
printk("STALLION: failed to allocate port structure\n");
continue;
}
+ memset(portp, 0, sizeof(stliport_t));
portp->magic = STLI_PORTMAGIC;
portp->portnr = i;
portp->brdnr = brdp->brdnr;
{
stlibrd_t *brdp;
- brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL);
- if (!brdp) {
+ brdp = (stlibrd_t *) stli_memalloc(sizeof(stlibrd_t));
+ if (brdp == (stlibrd_t *) NULL) {
printk(KERN_ERR "STALLION: failed to allocate memory "
"(size=%d)\n", sizeof(stlibrd_t));
- return NULL;
+ return((stlibrd_t *) NULL);
}
+ memset(brdp, 0, sizeof(stlibrd_t));
brdp->magic = STLI_BOARDMAGIC;
return(brdp);
}
/*
* Allocate a temporary write buffer.
*/
- stli_tmpwritebuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL);
- if (!stli_tmpwritebuf)
+ stli_tmpwritebuf = (char *) stli_memalloc(STLI_TXBUFSIZE);
+ if (stli_tmpwritebuf == (char *) NULL)
printk(KERN_ERR "STALLION: failed to allocate memory "
"(size=%d)\n", STLI_TXBUFSIZE);
- stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL);
- if (!stli_txcookbuf)
+ stli_txcookbuf = stli_memalloc(STLI_TXBUFSIZE);
+ if (stli_txcookbuf == (char *) NULL)
printk(KERN_ERR "STALLION: failed to allocate memory "
"(size=%d)\n", STLI_TXBUFSIZE);