- class_dev = kmalloc(sizeof(*class_dev), GFP_KERNEL);
- if (class_dev) {
- memset(class_dev, 0x00, sizeof(struct class_device));
- class_dev->class = &usb_class;
- class_dev->dev = &intf->dev;
-
- temp = strrchr(name, '/');
- if (temp && (temp[1] != 0x00))
- ++temp;
- else
- temp = name;
- snprintf(class_dev->class_id, BUS_ID_SIZE, "%s", temp);
- class_set_devdata(class_dev, (void *)(long)intf->minor);
- class_device_register(class_dev);
- class_device_create_file(class_dev, &class_device_attr_dev);
- intf->class_dev = class_dev;
+ snprintf(name, BUS_ID_SIZE, class_driver->name, minor - minor_base);
+ temp = strrchr(name, '/');
+ if (temp && (temp[1] != 0x00))
+ ++temp;
+ else
+ temp = name;
+ intf->class_dev = class_device_create(usb_class->class, NULL,
+ MKDEV(USB_MAJOR, minor),
+ &intf->dev, "%s", temp);
+ if (IS_ERR(intf->class_dev)) {
+ spin_lock (&minor_lock);
+ usb_minors[intf->minor] = NULL;
+ spin_unlock (&minor_lock);
+ retval = PTR_ERR(intf->class_dev);