char: xillybus: Move class-related functions to new xillybus_class.c
authorEli Billauer <eli.billauer@gmail.com>
Wed, 26 May 2021 10:03:10 +0000 (13:03 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 May 2021 12:07:41 +0000 (14:07 +0200)
commit8cb5d216ab3365bc85aac65da27f1c2b3dd6f366
treedd1e8fea56930c8abaa81820e0d90669fd633d71
parent83aacfbcbd42eec3882423bbafcb8b3190376ed8
char: xillybus: Move class-related functions to new xillybus_class.c

This patch is a preparation for adding another related driver, XillyUSB.
In order to share some code between the existing Xillybus driver and the
one to be added, some functions are moved to xillybus_class.c

XILLYBUS_CLASS is added to Kconfig and is common to all drivers in this
group. The relation with the existing XILLYBUS symbol is "select" rather
than "depends on" XILLYBUS_CLASS, or else "make olddefconfig" will silently
turn off XILLYBUS, which is currently enabled in several distributions.

XILLYBUS_CLASS doesn't depend on anything else, hence using it with
"select" poses no risk for a broken configuration.

After the future addition of the XillyUSB module, the tree of symbols
will be as follows:

XILLYBUS_CLASS --+-- XILLYBUS --+-- XILLYBUS_PCIE
                 |              |
                 |              +-- XILLYBUS_OF
                 |
                 +-- XILLYUSB

XILLYBUS is for drivers based upon memory registers + DMA-based interfaces,
and it's combined with XILLYBUS_PCIE and/or XILLYBUS_OF.

XILLYUSB is for the USB variant only.

Or a more detailed, bottom-up outline:

* CONFIG_XILLYBUS_PCIE -> xillybus_pcie.c: Functions related to PCIe.
* CONFIG_XILLYBUS_OF -> xillybus_of.c: Functions related to Xillybus as a
  peripheral on an FPGA / Processor combo chip.
* CONFIG_XILLYBUS -> xillybus_core.c: Functions that are common to the two
  above, mainly access to the peripheral with memory-mapped registers and
  DMA.
* CONFIG_XILLYUSB -> xillyusb.c: The driver for the USB variant, accesses
  the peripheral through the USB framework.
* CONFIG_XILLYBUS_CLASS -> xillybus_class.c: The new module, which contains
  the class and API parts that would otherwise appear both in
  xillybus_core.c and xillyusb.c. Contains utility functions for the two
  latter.

And since I'm at it, comments on the module names are added in the
Kconfig's help part.

The functions are exported with the non-GPL EXPORT_SYMBOL (a matter of
taste).

Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Link: https://lore.kernel.org/r/20210526100311.56327-2-eli.billauer@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/xillybus/Kconfig
drivers/char/xillybus/Makefile
drivers/char/xillybus/xillybus.h
drivers/char/xillybus/xillybus_class.c [new file with mode: 0644]
drivers/char/xillybus/xillybus_class.h [new file with mode: 0644]
drivers/char/xillybus/xillybus_core.c