09 Mar, 2012

2 commits

  • Nothing outside of the driver core needs to get to the deferred probe
    pointer, so move it inside the private area of 'struct device' so no one
    tries to mess around with it.

    Cc: Grant Likely
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • Allow drivers to report at probe time that they cannot get all the resources
    required by the device, and should be retried at a later time.

    This should completely solve the problem of getting devices
    initialized in the right order. Right now this is mostly handled by
    mucking about with initcall ordering which is a complete hack, and
    doesn't even remotely handle the case where device drivers are in
    modules. This approach completely sidesteps the issues by allowing
    driver registration to occur in any order, and any driver can request
    to be retried after a few more other drivers get probed.

    v4: - Integrate Manjunath's addition of a separate workqueue
    - Change -EAGAIN to -EPROBE_DEFER for drivers to trigger deferral
    - Update comment blocks to reflect how the code really works
    v3: - Hold off workqueue scheduling until late_initcall so that the bulk
    of driver probes are complete before we start retrying deferred devices.
    - Tested with simple use cases. Still needs more testing though.
    Using it to get rid of the gpio early_initcall madness, or to replace
    the ASoC internal probe deferral code would be ideal.
    v2: - added locking so it should no longer be utterly broken in that regard
    - remove device from deferred list at device_del time.
    - Still completely untested with any real use case, but has been
    boot tested.

    Signed-off-by: Grant Likely
    Cc: Mark Brown
    Cc: Arnd Bergmann
    Cc: Dilan Lee
    Cc: Manjunath GKondaiah
    Cc: Alan Stern
    Cc: Tony Lindgren
    Cc: Alan Cox
    Reviewed-by: Mark Brown
    Acked-by: David Daney
    Reviewed-by: Arnd Bergmann
    Signed-off-by: Greg Kroah-Hartman

    Grant Likely
     

12 Jan, 2012

1 commit

  • cpu_dev_init() is only called from driver_init(), which does not check
    its return value. Therefore make cpu_dev_init() return void.

    We must register the CPU subsystem, so panic if this fails.

    If sched_create_sysfs_power_savings_entries() fails, the damage is
    contained, so ignore this (as before).

    Signed-off-by: Ben Hutchings
    Signed-off-by: Linus Torvalds

    Ben Hutchings
     

15 Dec, 2011

1 commit

  • All sysdev classes and sysdev devices will converted to regular devices
    and buses to properly hook userspace into the event processing.

    There is no interesting difference between a 'sysdev' and 'device' which
    would justify to roll an entire own subsystem with different userspace
    export semantics. Userspace relies on events and generic sysfs subsystem
    infrastructure from sysdev devices, which are currently not properly
    available.

    Every converted sysdev class will create a regular device with the class
    name in /sys/devices/system and all registered devices will becom a children
    of theses devices.

    For compatibility reasons, the sysdev class-wide attributes are created
    at this parent device. (Do not copy that logic for anything new, subsystem-
    wide properties belong to the subsystem, not to some fake parent device
    created in /sys/devices.)

    Every sysdev driver is implemented as a simple subsystem interface now,
    and no longer called a driver.

    After all sysdev classes are ported to regular driver core entities, the
    sysdev implementation will be entirely removed from the kernel.

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

    Kay Sievers
     

01 Nov, 2011

1 commit

  • This file is currently relying on sneaking it in
    through the implicit include paths from device.h. Once that
    is cleaned up, this will happen:

    In file included from drivers/base/init.c:12:
    drivers/base/base.h:34: error: field ‘bus_notifier’ has incomplete type
    make[3]: *** [drivers/base/init.o] Error 1

    Fix it up in advance, so the cleanup can continue.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

12 May, 2011

1 commit

  • Since suspend, resume and shutdown operations in struct sysdev_class
    and struct sysdev_driver are not used any more, remove them. Also
    drop sysdev_suspend(), sysdev_resume() and sysdev_shutdown() used
    for executing those operations and modify all of their users
    accordingly. This reduces kernel code size quite a bit and reduces
    its complexity.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

18 Nov, 2010

1 commit


16 Sep, 2009

3 commits

  • Devtmpfs lets the kernel create a tmpfs instance called devtmpfs
    very early at kernel initialization, before any driver-core device
    is registered. Every device with a major/minor will provide a
    device node in devtmpfs.

    Devtmpfs can be changed and altered by userspace at any time,
    and in any way needed - just like today's udev-mounted tmpfs.
    Unmodified udev versions will run just fine on top of it, and will
    recognize an already existing kernel-created device node and use it.
    The default node permissions are root:root 0600. Proper permissions
    and user/group ownership, meaningful symlinks, all other policy still
    needs to be applied by userspace.

    If a node is created by devtmps, devtmpfs will remove the device node
    when the device goes away. If the device node was created by
    userspace, or the devtmpfs created node was replaced by userspace, it
    will no longer be removed by devtmpfs.

    If it is requested to auto-mount it, it makes init=/bin/sh work
    without any further userspace support. /dev will be fully populated
    and dynamic, and always reflect the current device state of the kernel.
    With the commonly used dynamic device numbers, it solves the problem
    where static devices nodes may point to the wrong devices.

    It is intended to make the initial bootup logic simpler and more robust,
    by de-coupling the creation of the inital environment, to reliably run
    userspace processes, from a complex userspace bootstrap logic to provide
    a working /dev.

    Signed-off-by: Kay Sievers
    Signed-off-by: Jan Blunck
    Tested-By: Harald Hoyer
    Tested-By: Scott James Remnant
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     
  • No one should directly access the driver_data field, so remove the field
    and make it private. We dynamically create the private field now if it
    is needed, to handle drivers that call get/set before they are
    registered with the driver core.

    Also update the copyright notices on these files while we are there.

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

    Greg Kroah-Hartman
     
  • This patch (as1271) affects when new devices get linked into their
    bus's list of devices. Currently this happens after probing, and it
    doesn't happen at all if probing fails. Clearly this is wrong,
    because at that point quite a few symbolic links have already been
    created in sysfs. We are committed to adding the device, so it should
    be linked into the bus's list regardless.

    In addition, this needs to happen before the uevent announcing the new
    device gets issued. Otherwise user programs might try to access the
    device before it has been added to the bus.

    To fix both these problems, the patch moves the call to
    klist_add_tail() forward from bus_attach_device() to bus_add_device().
    Since bus_attach_device() now does nothing but probe for drivers, it
    has been renamed to bus_probe_device(). And lastly, the kerneldoc is
    updated.

    Signed-off-by: Alan Stern
    CC: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

17 Apr, 2009

1 commit

  • This patch fixes a bug introduced in commit
    49b420a13ff95b449947181190b08367348e3e1b.

    If a instance of bus_type doesn't have .match method,
    all .probe of drivers in the bus should be called, or else
    the .probe have not a chance to be called.

    Signed-off-by: Ming Lei
    Reported-by: Guennadi Liakhovetski
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     

25 Mar, 2009

5 commits


23 Feb, 2009

1 commit


10 Jan, 2009

4 commits


07 Jan, 2009

4 commits


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 Jul, 2008

7 commits


01 May, 2008

1 commit


25 Jan, 2008

6 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
     
  • When SYSFS=n and MODULES=y, build ends with:

    linux-2.6.24-rc6-mm1/drivers/base/module.c: In function 'module_add_driver':
    linux-2.6.24-rc6-mm1/drivers/base/module.c:49: error: 'module_kset' undeclared (first use in this function)
    make[3]: *** [drivers/base/module.o] Error 1

    Below is one possible fix.
    Build-tested with all 4 config combinations of SYSFS & MODULES.

    Signed-off-by: Randy Dunlap
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     
  • LIST_HEAD has been widely used, so switch to this simpler method.

    Signed-off-by: Denis Cheng
    Signed-off-by: Greg Kroah-Hartman

    Denis Cheng
     
  • This patch removes the kobject, and a few other driver-core-only fields
    out of struct driver and into the driver core only. Now drivers can be
    safely create on the stack or statically (like they currently are.)

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

    Greg Kroah-Hartman
     
  • The module driver specific code should belong in the driver core, not in
    the kernel/ directory. So move this code. This is done in preparation
    for some struct device_driver rework that should be confined to the
    driver core code only.

    This also lets us keep from exporting these functions, as no external
    code should ever be calling it.

    Thanks to Andrew Morton for the !CONFIG_MODULES fix.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • struct bus_type is static everywhere in the kernel. This moves the
    kobject in the structure out of it, and a bunch of other private only to
    the driver core fields are now moved to a private structure. This lets
    us dynamically create the backing kobject properly and gives us the
    chance to be able to document to users exactly how to use the struct
    bus_type as there are no fields they can improperly access.

    Thanks to Kay for the build fixes on this patch.

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

    Greg Kroah-Hartman