[Linux-parport] Re: RFC: add udev support to parport_pc

Jan Engelhardt jengelh at linux01.gwdg.de
Sat Dec 31 12:38:42 EST 2005


> +	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/



More information about the Linux-parport mailing list