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: