lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 31 Jul 2009 23:32:32 +0300
From:	Roger Quadros <quadros.roger@...il.com>
To:	pHilipp Zabel <philipp.zabel@...il.com>
Cc:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] regulator: Add GPIO enable control to fixed voltage 
	regulator driver

On Fri, Jul 31, 2009 at 8:38 PM, pHilipp Zabel<philipp.zabel@...il.com> wrote:
> On Fri, Jul 31, 2009 at 7:20 PM, Mark
> Brown<broonie@...nsource.wolfsonmicro.com> wrote:
>> On Fri, Jul 31, 2009 at 07:19:49PM +0300, Roger Quadros wrote:
>>
>>
>>> +             ret = gpio_get_value(config->gpio);
>>
>> Can this fail?  It returns an int...
>
> No, gpio_get_value(_cansleep) return either zero or non-zero.
> I think some I2C gpio chips just return zero when the read fails.
> Also that's the return value if a gpiochip doesn't define the .get method.
>
> Only problem: drivers/gpio/gpiolib.c contains this piece of wisdom:
>
> /* Drivers MUST set GPIO direction before making get/set calls.  In
>  * some cases this is done in early boot, before IRQs are enabled.
>  [...]
>  */
>

Not having gpio_get_direction() in gpiolib is a limitation I think.
Can we just do the following for now ? (i.e. disable regulator by default)
Will there be any glitch? If yes, then how?

                ret = gpio_request(config->gpio, config->supply_name);
                ...

-               ret = gpio_get_value(config->gpio);
-               ret = gpio_direction_output(config->gpio, ret);
+               ret = gpio_direction_output(config->gpio, !config->enable_high);
                if (ret) {
                        dev_err(&pdev->dev, "Could not configure
enable GPIO %d direction: %d\n",
                                                        config->gpio, ret);
                        goto err_gpio;
                }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ