|
@@ -42,16 +42,10 @@ dev_t iio_devt;
|
|
|
EXPORT_SYMBOL(iio_devt);
|
|
|
|
|
|
#define IIO_DEV_MAX 256
|
|
|
-static char *iio_devnode(struct device *dev, mode_t *mode)
|
|
|
-{
|
|
|
- return kasprintf(GFP_KERNEL, "iio/%s", dev_name(dev));
|
|
|
-}
|
|
|
-
|
|
|
-struct class iio_class = {
|
|
|
+struct bus_type iio_bus_type = {
|
|
|
.name = "iio",
|
|
|
- .devnode = iio_devnode,
|
|
|
};
|
|
|
-EXPORT_SYMBOL(iio_class);
|
|
|
+EXPORT_SYMBOL(iio_bus_type);
|
|
|
|
|
|
void __iio_change_event(struct iio_detected_event_list *ev,
|
|
|
int ev_code,
|
|
@@ -405,7 +399,7 @@ int iio_setup_ev_int(struct iio_event_interface *ev_int,
|
|
|
{
|
|
|
int ret, minor;
|
|
|
|
|
|
- ev_int->dev.class = &iio_class;
|
|
|
+ ev_int->dev.bus = &iio_bus_type;
|
|
|
ev_int->dev.parent = dev;
|
|
|
ev_int->dev.type = &iio_event_type;
|
|
|
device_initialize(&ev_int->dev);
|
|
@@ -478,23 +472,23 @@ static int __init iio_init(void)
|
|
|
{
|
|
|
int ret;
|
|
|
|
|
|
- /* Create sysfs class */
|
|
|
- ret = class_register(&iio_class);
|
|
|
+ /* Register sysfs bus */
|
|
|
+ ret = bus_register(&iio_bus_type);
|
|
|
if (ret < 0) {
|
|
|
printk(KERN_ERR
|
|
|
- "%s could not create sysfs class\n",
|
|
|
+ "%s could not register bus type\n",
|
|
|
__FILE__);
|
|
|
goto error_nothing;
|
|
|
}
|
|
|
|
|
|
ret = iio_dev_init();
|
|
|
if (ret < 0)
|
|
|
- goto error_unregister_class;
|
|
|
+ goto error_unregister_bus_type;
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
-error_unregister_class:
|
|
|
- class_unregister(&iio_class);
|
|
|
+error_unregister_bus_type:
|
|
|
+ bus_unregister(&iio_bus_type);
|
|
|
error_nothing:
|
|
|
return ret;
|
|
|
}
|
|
@@ -502,7 +496,7 @@ error_nothing:
|
|
|
static void __exit iio_exit(void)
|
|
|
{
|
|
|
iio_dev_exit();
|
|
|
- class_unregister(&iio_class);
|
|
|
+ bus_unregister(&iio_bus_type);
|
|
|
}
|
|
|
|
|
|
static int iio_device_register_sysfs(struct iio_dev *dev_info)
|
|
@@ -768,7 +762,7 @@ struct iio_dev *iio_allocate_device(void)
|
|
|
|
|
|
if (dev) {
|
|
|
dev->dev.type = &iio_dev_type;
|
|
|
- dev->dev.class = &iio_class;
|
|
|
+ dev->dev.bus = &iio_bus_type;
|
|
|
device_initialize(&dev->dev);
|
|
|
dev_set_drvdata(&dev->dev, (void *)dev);
|
|
|
mutex_init(&dev->mlock);
|