[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkda2ix77k3noL3Ze6L3=g8cH_+DK1-HUh6fMkWnSJ1SfUw@mail.gmail.com>
Date: Sat, 2 Dec 2017 16:20:37 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Andrew Jeffery <andrew@...id.au>
Cc: linux-gpio@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Frank Rowand <frowand.list@...il.com>,
Joel Stanley <joel@....id.au>,
Charles Keepax <ckeepax@...nsource.wolfsonmicro.com>,
Laxman Dewangan <ldewangan@...dia.com>,
Ryan Chen <ryan_chen@...eedtech.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
OpenBMC Maillist <openbmc@...ts.ozlabs.org>,
linux-aspeed@...ts.ozlabs.org
Subject: Re: [PATCH v4 1/2] gpio: gpiolib: Generalise state persistence beyond sleep
On Thu, Nov 30, 2017 at 4:55 AM, Andrew Jeffery <andrew@...id.au> wrote:
> General support for state persistence is added to gpiolib with the
> introduction of a new pinconf parameter to propagate the request to
> hardware. The existing persistence support for sleep is adapted to
> include hardware support if the GPIO driver provides it. Persistence
> continues to be enabled by default; in-kernel consumers can opt out, but
> userspace (currently) does not have a choice.
>
> The *_SLEEP_MAY_LOSE_VALUE and *_SLEEP_MAINTAIN_VALUE symbols are
> renamed, dropping the SLEEP prefix to reflect that the concept is no
> longer sleep-specific. I feel that renaming to just *_MAY_LOSE_VALUE
> could initially be misinterpreted, so I've further changed the symbols
> to *_TRANSITORY and *_PERSISTENT to address this.
>
> The sysfs interface is modified only to keep consistency with the
> chardev interface in enforcing persistence for userspace exports.
>
> Signed-off-by: Andrew Jeffery <andrew@...id.au>
> Reviewed-by: Charles Keepax <ckeepax@...nsource.cirrus.com>
> Acked-by: Rob Herring <robh@...nel.org>
Nice work, patch applied!
> diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
> index 3f454eaf2101..0bd472ffb072 100644
> --- a/drivers/gpio/gpiolib-sysfs.c
> +++ b/drivers/gpio/gpiolib-sysfs.c
> @@ -474,11 +474,15 @@ static ssize_t export_store(struct class *class,
> status = -ENODEV;
> goto done;
> }
> - status = gpiod_export(desc, true);
> - if (status < 0)
> - gpiod_free(desc);
> - else
> - set_bit(FLAG_SYSFS, &desc->flags);
> +
> + status = gpiod_set_transitory(desc, false);
> + if (!status) {
> + status = gpiod_export(desc, true);
> + if (status < 0)
> + gpiod_free(desc);
> + else
> + set_bit(FLAG_SYSFS, &desc->flags);
> + }
Part of me just wanna drop this hunk of the patch and let
the old sysfs ABI rot.
But I guess that is especially malevolent so I will abstain.
Yours,
Linus Walleij
Powered by blists - more mailing lists