* [PATCH 2.6.6-rc1] Add class support to drivers/char/ppdev.c
@ 2004-04-27 22:52 Hanna Linder
2004-04-28 0:29 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Hanna Linder @ 2004-04-27 22:52 UTC (permalink / raw)
To: linux-parport; +Cc: linux-kernel, greg, hannal
Here is a patch to add class support to drivers/char/ppdev.c. I have verified
it compiles and works on my system.
Please test or consider for inclusion.
Thanks
Hanna Linder
IBM Linux Technology Center
--------
diff -Nrup linux-2.6.6-rc1/drivers/char/ppdev.c linux-2.6.6-rc1p/drivers/char/ppdev.c
--- linux-2.6.6-rc1/drivers/char/ppdev.c 2004-04-14 18:36:01.000000000 -0700
+++ linux-2.6.6-rc1p/drivers/char/ppdev.c 2004-04-27 14:56:56.000000000 -0700
@@ -84,6 +84,8 @@ struct pp_struct {
long default_inactivity;
};
+static struct class_simple *ppdev_class;
+
/* pp_struct.flags bitfields */
#define PP_CLAIMED (1<<0)
#define PP_EXCL (1<<1)
@@ -752,29 +754,53 @@ static struct file_operations pp_fops =
static int __init ppdev_init (void)
{
- int i;
+ int i, err = 0;
if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) {
printk (KERN_WARNING CHRDEV ": unable to get major %d\n",
PP_MAJOR);
- return -EIO;
+ err = -EIO;
+ goto out;
+ }
+ ppdev_class = class_simple_create(THIS_MODULE, CHRDEV);
+ if (IS_ERR(ppdev_class)) {
+ err = PTR_ERR(ppdev_class);
+ goto out_chrdev;
}
devfs_mk_dir("parports");
for (i = 0; i < PARPORT_MAX; i++) {
- devfs_mk_cdev(MKDEV(PP_MAJOR, i),
+ class_simple_device_add(ppdev_class, MKDEV(PP_MAJOR, i),
+ NULL, "parport%d", i);
+ err = devfs_mk_cdev(MKDEV(PP_MAJOR, i),
S_IFCHR | S_IRUGO | S_IWUGO, "parports/%d", i);
+ if (err)
+ goto out_class;
}
printk (KERN_INFO PP_VERSION "\n");
- return 0;
+ err = 0;
+ goto out;
+
+out_class:
+ for (i = 0; i < PARPORT_MAX; i++)
+ class_simple_device_remove(MKDEV(PP_MAJOR, i));
+ class_simple_destroy(ppdev_class);
+out_chrdev:
+ unregister_chrdev(PP_MAJOR, CHRDEV);
+out:
+ return err;
+
}
static void __exit ppdev_cleanup (void)
{
int i;
/* Clean up all parport stuff */
- for (i = 0; i < PARPORT_MAX; i++)
+ for (i = 0; i < PARPORT_MAX; i++) {
+ class_simple_device_remove(MKDEV(PP_MAJOR, i));
devfs_remove("parports/%d", i);
+ }
+ class_simple_destroy(ppdev_class);
devfs_remove("parports");
unregister_chrdev (PP_MAJOR, CHRDEV);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2.6.6-rc1] Add class support to drivers/char/ppdev.c
2004-04-27 22:52 [PATCH 2.6.6-rc1] Add class support to drivers/char/ppdev.c Hanna Linder
@ 2004-04-28 0:29 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-04-28 0:29 UTC (permalink / raw)
To: Hanna Linder; +Cc: linux-parport, linux-kernel
On Tue, Apr 27, 2004 at 03:52:28PM -0700, Hanna Linder wrote:
>
> Here is a patch to add class support to drivers/char/ppdev.c. I have verified
> it compiles and works on my system.
>
> Please test or consider for inclusion.
Sorry, but I already have a pending patch for this :(
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-04-28 0:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-27 22:52 [PATCH 2.6.6-rc1] Add class support to drivers/char/ppdev.c Hanna Linder
2004-04-28 0:29 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox