Re: [PATCH] serio: PS2 gpio bit banging driver for the serio bus

From: Danilo Krummrich
Date: Mon Aug 07 2017 - 12:21:15 EST


Hi Linus,

thanks for reviewing. Commented the ones which still holds.

On Mon, 7 Aug 2017 11:03:53 +0200
Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:

> On Tue, Aug 1, 2017 at 12:24 AM, Danilo Krummrich
> <danilokrummrich@xxxxxxxxxxxxx> wrote:
>
>
> When you add DT bindings you have to CC devicetree@xxxxxxxxxxxxxxx
>
I will do prospectively.

> > +#include <linux/gpio.h>
>
> Use only:
>
> #include <linux/gpio/consumer.h>
>
Done in v6.

> > +#include <linux/of_gpio.h>
>
> Should not be needed.
>
>
Removed in v6.

> > +static int ps2_gpio_write(struct serio *serio, unsigned char val)
> > +{
> > + struct ps2_gpio_data *drvdata = serio->port_data;
> > +
> > + drvdata->mode = PS2_MODE_TX;
> > + drvdata->tx_byte = val;
> > + /* Make sure ISR running on other CPU notice changes. */
> > + barrier();
>
> This seems overengineered, is this really needed?
>
> If we have races like this, the error is likely elsewhere, and should be
> fixed in the GPIO driver MMIO access or so.
>
Yes, seems it can be removed. I didn't saw any explicit barriers in the GPIO
driver (I'm testing on bcm2835), but it seems MMIO operations on SMP archs
does contain barriers. Not sure if all do. If some do not this barrier might
be needed to ensure ISR on other CPU notice the correct mode and byte to send.

--
Danilo Krummrich <danilokrummrich@xxxxxxxxxxxxx>