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]
Message-ID: <CACRpkdYSU6NdFuab6rJS7eADSqORNDBzbFfJ65nFoJj3EZVd-g@mail.gmail.com>
Date:	Tue, 8 Jul 2014 11:34:32 +0200
From:	Linus Walleij <linus.walleij@...aro.org>
To:	Sören Brinkmann <soren.brinkmann@...inx.com>
Cc:	Harini Katakam <harini.katakam@...inx.com>,
	Alexandre Courbot <gnurou@...il.com>,
	Grant Likely <grant.likely@...aro.org>,
	Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	"ijc+devicetree@...lion.org.uk" <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	Rob Landley <rob@...dley.net>,
	Michal Simek <michal.simek@...inx.com>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	Harini Katakam <harinikatakamlinux@...il.com>,
	Harini Katakam <harinik@...inx.com>
Subject: Re: [PATCH v2 1/2] gpio: Add driver for Zynq GPIO controller

On Mon, Jul 7, 2014 at 6:08 PM, Sören Brinkmann
<soren.brinkmann@...inx.com> wrote:

>> So: what is the usecase for these GPIOs?
>
> Yea, in this case it was a button. I have to look at these drivers. It's
> very likely that they cover what I want. But this case is trivial. I
> really don't do anything but enabling the IRQ by writing to the edge
> attribute and press the push-button connected to that GPIO line.

In case of a system using device tree it is very trivial to add a gpio
key binding. After compiling in the gpio keys driver this small
snipper type is all that is really needed in most cases:

        /* User key mapped in as "escape" */
        gpio-keys {
                compatible = "gpio-keys";
                user-button {
                        label = "user_button";
                        gpios = <&gpio0 3 0x1>;
                        linux,code = <1>; /* KEY_ESC */
                        gpio-key,wakeup;
                };
        };


> But as a general note: I think we have quite some customers trying to do
> GPIO in userspace.

For what? I mean the use cases. Usually it is a bad idea, and
as shown above, just using the right existing device driver with
device tree is much easier, also for an end user, given they know
how to alter DTs and compile in kernel modules.

> With Zynq's FPGA portion, a lot of things come down
> to make signals accessible in Linux and a lot of people do not want or
> need a full blown kernel driver and use GPIO. The request for 'how to
> handle GPIO IRQs in userspace' is pretty common. Often this gets passed
> on to UIO though.

The short answer is don't handle GPIO IRQs in userspace.

Userspace drivers is generally a bad idea and should not be written.
The kernel is intended to handle hardware.

The above is doubly true for anything involving IRQs. Just think
of what IRQs are. They are one of the reasons why we have a
kernel and not just write all software on a system from scratch
ourselves.

Yours,
Linus Walleij
--
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