mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
[PATCH] Driver core: add generic "subsystem" link to all devices
Like the SUBSYTEM= key we find in the environment of the uevent, this creates a generic "subsystem" link in sysfs for every device. Userspace usually doesn't care at all if its a "class" or a "bus" device. This provides an unified way to determine the subsytem of a device, regardless of the way the driver core has created it. Signed-off-by: Kay Sievers <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
23681e4791
commit
b9d9c82b4d
5 changed files with 17 additions and 7 deletions
|
|
@ -329,6 +329,7 @@ void delete_partition(struct gendisk *disk, int part)
|
|||
p->ios[0] = p->ios[1] = 0;
|
||||
p->sectors[0] = p->sectors[1] = 0;
|
||||
devfs_remove("%s/part%d", disk->devfs_name, part);
|
||||
sysfs_remove_link(&p->kobj, "subsystem");
|
||||
if (p->holder_dir)
|
||||
kobject_unregister(p->holder_dir);
|
||||
kobject_uevent(&p->kobj, KOBJ_REMOVE);
|
||||
|
|
@ -363,6 +364,7 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len)
|
|||
kobject_add(&p->kobj);
|
||||
if (!disk->part_uevent_suppress)
|
||||
kobject_uevent(&p->kobj, KOBJ_ADD);
|
||||
sysfs_create_link(&p->kobj, &block_subsys.kset.kobj, "subsystem");
|
||||
partition_sysfs_add_subdir(p);
|
||||
disk->part[part-1] = p;
|
||||
}
|
||||
|
|
@ -398,6 +400,7 @@ static void disk_sysfs_symlinks(struct gendisk *disk)
|
|||
kfree(disk_name);
|
||||
}
|
||||
}
|
||||
sysfs_create_link(&disk->kobj, &block_subsys.kset.kobj, "subsystem");
|
||||
}
|
||||
|
||||
/* Not exported, helper to add_disk(). */
|
||||
|
|
@ -548,5 +551,6 @@ void del_gendisk(struct gendisk *disk)
|
|||
put_device(disk->driverfs_dev);
|
||||
disk->driverfs_dev = NULL;
|
||||
}
|
||||
sysfs_remove_link(&disk->kobj, "subsystem");
|
||||
kobject_del(&disk->kobj);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue