mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
<linux/mod_devicetable.h> is included transitively in nearly every driver in an x86_64 allmodconfig build of v7.1: $ find drivers -name \*.o -not -name \*.mod.o | wc -l 21330 $ find drivers -name \*.o.cmd -not -name \*.mod.o.cmd | xargs grep -l mod_devicetable.h | wc -l 17038 The result is that even when touching an obscure device id struct most of the kernel needs to be recompiled. Given that each driver typically only needs one or two of these structures, splitting into per subsystem headers and only including what is really needed reduces the amount of needed recompilation. Implement the first step and define each device id struct in a separate header (together with its associated #defines). <linux/mod_devicetable.h> is modified to include all the new headers to continue to provide the same symbols. Several headers currently include <linux/mod_devicetable.h>, those that are most lukrative to include only their subsystem headers only are: $ git -C source grep -l mod_devicetable.h include/linux | while read h; do echo -n "$h:"; find drivers -name \*.o.cmd -not -name \*.mod.o.cmd | xargs grep -l $h | wc -l; done | sort -t: -k2 -n -r | head include/linux/of.h:10897 include/linux/pci.h:7920 include/linux/acpi.h:7097 include/linux/i2c.h:5402 include/linux/spi/spi.h:1897 include/linux/dmi.h:1643 include/linux/usb.h:1222 include/linux/input.h:1205 include/linux/mdio.h:835 include/linux/phy.h:733 struct cpu_feature isn't really a device_id struct. That is kept in <linux/mod_devicetable.h> for now. Acked-by: Danilo Krummrich <dakr@kernel.org> Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # zorro Link: https://patch.msgid.link/41400e323be8640702b906d04327e833c5bdaf4a.1782808461.git.u.kleine-koenig@baylibre.com [Drop "MOD" from the header guards] Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
55 lines
1.7 KiB
C
55 lines
1.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef LINUX_DEVICE_ID_PCI_H
|
|
#define LINUX_DEVICE_ID_PCI_H
|
|
|
|
#ifdef __KERNEL__
|
|
#include <linux/types.h>
|
|
typedef unsigned long kernel_ulong_t;
|
|
#endif
|
|
|
|
#define PCI_ANY_ID (~0)
|
|
|
|
enum {
|
|
PCI_ID_F_VFIO_DRIVER_OVERRIDE = 1,
|
|
};
|
|
|
|
/**
|
|
* struct pci_device_id - PCI device ID structure
|
|
* @vendor: Vendor ID to match (or PCI_ANY_ID)
|
|
* @device: Device ID to match (or PCI_ANY_ID)
|
|
* @subvendor: Subsystem vendor ID to match (or PCI_ANY_ID)
|
|
* @subdevice: Subsystem device ID to match (or PCI_ANY_ID)
|
|
* @class: Device class, subclass, and "interface" to match.
|
|
* See Appendix D of the PCI Local Bus Spec or
|
|
* include/linux/pci_ids.h for a full list of classes.
|
|
* Most drivers do not need to specify class/class_mask
|
|
* as vendor/device is normally sufficient.
|
|
* @class_mask: Limit which sub-fields of the class field are compared.
|
|
* See drivers/scsi/sym53c8xx_2/ for example of usage.
|
|
* @driver_data: Data private to the driver.
|
|
* Most drivers don't need to use driver_data field.
|
|
* Best practice is to use driver_data as an index
|
|
* into a static list of equivalent device types,
|
|
* instead of using it as a pointer.
|
|
* @override_only: Match only when dev->driver_override is this driver.
|
|
*/
|
|
struct pci_device_id {
|
|
__u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/
|
|
__u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */
|
|
__u32 class, class_mask; /* (class,subclass,prog-if) triplet */
|
|
kernel_ulong_t driver_data; /* Data private to the driver */
|
|
__u32 override_only;
|
|
};
|
|
|
|
/* pci_epf */
|
|
|
|
#define PCI_EPF_NAME_SIZE 20
|
|
#define PCI_EPF_MODULE_PREFIX "pci_epf:"
|
|
|
|
struct pci_epf_device_id {
|
|
char name[PCI_EPF_NAME_SIZE];
|
|
kernel_ulong_t driver_data;
|
|
};
|
|
|
|
#endif /* ifndef LINUX_DEVICE_ID_PCI_H */
|