I couldn't find any guarantee that the mode and tx_byte change is implicitly> +static int ps2_gpio_write(struct serio *serio, unsigned char val)Yes, seems it can be removed. I didn't saw any explicit barriers in the GPIO
> +{
> + 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.
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.