Re: RFC: add udev support to parport_pc
From: Jan Engelhardt
Date: Sat Dec 31 2005 - 12:39:50 EST
> + parallel_class = class_create(THIS_MODULE, "lp");
> + if (p->base == 888) /* 888 is dec for 378h */
I would prefer to actually see == 0x378 in the code, because the
hexademical number is what you see everywhere else, such as the BIOS POST
and /proc/ioports. This also applies to 0x278 and 0x3BC below.
> + {
> + class_device_create(parallel_class, NULL, MKDEV(6, 0), NULL,
> "lp0");
> + class_device_create(parallel_class, NULL, MKDEV(99, 0), NULL,
> "parport0");
> + }
Background info before: Because I burnt my on-board LPT port (applying too
much volts or milliamps), I bought a dual-slot PCI add-in card. This card
provides "parport1" and "parport2" at ports at 0xC800 and 0xC00
(/proc/ioports).
There are a number of problems in your code:
1- testing just for 0x378/0x278/0x3BC is not enough
2- parport0 could be 0xC800 (address may vary) if you do not
have any onboard LPT ports.
2=> that is why I think you should not reserver "lp0"/"parport0"
for 0x378.
All this applies to the other chunks too of course...:
> + if (p->base == 632) /* 632 is dec for 278h */
> + {
> + class_device_create(parallel_class, NULL, MKDEV(6, 1), NULL,
> "lp1");
> + class_device_create(parallel_class, NULL, MKDEV(99, 1), NULL,
> "parport1");
> + }
> +
> + if (p->base == 956) /* 956 is dec for 3BCh */
> + {
> + class_device_create(parallel_class, NULL, MKDEV(6, 2), NULL,
> "lp2");
> + class_device_create(parallel_class, NULL, MKDEV(99, 2), NULL,
> "parport2");
> + }
> +
> + class_device_destroy(parallel_class, MKDEV(99, 2));
> + class_device_destroy(parallel_class, MKDEV(6, 2));
> + class_device_destroy(parallel_class, MKDEV(99, 1));
> + class_device_destroy(parallel_class, MKDEV(6, 1));
> + class_device_destroy(parallel_class, MKDEV(99, 0));
> + class_device_destroy(parallel_class, MKDEV(6, 0));
> +
Jan Engelhardt
--
| Alphagate Systems, http://alphagate.hopto.org/
| jengelh's site, http://jengelh.hopto.org/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/