mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 06:52:07 +00:00
[PATCH] Char: stallion, variables cleanup
- fix `gcc -W' un/signed warnings by converting some ints -> uints. - move 3 global variables into functions, where are they used. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
c62429d93e
commit
6b2c9457bb
2 changed files with 45 additions and 50 deletions
|
@ -63,7 +63,7 @@
|
||||||
#define BRD_EASYIOPCI 28
|
#define BRD_EASYIOPCI 28
|
||||||
|
|
||||||
struct stlconf {
|
struct stlconf {
|
||||||
int brdtype;
|
unsigned int brdtype;
|
||||||
int ioaddr1;
|
int ioaddr1;
|
||||||
int ioaddr2;
|
int ioaddr2;
|
||||||
unsigned long memaddr;
|
unsigned long memaddr;
|
||||||
|
@ -120,15 +120,6 @@ static struct ktermios stl_deftermios = {
|
||||||
.c_ospeed = 9600,
|
.c_ospeed = 9600,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Define global stats structures. Not used often, and can be
|
|
||||||
* re-used for each stats call.
|
|
||||||
*/
|
|
||||||
static comstats_t stl_comstats;
|
|
||||||
static combrd_t stl_brdstats;
|
|
||||||
static struct stlbrd stl_dummybrd;
|
|
||||||
static struct stlport stl_dummyport;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define global place to put buffer overflow characters.
|
* Define global place to put buffer overflow characters.
|
||||||
*/
|
*/
|
||||||
|
@ -200,7 +191,7 @@ static char *stl_brdnames[] = {
|
||||||
* load line. These allow for easy board definitions, and easy
|
* load line. These allow for easy board definitions, and easy
|
||||||
* modification of the io, memory and irq resoucres.
|
* modification of the io, memory and irq resoucres.
|
||||||
*/
|
*/
|
||||||
static int stl_nargs = 0;
|
static unsigned int stl_nargs;
|
||||||
static char *board0[4];
|
static char *board0[4];
|
||||||
static char *board1[4];
|
static char *board1[4];
|
||||||
static char *board2[4];
|
static char *board2[4];
|
||||||
|
@ -632,7 +623,7 @@ static struct class *stallion_class;
|
||||||
static int __init stl_parsebrd(struct stlconf *confp, char **argp)
|
static int __init stl_parsebrd(struct stlconf *confp, char **argp)
|
||||||
{
|
{
|
||||||
char *sp;
|
char *sp;
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
pr_debug("stl_parsebrd(confp=%p,argp=%p)\n", confp, argp);
|
pr_debug("stl_parsebrd(confp=%p,argp=%p)\n", confp, argp);
|
||||||
|
|
||||||
|
@ -694,8 +685,8 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
|
||||||
{
|
{
|
||||||
struct stlport *portp;
|
struct stlport *portp;
|
||||||
struct stlbrd *brdp;
|
struct stlbrd *brdp;
|
||||||
unsigned int minordev;
|
unsigned int minordev, brdnr, panelnr;
|
||||||
int brdnr, panelnr, portnr, rc;
|
int portnr, rc;
|
||||||
|
|
||||||
pr_debug("stl_open(tty=%p,filp=%p): device=%s\n", tty, filp, tty->name);
|
pr_debug("stl_open(tty=%p,filp=%p): device=%s\n", tty, filp, tty->name);
|
||||||
|
|
||||||
|
@ -1556,8 +1547,8 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof
|
||||||
struct stlbrd *brdp;
|
struct stlbrd *brdp;
|
||||||
struct stlpanel *panelp;
|
struct stlpanel *panelp;
|
||||||
struct stlport *portp;
|
struct stlport *portp;
|
||||||
int brdnr, panelnr, portnr, totalport;
|
unsigned int brdnr, panelnr, portnr;
|
||||||
int curoff, maxoff;
|
int totalport, curoff, maxoff;
|
||||||
char *pos;
|
char *pos;
|
||||||
|
|
||||||
pr_debug("stl_readproc(page=%p,start=%p,off=%lx,count=%d,eof=%p,"
|
pr_debug("stl_readproc(page=%p,start=%p,off=%lx,count=%d,eof=%p,"
|
||||||
|
@ -1675,8 +1666,7 @@ static int stl_eiointr(struct stlbrd *brdp)
|
||||||
static int stl_echatintr(struct stlbrd *brdp)
|
static int stl_echatintr(struct stlbrd *brdp)
|
||||||
{
|
{
|
||||||
struct stlpanel *panelp;
|
struct stlpanel *panelp;
|
||||||
unsigned int ioaddr;
|
unsigned int ioaddr, bnknr;
|
||||||
int bnknr;
|
|
||||||
int handled = 0;
|
int handled = 0;
|
||||||
|
|
||||||
outb((brdp->ioctrlval | ECH_BRDENABLE), brdp->ioctrl);
|
outb((brdp->ioctrlval | ECH_BRDENABLE), brdp->ioctrl);
|
||||||
|
@ -1706,8 +1696,7 @@ static int stl_echatintr(struct stlbrd *brdp)
|
||||||
static int stl_echmcaintr(struct stlbrd *brdp)
|
static int stl_echmcaintr(struct stlbrd *brdp)
|
||||||
{
|
{
|
||||||
struct stlpanel *panelp;
|
struct stlpanel *panelp;
|
||||||
unsigned int ioaddr;
|
unsigned int ioaddr, bnknr;
|
||||||
int bnknr;
|
|
||||||
int handled = 0;
|
int handled = 0;
|
||||||
|
|
||||||
while (inb(brdp->iostatus) & ECH_INTRPEND) {
|
while (inb(brdp->iostatus) & ECH_INTRPEND) {
|
||||||
|
@ -1732,8 +1721,7 @@ static int stl_echmcaintr(struct stlbrd *brdp)
|
||||||
static int stl_echpciintr(struct stlbrd *brdp)
|
static int stl_echpciintr(struct stlbrd *brdp)
|
||||||
{
|
{
|
||||||
struct stlpanel *panelp;
|
struct stlpanel *panelp;
|
||||||
unsigned int ioaddr;
|
unsigned int ioaddr, bnknr, recheck;
|
||||||
int bnknr, recheck;
|
|
||||||
int handled = 0;
|
int handled = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -1763,8 +1751,7 @@ static int stl_echpciintr(struct stlbrd *brdp)
|
||||||
static int stl_echpci64intr(struct stlbrd *brdp)
|
static int stl_echpci64intr(struct stlbrd *brdp)
|
||||||
{
|
{
|
||||||
struct stlpanel *panelp;
|
struct stlpanel *panelp;
|
||||||
unsigned int ioaddr;
|
unsigned int ioaddr, bnknr;
|
||||||
int bnknr;
|
|
||||||
int handled = 0;
|
int handled = 0;
|
||||||
|
|
||||||
while (inb(brdp->ioctrl) & 0x1) {
|
while (inb(brdp->ioctrl) & 0x1) {
|
||||||
|
@ -1827,7 +1814,8 @@ static void stl_offintr(struct work_struct *work)
|
||||||
static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp)
|
static int __devinit stl_initports(struct stlbrd *brdp, struct stlpanel *panelp)
|
||||||
{
|
{
|
||||||
struct stlport *portp;
|
struct stlport *portp;
|
||||||
int chipmask, i;
|
unsigned int i;
|
||||||
|
int chipmask;
|
||||||
|
|
||||||
pr_debug("stl_initports(brdp=%p,panelp=%p)\n", brdp, panelp);
|
pr_debug("stl_initports(brdp=%p,panelp=%p)\n", brdp, panelp);
|
||||||
|
|
||||||
|
@ -2052,8 +2040,8 @@ err:
|
||||||
static int __devinit stl_initech(struct stlbrd *brdp)
|
static int __devinit stl_initech(struct stlbrd *brdp)
|
||||||
{
|
{
|
||||||
struct stlpanel *panelp;
|
struct stlpanel *panelp;
|
||||||
unsigned int status, nxtid, ioaddr, conflict;
|
unsigned int status, nxtid, ioaddr, conflict, panelnr, banknr, i;
|
||||||
int panelnr, banknr, i, retval;
|
int retval;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
pr_debug("stl_initech(brdp=%p)\n", brdp);
|
pr_debug("stl_initech(brdp=%p)\n", brdp);
|
||||||
|
@ -2337,7 +2325,7 @@ err:
|
||||||
|
|
||||||
static int __devinit stl_getbrdnr(void)
|
static int __devinit stl_getbrdnr(void)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < STL_MAXBRDS; i++)
|
for (i = 0; i < STL_MAXBRDS; i++)
|
||||||
if (stl_brds[i] == NULL) {
|
if (stl_brds[i] == NULL) {
|
||||||
|
@ -2361,7 +2349,7 @@ static int __devinit stl_pciprobe(struct pci_dev *pdev,
|
||||||
{
|
{
|
||||||
struct stlbrd *brdp;
|
struct stlbrd *brdp;
|
||||||
unsigned int brdtype = ent->driver_data;
|
unsigned int brdtype = ent->driver_data;
|
||||||
int retval = -ENODEV;
|
int brdnr, retval = -ENODEV;
|
||||||
|
|
||||||
if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE)
|
if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE)
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -2378,13 +2366,14 @@ static int __devinit stl_pciprobe(struct pci_dev *pdev,
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
mutex_lock(&stl_brdslock);
|
mutex_lock(&stl_brdslock);
|
||||||
brdp->brdnr = stl_getbrdnr();
|
brdnr = stl_getbrdnr();
|
||||||
if (brdp->brdnr < 0) {
|
if (brdnr < 0) {
|
||||||
dev_err(&pdev->dev, "too many boards found, "
|
dev_err(&pdev->dev, "too many boards found, "
|
||||||
"maximum supported %d\n", STL_MAXBRDS);
|
"maximum supported %d\n", STL_MAXBRDS);
|
||||||
mutex_unlock(&stl_brdslock);
|
mutex_unlock(&stl_brdslock);
|
||||||
goto err_fr;
|
goto err_fr;
|
||||||
}
|
}
|
||||||
|
brdp->brdnr = (unsigned int)brdnr;
|
||||||
stl_brds[brdp->brdnr] = brdp;
|
stl_brds[brdp->brdnr] = brdp;
|
||||||
mutex_unlock(&stl_brdslock);
|
mutex_unlock(&stl_brdslock);
|
||||||
|
|
||||||
|
@ -2460,9 +2449,10 @@ static struct pci_driver stl_pcidriver = {
|
||||||
|
|
||||||
static int stl_getbrdstats(combrd_t __user *bp)
|
static int stl_getbrdstats(combrd_t __user *bp)
|
||||||
{
|
{
|
||||||
|
combrd_t stl_brdstats;
|
||||||
struct stlbrd *brdp;
|
struct stlbrd *brdp;
|
||||||
struct stlpanel *panelp;
|
struct stlpanel *panelp;
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (copy_from_user(&stl_brdstats, bp, sizeof(combrd_t)))
|
if (copy_from_user(&stl_brdstats, bp, sizeof(combrd_t)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
@ -2508,12 +2498,12 @@ static struct stlport *stl_getport(int brdnr, int panelnr, int portnr)
|
||||||
brdp = stl_brds[brdnr];
|
brdp = stl_brds[brdnr];
|
||||||
if (brdp == NULL)
|
if (brdp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (panelnr < 0 || panelnr >= brdp->nrpanels)
|
if (panelnr < 0 || (unsigned int)panelnr >= brdp->nrpanels)
|
||||||
return NULL;
|
return NULL;
|
||||||
panelp = brdp->panels[panelnr];
|
panelp = brdp->panels[panelnr];
|
||||||
if (panelp == NULL)
|
if (panelp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (portnr < 0 || portnr >= panelp->nrports)
|
if (portnr < 0 || (unsigned int)portnr >= panelp->nrports)
|
||||||
return NULL;
|
return NULL;
|
||||||
return panelp->ports[portnr];
|
return panelp->ports[portnr];
|
||||||
}
|
}
|
||||||
|
@ -2528,6 +2518,7 @@ static struct stlport *stl_getport(int brdnr, int panelnr, int portnr)
|
||||||
|
|
||||||
static int stl_getportstats(struct stlport *portp, comstats_t __user *cp)
|
static int stl_getportstats(struct stlport *portp, comstats_t __user *cp)
|
||||||
{
|
{
|
||||||
|
comstats_t stl_comstats;
|
||||||
unsigned char *head, *tail;
|
unsigned char *head, *tail;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
@ -2585,6 +2576,8 @@ static int stl_getportstats(struct stlport *portp, comstats_t __user *cp)
|
||||||
|
|
||||||
static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp)
|
static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp)
|
||||||
{
|
{
|
||||||
|
comstats_t stl_comstats;
|
||||||
|
|
||||||
if (!portp) {
|
if (!portp) {
|
||||||
if (copy_from_user(&stl_comstats, cp, sizeof(comstats_t)))
|
if (copy_from_user(&stl_comstats, cp, sizeof(comstats_t)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
@ -2610,6 +2603,7 @@ static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp)
|
||||||
|
|
||||||
static int stl_getportstruct(struct stlport __user *arg)
|
static int stl_getportstruct(struct stlport __user *arg)
|
||||||
{
|
{
|
||||||
|
struct stlport stl_dummyport;
|
||||||
struct stlport *portp;
|
struct stlport *portp;
|
||||||
|
|
||||||
if (copy_from_user(&stl_dummyport, arg, sizeof(struct stlport)))
|
if (copy_from_user(&stl_dummyport, arg, sizeof(struct stlport)))
|
||||||
|
@ -2629,11 +2623,12 @@ static int stl_getportstruct(struct stlport __user *arg)
|
||||||
|
|
||||||
static int stl_getbrdstruct(struct stlbrd __user *arg)
|
static int stl_getbrdstruct(struct stlbrd __user *arg)
|
||||||
{
|
{
|
||||||
|
struct stlbrd stl_dummybrd;
|
||||||
struct stlbrd *brdp;
|
struct stlbrd *brdp;
|
||||||
|
|
||||||
if (copy_from_user(&stl_dummybrd, arg, sizeof(struct stlbrd)))
|
if (copy_from_user(&stl_dummybrd, arg, sizeof(struct stlbrd)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
if ((stl_dummybrd.brdnr < 0) || (stl_dummybrd.brdnr >= STL_MAXBRDS))
|
if (stl_dummybrd.brdnr >= STL_MAXBRDS)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
brdp = stl_brds[stl_dummybrd.brdnr];
|
brdp = stl_brds[stl_dummybrd.brdnr];
|
||||||
if (!brdp)
|
if (!brdp)
|
||||||
|
|
|
@ -69,12 +69,12 @@ struct stlrq {
|
||||||
*/
|
*/
|
||||||
struct stlport {
|
struct stlport {
|
||||||
unsigned long magic;
|
unsigned long magic;
|
||||||
int portnr;
|
unsigned int portnr;
|
||||||
int panelnr;
|
unsigned int panelnr;
|
||||||
int brdnr;
|
unsigned int brdnr;
|
||||||
int ioaddr;
|
int ioaddr;
|
||||||
int uartaddr;
|
int uartaddr;
|
||||||
int pagenr;
|
unsigned int pagenr;
|
||||||
long istate;
|
long istate;
|
||||||
int flags;
|
int flags;
|
||||||
int baud_base;
|
int baud_base;
|
||||||
|
@ -102,10 +102,10 @@ struct stlport {
|
||||||
|
|
||||||
struct stlpanel {
|
struct stlpanel {
|
||||||
unsigned long magic;
|
unsigned long magic;
|
||||||
int panelnr;
|
unsigned int panelnr;
|
||||||
int brdnr;
|
unsigned int brdnr;
|
||||||
int pagenr;
|
unsigned int pagenr;
|
||||||
int nrports;
|
unsigned int nrports;
|
||||||
int iobase;
|
int iobase;
|
||||||
void *uartp;
|
void *uartp;
|
||||||
void (*isr)(struct stlpanel *panelp, unsigned int iobase);
|
void (*isr)(struct stlpanel *panelp, unsigned int iobase);
|
||||||
|
@ -116,12 +116,12 @@ struct stlpanel {
|
||||||
|
|
||||||
struct stlbrd {
|
struct stlbrd {
|
||||||
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 nrbnks;
|
unsigned int nrbnks;
|
||||||
int irq;
|
int irq;
|
||||||
int irqtype;
|
int irqtype;
|
||||||
int (*isr)(struct stlbrd *brdp);
|
int (*isr)(struct stlbrd *brdp);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue