Commit 1328d737 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[PATCH] Char: istallion, variables cleanup

- wipe gcc -W warnings by int -> uint conversion
- move 2 global variables into their local place
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1f8ec435
...@@ -110,7 +110,7 @@ struct stlconf { ...@@ -110,7 +110,7 @@ struct stlconf {
int irqtype; int irqtype;
}; };
static int stli_nrbrds; static unsigned int stli_nrbrds;
/* stli_lock must NOT be taken holding brd_lock */ /* stli_lock must NOT be taken holding brd_lock */
static spinlock_t stli_lock; /* TTY logic lock */ static spinlock_t stli_lock; /* TTY logic lock */
...@@ -186,8 +186,6 @@ static struct ktermios stli_deftermios = { ...@@ -186,8 +186,6 @@ static struct ktermios stli_deftermios = {
static comstats_t stli_comstats; static comstats_t stli_comstats;
static combrd_t stli_brdstats; static combrd_t stli_brdstats;
static struct asystats stli_cdkstats; static struct asystats stli_cdkstats;
static struct stlibrd stli_dummybrd;
static struct stliport stli_dummyport;
/*****************************************************************************/ /*****************************************************************************/
...@@ -682,7 +680,7 @@ static void stli_stalinit(struct stlibrd *brdp); ...@@ -682,7 +680,7 @@ static void stli_stalinit(struct stlibrd *brdp);
static void __iomem *stli_stalgetmemptr(struct stlibrd *brdp, unsigned long offset, int line); static void __iomem *stli_stalgetmemptr(struct stlibrd *brdp, unsigned long offset, int line);
static void stli_stalreset(struct stlibrd *brdp); static void stli_stalreset(struct stlibrd *brdp);
static struct stliport *stli_getport(int brdnr, int panelnr, int portnr); static struct stliport *stli_getport(unsigned int brdnr, unsigned int panelnr, unsigned int portnr);
static int stli_initecp(struct stlibrd *brdp); static int stli_initecp(struct stlibrd *brdp);
static int stli_initonb(struct stlibrd *brdp); static int stli_initonb(struct stlibrd *brdp);
...@@ -755,6 +753,7 @@ static int __init istallion_module_init(void) ...@@ -755,6 +753,7 @@ static int __init istallion_module_init(void)
static void __exit istallion_module_exit(void) static void __exit istallion_module_exit(void)
{ {
struct stlibrd *brdp; struct stlibrd *brdp;
unsigned int j;
int i; int i;
printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle,
...@@ -777,8 +776,8 @@ static void __exit istallion_module_exit(void) ...@@ -777,8 +776,8 @@ static void __exit istallion_module_exit(void)
return; return;
} }
put_tty_driver(stli_serial); put_tty_driver(stli_serial);
for (i = 0; i < 4; i++) for (j = 0; j < 4; j++)
class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i)); class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, j));
class_destroy(istallion_class); class_destroy(istallion_class);
if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
printk("STALLION: failed to un-register serial memory device, " printk("STALLION: failed to un-register serial memory device, "
...@@ -786,8 +785,8 @@ static void __exit istallion_module_exit(void) ...@@ -786,8 +785,8 @@ static void __exit istallion_module_exit(void)
kfree(stli_txcookbuf); kfree(stli_txcookbuf);
for (i = 0; (i < stli_nrbrds); i++) { for (j = 0; (j < stli_nrbrds); j++) {
if ((brdp = stli_brds[i]) == NULL) if ((brdp = stli_brds[j]) == NULL)
continue; continue;
stli_cleanup_ports(brdp); stli_cleanup_ports(brdp);
...@@ -796,7 +795,7 @@ static void __exit istallion_module_exit(void) ...@@ -796,7 +795,7 @@ static void __exit istallion_module_exit(void)
if (brdp->iosize > 0) if (brdp->iosize > 0)
release_region(brdp->iobase, brdp->iosize); release_region(brdp->iobase, brdp->iosize);
kfree(brdp); kfree(brdp);
stli_brds[i] = NULL; stli_brds[j] = NULL;
} }
} }
...@@ -811,8 +810,8 @@ module_exit(istallion_module_exit); ...@@ -811,8 +810,8 @@ module_exit(istallion_module_exit);
static int stli_parsebrd(struct stlconf *confp, char **argp) static int stli_parsebrd(struct stlconf *confp, char **argp)
{ {
unsigned int i;
char *sp; char *sp;
int i;
if (argp[0] == NULL || *argp[0] == 0) if (argp[0] == NULL || *argp[0] == 0)
return 0; return 0;
...@@ -843,8 +842,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp) ...@@ -843,8 +842,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
{ {
struct stlibrd *brdp; struct stlibrd *brdp;
struct stliport *portp; struct stliport *portp;
unsigned int minordev; unsigned int minordev, brdnr, portnr;
int brdnr, portnr, rc; int rc;
minordev = tty->index; minordev = tty->index;
brdnr = MINOR2BRD(minordev); brdnr = MINOR2BRD(minordev);
...@@ -856,7 +855,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) ...@@ -856,7 +855,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
if ((brdp->state & BST_STARTED) == 0) if ((brdp->state & BST_STARTED) == 0)
return -ENODEV; return -ENODEV;
portnr = MINOR2PORT(minordev); portnr = MINOR2PORT(minordev);
if ((portnr < 0) || (portnr > brdp->nrports)) if (portnr > brdp->nrports)
return -ENODEV; return -ENODEV;
portp = brdp->ports[portnr]; portp = brdp->ports[portnr];
...@@ -1232,7 +1231,7 @@ static int stli_setport(struct stliport *portp) ...@@ -1232,7 +1231,7 @@ static int stli_setport(struct stliport *portp)
return -ENODEV; return -ENODEV;
if (portp->tty == NULL) if (portp->tty == NULL)
return -ENODEV; return -ENODEV;
if (portp->brdnr < 0 && portp->brdnr >= stli_nrbrds) if (portp->brdnr >= stli_nrbrds)
return -ENODEV; return -ENODEV;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -1324,7 +1323,7 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun ...@@ -1324,7 +1323,7 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun
portp = tty->driver_data; portp = tty->driver_data;
if (portp == NULL) if (portp == NULL)
return 0; return 0;
if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) if (portp->brdnr >= stli_nrbrds)
return 0; return 0;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -1446,7 +1445,7 @@ static void stli_flushchars(struct tty_struct *tty) ...@@ -1446,7 +1445,7 @@ static void stli_flushchars(struct tty_struct *tty)
portp = tty->driver_data; portp = tty->driver_data;
if (portp == NULL) if (portp == NULL)
return; return;
if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) if (portp->brdnr >= stli_nrbrds)
return; return;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -1524,7 +1523,7 @@ static int stli_writeroom(struct tty_struct *tty) ...@@ -1524,7 +1523,7 @@ static int stli_writeroom(struct tty_struct *tty)
portp = tty->driver_data; portp = tty->driver_data;
if (portp == NULL) if (portp == NULL)
return 0; return 0;
if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) if (portp->brdnr >= stli_nrbrds)
return 0; return 0;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -1572,7 +1571,7 @@ static int stli_charsinbuffer(struct tty_struct *tty) ...@@ -1572,7 +1571,7 @@ static int stli_charsinbuffer(struct tty_struct *tty)
portp = tty->driver_data; portp = tty->driver_data;
if (portp == NULL) if (portp == NULL)
return 0; return 0;
if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) if (portp->brdnr >= stli_nrbrds)
return 0; return 0;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -1670,7 +1669,7 @@ static int stli_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -1670,7 +1669,7 @@ static int stli_tiocmget(struct tty_struct *tty, struct file *file)
if (portp == NULL) if (portp == NULL)
return -ENODEV; return -ENODEV;
if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) if (portp->brdnr >= stli_nrbrds)
return 0; return 0;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -1694,7 +1693,7 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -1694,7 +1693,7 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file,
if (portp == NULL) if (portp == NULL)
return -ENODEV; return -ENODEV;
if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) if (portp->brdnr >= stli_nrbrds)
return 0; return 0;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -1728,7 +1727,7 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm ...@@ -1728,7 +1727,7 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
portp = tty->driver_data; portp = tty->driver_data;
if (portp == NULL) if (portp == NULL)
return -ENODEV; return -ENODEV;
if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) if (portp->brdnr >= stli_nrbrds)
return 0; return 0;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -1806,7 +1805,7 @@ static void stli_settermios(struct tty_struct *tty, struct ktermios *old) ...@@ -1806,7 +1805,7 @@ static void stli_settermios(struct tty_struct *tty, struct ktermios *old)
portp = tty->driver_data; portp = tty->driver_data;
if (portp == NULL) if (portp == NULL)
return; return;
if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) if (portp->brdnr >= stli_nrbrds)
return; return;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -1921,7 +1920,7 @@ static void stli_hangup(struct tty_struct *tty) ...@@ -1921,7 +1920,7 @@ static void stli_hangup(struct tty_struct *tty)
portp = tty->driver_data; portp = tty->driver_data;
if (portp == NULL) if (portp == NULL)
return; return;
if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) if (portp->brdnr >= stli_nrbrds)
return; return;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -1974,7 +1973,7 @@ static void stli_flushbuffer(struct tty_struct *tty) ...@@ -1974,7 +1973,7 @@ static void stli_flushbuffer(struct tty_struct *tty)
portp = tty->driver_data; portp = tty->driver_data;
if (portp == NULL) if (portp == NULL)
return; return;
if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) if (portp->brdnr >= stli_nrbrds)
return; return;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -2011,7 +2010,7 @@ static void stli_breakctl(struct tty_struct *tty, int state) ...@@ -2011,7 +2010,7 @@ static void stli_breakctl(struct tty_struct *tty, int state)
portp = tty->driver_data; portp = tty->driver_data;
if (portp == NULL) if (portp == NULL)
return; return;
if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) if (portp->brdnr >= stli_nrbrds)
return; return;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -2058,7 +2057,7 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) ...@@ -2058,7 +2057,7 @@ static void stli_sendxchar(struct tty_struct *tty, char ch)
portp = tty->driver_data; portp = tty->driver_data;
if (portp == NULL) if (portp == NULL)
return; return;
if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) if (portp->brdnr >= stli_nrbrds)
return; return;
brdp = stli_brds[portp->brdnr]; brdp = stli_brds[portp->brdnr];
if (brdp == NULL) if (brdp == NULL)
...@@ -2151,7 +2150,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo ...@@ -2151,7 +2150,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo
{ {
struct stlibrd *brdp; struct stlibrd *brdp;
struct stliport *portp; struct stliport *portp;
int brdnr, portnr, totalport; unsigned int brdnr, portnr, totalport;
int curoff, maxoff; int curoff, maxoff;
char *pos; char *pos;
...@@ -2603,7 +2602,7 @@ static void stli_poll(unsigned long arg) ...@@ -2603,7 +2602,7 @@ static void stli_poll(unsigned long arg)
{ {
cdkhdr_t __iomem *hdrp; cdkhdr_t __iomem *hdrp;
struct stlibrd *brdp; struct stlibrd *brdp;
int brdnr; unsigned int brdnr;
stli_timerlist.expires = STLI_TIMEOUT; stli_timerlist.expires = STLI_TIMEOUT;
add_timer(&stli_timerlist); add_timer(&stli_timerlist);
...@@ -2787,7 +2786,7 @@ static long stli_mktiocm(unsigned long sigvalue) ...@@ -2787,7 +2786,7 @@ static long stli_mktiocm(unsigned long sigvalue)
static int stli_initports(struct stlibrd *brdp) static int stli_initports(struct stlibrd *brdp)
{ {
struct stliport *portp; struct stliport *portp;
int i, panelnr, panelport; unsigned int i, panelnr, panelport;
for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) {
portp = kzalloc(sizeof(struct stliport), GFP_KERNEL); portp = kzalloc(sizeof(struct stliport), GFP_KERNEL);
...@@ -3570,8 +3569,9 @@ static int stli_startbrd(struct stlibrd *brdp) ...@@ -3570,8 +3569,9 @@ static int stli_startbrd(struct stlibrd *brdp)
cdkmem_t __iomem *memp; cdkmem_t __iomem *memp;
cdkasy_t __iomem *ap; cdkasy_t __iomem *ap;
unsigned long flags; unsigned long flags;
unsigned int portnr, nrdevs, i;
struct stliport *portp; struct stliport *portp;
int portnr, nrdevs, i, rc = 0; int rc = 0;
u32 memoff; u32 memoff;
spin_lock_irqsave(&brd_lock, flags); spin_lock_irqsave(&brd_lock, flags);
...@@ -3807,7 +3807,7 @@ static int stli_eisamemprobe(struct stlibrd *brdp) ...@@ -3807,7 +3807,7 @@ static int stli_eisamemprobe(struct stlibrd *brdp)
static int stli_getbrdnr(void) static int stli_getbrdnr(void)
{ {
int i; unsigned int i;
for (i = 0; i < STL_MAXBRDS; i++) { for (i = 0; i < STL_MAXBRDS; i++) {
if (!stli_brds[i]) { if (!stli_brds[i]) {
...@@ -3834,8 +3834,8 @@ static int stli_getbrdnr(void) ...@@ -3834,8 +3834,8 @@ static int stli_getbrdnr(void)
static int stli_findeisabrds(void) static int stli_findeisabrds(void)
{ {
struct stlibrd *brdp; struct stlibrd *brdp;
unsigned int iobase, eid; unsigned int iobase, eid, i;
int i; int brdnr;
/* /*
* Firstly check if this is an EISA system. If this is not an EISA system then * Firstly check if this is an EISA system. If this is not an EISA system then
...@@ -3874,8 +3874,10 @@ static int stli_findeisabrds(void) ...@@ -3874,8 +3874,10 @@ static int stli_findeisabrds(void)
*/ */
if ((brdp = stli_allocbrd()) == NULL) if ((brdp = stli_allocbrd()) == NULL)
return -ENOMEM; return -ENOMEM;
if ((brdp->brdnr = stli_getbrdnr()) < 0) brdnr = stli_getbrdnr();
if (brdnr < 0)
return -ENOMEM; return -ENOMEM;
brdp->brdnr = (unsigned int)brdnr;
eid = inb(iobase + 0xc82); eid = inb(iobase + 0xc82);
if (eid == ECP_EISAID) if (eid == ECP_EISAID)
brdp->brdtype = BRD_ECPE; brdp->brdtype = BRD_ECPE;
...@@ -3911,7 +3913,7 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev, ...@@ -3911,7 +3913,7 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
struct stlibrd *brdp; struct stlibrd *brdp;
int retval = -EIO; int brdnr, retval = -EIO;
retval = pci_enable_device(pdev); retval = pci_enable_device(pdev);
if (retval) if (retval)
...@@ -3921,12 +3923,14 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev, ...@@ -3921,12 +3923,14 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev,
retval = -ENOMEM; retval = -ENOMEM;
goto err; goto err;
} }
if ((brdp->brdnr = stli_getbrdnr()) < 0) { /* TODO: locking */ brdnr = stli_getbrdnr();
if (brdnr < 0) { /* TODO: locking */
printk(KERN_INFO "STALLION: too many boards found, " printk(KERN_INFO "STALLION: too many boards found, "
"maximum supported %d\n", STL_MAXBRDS); "maximum supported %d\n", STL_MAXBRDS);
retval = -EIO; retval = -EIO;
goto err_fr; goto err_fr;
} }
brdp->brdnr = (unsigned int)brdnr;
brdp->brdtype = BRD_ECPPCI; brdp->brdtype = BRD_ECPPCI;
/* /*
* We have all resources from the board, so lets setup the actual * We have all resources from the board, so lets setup the actual
...@@ -3998,7 +4002,8 @@ static int stli_initbrds(void) ...@@ -3998,7 +4002,8 @@ static int stli_initbrds(void)
{ {
struct stlibrd *brdp, *nxtbrdp; struct stlibrd *brdp, *nxtbrdp;
struct stlconf conf; struct stlconf conf;
int i, j, retval; unsigned int i, j;
int retval;
for (stli_nrbrds = 0; stli_nrbrds < ARRAY_SIZE(stli_brdsp); for (stli_nrbrds = 0; stli_nrbrds < ARRAY_SIZE(stli_brdsp);
stli_nrbrds++) { stli_nrbrds++) {
...@@ -4074,7 +4079,8 @@ static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, lof ...@@ -4074,7 +4079,8 @@ static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, lof
unsigned long flags; unsigned long flags;
void __iomem *memptr; void __iomem *memptr;
struct stlibrd *brdp; struct stlibrd *brdp;
int brdnr, size, n; unsigned int brdnr;
int size, n;
void *p; void *p;
loff_t off = *offp; loff_t off = *offp;
...@@ -4138,7 +4144,8 @@ static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t cou ...@@ -4138,7 +4144,8 @@ static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t cou
void __iomem *memptr; void __iomem *memptr;
struct stlibrd *brdp; struct stlibrd *brdp;
char __user *chbuf; char __user *chbuf;
int brdnr, size, n; unsigned int brdnr;
int size, n;
void *p; void *p;
loff_t off = *offp; loff_t off = *offp;
...@@ -4198,7 +4205,7 @@ static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t cou ...@@ -4198,7 +4205,7 @@ static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t cou
static int stli_getbrdstats(combrd_t __user *bp) static int stli_getbrdstats(combrd_t __user *bp)
{ {
struct stlibrd *brdp; struct stlibrd *brdp;
int i; unsigned int i;
if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t))) if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t)))
return -EFAULT; return -EFAULT;
...@@ -4234,19 +4241,20 @@ static int stli_getbrdstats(combrd_t __user *bp) ...@@ -4234,19 +4241,20 @@ static int stli_getbrdstats(combrd_t __user *bp)
* Resolve the referenced port number into a port struct pointer. * Resolve the referenced port number into a port struct pointer.
*/ */
static struct stliport *stli_getport(int brdnr, int panelnr, int portnr) static struct stliport *stli_getport(unsigned int brdnr, unsigned int panelnr,
unsigned int portnr)
{ {
struct stlibrd *brdp; struct stlibrd *brdp;
int i; unsigned int i;
if (brdnr < 0 || brdnr >= STL_MAXBRDS) if (brdnr >= STL_MAXBRDS)
return NULL; return NULL;
brdp = stli_brds[brdnr]; brdp = stli_brds[brdnr];
if (brdp == NULL) if (brdp == NULL)
return NULL; return NULL;
for (i = 0; (i < panelnr); i++) for (i = 0; (i < panelnr); i++)
portnr += brdp->panels[i]; portnr += brdp->panels[i];
if ((portnr < 0) || (portnr >= brdp->nrports)) if (portnr >= brdp->nrports)
return NULL; return NULL;
return brdp->ports[portnr]; return brdp->ports[portnr];
} }
...@@ -4405,6 +4413,7 @@ static int stli_clrportstats(struct stliport *portp, comstats_t __user *cp) ...@@ -4405,6 +4413,7 @@ static int stli_clrportstats(struct stliport *portp, comstats_t __user *cp)
static int stli_getportstruct(struct stliport __user *arg) static int stli_getportstruct(struct stliport __user *arg)
{ {
struct stliport stli_dummyport;
struct stliport *portp; struct stliport *portp;
if (copy_from_user(&stli_dummyport, arg, sizeof(struct stliport))) if (copy_from_user(&stli_dummyport, arg, sizeof(struct stliport)))
...@@ -4426,11 +4435,12 @@ static int stli_getportstruct(struct stliport __user *arg) ...@@ -4426,11 +4435,12 @@ static int stli_getportstruct(struct stliport __user *arg)
static int stli_getbrdstruct(struct stlibrd __user *arg) static int stli_getbrdstruct(struct stlibrd __user *arg)
{ {
struct stlibrd stli_dummybrd;
struct stlibrd *brdp; struct stlibrd *brdp;
if (copy_from_user(&stli_dummybrd, arg, sizeof(struct stlibrd))) if (copy_from_user(&stli_dummybrd, arg, sizeof(struct stlibrd)))
return -EFAULT; return -EFAULT;
if ((stli_dummybrd.brdnr < 0) || (stli_dummybrd.brdnr >= STL_MAXBRDS)) if (stli_dummybrd.brdnr >= STL_MAXBRDS)
return -ENODEV; return -ENODEV;
brdp = stli_brds[stli_dummybrd.brdnr]; brdp = stli_brds[stli_dummybrd.brdnr];
if (!brdp) if (!brdp)
......
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
*/ */
struct stliport { struct stliport {
unsigned long magic; unsigned long magic;
int portnr; unsigned int portnr;
int panelnr; unsigned int panelnr;
int brdnr; unsigned int brdnr;
unsigned long state; unsigned long state;
int devnr; unsigned int devnr;
int flags; int flags;
int baud_base; int baud_base;
int custom_divisor; int custom_divisor;
...@@ -91,23 +91,23 @@ struct stliport { ...@@ -91,23 +91,23 @@ struct stliport {
*/ */
struct stlibrd { struct stlibrd {
unsigned long magic; unsigned long magic;
int brdnr; unsigned int brdnr;
int brdtype; unsigned int brdtype;
int state; unsigned int state;
int nrpanels; unsigned int nrpanels;
int nrports; unsigned int nrports;
int nrdevs; unsigned int nrdevs;
unsigned int iobase; unsigned int iobase;
int iosize; int iosize;
unsigned long memaddr; unsigned long memaddr;
void __iomem *membase; void __iomem *membase;
int memsize; unsigned long memsize;
int pagesize; int pagesize;
int hostoffset; int hostoffset;
int slaveoffset; int slaveoffset;
int bitsize; int bitsize;
int enabval; int enabval;
int panels[STL_MAXPANELS]; unsigned int panels[STL_MAXPANELS];
int panelids[STL_MAXPANELS]; int panelids[STL_MAXPANELS];
void (*init)(struct stlibrd *brdp); void (*init)(struct stlibrd *brdp);
void (*enable)(struct stlibrd *brdp); void (*enable)(struct stlibrd *brdp);
......
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