parport_pc: Coding style

Michael's patch fixed some of the coding style so the style is now
inconsistent. Sort the rest out

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Alan Cox
2009-06-11 13:07:29 +01:00
committed by Linus Torvalds
parent 73e0d48b8c
commit 3aeda9bc95

View File

@@ -56,10 +56,10 @@
#include <linux/pnp.h>
#include <linux/platform_device.h>
#include <linux/sysctl.h>
#include <linux/io.h>
#include <linux/uaccess.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/uaccess.h>
#include <linux/parport.h>
#include <linux/parport_pc.h>
@@ -123,7 +123,7 @@ static void frob_econtrol (struct parport *pb, unsigned char m,
outb((ectr & ~m) ^ v, ECONTROL(pb));
}
static __inline__ void frob_set_mode (struct parport *p, int mode)
static inline void frob_set_mode(struct parport *p, int mode)
{
frob_econtrol(p, ECR_MODE_MASK, mode << 5);
}
@@ -151,7 +151,8 @@ static int change_mode(struct parport *p, int m)
/* Bits <7:5> contain the mode. */
oecr = inb(ECONTROL(p));
mode = (oecr >> 5) & 0x7;
if (mode == m) return 0;
if (mode == m)
return 0;
if (mode >= 2 && !(priv->ctr & 0x20)) {
/* This mode resets the FIFO, so we may
@@ -165,7 +166,8 @@ static int change_mode(struct parport *p, int m)
for (counter = 0; counter < 40; counter++) {
if (inb(ECONTROL(p)) & 0x01)
break;
if (signal_pending (current)) break;
if (signal_pending(current))
break;
udelay(5);
}
@@ -174,7 +176,8 @@ static int change_mode(struct parport *p, int m)
if (time_after_eq(jiffies, expire))
/* The FIFO is stuck. */
return -EBUSY;
schedule_timeout_interruptible(msecs_to_jiffies(10));
schedule_timeout_interruptible(
msecs_to_jiffies(10));
if (signal_pending(current))
break;
}
@@ -235,7 +238,9 @@ static int get_fifo_residue (struct parport *p)
/* Back to PS2 mode. */
frob_set_mode(p, ECR_PS2);
DPRINTK (KERN_DEBUG "*** get_fifo_residue: done residue collecting (ecr = 0x%2.2x)\n", inb (ECONTROL (p)));
DPRINTK(KERN_DEBUG
"*** get_fifo_residue: done residue collecting (ecr = 0x%2.2x)\n",
inb(ECONTROL(p)));
return residue;
}
#endif /* 0 */
@@ -272,7 +277,8 @@ static int clear_epp_timeout(struct parport *pb)
* of these are in parport_pc.h.
*/
static void parport_pc_init_state(struct pardevice *dev, struct parport_state *s)
static void parport_pc_init_state(struct pardevice *dev,
struct parport_state *s)
{
s->u.pc.ctr = 0xc;
if (dev->irq_func &&
@@ -292,7 +298,8 @@ static void parport_pc_save_state(struct parport *p, struct parport_state *s)
s->u.pc.ecr = inb(ECONTROL(p));
}
static void parport_pc_restore_state(struct parport *p, struct parport_state *s)
static void parport_pc_restore_state(struct parport *p,
struct parport_state *s)
{
struct parport_pc_private *priv = p->physport->private_data;
register unsigned char c = s->u.pc.ctr & priv->ctr_writable;
@@ -318,14 +325,13 @@ static size_t parport_pc_epp_read_data (struct parport *port, void *buf,
*/
status = inb(STATUS(port));
while (!(status & 0x08) && (got < length)) {
if ((left >= 16) && (status & 0x20) && !(status & 0x08)) {
while (!(status & 0x08) && got < length) {
if (left >= 16 && (status & 0x20) && !(status & 0x08)) {
/* can grab 16 bytes from warp fifo */
if (!((long)buf & 0x03)) {
if (!((long)buf & 0x03))
insl(EPPDATA(port), buf, 4);
} else {
else
insb(EPPDATA(port), buf, 16);
}
buf += 16;
got += 16;
left -= 16;
@@ -339,19 +345,18 @@ static size_t parport_pc_epp_read_data (struct parport *port, void *buf,
status = inb(STATUS(port));
if (status & 0x01) {
/* EPP timeout should never occur... */
printk (KERN_DEBUG "%s: EPP timeout occurred while talking to "
"w91284pic (should not have done)\n", port->name);
printk(KERN_DEBUG
"%s: EPP timeout occurred while talking to w91284pic (should not have done)\n", port->name);
clear_epp_timeout(port);
}
}
return got;
}
if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
if (!(((long)buf | length) & 0x03)) {
if (!(((long)buf | length) & 0x03))
insl(EPPDATA(port), buf, (length >> 2));
} else {
else
insb(EPPDATA(port), buf, length);
}
if (inb(STATUS(port)) & 0x01) {
clear_epp_timeout(port);
return -EIO;
@@ -377,11 +382,10 @@ static size_t parport_pc_epp_write_data (struct parport *port, const void *buf,
size_t written = 0;
if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
if (!(((long)buf | length) & 0x03)) {
if (!(((long)buf | length) & 0x03))
outsl(EPPDATA(port), buf, (length >> 2));
} else {
else
outsb(EPPDATA(port), buf, length);
}
if (inb(STATUS(port)) & 0x01) {
clear_epp_timeout(port);
return -EIO;
@@ -555,7 +559,8 @@ static size_t parport_pc_fifo_write_block_pio (struct parport *port,
ECR_WRITE(port, ecrval & ~(1<<2));
false_alarm:
ret = parport_wait_event(port, HZ);
if (ret < 0) break;
if (ret < 0)
break;
ret = 0;
if (!time_before(jiffies, expire)) {
/* Timed out. */
@@ -589,7 +594,8 @@ static size_t parport_pc_fifo_write_block_pio (struct parport *port,
left -= n;
/* Adjust the poll time. */
if (i < (poll_for - 2)) poll_for--;
if (i < (poll_for - 2))
poll_for--;
continue;
} else if (i++ < poll_for) {
udelay(10);
@@ -602,7 +608,6 @@ static size_t parport_pc_fifo_write_block_pio (struct parport *port,
outb(byte, fifo);
left--;
}
dump_parport_state("leave fifo_write_block_pio", port);
return length - left;
}
@@ -630,7 +635,8 @@ dump_parport_state ("enter fifo_write_block_dma", port);
dma_addr = dma_handle = dma_map_single(dev, (void *)buf, length,
DMA_TO_DEVICE);
} else {
/* above 16 MB we use a bounce buffer as ISA-DMA is not possible */
/* above 16 MB we use a bounce buffer as ISA-DMA
is not possible */
maxlen = PAGE_SIZE; /* sizeof(priv->dma_buf) */
dma_addr = priv->dma_handle;
dma_handle = 0;
@@ -676,12 +682,14 @@ dump_parport_state ("enter fifo_write_block_dma", port);
/* assume DMA will be successful */
left -= count;
buf += count;
if (dma_handle) dma_addr += count;
if (dma_handle)
dma_addr += count;
/* Wait for interrupt. */
false_alarm:
ret = parport_wait_event(port, HZ);
if (ret < 0) break;
if (ret < 0)
break;
ret = 0;
if (!time_before(jiffies, expire)) {
/* Timed out. */
@@ -712,7 +720,8 @@ dump_parport_state ("enter fifo_write_block_dma", port);
/* update for possible DMA residue ! */
buf -= count;
left += count;
if (dma_handle) dma_addr -= count;
if (dma_handle)
dma_addr -= count;
}
/* Maybe got here through break, so adjust for DMA residue! */
@@ -763,7 +772,9 @@ static size_t parport_pc_compat_write_block_pio (struct parport *port,
parport_pc_data_forward(port); /* Must be in PS2 mode */
parport_pc_frob_control(port, PARPORT_CONTROL_STROBE, 0);
r = change_mode(port, ECR_PPF); /* Parallel port FIFO */
if (r) printk (KERN_DEBUG "%s: Warning change_mode ECR_PPF failed\n", port->name);
if (r)
printk(KERN_DEBUG "%s: Warning change_mode ECR_PPF failed\n",
port->name);
port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA;
@@ -779,9 +790,8 @@ static size_t parport_pc_compat_write_block_pio (struct parport *port,
do {
/* Wait for the FIFO to empty */
r = change_mode(port, ECR_PS2);
if (r != -EBUSY) {
if (r != -EBUSY)
break;
}
} while (time_before(jiffies, expire));
if (r == -EBUSY) {
@@ -859,7 +869,9 @@ static size_t parport_pc_ecp_write_block_pio (struct parport *port,
PARPORT_CONTROL_AUTOFD,
0);
r = change_mode(port, ECR_ECP); /* ECP FIFO */
if (r) printk (KERN_DEBUG "%s: Warning change_mode ECR_ECP failed\n", port->name);
if (r)
printk(KERN_DEBUG "%s: Warning change_mode ECR_ECP failed\n",
port->name);
port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA;
/* Write the data to the FIFO. */
@@ -874,9 +886,8 @@ static size_t parport_pc_ecp_write_block_pio (struct parport *port,
do {
/* Wait for the FIFO to empty */
r = change_mode(port, ECR_PS2);
if (r != -EBUSY) {
if (r != -EBUSY)
break;
}
} while (time_before(jiffies, expire));
if (r == -EBUSY) {
@@ -998,7 +1009,9 @@ dump_parport_state ("enter fcn", port);
PARPORT_CONTROL_AUTOFD,
PARPORT_CONTROL_AUTOFD); */
r = change_mode(port, ECR_ECP); /* ECP FIFO */
if (r) printk (KERN_DEBUG "%s: Warning change_mode ECR_ECP failed\n", port->name);
if (r)
printk(KERN_DEBUG "%s: Warning change_mode ECR_ECP failed\n",
port->name);
port->ieee1284.phase = IEEE1284_PH_REV_DATA;
@@ -1021,7 +1034,8 @@ dump_parport_state ("43-44", port);
0);
dump_parport_state("pre 45", port);
/* Event 45: Wait for nAck to go high */
/* r = parport_wait_peripheral (port, PARPORT_STATUS_ACK, PARPORT_STATUS_ACK); */
/* r = parport_wait_peripheral(port, PARPORT_STATUS_ACK,
PARPORT_STATUS_ACK); */
dump_parport_state("post 45", port);
r = 0;
if (r) {
@@ -1069,7 +1083,8 @@ dump_parport_state ("FIFO empty", port);
false_alarm:
dump_parport_state("waiting", port);
ret = parport_wait_event(port, HZ);
DPRINTK (KERN_DEBUG "parport_wait_event returned %d\n", ret);
DPRINTK(KERN_DEBUG "parport_wait_event returned %d\n",
ret);
if (ret < 0)
break;
ret = 0;
@@ -1164,8 +1179,7 @@ dump_parport_state ("fwd idle", port);
/* GCC is not inlining extern inline function later overwriten to non-inline,
so we use outlined_ variants here. */
static const struct parport_operations parport_pc_ops =
{
static const struct parport_operations parport_pc_ops = {
.write_data = parport_pc_write_data,
.read_data = parport_pc_read_data,
@@ -1229,21 +1243,27 @@ static void __devinit show_parconfig_smsc37c669(int io, int key)
outb(0xaa, io);
if (verbose_probing) {
printk (KERN_INFO "SMSC 37c669 LPT Config: cr_1=0x%02x, 4=0x%02x, "
printk(KERN_INFO
"SMSC 37c669 LPT Config: cr_1=0x%02x, 4=0x%02x, "
"A=0x%2x, 23=0x%02x, 26=0x%02x, 27=0x%02x\n",
cr1, cr4, cra, cr23, cr26, cr27);
/* The documentation calls DMA and IRQ-Lines by letters, so
the board maker can/will wire them
appropriately/randomly... G=reserved H=IDE-irq, */
printk (KERN_INFO "SMSC LPT Config: io=0x%04x, irq=%c, dma=%c, "
"fifo threshold=%d\n", cr23*4,
printk(KERN_INFO
"SMSC LPT Config: io=0x%04x, irq=%c, dma=%c, fifo threshold=%d\n",
cr23 * 4,
(cr27 & 0x0f) ? 'A' - 1 + (cr27 & 0x0f) : '-',
(cr26 &0x0f) ? 'A'-1+(cr26 &0x0f): '-', cra & 0x0f);
(cr26 & 0x0f) ? 'A' - 1 + (cr26 & 0x0f) : '-',
cra & 0x0f);
printk(KERN_INFO "SMSC LPT Config: enabled=%s power=%s\n",
(cr23*4 >=0x100) ?"yes":"no", (cr1 & 4) ? "yes" : "no");
printk(KERN_INFO "SMSC LPT Config: Port mode=%s, EPP version =%s\n",
(cr1 & 0x08 ) ? "Standard mode only (SPP)" : modes[cr4 & 0x03],
(cr23 * 4 >= 0x100) ? "yes" : "no",
(cr1 & 4) ? "yes" : "no");
printk(KERN_INFO
"SMSC LPT Config: Port mode=%s, EPP version =%s\n",
(cr1 & 0x08) ? "Standard mode only (SPP)"
: modes[cr4 & 0x03],
(cr4 & 0x40) ? "1.7" : "1.9");
}
@@ -1272,7 +1292,7 @@ static void __devinit show_parconfig_smsc37c669(int io, int key)
superios[i].irq = 5;
}
d = (cr26 & 0x0f);
if((d==1) || (d==3))
if (d == 1 || d == 3)
superios[i].dma = d;
else
superios[i].dma = PARPORT_DMA_NONE;
@@ -1319,17 +1339,20 @@ static void __devinit show_parconfig_winbond(int io, int key)
outb(0xaa, io);
if (verbose_probing) {
printk(KERN_INFO "Winbond LPT Config: cr_30=%02x 60,61=%02x%02x "
"70=%02x 74=%02x, f0=%02x\n", cr30,cr60,cr61,cr70,cr74,crf0);
printk(KERN_INFO
"Winbond LPT Config: cr_30=%02x 60,61=%02x%02x 70=%02x 74=%02x, f0=%02x\n",
cr30, cr60, cr61, cr70, cr74, crf0);
printk(KERN_INFO "Winbond LPT Config: active=%s, io=0x%02x%02x irq=%d, ",
(cr30 & 0x01) ? "yes" : "no", cr60, cr61, cr70 & 0x0f);
if ((cr74 & 0x07) > 3)
printk("dma=none\n");
else
printk("dma=%d\n", cr74 & 0x07);
printk(KERN_INFO "Winbond LPT Config: irqtype=%s, ECP fifo threshold=%d\n",
printk(KERN_INFO
"Winbond LPT Config: irqtype=%s, ECP fifo threshold=%d\n",
irqtypes[crf0>>7], (crf0>>3)&0x0f);
printk(KERN_INFO "Winbond LPT Config: Port mode=%s\n", modes[crf0 & 0x07]);
printk(KERN_INFO "Winbond LPT Config: Port mode=%s\n",
modes[crf0 & 0x07]);
}
if (cr30 & 0x01) { /* the settings can be interrogated later ... */
@@ -1346,7 +1369,8 @@ static void __devinit show_parconfig_winbond(int io, int key)
}
}
static void __devinit decode_winbond(int efer, int key, int devid, int devrev, int oldid)
static void __devinit decode_winbond(int efer, int key, int devid,
int devrev, int oldid)
{
const char *type = "unknown";
int id, progif = 2;
@@ -1360,18 +1384,34 @@ static void __devinit decode_winbond(int efer, int key, int devid, int devrev, i
/* Values are from public data sheets pdf files, I can just
confirm 83977TF is correct :-) */
if (id == 0x9771) type="83977F/AF";
else if (id == 0x9773) type="83977TF / SMSC 97w33x/97w34x";
else if (id == 0x9774) type="83977ATF";
else if ((id & ~0x0f) == 0x5270) type="83977CTF / SMSC 97w36x";
else if ((id & ~0x0f) == 0x52f0) type="83977EF / SMSC 97w35x";
else if ((id & ~0x0f) == 0x5210) type="83627";
else if ((id & ~0x0f) == 0x6010) type="83697HF";
else if ((oldid &0x0f ) == 0x0a) { type="83877F"; progif=1;}
else if ((oldid &0x0f ) == 0x0b) { type="83877AF"; progif=1;}
else if ((oldid &0x0f ) == 0x0c) { type="83877TF"; progif=1;}
else if ((oldid &0x0f ) == 0x0d) { type="83877ATF"; progif=1;}
else progif=0;
if (id == 0x9771)
type = "83977F/AF";
else if (id == 0x9773)
type = "83977TF / SMSC 97w33x/97w34x";
else if (id == 0x9774)
type = "83977ATF";
else if ((id & ~0x0f) == 0x5270)
type = "83977CTF / SMSC 97w36x";
else if ((id & ~0x0f) == 0x52f0)
type = "83977EF / SMSC 97w35x";
else if ((id & ~0x0f) == 0x5210)
type = "83627";
else if ((id & ~0x0f) == 0x6010)
type = "83697HF";
else if ((oldid & 0x0f) == 0x0a) {
type = "83877F";
progif = 1;
} else if ((oldid & 0x0f) == 0x0b) {
type = "83877AF";
progif = 1;
} else if ((oldid & 0x0f) == 0x0c) {
type = "83877TF";
progif = 1;
} else if ((oldid & 0x0f) == 0x0d) {
type = "83877ATF";
progif = 1;
} else
progif = 0;
if (verbose_probing)
printk(KERN_INFO "Winbond chip at EFER=0x%x key=0x%02x "
@@ -1396,10 +1436,15 @@ static void __devinit decode_smsc(int efer, int key, int devid, int devrev)
func = NULL;
id = (devid << 8) | devrev;
if (id==0x0302) {type="37c669"; func=show_parconfig_smsc37c669;}
else if (id==0x6582) type="37c665IR";
else if (devid==0x65) type="37c665GT";
else if (devid==0x66) type="37c666GT";
if (id == 0x0302) {
type = "37c669";
func = show_parconfig_smsc37c669;
} else if (id == 0x6582)
type = "37c665IR";
else if (devid == 0x65)
type = "37c665GT";
else if (devid == 0x66)
type = "37c666GT";
if (verbose_probing)
printk(KERN_INFO "SMSC chip at EFER=0x%x "
@@ -1470,7 +1515,7 @@ static void __devinit winbond_check2(int io,int key)
oldid = inb(io + 2);
outb(0xaa, io); /* Magic Seal */
if ((x_devid == devid) && (x_devrev == devrev) && (x_oldid == oldid))
if (x_devid == devid && x_devrev == devrev && x_oldid == oldid)
goto out; /* protection against false positives */
decode_winbond(io, key, devid, devrev, oldid);
@@ -1508,8 +1553,8 @@ static void __devinit smsc_check(int io, int key)
rev = inb(io + 1);
outb(0xaa, io); /* Magic Seal */
if ((x_id == id) && (x_oldrev == oldrev) &&
(x_oldid == oldid) && (x_rev == rev))
if (x_id == id && x_oldrev == oldrev &&
x_oldid == oldid && x_rev == rev)
goto out; /* protection against false positives */
decode_smsc(io, key, oldid, oldrev);
@@ -1750,10 +1795,12 @@ static int parport_PS2_supported(struct parport *pb)
parport_pc_data_reverse(pb);
parport_pc_write_data(pb, 0x55);
if (parport_pc_read_data(pb) != 0x55) ok++;
if (parport_pc_read_data(pb) != 0x55)
ok++;
parport_pc_write_data(pb, 0xaa);
if (parport_pc_read_data(pb) != 0xaa) ok++;
if (parport_pc_read_data(pb) != 0xaa)
ok++;
/* cancel input mode */
parport_pc_data_forward(pb);
@@ -1869,7 +1916,8 @@ static int parport_ECP_supported(struct parport *pb)
priv->pword = pword;
if (verbose_probing) {
printk (KERN_DEBUG "0x%lx: PWord is %d bits\n", pb->base, 8 * pword);
printk(KERN_DEBUG "0x%lx: PWord is %d bits\n",
pb->base, 8 * pword);
printk(KERN_DEBUG "0x%lx: Interrupts are ISA-%s\n", pb->base,
config & 0x80 ? "Level" : "Pulses");
@@ -1932,9 +1980,8 @@ static int parport_EPP_supported(struct parport *pb)
*/
/* If EPP timeout bit clear then EPP available */
if (!clear_epp_timeout(pb)) {
if (!clear_epp_timeout(pb))
return 0; /* No way to clear timeout */
}
/* Check for Intel bug. */
if (priv->ecr) {
@@ -1965,9 +2012,8 @@ static int parport_ECPEPP_supported(struct parport *pb)
int result;
unsigned char oecr;
if (!priv->ecr) {
if (!priv->ecr)
return 0;
}
oecr = inb(ECONTROL(pb));
/* Search for SMC style EPP+ECP mode */
@@ -1993,11 +2039,25 @@ static int parport_ECPEPP_supported(struct parport *pb)
/* Don't bother probing for modes we know we won't use. */
static int __devinit parport_PS2_supported(struct parport *pb) { return 0; }
#ifdef CONFIG_PARPORT_PC_FIFO
static int parport_ECP_supported(struct parport *pb) { return 0; }
static int parport_ECP_supported(struct parport *pb)
{
return 0;
}
#endif
static int __devinit parport_EPP_supported(struct parport *pb) { return 0; }
static int __devinit parport_ECPEPP_supported(struct parport *pb){return 0;}
static int __devinit parport_ECPPS2_supported(struct parport *pb){return 0;}
static int __devinit parport_EPP_supported(struct parport *pb)
{
return 0;
}
static int __devinit parport_ECPEPP_supported(struct parport *pb)
{
return 0;
}
static int __devinit parport_ECPPS2_supported(struct parport *pb)
{
return 0;
}
#endif /* No IEEE 1284 support */
@@ -2155,8 +2215,8 @@ static int programmable_dma_support (struct parport *p)
static int parport_dma_probe(struct parport *p)
{
const struct parport_pc_private *priv = p->private_data;
if (priv->ecr)
p->dma = programmable_dma_support(p); /* ask ECP chipset first */
if (priv->ecr) /* ask ECP chipset first */
p->dma = programmable_dma_support(p);
if (p->dma == PARPORT_DMA_NONE) {
/* ask known Super-IO chips proper, although these
claim ECP compatible, some don't report their DMA
@@ -2290,16 +2350,23 @@ struct parport *parport_pc_probe_port(unsigned long int base,
if (p->dma != PARPORT_DMA_NONE) {
printk(", dma %d", p->dma);
p->modes |= PARPORT_MODE_DMA;
}
else printk(", using FIFO");
}
else
} else
printk(", using FIFO");
} else
/* We can't use the DMA channel after all. */
p->dma = PARPORT_DMA_NONE;
#endif /* Allowed to use FIFO/DMA */
printk(" [");
#define printmode(x) {if(p->modes&PARPORT_MODE_##x){printk("%s%s",f?",":"",#x);f++;}}
#define printmode(x) \
{\
if (p->modes & PARPORT_MODE_##x) {\
printk("%s%s", f ? "," : "", #x);\
f++;\
} \
}
{
int f = 0;
printmode(PCSPP);
@@ -2403,7 +2470,6 @@ out1:
platform_device_unregister(pdev);
return NULL;
}
EXPORT_SYMBOL(parport_pc_probe_port);
void parport_pc_unregister_port(struct parport *p)
@@ -2436,7 +2502,6 @@ void parport_pc_unregister_port (struct parport *p)
parport_put_port(p);
kfree(ops); /* hope no-one cached it */
}
EXPORT_SYMBOL(parport_pc_unregister_port);
#ifdef CONFIG_PCI
@@ -2456,7 +2521,7 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq,
DPRINTK(KERN_DEBUG "sio_ite_8872_probe()\n");
// make sure which one chip
/* make sure which one chip */
for (i = 0; i < 5; i++) {
base_res = request_region(inta_addr[i], 32, "it887x");
if (base_res) {
@@ -2466,7 +2531,8 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq,
pci_write_config_dword(pdev, 0x78,
0x00000000 | inta_addr[i]);
test = inb(inta_addr[i]);
if (test != 0xff) break;
if (test != 0xff)
break;
release_region(inta_addr[i], 0x8);
}
}
@@ -2512,8 +2578,8 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq,
pci_write_config_dword(pdev, 0x6c, 0xe3000000 | ite8872_lpt);
pci_write_config_dword(pdev, 0x70, 0xe3000000 | ite8872_lpthi);
pci_write_config_dword(pdev, 0x80, (ite8872_lpthi<<16) | ite8872_lpt);
// SET SPP&EPP , Parallel Port NO DMA , Enable All Function
// SET Parallel IRQ
/* SET SPP&EPP , Parallel Port NO DMA , Enable All Function */
/* SET Parallel IRQ */
pci_write_config_dword(pdev, 0x9c,
ite8872set | (ite8872_irq * 0x11111));
@@ -2548,7 +2614,7 @@ static int __devinit sio_ite_8872_probe (struct pci_dev *pdev, int autoirq,
/* VIA 8231 support by Pavel Fedin <sonic_amiga@rambler.ru>
based on VIA 686a support code by Jeff Garzik <jgarzik@pobox.com> */
static int __devinitdata parport_init_mode = 0;
static int __devinitdata parport_init_mode;
/* Data for two known VIA chips */
static struct parport_pc_via_data via_686a_data __devinitdata = {
@@ -2582,8 +2648,7 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq,
printk(KERN_DEBUG "parport_pc: VIA 686A/8231 detected\n");
switch(parport_init_mode)
{
switch (parport_init_mode) {
case 1:
printk(KERN_DEBUG "parport_pc: setting SPP mode\n");
siofunc = VIA_FUNCTION_PARPORT_SPP;
@@ -2611,7 +2676,8 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq,
have_epp = 1;
break;
default:
printk(KERN_DEBUG "parport_pc: probing current configuration\n");
printk(KERN_DEBUG
"parport_pc: probing current configuration\n");
siofunc = VIA_FUNCTION_PROBE;
break;
}
@@ -2628,13 +2694,10 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq,
/* Bit 5: EPP+ECP enable; bit 7: PS/2 bidirectional port enable */
outb(via->viacfg_parport_control, VIA_CONFIG_INDEX);
tmp2 = inb(VIA_CONFIG_DATA);
if (siofunc == VIA_FUNCTION_PROBE)
{
if (siofunc == VIA_FUNCTION_PROBE) {
siofunc = tmp & VIA_FUNCTION_PARPORT_DISABLE;
ppcontrol = tmp2;
}
else
{
} else {
tmp &= ~VIA_FUNCTION_PARPORT_DISABLE;
tmp |= siofunc;
outb(via->viacfg_function, VIA_CONFIG_INDEX);
@@ -2649,12 +2712,13 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq,
outb(via->viacfg_parport_base, VIA_CONFIG_INDEX);
port1 = inb(VIA_CONFIG_DATA) << 2;
printk (KERN_DEBUG "parport_pc: Current parallel port base: 0x%X\n",port1);
if ((port1 == 0x3BC) && have_epp)
{
printk(KERN_DEBUG "parport_pc: Current parallel port base: 0x%X\n",
port1);
if (port1 == 0x3BC && have_epp) {
outb(via->viacfg_parport_base, VIA_CONFIG_INDEX);
outb((0x378 >> 2), VIA_CONFIG_DATA);
printk(KERN_DEBUG "parport_pc: Parallel port base changed to 0x378\n");
printk(KERN_DEBUG
"parport_pc: Parallel port base changed to 0x378\n");
port1 = 0x378;
}
@@ -2674,14 +2738,13 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq,
pci_read_config_byte(pdev, via->via_pci_parport_irq_reg, &tmp);
irq = ((tmp & VIA_IRQCONTROL_PARALLEL) >> 4);
if (siofunc == VIA_FUNCTION_PARPORT_ECP)
{
if (siofunc == VIA_FUNCTION_PARPORT_ECP) {
/* Bits 3-2: PnP Routing for Parallel Port DMA */
pci_read_config_byte(pdev, via->via_pci_parport_dma_reg, &tmp);
dma = ((tmp & VIA_DMACONTROL_PARALLEL) >> 2);
}
else
/* if ECP not enabled, DMA is not enabled, assumed bogus 'dma' value */
} else
/* if ECP not enabled, DMA is not enabled, assumed
bogus 'dma' value */
dma = PARPORT_DMA_NONE;
/* Let the user (or defaults) steer us away from interrupts and DMA */
@@ -2693,11 +2756,15 @@ static int __devinit sio_via_probe (struct pci_dev *pdev, int autoirq,
dma = PARPORT_DMA_NONE;
switch (port1) {
case 0x3bc: port2 = 0x7bc; break;
case 0x378: port2 = 0x778; break;
case 0x278: port2 = 0x678; break;
case 0x3bc:
port2 = 0x7bc; break;
case 0x378:
port2 = 0x778; break;
case 0x278:
port2 = 0x678; break;
default:
printk(KERN_INFO "parport_pc: Weird VIA parport base 0x%X, ignoring\n",
printk(KERN_INFO
"parport_pc: Weird VIA parport base 0x%X, ignoring\n",
port1);
return 0;
}
@@ -2813,8 +2880,8 @@ static struct parport_pc_pci {
struct { /* BAR (base address registers) numbers in the config
space header */
int lo;
int hi; /* -1 if not there, >6 for offset-method (max
BAR is 6) */
int hi;
/* -1 if not there, >6 for offset-method (max BAR is 6) */
} addr[4];
/* If set, this is called immediately after pci_enable_device.
@@ -2875,11 +2942,14 @@ static struct parport_pc_pci {
/* oxsemi_pcie_pport */ { 1, { { 0, 1 }, } },
/* aks_0100 */ { 1, { { 0, -1 }, } },
/* mobility_pp */ { 1, { { 0, 1 }, } },
/* netmos_9705 */ { 1, { { 0, -1 }, } }, /* untested */
/* netmos_9715 */ { 2, { { 0, 1 }, { 2, 3 },} }, /* untested */
/* netmos_9755 */ { 2, { { 0, 1 }, { 2, 3 },} }, /* untested */
/* netmos_9805 */ { 1, { { 0, -1 }, } }, /* untested */
/* netmos_9815 */ { 2, { { 0, -1 }, { 2, -1 }, } }, /* untested */
/* The netmos entries below are untested */
/* netmos_9705 */ { 1, { { 0, -1 }, } },
/* netmos_9715 */ { 2, { { 0, 1 }, { 2, 3 },} },
/* netmos_9755 */ { 2, { { 0, 1 }, { 2, 3 },} },
/* netmos_9805 */ { 1, { { 0, -1 }, } },
/* netmos_9815 */ { 2, { { 0, -1 }, { 2, -1 }, } },
/* quatech_sppxp100 */ { 1, { { 0, 1 }, } },
};
@@ -2942,7 +3012,8 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
{ 0x9710, 0x9805, 0x1000, 0x0010, 0, 0, titan_1284p1 },
{ 0x9710, 0x9815, 0x1000, 0x0020, 0, 0, titan_1284p2 },
/* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/
{ 0x14db, 0x2120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1p}, /* AFAVLAB_TK9902 */
/* AFAVLAB_TK9902 */
{ 0x14db, 0x2120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1p},
{ 0x14db, 0x2121, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2p},
{ PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952PP,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_952 },
@@ -3005,7 +3076,8 @@ static int parport_pc_pci_probe (struct pci_dev *dev,
/* This is a PCI card */
i -= last_sio;
count = 0;
if ((err = pci_enable_device (dev)) != 0)
err = pci_enable_device(dev);
if (err)
return err;
data = kmalloc(sizeof(struct pci_parport_data), GFP_KERNEL);
@@ -3103,8 +3175,9 @@ static int __init parport_pc_init_superio (int autoirq, int autodma)
if (id == NULL || id->driver_data >= last_sio)
continue;
if (parport_pc_superio_info[id->driver_data].probe
(pdev, autoirq, autodma,parport_pc_superio_info[id->driver_data].via)) {
if (parport_pc_superio_info[id->driver_data].probe(
pdev, autoirq, autodma,
parport_pc_superio_info[id->driver_data].via)) {
ret++;
}
}
@@ -3113,7 +3186,10 @@ static int __init parport_pc_init_superio (int autoirq, int autodma)
}
#else
static struct pci_driver parport_pc_pci_driver;
static int __init parport_pc_init_superio(int autoirq, int autodma) {return 0;}
static int __init parport_pc_init_superio(int autoirq, int autodma)
{
return 0;
}
#endif /* CONFIG_PCI */
#ifdef CONFIG_PNP
@@ -3128,7 +3204,8 @@ static const struct pnp_device_id parport_pc_pnp_tbl[] = {
MODULE_DEVICE_TABLE(pnp, parport_pc_pnp_tbl);
static int parport_pc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id)
static int parport_pc_pnp_probe(struct pnp_dev *dev,
const struct pnp_device_id *id)
{
struct parport *pdata;
unsigned long io_lo, io_hi;
@@ -3159,8 +3236,8 @@ static int parport_pc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id
dma = PARPORT_DMA_NONE;
dev_info(&dev->dev, "reported by %s\n", dev->protocol->name);
if (!(pdata = parport_pc_probe_port(io_lo, io_hi,
irq, dma, &dev->dev, 0)))
pdata = parport_pc_probe_port(io_lo, io_hi, irq, dma, &dev->dev, 0);
if (pdata == NULL)
return -ENODEV;
pnp_set_drvdata(dev, pdata);
@@ -3263,11 +3340,18 @@ static void __init parport_pc_find_ports (int autoirq, int autodma)
* syntax and keep in mind that code below is a cleaned up version.
*/
static int __initdata io[PARPORT_PC_MAX_PORTS+1] = { [0 ... PARPORT_PC_MAX_PORTS] = 0 };
static int __initdata io_hi[PARPORT_PC_MAX_PORTS+1] =
{ [0 ... PARPORT_PC_MAX_PORTS] = PARPORT_IOHI_AUTO };
static int __initdata dmaval[PARPORT_PC_MAX_PORTS] = { [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_DMA_NONE };
static int __initdata irqval[PARPORT_PC_MAX_PORTS] = { [0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_IRQ_PROBEONLY };
static int __initdata io[PARPORT_PC_MAX_PORTS+1] = {
[0 ... PARPORT_PC_MAX_PORTS] = 0
};
static int __initdata io_hi[PARPORT_PC_MAX_PORTS+1] = {
[0 ... PARPORT_PC_MAX_PORTS] = PARPORT_IOHI_AUTO
};
static int __initdata dmaval[PARPORT_PC_MAX_PORTS] = {
[0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_DMA_NONE
};
static int __initdata irqval[PARPORT_PC_MAX_PORTS] = {
[0 ... PARPORT_PC_MAX_PORTS-1] = PARPORT_IRQ_PROBEONLY
};
static int __init parport_parse_param(const char *s, int *val,
int automatic, int none, int nofifo)
@@ -3308,7 +3392,8 @@ static int __init parport_parse_dma(const char *dmastr, int *val)
#ifdef CONFIG_PCI
static int __init parport_init_mode_setup(char *str)
{
printk(KERN_DEBUG "parport_pc.c: Specified parameter parport_init_mode=%s\n", str);
printk(KERN_DEBUG
"parport_pc.c: Specified parameter parport_init_mode=%s\n", str);
if (!strcmp(str, "spp"))
parport_init_mode = 1;
@@ -3343,7 +3428,8 @@ module_param(verbose_probing, int, 0644);
#endif
#ifdef CONFIG_PCI
static char *init_mode;
MODULE_PARM_DESC(init_mode, "Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)");
MODULE_PARM_DESC(init_mode,
"Initialise mode for VIA VT8231 port (spp, ps2, epp, ecp or ecpepp)");
module_param(init_mode, charp, 0);
#endif
@@ -3398,7 +3484,7 @@ static int __init parse_parport_params(void)
#else
static int parport_setup_ptr __initdata = 0;
static int parport_setup_ptr __initdata;
/*
* Acceptable parameters:
@@ -3495,7 +3581,7 @@ static int __init parport_pc_init(void)
for (i = 0; i < PARPORT_PC_MAX_PORTS; i++) {
if (!io[i])
break;
if ((io_hi[i]) == PARPORT_IOHI_AUTO)
if (io_hi[i] == PARPORT_IOHI_AUTO)
io_hi[i] = 0x400 + io[i];
parport_pc_probe_port(io[i], io_hi[i],
irqval[i], dmaval[i], NULL, 0);