s390/cio: remove ccw_device_add() wrapper
authorJulian Wiedmann <jwi@linux.ibm.com>
Mon, 30 Nov 2020 08:19:57 +0000 (10:19 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 19 Jan 2021 11:29:25 +0000 (12:29 +0100)
Set the bus type when initializing the cdev structure. The device core
won't act on it until we call device_add().

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
drivers/s390/cio/device.c

index 4b0a7cb..df46373 100644 (file)
@@ -621,14 +621,6 @@ static const struct attribute_group *ccwdev_attr_groups[] = {
        NULL,
 };
 
-static int ccw_device_add(struct ccw_device *cdev)
-{
-       struct device *dev = &cdev->dev;
-
-       dev->bus = &ccw_bus_type;
-       return device_add(dev);
-}
-
 static int match_dev_id(struct device *dev, const void *data)
 {
        struct ccw_device *cdev = to_ccwdev(dev);
@@ -739,6 +731,7 @@ static int io_subchannel_initialize_dev(struct subchannel *sch,
        cdev->ccwlock = sch->lock;
        cdev->dev.parent = &sch->dev;
        cdev->dev.release = ccw_device_release;
+       cdev->dev.bus = &ccw_bus_type;
        cdev->dev.groups = ccwdev_attr_groups;
        /* Do first half of device_register. */
        device_initialize(&cdev->dev);
@@ -840,7 +833,7 @@ static void io_subchannel_register(struct ccw_device *cdev)
                kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
        }
        /* make it known to the system */
-       ret = ccw_device_add(cdev);
+       ret = device_add(&cdev->dev);
        if (ret) {
                CIO_MSG_EVENT(0, "Could not register ccw dev 0.%x.%04x: %d\n",
                              cdev->private->dev_id.ssid,
@@ -1052,7 +1045,7 @@ static int io_subchannel_probe(struct subchannel *sch)
                        kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
                }
                cdev = sch_get_cdev(sch);
-               rc = ccw_device_add(cdev);
+               rc = device_add(&cdev->dev);
                if (rc) {
                        /* Release online reference. */
                        put_device(&cdev->dev);