Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sebastian Ott and committed by
Martin Schwidefsky
ed35ba9a eb546195

+5 -7
+5 -7
drivers/s390/cio/chp.c
··· 362 362 &dev_attr_shared.attr, 363 363 NULL, 364 364 }; 365 - 366 365 static struct attribute_group chp_attr_group = { 367 366 .attrs = chp_attrs, 367 + }; 368 + static const struct attribute_group *chp_attr_groups[] = { 369 + &chp_attr_group, 370 + NULL, 368 371 }; 369 372 370 373 static void chp_release(struct device *dev) ··· 400 397 chp->chpid = chpid; 401 398 chp->state = 1; 402 399 chp->dev.parent = &channel_subsystems[chpid.cssid]->device; 400 + chp->dev.groups = chp_attr_groups; 403 401 chp->dev.release = chp_release; 404 402 mutex_init(&chp->lock); 405 403 ··· 430 426 put_device(&chp->dev); 431 427 goto out; 432 428 } 433 - ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group); 434 - if (ret) { 435 - device_unregister(&chp->dev); 436 - goto out; 437 - } 438 429 mutex_lock(&channel_subsystems[chpid.cssid]->mutex); 439 430 if (channel_subsystems[chpid.cssid]->cm_enabled) { 440 431 ret = chp_add_cmg_attr(chp); 441 432 if (ret) { 442 - sysfs_remove_group(&chp->dev.kobj, &chp_attr_group); 443 433 device_unregister(&chp->dev); 444 434 mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); 445 435 goto out;