aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/ccwgroup.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/cio/ccwgroup.c')
-rw-r--r--drivers/s390/cio/ccwgroup.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index f26a2ee3aad8..38954f5cd14c 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -152,7 +152,6 @@ ccwgroup_create(struct device *root,
152 struct ccwgroup_device *gdev; 152 struct ccwgroup_device *gdev;
153 int i; 153 int i;
154 int rc; 154 int rc;
155 int del_drvdata;
156 155
157 if (argc > 256) /* disallow dumb users */ 156 if (argc > 256) /* disallow dumb users */
158 return -EINVAL; 157 return -EINVAL;
@@ -163,7 +162,6 @@ ccwgroup_create(struct device *root,
163 162
164 atomic_set(&gdev->onoff, 0); 163 atomic_set(&gdev->onoff, 0);
165 164
166 del_drvdata = 0;
167 for (i = 0; i < argc; i++) { 165 for (i = 0; i < argc; i++) {
168 gdev->cdev[i] = get_ccwdev_by_busid(cdrv, argv[i]); 166 gdev->cdev[i] = get_ccwdev_by_busid(cdrv, argv[i]);
169 167
@@ -180,18 +178,14 @@ ccwgroup_create(struct device *root,
180 rc = -EINVAL; 178 rc = -EINVAL;
181 goto free_dev; 179 goto free_dev;
182 } 180 }
183 }
184 for (i = 0; i < argc; i++)
185 gdev->cdev[i]->dev.driver_data = gdev; 181 gdev->cdev[i]->dev.driver_data = gdev;
186 del_drvdata = 1; 182 }
187 183
188 gdev->creator_id = creator_id; 184 gdev->creator_id = creator_id;
189 gdev->count = argc; 185 gdev->count = argc;
190 gdev->dev = (struct device ) { 186 gdev->dev.bus = &ccwgroup_bus_type;
191 .bus = &ccwgroup_bus_type, 187 gdev->dev.parent = root;
192 .parent = root, 188 gdev->dev.release = ccwgroup_release;
193 .release = ccwgroup_release,
194 };
195 189
196 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s", 190 snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s",
197 gdev->cdev[0]->dev.bus_id); 191 gdev->cdev[0]->dev.bus_id);
@@ -226,9 +220,9 @@ error:
226free_dev: 220free_dev:
227 for (i = 0; i < argc; i++) 221 for (i = 0; i < argc; i++)
228 if (gdev->cdev[i]) { 222 if (gdev->cdev[i]) {
229 put_device(&gdev->cdev[i]->dev); 223 if (gdev->cdev[i]->dev.driver_data == gdev)
230 if (del_drvdata)
231 gdev->cdev[i]->dev.driver_data = NULL; 224 gdev->cdev[i]->dev.driver_data = NULL;
225 put_device(&gdev->cdev[i]->dev);
232 } 226 }
233 kfree(gdev); 227 kfree(gdev);
234 return rc; 228 return rc;
@@ -395,10 +389,8 @@ int
395ccwgroup_driver_register (struct ccwgroup_driver *cdriver) 389ccwgroup_driver_register (struct ccwgroup_driver *cdriver)
396{ 390{
397 /* register our new driver with the core */ 391 /* register our new driver with the core */
398 cdriver->driver = (struct device_driver) { 392 cdriver->driver.bus = &ccwgroup_bus_type;
399 .bus = &ccwgroup_bus_type, 393 cdriver->driver.name = cdriver->name;
400 .name = cdriver->name,
401 };
402 394
403 return driver_register(&cdriver->driver); 395 return driver_register(&cdriver->driver);
404} 396}