lkml.org 
[lkml]   [2011]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] drivercore: Add driver probe deferral mechanism
    On Mon, 04 Jul 2011 11:11:59 -0600 Grant Likely wrote:

    > diff --git a/drivers/base/dd.c b/drivers/base/dd.c
    > index 6658da7..ccbf3d3 100644
    > --- a/drivers/base/dd.c
    > +++ b/drivers/base/dd.c
    > @@ -28,6 +28,62 @@
    > #include "base.h"
    > #include "power/power.h"
    >
    > +/**
    > + * deferred_probe_work_func() - Retry probing devices in the deferred list.
    > + */
    > +static DEFINE_MUTEX(deferred_probe_mutex);
    > +static LIST_HEAD(deferred_probe_list);
    > +static void deferred_probe_work_func(struct work_struct *work)

    The kernel-doc notation needs to be immediately before the function,
    without the intervening data...

    > +{
    > + struct device *dev;
    > + /*
    > + * This bit is tricky. We want to process every device in the
    > + * deferred list, but devices can be removed from the list at any
    > + * time while inside this for-each loop. There are two things that
    > + * need to be protected against:
    > + * - if the device is removed from the deferred_probe_list, then we
    > + * loose our place in the loop. Since any device can be removed
    > + * asynchronously, list_for_each_entry_safe() wouldn't make things
    > + * much better. Simplest solution is to restart walking the list
    > + * whenever the current device gets removed. Not the most efficient,
    > + * but is simple to implement and easy to audit for correctness.
    > + * - if the device is unregistered, and freed, then there is a risk
    > + * of a null pointer dereference. This code uses get/put_device()
    > + * to ensure the device cannot disappear from under our feet.
    > + */


    ---
    ~Randy
    *** Remember to use Documentation/SubmitChecklist when testing your code ***


    \
     
     \ /
      Last update: 2011-07-04 21:59    [W:0.047 / U:78.892 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site