lp.c patch (was Re: [Fwd: Kernel 2.1.8x doesn't boot])

Tim Waugh (tim@cyberelk.demon.co.uk)
Tue, 24 Feb 1998 23:30:24 +0000 (GMT)


> MOLNAR Ingo wrote:
> >
> > Jussi, does it boot if you disable paralell port support?
>
> Yes! I also found that I was using old style kernel parameter for
> parallel port (lp=0x378,7). I reread the documentation and sources and
> changed that to new style (parport=0x378,7 lp=parport0) and now it works
> fine. Now I feel very stupid... Dunno why it booted with old MB. Only
> cosmetic problem is that kernel autodetects parallel port to IRQ8 which
> it "never" can't be. Same autodetection failure with both MBs.

I think the problem was that lp_setup wasn't checking `str' to see if it
was NULL before using it. Here's a patch (Linus, please apply it for
2.1.89). It fixes the problem for me:

--- linux-2.1.88+5/drivers/char/lp.c Sun Feb 22 17:06:23 1998
+++ linux/drivers/char/lp.c Tue Feb 24 23:20:50 1998
@@ -654,7 +654,14 @@

__initfunc(void lp_setup(char *str, int *ints))
{
- if (!strncmp(str, "parport", 7)) {
+ if (!str) {
+ if (ints[0] == 0 || ints[1] == 0) {
+ /* disable driver on "lp=" or "lp=0" */
+ parport[0] = LP_PARPORT_OFF;
+ } else {
+ printk(KERN_WARNING "warning: 'lp=0x%x' is deprecated, ignored\n", ints[1]);
+ }
+ } else if (!strncmp(str, "parport", 7)) {
int n = simple_strtoul(str+7, NULL, 10);
if (parport_ptr < LP_NO)
parport[parport_ptr++] = n;
@@ -667,13 +674,6 @@
parport[parport_ptr++] = LP_PARPORT_NONE;
} else if (!strcmp(str, "reset")) {
reset = 1;
- } else {
- if (ints[0] == 0 || ints[1] == 0) {
- /* disable driver on "lp=" or "lp=0" */
- parport[0] = LP_PARPORT_OFF;
- } else {
- printk(KERN_WARNING "warning: 'lp=0x%x' is deprecated, ignored\n", ints[1]);
- }
}
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu