• D
    fix hotplug for legacy platform drivers · 49a4ec18
    David Brownell 提交于
    We've had various reports of some legacy "probe the hardware" style
    platform drivers having nasty problems with hotplug support.
    
    The core issue is that those legacy drivers don't fully conform to the
    driver model.  They assume a role that should be the responsibility of
    infrastructure code: creating device nodes.
    
    The "modprobe" step in hotplugging relies on drivers to have split those
    roles into different modules.  The lack of this split causes the problems.
    When a driver creates nodes for devices that don't exist (sending a hotplug
    event), then exits (aborting one modprobe) before the "modprobe $MODALIAS"
    step completes (by failing, since it's in the middle of a modprobe), the
    result can be an endless loop of modprobe invocations ...  badness.
    
    This fix uses the newish per-device flag controlling issuance of "add"
    events.  (A previous version of this patch used a per-device "driver can
    hotplug" flag, which only scrubbed $MODALIAS from the environment rather
    than suppressing the entire hotplug event.) It also shrinks that flag to
    one bit, saving a word in "struct device".
    
    So the net of this patch is removing some nasty failures with legacy
    drivers, while retaining hotplug capability for the majority of platform
    drivers.
    Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
    Cc: Greg KH <gregkh@suse.de>
    Cc: Andres Salomon <dilinger@debian.org>
    Cc: Dominik Brodowski <linux@dominikbrodowski.net>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    49a4ec18
platform.c 17.5 KB