mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jason Dravet" <dravet@hotmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-parport@lists.infradead.org
Subject: RFC: add udev support to parport_pc
Date: Sat, 31 Dec 2005 11:20:00 -0600	[thread overview]
Message-ID: <BAY103-F5ABE5F52E47CC9DD71D21DF2B0@phx.gbl> (raw)

Here is a patch to parport_pc.c that adds udev support.  Without it sysfs 
does not have enough information to give to udev so the lp and parport nodes 
can be created.  The only problem I have is the kernel_oops when I do the 
following: insmod parport, insmod parport_pc, rmmod parport_pc, rmmod 
parport, insmod parport, insmod parport_pc, rmmod parport_pc, kernel oops.  
>From the part of the traceback I can read the problem is in parport_pc_exit. 
  Any help in tracking down the problem would be appreciated.  If this is 
acceptable how can I get this added to the mainline?  This is my first patch 
so please be gentle.

Thanks,
Jason Dravet

Signed-off-by: Jason Dravet <dravet@hotmail.com>
--- /usr/src/linux-2.6.14/drivers/parport/parport_pc.c.orig	2005-12-30 
13:52:48.000000000 -0600
+++ /usr/src/linux-2.6.14/drivers/parport/parport_pc.c	2005-12-30 
19:56:20.000000000 -0600
@@ -55,6 +55,7 @@
#include <linux/pci.h>
#include <linux/pnp.h>
#include <linux/sysctl.h>
+#include <linux/sysfs.h>

#include <asm/io.h>
#include <asm/dma.h>
@@ -99,6 +100,8 @@ static struct superio_struct {	/* For Su
	int dma;
} superios[NR_SUPERIOS] __devinitdata = { {0,},};

+static struct class *parallel_class;
+
static int user_specified;
#if defined(CONFIG_PARPORT_PC_SUPERIO) || \
        (defined(CONFIG_PARPORT_1284) && defined(CONFIG_PARPORT_PC_FIFO))
@@ -2232,6 +2235,25 @@ struct parport *parport_pc_probe_port (u
                                            is mandatory (see above) */
		p->dma = PARPORT_DMA_NONE;

+	parallel_class = class_create(THIS_MODULE, "lp");
+	if (p->base == 888) /* 888 is dec for 378h */
+	{
+		class_device_create(parallel_class, NULL, MKDEV(6, 0), NULL, "lp0");
+		class_device_create(parallel_class, NULL, MKDEV(99, 0), NULL, 
"parport0");
+	}
+
+	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");
+	}
+
#ifdef CONFIG_PARPORT_PC_FIFO
	if (parport_ECP_supported(p) &&
	    p->dma != PARPORT_DMA_NOFIFO &&
@@ -3406,6 +3428,13 @@ static void __exit parport_pc_exit(void)
	if (pnp_registered_parport)
		pnp_unregister_driver (&parport_pc_pnp_driver);

+	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));
+
	spin_lock(&ports_lock);
	while (!list_empty(&ports_list)) {
		struct parport_pc_private *priv;



             reply	other threads:[~2005-12-31 17:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-31 17:20 Jason Dravet [this message]
2005-12-31 17:38 ` Jan Engelhardt
2005-12-31 18:07   ` Jason Dravet
2005-12-31 20:50     ` Jan Engelhardt
2005-12-31 19:22   ` Jason Dravet
2005-12-31 17:59 ` Jiri Slaby
2005-12-31 18:14   ` Jason Dravet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY103-F5ABE5F52E47CC9DD71D21DF2B0@phx.gbl \
    --to=dravet@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parport@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®