&sfp->attr_unit_number);
        }
        pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev);
-       sfp->class_dev->driver_data = NULL;
+       dev_set_drvdata(sfp->class_dev, NULL);
        device_unregister(sfp->class_dev);
        sfp->class_dev = NULL;
 }
                                     struct device_attribute *attr, char *buf)
 {
        struct pvr2_sysfs *sfp;
-       sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+       sfp = dev_get_drvdata(class_dev);
        if (!sfp) return -EINVAL;
        return scnprintf(buf,PAGE_SIZE,"%d\n",
                         pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw,
                             struct device_attribute *attr, char *buf)
 {
        struct pvr2_sysfs *sfp;
-       sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+       sfp = dev_get_drvdata(class_dev);
        if (!sfp) return -EINVAL;
        return scnprintf(buf,PAGE_SIZE,"%s\n",
                         pvr2_hdw_get_bus_info(sfp->channel.hdw));
                             struct device_attribute *attr, char *buf)
 {
        struct pvr2_sysfs *sfp;
-       sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+       sfp = dev_get_drvdata(class_dev);
        if (!sfp) return -EINVAL;
        return scnprintf(buf,PAGE_SIZE,"%s\n",
                         pvr2_hdw_get_type(sfp->channel.hdw));
                             struct device_attribute *attr, char *buf)
 {
        struct pvr2_sysfs *sfp;
-       sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+       sfp = dev_get_drvdata(class_dev);
        if (!sfp) return -EINVAL;
        return scnprintf(buf,PAGE_SIZE,"%s\n",
                         pvr2_hdw_get_desc(sfp->channel.hdw));
                                           char *buf)
 {
        struct pvr2_sysfs *sfp;
-       sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+       sfp = dev_get_drvdata(class_dev);
        if (!sfp) return -EINVAL;
        return scnprintf(buf,PAGE_SIZE,"%d\n",
                         pvr2_hdw_v4l_get_minor_number(sfp->channel.hdw,
                                struct device_attribute *attr, char *buf)
 {
        struct pvr2_sysfs *sfp;
-       sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+       sfp = dev_get_drvdata(class_dev);
        if (!sfp) return -EINVAL;
        return scnprintf(buf,PAGE_SIZE,"%d\n",
                         pvr2_hdw_get_unit_number(sfp->channel.hdw));
        class_dev->parent = &usb_dev->dev;
 
        sfp->class_dev = class_dev;
-       class_dev->driver_data = sfp;
+       dev_set_drvdata(class_dev, sfp);
        ret = device_register(class_dev);
        if (ret) {
                pvr2_trace(PVR2_TRACE_ERROR_LEGS,
                              struct device_attribute *attr, char *buf)
 {
        struct pvr2_sysfs *sfp;
-       sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+       sfp = dev_get_drvdata(class_dev);
        if (!sfp) return -EINVAL;
        pvr2_hdw_trigger_module_log(sfp->channel.hdw);
        return pvr2_debugifc_print_info(sfp->channel.hdw,buf,PAGE_SIZE);
                             struct device_attribute *attr, char *buf)
 {
        struct pvr2_sysfs *sfp;
-       sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+       sfp = dev_get_drvdata(class_dev);
        if (!sfp) return -EINVAL;
        return pvr2_debugifc_print_status(sfp->channel.hdw,buf,PAGE_SIZE);
 }
        struct pvr2_sysfs *sfp;
        int ret;
 
-       sfp = (struct pvr2_sysfs *)class_dev->driver_data;
+       sfp = dev_get_drvdata(class_dev);
        if (!sfp) return -EINVAL;
 
        ret = pvr2_debugifc_docmd(sfp->channel.hdw,buf,count);