Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1288668
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Linus Walleij <linus.walleij@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] gpiolib: return 0 or 1 in gpiod_get_value*() functions |
| Date | Thu, 10 Dec 2015 18:00:01 +0100 |
| Message-ID | <qEcJr-k8-1@gated-at.bofh.it> (permalink) |
| References | <qAAAF-6D4-7@gated-at.bofh.it> |
| X-Original-To | Jose Diaz de Grenu de Pedro <Jose.DiazdeGrenudePedro@digi.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3YC0Io61grx9JQOPLGSN9V/Unwk/VYoWIUeL4bLRjJg=; b=n9dZ/X6ADiwF7GlkKhBQoNviL7gFYfBsBhf0+fz2M7VNye6TsJOvhbPPmd6FYXAYgK upDXizE+9NwZFuiz4/PqjDwspPRkfIxZ2alxgoUCbY+aX8LAbCWq6+nD4nXz7WTqKrDx GK+vdciQGUFm6C7CoeI3MUot57uHihWKAX24YhK/iCGagyRW23wshQe4VImA8pfNM2O3 I2AzyFrKi6S9HRh0qBJJenDfHQJyrblkMmRwjorMuIfrrvLuOsMGQgSKH6R6At+fjFOg M8WKKMf1d95cNVgJEcbZloHuJYepr56BbDFcgQx+qFmPs55p34IZ3joEY2eqPyuRIdXG Lb3Q== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=3YC0Io61grx9JQOPLGSN9V/Unwk/VYoWIUeL4bLRjJg=; b=g24EoU8sm6ifLgCWgDkbYU/rMZ9eTTbajKaEXgwds+vT3775L2bBYlzy6Okm3rabPX 2VzDViduMP12sNW7Ca0ody5rZbauPES086kzwRo+KQI6aMP4CjQqUcP17yRB3DcajMWa KFU5+Ky47pKK6rdTRzBykwjGr4j2FCTDhs8RMCaUYue/dIP6g3oWy5C3COFbd4EXJaUF vn2hrYzBkKIUms4Cb6eTYH8zRFdH+CKwDyXurerXLXZNmwtS/SOeLyMAihbu6O82NX4Y dLm7S6L8ZCX+sT76IOJxmfuc6G+c4OtE31ot4GoEOjPbA/k1barBzer8uA0UExnreKrR 3Cvg== |
| X-Gm-Message-State | ALoCoQkxAHCAQaei/95MkwbLPoVxzhQZcjSoAAAFVGiOMTxQFwl5EBe4rsFFTdKnUTkvFD9iHmQm/HF2F2DyMcFmr44O4DsLUWN7zChWB3tNKGLXgZiKvLw= |
| MIME-Version | 1.0 |
| X-Received | by 10.182.219.228 with SMTP id pr4mr10168869obc.76.1449766441161; Thu, 10 Dec 2015 08:54:01 -0800 (PST) |
| Content-Type | text/plain; charset=UTF-8 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 34 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Alexandre Courbot <gnurou@gmail.com>, Hector Palacios <hector.palacios@digi.com> |
| X-Original-Date | Thu, 10 Dec 2015 17:54:01 +0100 |
| X-Original-Message-ID | <CACRpkdYqX53dmg-SugBsGk-RYTXiLeAZkx1Ws5s8RMU6wjTjxA@mail.gmail.com> |
| X-Original-References | <1448904631-30230-1-git-send-email-Jose.DiazdeGrenudePedro@digi.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1288668 |
Show key headers only | View raw
On Mon, Nov 30, 2015 at 6:30 PM, Jose Diaz de Grenu de Pedro
<Jose.DiazdeGrenudePedro@digi.com> wrote:
> Commit 79a9becda894 moved the awareness of active low state
> into the gpiod_get_value*() functions, but it only inverts the
> GPIO's raw value when it is active low. If the GPIO is active
> high, the gpiod_get_value*() functions return the raw value of
> the register, which can be any positive value.
No, because:
static int _gpiod_get_raw_value(const struct gpio_desc *desc)
{
struct gpio_chip *chip;
int offset;
int value;
chip = desc->chip;
offset = gpio_chip_hwgpio(desc);
value = chip->get ? chip->get(chip, offset) : -EIO;
value = value < 0 ? value : !!value;
trace_gpio_value(desc_to_gpio(desc), 1, value);
return value;
}
This returns a negative error code or the value clamped to [0,1]
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2] gpiolib: return 0 or 1 in gpiod_get_value*() functions Jose Diaz de Grenu de Pedro <Jose.DiazdeGrenudePedro@digi.com> - 2015-11-30 18:40 +0100 Re: [PATCH v2] gpiolib: return 0 or 1 in gpiod_get_value*() functions Bjorn Andersson <bjorn@kryo.se> - 2015-11-30 21:10 +0100 Re: [PATCH v2] gpiolib: return 0 or 1 in gpiod_get_value*() functions Linus Walleij <linus.walleij@linaro.org> - 2015-12-10 18:00 +0100
csiph-web