Skip to content
Snippets Groups Projects
Commit 10091c36 authored by Federico Vaga's avatar Federico Vaga
Browse files

chardev.c: change zio_class variable name and class name


This has no effect for ZIO users

Signed-off-by: default avatarFederico Vaga <federico.vaga@gmail.com>
Acked-by: default avatarAlessandro Rubini <rubini@gnudd.com>
parent 2e9f3416
No related merge requests found
...@@ -39,12 +39,12 @@ static char *zio_devnode(struct device *dev, mode_t *mode) ...@@ -39,12 +39,12 @@ static char *zio_devnode(struct device *dev, mode_t *mode)
} }
/* /*
* zio_class: don't use class_create to create class because it doesn't permit * zio_cdev_class: don't use class_create to create class, as it doesn't permit
* to insert a set of class attributes. This structure is the exact * to insert a set of class attributes. This structure is the exact
* reproduction of what class_create does but with some additional settings. * reproduction of what class_create does but with some additional settings.
*/ */
static struct class zio_class = { static struct class zio_cdev_class = {
.name = "zio-char-devices", .name = "zio-cdev",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.dev_uevent = zio_dev_uevent, .dev_uevent = zio_dev_uevent,
.devnode = zio_devnode, .devnode = zio_devnode,
...@@ -182,7 +182,7 @@ int zio_create_chan_devices(struct zio_channel *chan) ...@@ -182,7 +182,7 @@ int zio_create_chan_devices(struct zio_channel *chan)
devt_c = zstat->basedev + chan->cset->minor + chan->index * 2; devt_c = zstat->basedev + chan->cset->minor + chan->index * 2;
pr_debug("%s:%d dev_t=0x%x\n", __func__, __LINE__, devt_c); pr_debug("%s:%d dev_t=0x%x\n", __func__, __LINE__, devt_c);
chan->ctrl_dev = device_create(&zio_class, NULL, devt_c, &chan->flags, chan->ctrl_dev = device_create(&zio_cdev_class, NULL, devt_c, &chan->flags,
"%s-%i-%i-ctrl", "%s-%i-%i-ctrl",
dev_name(&chan->cset->zdev->head.dev), dev_name(&chan->cset->zdev->head.dev),
chan->cset->index, chan->cset->index,
...@@ -194,7 +194,7 @@ int zio_create_chan_devices(struct zio_channel *chan) ...@@ -194,7 +194,7 @@ int zio_create_chan_devices(struct zio_channel *chan)
devt_d = devt_c + 1; devt_d = devt_c + 1;
pr_debug("%s:%d dev_t=0x%x\n", __func__, __LINE__, devt_d); pr_debug("%s:%d dev_t=0x%x\n", __func__, __LINE__, devt_d);
chan->data_dev = device_create(&zio_class, NULL, devt_d, &chan->flags, chan->data_dev = device_create(&zio_cdev_class, NULL, devt_d, &chan->flags,
"%s-%i-%i-data", "%s-%i-%i-data",
dev_name(&chan->cset->zdev->head.dev), dev_name(&chan->cset->zdev->head.dev),
chan->cset->index, chan->cset->index,
...@@ -207,7 +207,7 @@ int zio_create_chan_devices(struct zio_channel *chan) ...@@ -207,7 +207,7 @@ int zio_create_chan_devices(struct zio_channel *chan)
return 0; return 0;
out_data: out_data:
device_destroy(&zio_class, chan->ctrl_dev->devt); device_destroy(&zio_cdev_class, chan->ctrl_dev->devt);
out: out:
return err; return err;
} }
...@@ -215,15 +215,15 @@ out: ...@@ -215,15 +215,15 @@ out:
void zio_destroy_chan_devices(struct zio_channel *chan) void zio_destroy_chan_devices(struct zio_channel *chan)
{ {
pr_debug("%s\n", __func__); pr_debug("%s\n", __func__);
device_destroy(&zio_class, chan->data_dev->devt); device_destroy(&zio_cdev_class, chan->data_dev->devt);
device_destroy(&zio_class, chan->ctrl_dev->devt); device_destroy(&zio_cdev_class, chan->ctrl_dev->devt);
} }
int zio_register_cdev() int zio_register_cdev()
{ {
int err; int err;
err = class_register(&zio_class); err = class_register(&zio_cdev_class);
if (err) { if (err) {
pr_err("%s: unable to register class\n", __func__); pr_err("%s: unable to register class\n", __func__);
goto out; goto out;
...@@ -247,15 +247,16 @@ int zio_register_cdev() ...@@ -247,15 +247,16 @@ int zio_register_cdev()
out_cdev: out_cdev:
unregister_chrdev_region(zstat->basedev, ZIO_NR_MINORS); unregister_chrdev_region(zstat->basedev, ZIO_NR_MINORS);
out: out:
class_unregister(&zio_class); class_unregister(&zio_cdev_class);
zio_ffa_destroy(zstat->minors); zio_ffa_destroy(zstat->minors);
return err; return err;
} }
void zio_unregister_cdev() void zio_unregister_cdev()
{ {
cdev_del(&zstat->chrdev); cdev_del(&zstat->chrdev);
unregister_chrdev_region(zstat->basedev, ZIO_NR_MINORS); unregister_chrdev_region(zstat->basedev, ZIO_NR_MINORS);
class_unregister(&zio_class); class_unregister(&zio_cdev_class);
zio_ffa_destroy(zstat->minors); zio_ffa_destroy(zstat->minors);
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment