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>
diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c
index d9f3bb2..54ef27b 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 @@
 	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)