aboutsummaryrefslogtreecommitdiffstats
path: root/testing/dahdi-linux-vserver/dahdi-2.2.0.2-driver_data-2.6.32.patch
blob: 3085218c09fa619954abd96b35c8e39269d8ea4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
diff -uNr dahdi-linux-2.2.0.2.ORIg/drivers/dahdi/xpp/xbus-sysfs.c dahdi-linux-2.2.0.2/drivers/dahdi/xpp/xbus-sysfs.c
--- dahdi-linux-2.2.0.2.ORIg/drivers/dahdi/xpp/xbus-sysfs.c	2009-10-22 18:04:47.000000000 +0100
+++ dahdi-linux-2.2.0.2/drivers/dahdi/xpp/xbus-sysfs.c	2009-10-22 18:05:54.000000000 +0100
@@ -707,7 +707,11 @@
 	dev->parent = &xbus->astribank;
 	dev_set_name(dev, "%02d:%1x:%1x", xbus->num, xpd->addr.unit, 
 			xpd->addr.subunit);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
+	dev_set_drvdata(dev, xpd);
+#else
 	dev->driver_data = xpd;
+#endif
 	dev->release = xpd_release;
 	ret = device_register(dev);
 	if(ret) {
@@ -728,11 +732,21 @@
 	BUG_ON(!xbus);
 	XPD_DBG(DEVICES, xpd, "SYSFS\n");
 	dev = &xpd->xpd_dev;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
+	if(!dev_get_drvdata(dev))
+		return;
+	BUG_ON(dev_get_drvdata(dev) != xpd);
+#else
 	if(!dev->driver_data)
 		return;
 	BUG_ON(dev->driver_data != xpd);
+#endif
 	device_unregister(dev);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
+	dev_set_drvdata(dev, NULL);
+#else
 	dev->driver_data = NULL;
+#endif
 }
 
 /*--------- Sysfs Device handling ----*/
@@ -746,9 +760,15 @@
 	astribank = &xbus->astribank;
 	BUG_ON(!astribank);
 	sysfs_remove_link(&astribank->kobj, "transport");
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
+	if(!dev_get_drvdata(astribank))
+		return;
+	BUG_ON(dev_get_drvdata(astribank) != xbus);
+#else
 	if(!astribank->driver_data)
 		return;
 	BUG_ON(astribank->driver_data != xbus);
+#endif
 	device_unregister(&xbus->astribank);
 }
 
@@ -764,18 +784,30 @@
 	astribank->bus = &toplevel_bus_type;
 	astribank->parent = xbus->transport.transport_device;
 	dev_set_name(astribank, "xbus-%02d", xbus->num);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
+	dev_set_drvdata(astribank, xbus);
+#else
 	astribank->driver_data = xbus;
+#endif
 	astribank->release = astribank_release;
 	ret = device_register(astribank);
 	if(ret) {
 		XBUS_ERR(xbus, "%s: device_register failed: %d\n", __FUNCTION__, ret);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
+		dev_set_drvdata(astribank, NULL);
+#else
 		astribank->driver_data = NULL;
+#endif
 		goto out;
 	}
 	ret = sysfs_create_link(&astribank->kobj, &astribank->parent->kobj, "transport");
 	if(ret < 0) {
 		XBUS_ERR(xbus, "%s: sysfs_create_link failed: %d\n", __FUNCTION__, ret);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
+		dev_set_drvdata(astribank, NULL);
+#else
 		astribank->driver_data = NULL;
+#endif
 		goto out;
 	}
 out: