Re: [PATCH RFC v1 1/2] bus: add Wiegand write-only GPIO driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 19, 2022 at 2:57 PM Martin Zaťovič <m.zatovic1@xxxxxxxxx> wrote:

> 1. drivers/bus/wiegand.c
> 2. include/linux/wiegand.h
> 3. drivers/gpio/gpio-wiegand.h
>
> I have looked for drivers with a similar division and tried to figure out what the file drivers/bus/wiegand.c should contain.
> So far I am only sure that it will contain the parity calculation functions.

That is a question for people who know wiegand... Maybe just yourself!

You also clearly need some bus infrastructure to populate and spawn devices.
This mechanism depends on the specifics of the bus.

> The code for sysfs attribute files may also be a part of this file, but I am not sure about it.
> If hypothetically there was another Wiegand driver besides the GPIO one and a user would
> like to connect both of these Wiegand interfaces, he would loose the ability to set attributes
> for individual Wiegand interfaces, am I right?

You should spawn individual devices on a wiegand bus (the kernel concept of
bus). Each new device becomes something like a struct wiegand_device that
contains a struct device, and the struct device is the anchor in sysfs.
https://www.kernel.org/doc/html/latest/driver-api/driver-model/bus.html

> Should the drivers/bus/wiegand.c be a full-scale driver or should it just be a file that
> contains the Wiegand-specific functions(such as parity calculation)?

It should be what we call a bus driver, OK a bit self-referential, but anything
that is common for the bus and the code to spawn the devices.

Yours,
Linus Walleij




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux