09 Oct, 2008

1 commit

  • Iterating over entries using callback usually isn't too fun especially
    when the entry being iterated over can't be manipulated freely. This
    patch converts class->p->class_devices to klist and implements class
    device iterator so that the users can freely build their own control
    structure. The users are also free to call back into class code
    without worrying about locking.

    class_for_each_device() and class_find_device() are converted to use
    the new iterators, so their users don't have to worry about locking
    anymore either.

    Note: This depends on klist-dont-iterate-over-deleted-entries patch
    because class_intf->add/remove_dev() depends on proper synchronization
    with device removal.

    Signed-off-by: Tejun Heo
    Cc: Greg Kroah-Hartman
    Cc: Jens Axboe
    Signed-off-by: Jens Axboe

    Tejun Heo
     

22 Aug, 2008

1 commit

  • Anti-oops medicine for the class iterators ... the oops was
    observed when a class was implicitly referenced before it
    was initialized.

    [Modified by Greg to spit a warning back so someone knows to fix their code]

    Signed-off-by: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    David Brownell
     

29 Jul, 2008

1 commit


22 Jul, 2008

10 commits

  • Now that the lockdep infrastructure in the class core is in place, we
    should be able to properly change the internal class semaphore to be a
    mutex.

    David wrote the original patch, and Greg fixed it up to apply properly
    due to all of the recent changes in this area.

    From: Dave Young
    Cc: Matthew Wilcox
    Cc: Kay Sievers
    Cc: Andrew Morton
    Cc: James Bottomley
    Signed-off-by: Greg Kroah-Hartman

    Dave Young
     
  • This adds the infrastructure to properly handle lockdep issues when the
    internal class semaphore is changed to a mutex.

    Matthew wrote the original patch, and Greg fixed it up to work properly
    with the class_create() function.

    From: Matthew Wilcox
    Cc: Kay Sievers
    Cc: Dave Young
    Cc: Andrew Morton
    Cc: James Bottomley
    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Matthew Wilcox
     
  • This renames the struct class "sem" field to be "class_sem" to make
    things easier when struct bus_type and struct class merge in the future.
    It also makes grepping for fields easier as well.

    Based on an idea from Kay.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This renames the struct class "subsys" field to be "class_subsys" to
    make things easier when struct bus_type and struct class merge in the
    future. It also makes grepping for fields easier as well.

    Based on an idea from Kay.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This renames the struct class "interfaces" field to be
    "class_interfaces" to make things easier when struct bus_type and struct
    class merge in the future. It also makes grepping for fields easier as
    well.

    Based on an idea from Kay.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This renames the struct class "devices" field to be "class_devices" to
    make things easier when struct bus_type and struct class merge in the
    future. It also makes grepping for fields easier as well.

    Based on an idea from Kay.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This moves the portions of struct class that are dynamic (kobject and
    lock and lists) out of the main structure and into a dynamic, private,
    structure.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This mirrors the functionality that driver_find_device has as well.

    We add a start variable, and all callers of the function are fixed up at
    the same time.

    The block layer will be using this new functionality in a follow-on
    patch.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This mirrors the functionality that driver_for_each_device has as well.

    We add a start variable, and all callers of the function are fixed up at
    the same time.

    The block layer will be using this new functionality in a follow-on
    patch.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • Why?:
    There are occasions where userspace would like to access sysfs
    attributes for a device but it may not know how sysfs has named the
    device or the path. For example what is the sysfs path for
    /dev/disk/by-id/ata-ST3160827AS_5MT004CK? With this change a call to
    stat(2) returns the major:minor then userspace can see that
    /sys/dev/block/8:32 links to /sys/block/sdc.

    What are the alternatives?:
    1/ Add an ioctl to return the path: Doable, but sysfs is meant to reduce
    the need to proliferate ioctl interfaces into the kernel, so this
    seems counter productive.

    2/ Use udev to create these symlinks: Also doable, but it adds a
    udev dependency to utilities that might be running in a limited
    environment like an initramfs.

    3/ Do a full-tree search of sysfs.

    [kay.sievers@vrfy.org: fix duplicate registrations]
    [kay.sievers@vrfy.org: cleanup suggestions]

    Cc: Neil Brown
    Cc: Tejun Heo
    Acked-by: Kay Sievers
    Reviewed-by: SL Baur
    Acked-by: Kay Sievers
    Acked-by: Mark Lord
    Acked-by: H. Peter Anvin
    Signed-off-by: Dan Williams
    Signed-off-by: Greg Kroah-Hartman

    Dan Williams
     

15 May, 2008

1 commit


01 May, 2008

1 commit


20 Apr, 2008

1 commit


31 Jan, 2008

2 commits


28 Jan, 2008

1 commit


25 Jan, 2008

11 commits

  • Fix up a number of coding style issues in the drivers/base/ directory
    that have annoyed me over the years. checkpatch.pl is now very happy.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • Add the following class iteration functions for driver use:
    class_for_each_device
    class_find_device
    class_for_each_child
    class_find_child

    Signed-off-by: Dave Young
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Dave Young
     
  • All kobjects require a dynamically allocated name now. We no longer
    need to keep track if the name is statically assigned, we can just
    unconditionally free() all kobject names on cleanup.

    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     
  • Now that the old kobject_init() function is gone, rename
    kobject_init_ng() to kobject_init() to clean up the namespace.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • Now that the old kobject_add() function is gone, rename kobject_add_ng()
    to kobject_add() to clean up the namespace.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This moves the block devices to /sys/class/block. It will create a
    flat list of all block devices, with the disks and partitions in one
    directory. For compatibility /sys/block is created and contains symlinks
    to the disks.

    /sys/class/block
    |-- sda -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
    |-- sda1 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1
    |-- sda10 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10
    |-- sda5 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5
    |-- sda6 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6
    |-- sda7 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7
    |-- sda8 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8
    |-- sda9 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9
    `-- sr0 -> ../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0

    /sys/block/
    |-- sda -> ../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
    `-- sr0 -> ../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0

    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     
  • This converts the code to use the new kobject functions, cleaning up the
    logic in doing so.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • These functions are no longer used and are the last remants of the old
    subsystem crap. So delete them for good.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This macro is no longer used. ksets should be created dynamically with
    a call to kset_create_and_add() not declared statically.

    Yes, there are 5 remaining static struct kset usages in the kernel tree,
    but they will be fixed up soon.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • Dynamically create the kset instead of declaring it statically.

    The class_obj subsystem is not yet converted as it is more complex and
    should be going away soon with the removal of class_device from the
    kernel tree.

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • We don't need a "default" ktype for a kset. We should set this
    explicitly every time for each kset. This change is needed so that we
    can make ksets dynamic, and cleans up one of the odd, undocumented
    assumption that the kset/kobject/ktype model has.

    This patch is based on a lot of help from Kay Sievers.

    Nasty bug in the block code was found by Dave Young

    Cc: Kay Sievers
    Cc: Dave Young
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

01 Nov, 2007

1 commit


31 Oct, 2007

1 commit


13 Oct, 2007

6 commits


12 Jul, 2007

2 commits

  • devt_attr and uevent_attr are either allocated dynamically with or
    embedded in device and class_device as they needed their owner field
    set to the module implementing the driver. Now that sysfs implements
    immediate disconnect and owner field removed from struct attribute,
    there is no reason to do this. Remove these attributes from
    [class_]device and use static attribute structures instead.

    Signed-off-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • sysfs is now completely out of driver/module lifetime game. After
    deletion, a sysfs node doesn't access anything outside sysfs proper,
    so there's no reason to hold onto the attribute owners. Note that
    often the wrong modules were accounted for as owners leading to
    accessing removed modules.

    This patch kills now unnecessary attribute->owner. Note that with
    this change, userland holding a sysfs node does not prevent the
    backing module from being unloaded.

    For more info regarding lifetime rule cleanup, please read the
    following message.

    http://article.gmane.org/gmane.linux.kernel/510293

    (tweaked by Greg to not delete the field just yet, to make it easier to
    merge things properly.)

    Signed-off-by: Tejun Heo
    Cc: Cornelia Huck
    Cc: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo