@@ -466,35 +466,6 @@ int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
466
466
}
467
467
EXPORT_SYMBOL_GPL (bus_for_each_drv );
468
468
469
- static int device_add_attrs (struct bus_type * bus , struct device * dev )
470
- {
471
- int error = 0 ;
472
- int i ;
473
-
474
- if (!bus -> dev_attrs )
475
- return 0 ;
476
-
477
- for (i = 0 ; bus -> dev_attrs [i ].attr .name ; i ++ ) {
478
- error = device_create_file (dev , & bus -> dev_attrs [i ]);
479
- if (error ) {
480
- while (-- i >= 0 )
481
- device_remove_file (dev , & bus -> dev_attrs [i ]);
482
- break ;
483
- }
484
- }
485
- return error ;
486
- }
487
-
488
- static void device_remove_attrs (struct bus_type * bus , struct device * dev )
489
- {
490
- int i ;
491
-
492
- if (bus -> dev_attrs ) {
493
- for (i = 0 ; bus -> dev_attrs [i ].attr .name ; i ++ )
494
- device_remove_file (dev , & bus -> dev_attrs [i ]);
495
- }
496
- }
497
-
498
469
/**
499
470
* bus_add_device - add device to bus
500
471
* @dev: device being added
@@ -510,12 +481,9 @@ int bus_add_device(struct device *dev)
510
481
511
482
if (bus ) {
512
483
pr_debug ("bus: '%s': add device %s\n" , bus -> name , dev_name (dev ));
513
- error = device_add_attrs (bus , dev );
514
- if (error )
515
- goto out_put ;
516
484
error = device_add_groups (dev , bus -> dev_groups );
517
485
if (error )
518
- goto out_id ;
486
+ goto out_put ;
519
487
error = sysfs_create_link (& bus -> p -> devices_kset -> kobj ,
520
488
& dev -> kobj , dev_name (dev ));
521
489
if (error )
@@ -532,8 +500,6 @@ int bus_add_device(struct device *dev)
532
500
sysfs_remove_link (& bus -> p -> devices_kset -> kobj , dev_name (dev ));
533
501
out_groups :
534
502
device_remove_groups (dev , bus -> dev_groups );
535
- out_id :
536
- device_remove_attrs (bus , dev );
537
503
out_put :
538
504
bus_put (dev -> bus );
539
505
return error ;
@@ -590,7 +556,6 @@ void bus_remove_device(struct device *dev)
590
556
sysfs_remove_link (& dev -> kobj , "subsystem" );
591
557
sysfs_remove_link (& dev -> bus -> p -> devices_kset -> kobj ,
592
558
dev_name (dev ));
593
- device_remove_attrs (dev -> bus , dev );
594
559
device_remove_groups (dev , dev -> bus -> dev_groups );
595
560
if (klist_node_attached (& dev -> p -> knode_bus ))
596
561
klist_del (& dev -> p -> knode_bus );
0 commit comments