fwctl: Add basic structure for a class subsystem with a cdev
authorJason Gunthorpe <jgg@nvidia.com>
Fri, 28 Feb 2025 00:26:29 +0000 (20:26 -0400)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 6 Mar 2025 19:11:30 +0000 (15:11 -0400)
commit2e4986cf2d525eed3a240b7821f89ca45cf36d78
tree58449db5198d662488a0e2086c728f9033cb7331
parent2014c95afecee3e76ca4a56956a936e23283f05b
fwctl: Add basic structure for a class subsystem with a cdev

Create the class, character device and functions for a fwctl driver to
un/register to the subsystem.

A typical fwctl driver has a sysfs presence like:

$ ls -l /dev/fwctl/fwctl0
crw------- 1 root root 250, 0 Apr 25 19:16 /dev/fwctl/fwctl0

$ ls /sys/class/fwctl/fwctl0
dev  device  power  subsystem  uevent

$ ls /sys/class/fwctl/fwctl0/device/infiniband/
ibp0s10f0

$ ls /sys/class/infiniband/ibp0s10f0/device/fwctl/
fwctl0/

$ ls /sys/devices/pci0000:00/0000:00:0a.0/fwctl/fwctl0
dev  device  power  subsystem  uevent

Which allows userspace to link all the multi-subsystem driver components
together and learn the subsystem specific names for the device's
components.

Link: https://patch.msgid.link/r/1-v5-642aa0c94070+4447f-fwctl_jgg@nvidia.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Tested-by: Dave Jiang <dave.jiang@intel.com>
Tested-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
MAINTAINERS
drivers/Kconfig
drivers/Makefile
drivers/fwctl/Kconfig [new file with mode: 0644]
drivers/fwctl/Makefile [new file with mode: 0644]
drivers/fwctl/main.c [new file with mode: 0644]
include/linux/fwctl.h [new file with mode: 0644]