lkml.org 
[lkml]   [2012]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] pwm-backlight: add regulator and GPIO support
    On Thu, Jul 05, 2012 at 03:25:44PM +0900, Alex Courbot wrote:
    > On 07/05/2012 03:20 PM, Sascha Hauer wrote:
    > >>Oh, that is a mistake of mine then. Driver probe should continue if
    > >>no regulator is declared (but should fail if some other error
    > >>occured). I want to maintain backward compatibility with current
    > >>users of the driver, so regulator/gpio specification should be
    > >>optional.
    > >
    > >I think the only way doing this is to add a flag to platform_data. I
    > >don't know if that's accepted though.
    >
    > I thought about just checking if devm_get_regulator returned -ENODEV
    > and happily continue if that was the case, assuming no regulator was
    > declared.

    And that's the problem. The get_regulator won't return -ENODEV. It will
    return -EPROBE_DEFER which tells you nothing about whether a regulator
    will ever be available or not.

    Having a flag in platform data would be fine with me, but I know other
    people think differently.

    BTW in devicetree this flag implicitely exists with the power-supply
    property. The regulator core could look if a power-supply property
    is given and

    - if it is given, a regulator is mandatory and the core either
    returns the regulator or -EPROBE_DEFER if it cannot find one.
    - If it is not given, there is no regulator and the core could either
    return a special error code or a dummy regulator.

    Right now the regulator core will just return -EPROBE_DEFER in both
    cases. This could easily be changed in the regulator core.

    Sascha

    --
    Pengutronix e.K. | |
    Industrial Linux Solutions | http://www.pengutronix.de/ |
    Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
    Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |


    \
     
     \ /
      Last update: 2012-07-05 09:21    [W:7.446 / U:0.340 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site