u8 data[];
};
-static struct class *raw_class;
+static const struct class raw_class = {
+ .name = "gb_raw",
+};
+
static int raw_major;
static const struct file_operations raw_fops;
static DEFINE_IDA(minors);
if (retval)
goto error_connection_disable;
- raw->device = device_create(raw_class, &connection->bundle->dev,
+ raw->device = device_create(&raw_class, &connection->bundle->dev,
raw->dev, raw, "gb!raw%d", minor);
if (IS_ERR(raw->device)) {
retval = PTR_ERR(raw->device);
struct raw_data *temp;
// FIXME - handle removing a connection when the char device node is open.
- device_destroy(raw_class, raw->dev);
+ device_destroy(&raw_class, raw->dev);
cdev_del(&raw->cdev);
gb_connection_disable(connection);
ida_simple_remove(&minors, MINOR(raw->dev));
dev_t dev;
int retval;
- raw_class = class_create("gb_raw");
- if (IS_ERR(raw_class)) {
- retval = PTR_ERR(raw_class);
+ retval = class_register(&raw_class);
+ if (retval)
goto error_class;
- }
retval = alloc_chrdev_region(&dev, 0, NUM_MINORS, "gb_raw");
if (retval < 0)
error_gb:
unregister_chrdev_region(dev, NUM_MINORS);
error_chrdev:
- class_destroy(raw_class);
+ class_unregister(&raw_class);
error_class:
return retval;
}
{
greybus_deregister(&gb_raw_driver);
unregister_chrdev_region(MKDEV(raw_major, 0), NUM_MINORS);
- class_destroy(raw_class);
+ class_unregister(&raw_class);
ida_destroy(&minors);
}
module_exit(raw_exit);