[Linux-parport] patch to parport_pc

hans yperman hansyperman at hotmail.com
Thu Nov 25 08:52:17 EST 2004


I had a bug when upgrading from linux 2.6.1 to 2.6.9: i could not load the 
floppy driver because a device called "winbond_check" took over its io 
ports.

The claim of these io ports is for port 0x3f2, claimed as part of the scan 
to 0x3f0 in detect_and_report_winbond(parport_pc.c line 1522 and 1536).  
What happens is that winbond_check does not release the ports after the 
autodetection.

A side effect of this is, when removing the modules parport_pc,parport and 
lp,
   cat /proc/ioports
crashes the kernel as nobody releases the ports, and they belong to nobody 
anymore.

I propose following changes to the source code:

a) parport_pc.c line 1448 in winbond_check: change to:

	if ((x_devid != devid) || (x_devrev != devrev) || (x_oldid != oldid))
    	    decode_winbond(io,key,devid,devrev,oldid);
	release_region(io, 3);

This always releases the ports and gets rid of an ugly 'goto out'.  It seems 
safe to release the ports 'io', because winbond_check,decode_winbond or 
their callees never store the value of this variable anywhere.

b) parport_pc.c line  1426 in winbond_check: change __FUNCTION__ to e.g. 
"parport_pc:winbond_check".

This way it is more easy to find the offending function.  "winbond_check"  
is not really helpful to trace the problem back to the parallel port.

I tested these changes on my computer, and it works flawlessly.  Nobody else 
tested it, unfortunately.

There is a function winbond_check2 just below winbond_check, that probably 
needs more or less the same changes, but i am not able to test this.

This is my very first change to the linux kernel, so better check everything 
twice before believing me.

If there are problems with this mail, please reply to me personally, as i 
can not subscribe to high volume mailing lists as linux_parport probably is.

Sincerely,

Hans Yperman

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




More information about the Linux-parport mailing list