diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-03-07 12:12:44 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-09 22:03:09 +0100 |
commit | a3aca3dabbcf00f2088d472f27755c29acaa992e (patch) | |
tree | c6b23c1d51a7eab5bee4137d344264974ddfc432 /drivers/firewire/fw-device-cdev.c | |
parent | 344bbc4de14e70d03f09bff04bb7d161b8a0d28c (diff) | |
download | lwn-a3aca3dabbcf00f2088d472f27755c29acaa992e.tar.gz lwn-a3aca3dabbcf00f2088d472f27755c29acaa992e.zip |
firewire: Switch cdev code over to use register_chrdev and keep a list of devices.
The old mechanism kept a struct cdev for each fw device, but fops->release
would reference this struct after the device got freed in some cases.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-device-cdev.c')
-rw-r--r-- | drivers/firewire/fw-device-cdev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c index d9f3bb2be1c2..54ef27b2adb5 100644 --- a/drivers/firewire/fw-device-cdev.c +++ b/drivers/firewire/fw-device-cdev.c @@ -28,6 +28,7 @@ #include <linux/poll.h> #include <linux/delay.h> #include <linux/mm.h> +#include <linux/idr.h> #include <linux/compat.h> #include <asm/uaccess.h> #include "fw-transaction.h" @@ -103,7 +104,9 @@ static int fw_device_op_open(struct inode *inode, struct file *file) struct client *client; unsigned long flags; - device = container_of(inode->i_cdev, struct fw_device, cdev); + device = fw_device_from_devt(inode->i_rdev); + if (device == NULL) + return -ENODEV; client = kzalloc(sizeof *client, GFP_KERNEL); if (client == NULL) |