diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2012-06-04 13:29:41 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-06-05 07:23:36 -0400 |
commit | ed35ba9af4f40056a222dd7b67f39f1f6172185a (patch) | |
tree | fccc62e460c46f1b2de1576bb6cc57bacc4a3358 /drivers/s390 | |
parent | eb546195a7d8bc492ec6865980bf767474e74d87 (diff) |
s390/cio/chp: cleanup attribute usage
Let the driver core handle device attribute creation and removal. This
will simplify the code and eliminates races between attribute
availability and userspace notification via uevents.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/cio/chp.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c index e792436c9270..9b054806f7b1 100644 --- a/drivers/s390/cio/chp.c +++ b/drivers/s390/cio/chp.c | |||
@@ -362,10 +362,13 @@ static struct attribute *chp_attrs[] = { | |||
362 | &dev_attr_shared.attr, | 362 | &dev_attr_shared.attr, |
363 | NULL, | 363 | NULL, |
364 | }; | 364 | }; |
365 | |||
366 | static struct attribute_group chp_attr_group = { | 365 | static struct attribute_group chp_attr_group = { |
367 | .attrs = chp_attrs, | 366 | .attrs = chp_attrs, |
368 | }; | 367 | }; |
368 | static const struct attribute_group *chp_attr_groups[] = { | ||
369 | &chp_attr_group, | ||
370 | NULL, | ||
371 | }; | ||
369 | 372 | ||
370 | static void chp_release(struct device *dev) | 373 | static void chp_release(struct device *dev) |
371 | { | 374 | { |
@@ -397,6 +400,7 @@ int chp_new(struct chp_id chpid) | |||
397 | chp->chpid = chpid; | 400 | chp->chpid = chpid; |
398 | chp->state = 1; | 401 | chp->state = 1; |
399 | chp->dev.parent = &channel_subsystems[chpid.cssid]->device; | 402 | chp->dev.parent = &channel_subsystems[chpid.cssid]->device; |
403 | chp->dev.groups = chp_attr_groups; | ||
400 | chp->dev.release = chp_release; | 404 | chp->dev.release = chp_release; |
401 | mutex_init(&chp->lock); | 405 | mutex_init(&chp->lock); |
402 | 406 | ||
@@ -426,16 +430,10 @@ int chp_new(struct chp_id chpid) | |||
426 | put_device(&chp->dev); | 430 | put_device(&chp->dev); |
427 | goto out; | 431 | goto out; |
428 | } | 432 | } |
429 | ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group); | ||
430 | if (ret) { | ||
431 | device_unregister(&chp->dev); | ||
432 | goto out; | ||
433 | } | ||
434 | mutex_lock(&channel_subsystems[chpid.cssid]->mutex); | 433 | mutex_lock(&channel_subsystems[chpid.cssid]->mutex); |
435 | if (channel_subsystems[chpid.cssid]->cm_enabled) { | 434 | if (channel_subsystems[chpid.cssid]->cm_enabled) { |
436 | ret = chp_add_cmg_attr(chp); | 435 | ret = chp_add_cmg_attr(chp); |
437 | if (ret) { | 436 | if (ret) { |
438 | sysfs_remove_group(&chp->dev.kobj, &chp_attr_group); | ||
439 | device_unregister(&chp->dev); | 437 | device_unregister(&chp->dev); |
440 | mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); | 438 | mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); |
441 | goto out; | 439 | goto out; |