Re: [PATCH v2 1/9] Documentation: gpio: add chardev userspace API documentation

From: Andy Shevchenko
Date: Sun Jan 14 2024 - 20:12:00 EST


On Mon, Jan 15, 2024 at 2:49 AM Kent Gibson <warthog618@xxxxxxxxx> wrote:
>
> Add documentation for the GPIO character device userspace API.
>
> Added to the userspace-api book, but also provide a link from the
> admin-guide book, as historically the GPIO documentation has been
> there.

..

> +.. note::
> + Do NOT abuse userspace APIs to control hardware that has proper kernel
> + drivers. There may already be a driver for your use case, and an existing
> + kernel driver is sure to provide a superior solution to bitbashing
> + from userspace.
> +
> + Read Documentation/driver-api/gpio/drivers-on-gpio.rst to avoid reinventing
> + kernel wheels in userspace.
> +
> + Similarly, for multi-function lines there may be other subsystems, such as
> + Documentation/spi/index.rst, Documentation/i2c/index.rst,
> + Documentation/driver-api/pwm.rst, Documentation/w1/index.rst etc, that
> + provide suitable drivers and APIs for your hardware.

Very good note and would be nice to convince users to follow it:
https://stackoverflow.com/q/77683532/2511795
(OOH you might be proud it's Rust, OTOH as described above)

--
With Best Regards,
Andy Shevchenko