13 Oct, 2007

3 commits

  • This makes it a bit more sane when trying to figure out how to clean up
    the ktype mess.

    Based on a larger patch from Kay Sievers

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

    Greg Kroah-Hartman
     
  • Move uevent specific logic from the core into kobject_uevent.c, which
    does no longer require to link the unused string array if hotplug
    is not compiled in.

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

    Kay Sievers
     
  • This changes the uevent buffer functions to use a struct instead of a
    long list of parameters. It does no longer require the caller to do the
    proper buffer termination and size accounting, which is currently wrong
    in some places. It fixes a known bug where parts of the uevent
    environment are overwritten because of wrong index calculations.

    Many thanks to Mathieu Desnoyers for finding bugs and improving the
    error handling.

    Signed-off-by: Kay Sievers
    Cc: Mathieu Desnoyers
    Cc: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

08 Oct, 2007

1 commit


27 Sep, 2007

1 commit

  • As Stephen Hemminger says, this is a "belt and suspenders" patch that
    zeroes the envp array at allocation time, even though all the users
    should NULL-terminate it anyway (and we've hopefully fixed everybody
    that doesn't do that).

    And we'll apparently clean the whole envp thing up for 2.6.24 anyway.

    But let's just be robust, and do both this *and* make sure that all
    users are doing the right thing.

    Acked-by: Stephen Hemminger
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

20 Sep, 2007

1 commit

  • Nested class devices used to have 'device' symlink point to a real
    (physical) device instead of a parent class device. When converting
    subsystems to struct device we need to keep doing what class devices did if
    CONFIG_SYSFS_DEPRECATED is Y, otherwise parts of udev break.

    Signed-off-by: Dmitry Torokhov
    Cc: Kay Sievers
    Acked-by: Greg KH
    Tested-by: Anssi Hannula
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dmitry Torokhov
     

31 Jul, 2007

2 commits


19 Jul, 2007

2 commits


12 Jul, 2007

3 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
     
  • This converts code of the form

    if ((error = some_func()))
    goto fixup;
    to
    error = some_func();
    if (error)
    goto fixup;

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

    Cornelia Huck
     

09 Jun, 2007

1 commit


03 May, 2007

2 commits


28 Apr, 2007

10 commits

  • This patch (as896b) fixes an oversight in the design of
    device_schedule_callback(). It is necessary to acquire a reference to the
    module owning the callback routine, to prevent the module from being
    unloaded before the callback can run.

    Signed-off-by: Alan Stern
    Cc: Satyam Sharma
    Cc: Neil Brown
    Cc: Cornelia Huck
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • In the future we will allow the uevent type to be written to the uevent
    file to trigger the different types of uevents. But for now, as we only
    support the ADD event, warn if userspace tries to write anything else to
    this file.

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

    Kay Sievers
     
  • This allows sysfs to show the environment variables that are available
    if the uevent happens. This lets userspace not have to cache all of
    this information as the kernel already knows it.

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

    Kay Sievers
     
  • Suppress uevents for devices if uevent_suppress is set via
    dev_uevent_filter(). This makes the driver core suppress all device
    uevents, not just the add event in device_add().

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

    Cornelia Huck
     
  • Don't fail bus_attach_device() if the device cannot be bound.

    If dev->driver has been specified, reset it to NULL if device_bind_driver()
    failed and add the device as an unbound device. As a result,
    bus_attach_device() now cannot fail, and we can remove some checking from
    device_add().

    Also remove an unneeded check in bus_rescan_devices_helper().

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

    Cornelia Huck
     
  • If "name" of a device_type is specified, the uevent will
    contain the device_type name in the DEVTYPE variable.
    This helps userspace to distingiush between different types
    of devices, belonging to the same subsystem.

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

    Kay Sievers
     
  • Driver core: use attribute groups in struct device_type

    Attribute groups are more flexible than attribute lists
    (an attribute list can be represented by anonymous group)
    so switch struct device_type to use them.

    Also rework attribute creation for devices so that they all
    cleaned up properly in case of errors.

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

    Dmitry Torokhov
     
  • As the new-style class devices (as opposed to old-style struct
    class_device) are becoming more widely used, I noticed that the
    dev_printk-based functions are not working properly with these.
    New-style class devices have no driver nor bus, almost by definition,
    and as a result dev_driver_string(), which is used as the first
    parameter of dev_printk, resolves to an empty string. This causes
    entries like the following to show in my logs:

    i2c-2: adapter [SMBus stub driver] registered

    Notice the unaesthetical leading whitespace. In order to fix this
    problem, I suggest that we extend dev_driver_string to deal with
    new-style class devices:

    Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     
  • - uses a kset in "struct class" to keep track of all directories
    belonging to this class
    - merges with the /sys/devices/virtual logic.
    - removes the namespace-dir if the last member of that class
    leaves the directory.

    There may be locking or refcounting fixes left, I stopped when it seemed
    to work with network and sound modules. :)

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

    Kay Sievers
     
  • - At the moment we jump here device was't added to
    dev->class->devices list yet.

    Signed-off-by: Monakhov Dmitriy
    Signed-off-by: Greg Kroah-Hartman

    Dmitriy Monakhov
     

05 Apr, 2007

1 commit

  • Revert all this. It can cause device-mapper to receive a different major from
    earlier kernels and it turns out that the Amanda backup program (via GNU tar,
    apparently) checks major numbers on files when performing incremental backups.

    Which is a bit broken of Amanda (or tar), but this feature isn't important
    enough to justify the churn.

    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

16 Mar, 2007

1 commit

  • This patch (as868) adds a helper routine for device drivers that need
    to set up a callback to perform some action in a different process's
    context. This is intended for use by attribute methods that want to
    unregister themselves or their parent device. Attribute method calls
    are mutually exclusive with unregistration, so such actions cannot be
    taken directly.

    Two attribute methods are converted to use the new helper routine: one
    for SCSI device deletion and one for System/390 ccwgroup devices.

    Signed-off-by: Alan Stern
    Cc: Hugh Dickins
    Cc: Cornelia Huck
    Cc: Oliver Neukum
    Signed-off-by: Linus Torvalds

    Alan Stern
     

10 Mar, 2007

2 commits

  • In wireless we'd like to allow renaming of the phy devices we surface in
    sysfs. The base wireless code, however, can be built modular and thus we
    need device_rename exported.

    Signed-off-by: Johannes Berg
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     
  • This moves the device symlink back to sysfs even if
    CONFIG_SYSFS_DEPRECATED is enabled as too many userspace programs (well,
    HAL), still rely on this link to be present.

    I will rework the ability for sysfs to change layouts like this in the
    future, but for now, this patch should fix people's network connections.

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

    Greg Kroah-Hartman
     

09 Mar, 2007

1 commit

  • Some platform devices are driven without driver attached, so managed
    resources can be acquired without driver attached. Make sure such
    resources are released by calling devres_release_all() in
    device_del().

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

24 Feb, 2007

1 commit

  • When a device fails to register the class symlinks where not cleaned up.
    This left a symlink in the /sys/class/"device"/ directory that pointed
    to no where. This caused the sysfs_follow_link Oops I reported earlier.
    This patch cleanups up the symlink. Please apply. Thank you.

    Signed-Off: James Simmons
    Signed-off-by: Greg Kroah-Hartman

    James Simmons
     

21 Feb, 2007

1 commit

  • Several people have reported failures in dynamic major device number handling
    due to the recent changes in there to avoid handing out the local/experimental
    majors.

    Rolf reports that this is due to a gcc-4.1.0 bug.

    The patch refactors that code a lot in an attempt to provoke the compiler into
    behaving.

    Cc: Rolf Eike Beer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

10 Feb, 2007

1 commit

  • Implement device resource management, in short, devres. A device
    driver can allocate arbirary size of devres data which is associated
    with a release function. On driver detach, release function is
    invoked on the devres data, then, devres data is freed.

    devreses are typed by associated release functions. Some devreses are
    better represented by single instance of the type while others need
    multiple instances sharing the same release function. Both usages are
    supported.

    devreses can be grouped using devres group such that a device driver
    can easily release acquired resources halfway through initialization
    or selectively release resources (e.g. resources for port 1 out of 4
    ports).

    This patch adds devres core including documentation and the following
    managed interfaces.

    * alloc/free : devm_kzalloc(), devm_kzfree()
    * IO region : devm_request_region(), devm_release_region()
    * IRQ : devm_request_irq(), devm_free_irq()
    * DMA : dmam_alloc_coherent(), dmam_free_coherent(),
    dmam_declare_coherent_memory(), dmam_pool_create(),
    dmam_pool_destroy()
    * PCI : pcim_enable_device(), pcim_pin_device(), pci_is_managed()
    * iomap : devm_ioport_map(), devm_ioport_unmap(), devm_ioremap(),
    devm_ioremap_nocache(), devm_iounmap(), pcim_iomap_table(),
    pcim_iomap(), pcim_iounmap()

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

08 Feb, 2007

6 commits

  • For the block subsystem, we want to delay all uevents until the
    disk has been scanned and allpartitons are already created before
    the first event is sent out.

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

    Kay Sievers
     
  • This allows us to add type specific attributes, uevent vars and
    release funtions.

    A subsystem can carry different types of devices like the "block"
    subsys has disks and partitions. Both types create a different set
    of attributes, but belong to the same subsystem.

    This corresponds to the low level objects:
    kobject -> device (object/device data)
    kobj_type -> device_type (type of object/device we are embedded in)
    kset -> class/bus (list of objects/devices of a subsystem)

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

    Kay Sievers
     
  • Devices converted from class_device to device should have
    the same uevent keys as the original class_device had. We
    search up the parents until we find the first bus device and
    add the (already deprecated) PHYDEV* values.

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

    Kay Sievers
     
  • Make make_class_name() return NULL on error and fixup callers in the
    driver core.

    Signed-off-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Cornelia Huck
     
  • If we allow NULL as the new parent in device_move(), we need to make sure
    that the device is placed into the same place as it would if it was
    newly registered:

    - Consider the device virtual tree. In order to be able to reuse code,
    setup_parent() has been tweaked a bit.
    - kobject_move() can fall back to the kset's kobject.
    - sysfs_move_dir() uses the sysfs root dir as fallback.

    Signed-off-by: Cornelia Huck
    Cc: Marcel Holtmann
    Signed-off-by: Greg Kroah-Hartman

    Cornelia Huck
     
  • device_is_registered() will always be false for a device with no bus. Remove
    this check and trust the caller to know what they're doing.

    Signed-off-by: Cornelia Huck
    Cc: Marcel Holtmann
    Signed-off-by: Greg Kroah-Hartman

    Cornelia Huck