19 May, 2011

2 commits

  • Commit b826291c, "drivercore/dt: add a match table pointer to struct
    device" added an of_match pointer to struct device to cache the
    of_match_table entry discovered at driver match time. This was unsafe
    because matching is not an atomic operation with probing a driver. If
    two or more drivers are attempted to be matched to a driver at the
    same time, then the cached matching entry pointer could get
    overwritten.

    This patch reverts the of_match cache pointer and reworks all users to
    call of_match_device() directly instead.

    Signed-off-by: Grant Likely

    Grant Likely
     
  • If two drivers are probing devices at the same time, both will write
    their match table result to the dev->of_match cache at the same time.

    Only write the result if the device matches.

    In a thread titled "SBus devices sometimes detected, sometimes not",
    Meelis reported his SBus hme was not detected about 50% of the time.
    From the debug suggested by Grant it was obvious another driver matched
    some devices between the call to match the hme and the hme discovery
    failling.

    Reported-by: Meelis Roos
    Signed-off-by: Milton Miller
    [grant.likely: modified to only call of_match_device() once]
    Signed-off-by: Grant Likely

    Milton Miller
     

28 Feb, 2011

1 commit


22 Oct, 2010

1 commit

  • The current code allocates and manages platform_devices created from
    the device tree manually. It also uses an unsafe shortcut for
    allocating the platform_device and the resource table at the same
    time. (which I added in the last rework; sorry).

    This patch refactors the code to use platform_device_alloc() for
    allocating new devices. This reduces the amount of custom code
    implemented by of_platform, eliminates the unsafe alloc trick, and has
    the side benefit of letting the platform_bus code manage freeing the
    device data and resources when the device is freed.

    Signed-off-by: Grant Likely
    Cc: Benjamin Herrenschmidt
    Cc: Greg Kroah-Hartman
    Cc: "David S. Miller"
    Cc: Michal Simek

    Grant Likely
     

06 Aug, 2010

1 commit

  • of_device is just an alias for platform_device, so remove it entirely. Also
    replace to_of_device() with to_platform_device() and update comment blocks.

    This patch was initially generated from the following semantic patch, and then
    edited by hand to pick up the bits that coccinelle didn't catch.

    @@
    @@
    -struct of_device
    +struct platform_device

    Signed-off-by: Grant Likely
    Reviewed-by: David S. Miller

    Grant Likely
     

30 Jul, 2010

1 commit


24 Jul, 2010

3 commits

  • of_device is currently just an #define alias to platform_device until it
    gets removed entirely. This patch removes references to it from the
    include directories and the core drivers/of code.

    Signed-off-by: Grant Likely
    Acked-by: David S. Miller

    Grant Likely
     
  • It is mostly unused now. Sparc has a few defines left in it, but they
    can be moved to other headers. Removing this header means that new
    architectures adding CONFIG_OF support don't need to also add this
    header file.

    Signed-off-by: Grant Likely
    Acked-by: David S. Miller

    Grant Likely
     
  • of_platform_bus was being used in the same manner as the platform_bus.
    The only difference being that of_platform_bus devices are generated
    from data in the device tree, and platform_bus devices are usually
    statically allocated in platform code. Having them separate causes
    the problem of device drivers having to be registered twice if it
    was possible for the same device to appear on either bus.

    This patch removes of_platform_bus_type and registers all of_platform
    bus devices and drivers on the platform bus instead. A previous patch
    made the of_device structure an alias for the platform_device structure,
    and a shim is used to adapt of_platform_drivers to the platform bus.

    After all of of_platform_bus drivers are converted to be normal platform
    drivers, the shim code can be removed.

    Signed-off-by: Grant Likely
    Acked-by: David S. Miller

    Grant Likely
     

06 Jul, 2010

4 commits

  • Some code uses of_device even when CONFIG_OF_DEVICE is not set. This
    patch makes of_device valid all the time by moving it outside of the
    ifdef CONFIG_OF_DEVICE test.

    Reported-by: Randy Dunlap
    Signed-off-by: Grant Likely
    Acked-by: Randy Dunlap

    Grant Likely
     
  • Add of_driver_match_device() helper function. This function can be used
    by bus types to determine if a driver works with a device when using OF
    style matching. If CONFIG_OF is unselected, then it is a nop.

    Signed-off-by: Grant Likely
    CC: Greg Kroah-Hartman
    CC: Michal Simek
    CC: Grant Likely
    CC: Benjamin Herrenschmidt
    CC: Stephen Rothwell
    CC: linux-kernel@vger.kernel.org
    CC: microblaze-uclinux@itee.uq.edu.au
    CC: linuxppc-dev@ozlabs.org
    CC: devicetree-discuss@lists.ozlabs.org

    Grant Likely
     
  • Now that the of_node pointer is part of struct device,
    of_device_get_modalias could be used on any struct device
    that has the device node pointer set. This patch changes
    of_device_get_modalias to accept a struct device instead
    of a struct of_device.

    Signed-off-by: Grant Likely
    CC: Michal Simek
    CC: Benjamin Herrenschmidt
    CC: Wolfram Sang
    CC: Stephen Rothwell
    CC: microblaze-uclinux@itee.uq.edu.au
    CC: linuxppc-dev@ozlabs.org

    Grant Likely
     
  • Merge common code between powerpc and microblaze

    Signed-off-by: Grant Likely
    CC: Michal Simek
    CC: Wolfram Sang
    CC: Stephen Rothwell
    CC: Benjamin Herrenschmidt
    CC: microblaze-uclinux@itee.uq.edu.au
    CC: linuxppc-dev@ozlabs.org

    Grant Likely
     

29 Jun, 2010

1 commit

  • Now that the device tree node pointer has been moved out of struct
    of_device and into the common struct device, there isn't anything
    unique about of_device anymore. In fact, there isn't much need
    for a separate of_bus when all busses have access to OF style
    probing.

    arch/powerpc and arch/microblaze are moving away from using the of_bus
    and using the regular platform bus instead for mmio devices. This
    patch makes of_device the same as platform_device as a stepping stone
    in migrating of_platform_drivers over to the platform bus.

    Signed-off-by: Grant Likely
    Acked-by: David S. Miller
    Cc: Michal Simek
    Cc: Benjamin Herrenschmidt
    Cc: Stephen Rothwell

    Grant Likely
     

22 May, 2010

1 commit


29 Apr, 2010

1 commit


16 May, 2008

1 commit

  • Commit 140b932f8cb6cced10b96860651a198b1b89cbb9 ("Create modalias file
    in sysfs for of_platform bus") needs this to avoid breaking the sparc
    builds.

    Just move the code and add whitespace around some binary operators.

    Signed-off-by: Stephen Rothwell
    Acked-by: David S. Miller
    Signed-off-by: Paul Mackerras

    Stephen Rothwell
     

30 Apr, 2008

1 commit


17 Jan, 2008

1 commit

  • Similar to of_find_compatible_node(), of_find_matching_node() and
    for_each_matching_node() allow you to iterate over the device tree
    looking for specific nodes, except that they take of_device_id
    tables instead of strings.

    This also moves of_match_node() from driver/of/device.c to
    driver/of/base.c to colocate it with the of_find_matching_node which
    depends on it.

    Signed-off-by: Grant Likely
    Signed-off-by: Paul Mackerras

    Grant Likely
     

17 Oct, 2007

1 commit

  • Extract generic of_device allocation code from of_platform_device_create()
    and move it into of_device.[ch], called of_device_alloc(). Also, there's now
    of_device_free() which puts the device node.

    This way, bus drivers that build on of_platform (like ibmebus will) can
    build upon this code instead of reinventing the wheel.

    Signed-off-by: Joachim Fenkes
    Acked-by: Arnd Bergmann
    Signed-off-by: Paul Mackerras

    Joachim Fenkes
     

20 Jul, 2007

1 commit