aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/attribute_container.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 20:19:08 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 20:19:08 -0500
commit9b73e76f3cf63379dcf45fcd4f112f5812418d0a (patch)
tree4e6bef87cd0cd6d848fc39a5ae25b981dbbe035b /drivers/base/attribute_container.c
parent50d9a126240f9961cfdd063336bbeb91f77a7dce (diff)
parent23c3e290fb9ce38cabc2822b47583fc8702411bf (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (200 commits) [SCSI] usbstorage: use last_sector_bug flag universally [SCSI] libsas: abstract STP task status into a function [SCSI] ultrastor: clean up inline asm warnings [SCSI] aic7xxx: fix firmware build [SCSI] aacraid: fib context lock for management ioctls [SCSI] ch: remove forward declarations [SCSI] ch: fix device minor number management bug [SCSI] ch: handle class_device_create failure properly [SCSI] NCR5380: fix section mismatch [SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices [SCSI] IB/iSER: add logical unit reset support [SCSI] don't use __GFP_DMA for sense buffers if not required [SCSI] use dynamically allocated sense buffer [SCSI] scsi.h: add macro for enclosure bit of inquiry data [SCSI] sd: add fix for devices with last sector access problems [SCSI] fix pcmcia compile problem [SCSI] aacraid: add Voodoo Lite class of cards. [SCSI] aacraid: add new driver features flags [SCSI] qla2xxx: Update version number to 8.02.00-k7. [SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command. ...
Diffstat (limited to 'drivers/base/attribute_container.c')
-rw-r--r--drivers/base/attribute_container.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c
index d4dfb97de3b0..3b43e8a9f87e 100644
--- a/drivers/base/attribute_container.c
+++ b/drivers/base/attribute_container.c
@@ -320,9 +320,14 @@ attribute_container_add_attrs(struct class_device *classdev)
320 struct class_device_attribute **attrs = cont->attrs; 320 struct class_device_attribute **attrs = cont->attrs;
321 int i, error; 321 int i, error;
322 322
323 if (!attrs) 323 BUG_ON(attrs && cont->grp);
324
325 if (!attrs && !cont->grp)
324 return 0; 326 return 0;
325 327
328 if (cont->grp)
329 return sysfs_create_group(&classdev->kobj, cont->grp);
330
326 for (i = 0; attrs[i]; i++) { 331 for (i = 0; attrs[i]; i++) {
327 error = class_device_create_file(classdev, attrs[i]); 332 error = class_device_create_file(classdev, attrs[i]);
328 if (error) 333 if (error)
@@ -378,9 +383,14 @@ attribute_container_remove_attrs(struct class_device *classdev)
378 struct class_device_attribute **attrs = cont->attrs; 383 struct class_device_attribute **attrs = cont->attrs;
379 int i; 384 int i;
380 385
381 if (!attrs) 386 if (!attrs && !cont->grp)
382 return; 387 return;
383 388
389 if (cont->grp) {
390 sysfs_remove_group(&classdev->kobj, cont->grp);
391 return ;
392 }
393
384 for (i = 0; attrs[i]; i++) 394 for (i = 0; attrs[i]; i++)
385 class_device_remove_file(classdev, attrs[i]); 395 class_device_remove_file(classdev, attrs[i]);
386} 396}