[PATCH] dm: Use explicit numbers for all enum values

Michal Simek michal.simek at xilinx.com
Fri Apr 1 12:13:44 CEST 2022


Based on discussion at
https://lore.kernel.org/r/20200318125003.GA2727094@kroah.com we got
recommendation to use explicit values for all enum values.
The patch is following this recommendation.

The same change was also done by commit 31431dd466e7 ("firmware: xilinx:
Use explicit values for all enum values").

Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---

I was doing some debug and got uclass ID but without values it is hard to
find out which uclass it is.
---
 include/dm/uclass-id.h | 240 ++++++++++++++++++++---------------------
 1 file changed, 120 insertions(+), 120 deletions(-)

diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index 0e26e1d13824..30d120879a4e 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -13,129 +13,129 @@
 enum uclass_id {
 	/* These are used internally by driver model */
 	UCLASS_ROOT = 0,
-	UCLASS_DEMO,
-	UCLASS_TEST,
-	UCLASS_TEST_FDT,
-	UCLASS_TEST_FDT_MANUAL,
-	UCLASS_TEST_BUS,
-	UCLASS_TEST_PROBE,
-	UCLASS_TEST_DUMMY,
-	UCLASS_TEST_DEVRES,
-	UCLASS_TEST_ACPI,
-	UCLASS_SPI_EMUL,	/* sandbox SPI device emulator */
-	UCLASS_I2C_EMUL,	/* sandbox I2C device emulator */
-	UCLASS_I2C_EMUL_PARENT,	/* parent for I2C device emulators */
-	UCLASS_PCI_EMUL,	/* sandbox PCI device emulator */
-	UCLASS_PCI_EMUL_PARENT,	/* parent for PCI device emulators */
-	UCLASS_USB_EMUL,	/* sandbox USB bus device emulator */
-	UCLASS_AXI_EMUL,	/* sandbox AXI bus device emulator */
+	UCLASS_DEMO = 1,
+	UCLASS_TEST = 2,
+	UCLASS_TEST_FDT = 3,
+	UCLASS_TEST_FDT_MANUAL = 4,
+	UCLASS_TEST_BUS = 5,
+	UCLASS_TEST_PROBE = 6,
+	UCLASS_TEST_DUMMY = 7,
+	UCLASS_TEST_DEVRES = 8,
+	UCLASS_TEST_ACPI = 10,
+	UCLASS_SPI_EMUL = 11,	/* sandbox SPI device emulator */
+	UCLASS_I2C_EMUL = 12,	/* sandbox I2C device emulator */
+	UCLASS_I2C_EMUL_PARENT = 12, /* parent for I2C device emulators */
+	UCLASS_PCI_EMUL = 13,	/* sandbox PCI device emulator */
+	UCLASS_PCI_EMUL_PARENT = 14, /* parent for PCI device emulators */
+	UCLASS_USB_EMUL = 15,	/* sandbox USB bus device emulator */
+	UCLASS_AXI_EMUL = 16,	/* sandbox AXI bus device emulator */
 
 	/* U-Boot uclasses start here - in alphabetical order */
-	UCLASS_ACPI_PMC,	/* (x86) Power-management controller (PMC) */
-	UCLASS_ADC,		/* Analog-to-digital converter */
-	UCLASS_AHCI,		/* SATA disk controller */
-	UCLASS_AUDIO_CODEC,	/* Audio codec with control and data path */
-	UCLASS_AXI,		/* AXI bus */
-	UCLASS_BLK,		/* Block device */
-	UCLASS_BOOTCOUNT,       /* Bootcount backing store */
-	UCLASS_BUTTON,		/* Button */
-	UCLASS_CACHE,		/* Cache controller */
-	UCLASS_CLK,		/* Clock source, e.g. used by peripherals */
-	UCLASS_CPU,		/* CPU, typically part of an SoC */
-	UCLASS_CROS_EC,		/* Chrome OS EC */
-	UCLASS_DISPLAY,		/* Display (e.g. DisplayPort, HDMI) */
-	UCLASS_DSI_HOST,	/* Display Serial Interface host */
-	UCLASS_DMA,		/* Direct Memory Access */
-	UCLASS_DSA,		/* Distributed (Ethernet) Switch Architecture */
-	UCLASS_ECDSA,		/* Elliptic curve cryptographic device */
-	UCLASS_EFI_LOADER,	/* Devices created by UEFI applications */
-	UCLASS_EFI_MEDIA,	/* Devices provided by UEFI firmware */
-	UCLASS_ETH,		/* Ethernet device */
-	UCLASS_ETH_PHY,		/* Ethernet PHY device */
-	UCLASS_FIRMWARE,	/* Firmware */
-	UCLASS_FS_FIRMWARE_LOADER,		/* Generic loader */
-	UCLASS_GPIO,		/* Bank of general-purpose I/O pins */
-	UCLASS_HASH,		/* Hash device */
-	UCLASS_HWSPINLOCK,	/* Hardware semaphores */
-	UCLASS_I2C,		/* I2C bus */
-	UCLASS_I2C_EEPROM,	/* I2C EEPROM device */
-	UCLASS_I2C_GENERIC,	/* Generic I2C device */
-	UCLASS_I2C_MUX,		/* I2C multiplexer */
-	UCLASS_I2S,		/* I2S bus */
-	UCLASS_IDE,		/* IDE device */
-	UCLASS_IOMMU,		/* IOMMU */
-	UCLASS_IRQ,		/* Interrupt controller */
-	UCLASS_KEYBOARD,	/* Keyboard input device */
-	UCLASS_LED,		/* Light-emitting diode (LED) */
-	UCLASS_LPC,		/* x86 'low pin count' interface */
-	UCLASS_MAILBOX,		/* Mailbox controller */
-	UCLASS_MASS_STORAGE,	/* Mass storage device */
-	UCLASS_MDIO,		/* MDIO bus */
-	UCLASS_MDIO_MUX,	/* MDIO MUX/switch */
-	UCLASS_MISC,		/* Miscellaneous device */
-	UCLASS_MMC,		/* SD / MMC card or chip */
-	UCLASS_MOD_EXP,		/* RSA Mod Exp device */
-	UCLASS_MTD,		/* Memory Technology Device (MTD) device */
-	UCLASS_MUX,		/* Multiplexer device */
-	UCLASS_NOP,		/* No-op devices */
-	UCLASS_NORTHBRIDGE,	/* Intel Northbridge / SDRAM controller */
-	UCLASS_NVME,		/* NVM Express device */
-	UCLASS_P2SB,		/* (x86) Primary-to-Sideband Bus */
-	UCLASS_PANEL,		/* Display panel, such as an LCD */
-	UCLASS_PANEL_BACKLIGHT,	/* Backlight controller for panel */
-	UCLASS_PCH,		/* x86 platform controller hub */
-	UCLASS_PCI,		/* PCI bus */
-	UCLASS_PCI_EP,		/* PCI endpoint device */
-	UCLASS_PCI_GENERIC,	/* Generic PCI bus device */
-	UCLASS_PHY,		/* Physical Layer (PHY) device */
-	UCLASS_PINCONFIG,	/* Pin configuration node device */
-	UCLASS_PINCTRL,		/* Pinctrl (pin muxing/configuration) device */
-	UCLASS_PMIC,		/* PMIC I/O device */
-	UCLASS_POWER_DOMAIN,	/* (SoC) Power domains */
-	UCLASS_PWM,		/* Pulse-width modulator */
-	UCLASS_PWRSEQ,		/* Power sequence device */
-	UCLASS_QFW,		/* QEMU firmware config device */
-	UCLASS_RAM,		/* RAM controller */
-	UCLASS_REBOOT_MODE,	/* Reboot mode */
-	UCLASS_REGULATOR,	/* Regulator device */
-	UCLASS_REMOTEPROC,	/* Remote Processor device */
-	UCLASS_RESET,		/* Reset controller device */
-	UCLASS_RNG,		/* Random Number Generator */
-	UCLASS_RTC,		/* Real time clock device */
-	UCLASS_SCMI_AGENT,	/* Interface with an SCMI server */
-	UCLASS_SCSI,		/* SCSI device */
-	UCLASS_SERIAL,		/* Serial UART */
-	UCLASS_SIMPLE_BUS,	/* Bus with child devices */
-	UCLASS_SMEM,		/* Shared memory interface */
-	UCLASS_SOC,		/* SOC Device */
-	UCLASS_SOUND,		/* Playing simple sounds */
-	UCLASS_SPI,		/* SPI bus */
-	UCLASS_SPI_FLASH,	/* SPI flash */
-	UCLASS_SPI_GENERIC,	/* Generic SPI flash target */
-	UCLASS_SPMI,		/* System Power Management Interface bus */
-	UCLASS_SYSCON,		/* System configuration device */
-	UCLASS_SYSINFO,		/* Device information from hardware */
-	UCLASS_SYSRESET,	/* System reset device */
-	UCLASS_TEE,		/* Trusted Execution Environment device */
-	UCLASS_THERMAL,		/* Thermal sensor */
-	UCLASS_TIMER,		/* Timer device */
-	UCLASS_TPM,		/* Trusted Platform Module TIS interface */
-	UCLASS_UFS,		/* Universal Flash Storage */
-	UCLASS_USB,		/* USB bus */
-	UCLASS_USB_DEV_GENERIC,	/* USB generic device */
-	UCLASS_USB_HUB,		/* USB hub */
-	UCLASS_USB_GADGET_GENERIC,	/* USB generic device */
-	UCLASS_VIDEO,		/* Video or LCD device */
-	UCLASS_VIDEO_BRIDGE,	/* Video bridge, e.g. DisplayPort to LVDS */
-	UCLASS_VIDEO_CONSOLE,	/* Text console driver for video device */
-	UCLASS_VIDEO_OSD,	/* On-screen display */
-	UCLASS_VIRTIO,		/* VirtIO transport device */
-	UCLASS_W1,		/* Dallas 1-Wire bus */
-	UCLASS_W1_EEPROM,	/* one-wire EEPROMs */
-	UCLASS_WDT,		/* Watchdog Timer driver */
-	UCLASS_PVBLOCK,		/* Xen virtual block device */
+	UCLASS_ACPI_PMC = 17,	/* (x86) Power-management controller (PMC) */
+	UCLASS_ADC = 18,	/* Analog-to-digital converter */
+	UCLASS_AHCI = 19,	/* SATA disk controller */
+	UCLASS_AUDIO_CODEC = 20,/* Audio codec with control and data path */
+	UCLASS_AXI = 21,	/* AXI bus */
+	UCLASS_BLK = 22,	/* Block device */
+	UCLASS_BOOTCOUNT = 23,	/* Bootcount backing store */
+	UCLASS_BUTTON = 24,	/* Button */
+	UCLASS_CACHE = 25,	/* Cache controller */
+	UCLASS_CLK = 26,	/* Clock source, e.g. used by peripherals */
+	UCLASS_CPU = 27,	/* CPU, typically part of an SoC */
+	UCLASS_CROS_EC = 28,	/* Chrome OS EC */
+	UCLASS_DISPLAY = 29,	/* Display (e.g. DisplayPort, HDMI) */
+	UCLASS_DSI_HOST = 30,	/* Display Serial Interface host */
+	UCLASS_DMA = 31,	/* Direct Memory Access */
+	UCLASS_DSA = 32,	/* Distributed (Ethernet) Switch Architecture */
+	UCLASS_ECDSA = 33,	/* Elliptic curve cryptographic device */
+	UCLASS_EFI_LOADER = 34,	/* Devices created by UEFI applications */
+	UCLASS_EFI_MEDIA = 35,	/* Devices provided by UEFI firmware */
+	UCLASS_ETH = 36,	/* Ethernet device */
+	UCLASS_ETH_PHY = 37,	/* Ethernet PHY device */
+	UCLASS_FIRMWARE = 38,	/* Firmware */
+	UCLASS_FS_FIRMWARE_LOADER = 39, /* Generic loader */
+	UCLASS_GPIO = 40,	/* Bank of general-purpose I/O pins */
+	UCLASS_HASH = 41,	/* Hash device */
+	UCLASS_HWSPINLOCK = 42,	/* Hardware semaphores */
+	UCLASS_I2C = 43,	/* I2C bus */
+	UCLASS_I2C_EEPROM = 44,	/* I2C EEPROM device */
+	UCLASS_I2C_GENERIC = 45, /* Generic I2C device */
+	UCLASS_I2C_MUX = 46,	/* I2C multiplexer */
+	UCLASS_I2S = 47,	/* I2S bus */
+	UCLASS_IDE = 48,	/* IDE device */
+	UCLASS_IOMMU = 49,	/* IOMMU */
+	UCLASS_IRQ = 49,	/* Interrupt controller */
+	UCLASS_KEYBOARD = 50,	/* Keyboard input device */
+	UCLASS_LED = 51,	/* Light-emitting diode (LED) */
+	UCLASS_LPC = 52,	/* x86 'low pin count' interface */
+	UCLASS_MAILBOX = 53,	/* Mailbox controller */
+	UCLASS_MASS_STORAGE = 54, /* Mass storage device */
+	UCLASS_MDIO = 55,	/* MDIO bus */
+	UCLASS_MDIO_MUX = 56,	/* MDIO MUX/switch */
+	UCLASS_MISC = 57,	/* Miscellaneous device */
+	UCLASS_MMC = 58,	/* SD / MMC card or chip */
+	UCLASS_MOD_EXP = 59,	/* RSA Mod Exp device */
+	UCLASS_MTD = 60,	/* Memory Technology Device (MTD) device */
+	UCLASS_MUX = 61,	/* Multiplexer device */
+	UCLASS_NOP = 62,	/* No-op devices */
+	UCLASS_NORTHBRIDGE = 63, /* Intel Northbridge / SDRAM controller */
+	UCLASS_NVME = 64,	/* NVM Express device */
+	UCLASS_P2SB = 65,	/* (x86) Primary-to-Sideband Bus */
+	UCLASS_PANEL = 66,	/* Display panel, such as an LCD */
+	UCLASS_PANEL_BACKLIGHT = 67, /* Backlight controller for panel */
+	UCLASS_PCH = 68,	/* x86 platform controller hub */
+	UCLASS_PCI = 69,	/* PCI bus */
+	UCLASS_PCI_EP = 70,	/* PCI endpoint device */
+	UCLASS_PCI_GENERIC = 71,/* Generic PCI bus device */
+	UCLASS_PHY = 72,	/* Physical Layer (PHY) device */
+	UCLASS_PINCONFIG = 73,	/* Pin configuration node device */
+	UCLASS_PINCTRL = 74,	/* Pinctrl (pin muxing/configuration) device */
+	UCLASS_PMIC = 75,	/* PMIC I/O device */
+	UCLASS_POWER_DOMAIN = 76, /* (SoC) Power domains */
+	UCLASS_PWM = 77,	/* Pulse-width modulator */
+	UCLASS_PWRSEQ = 78,	/* Power sequence device */
+	UCLASS_QFW = 79,	/* QEMU firmware config device */
+	UCLASS_RAM = 80,	/* RAM controller */
+	UCLASS_REBOOT_MODE = 81,/* Reboot mode */
+	UCLASS_REGULATOR = 82,	/* Regulator device */
+	UCLASS_REMOTEPROC = 83,	/* Remote Processor device */
+	UCLASS_RESET = 84,	/* Reset controller device */
+	UCLASS_RNG = 85,	/* Random Number Generator */
+	UCLASS_RTC = 86,	/* Real time clock device */
+	UCLASS_SCMI_AGENT = 87,	/* Interface with an SCMI server */
+	UCLASS_SCSI = 88,	/* SCSI device */
+	UCLASS_SERIAL = 89,	/* Serial UART */
+	UCLASS_SIMPLE_BUS = 90,	/* Bus with child devices */
+	UCLASS_SMEM = 91,	/* Shared memory interface */
+	UCLASS_SOC = 92,	/* SOC Device */
+	UCLASS_SOUND = 93,	/* Playing simple sounds */
+	UCLASS_SPI = 94,	/* SPI bus */
+	UCLASS_SPI_FLASH = 95,	/* SPI flash */
+	UCLASS_SPI_GENERIC = 96, /* Generic SPI flash target */
+	UCLASS_SPMI = 97,	/* System Power Management Interface bus */
+	UCLASS_SYSCON = 98,	/* System configuration device */
+	UCLASS_SYSINFO = 99,	/* Device information from hardware */
+	UCLASS_SYSRESET = 100,	/* System reset device */
+	UCLASS_TEE = 101,	/* Trusted Execution Environment device */
+	UCLASS_THERMAL = 102,	/* Thermal sensor */
+	UCLASS_TIMER = 103,	/* Timer device */
+	UCLASS_TPM = 104,	/* Trusted Platform Module TIS interface */
+	UCLASS_UFS = 105,	/* Universal Flash Storage */
+	UCLASS_USB = 106,	/* USB bus */
+	UCLASS_USB_DEV_GENERIC = 107, /* USB generic device */
+	UCLASS_USB_HUB = 108,	/* USB hub */
+	UCLASS_USB_GADGET_GENERIC = 109, /* USB generic device */
+	UCLASS_VIDEO = 110,	/* Video or LCD device */
+	UCLASS_VIDEO_BRIDGE = 111, /* Video bridge, e.g. DisplayPort to LVDS */
+	UCLASS_VIDEO_CONSOLE = 112, /* Text console driver for video device */
+	UCLASS_VIDEO_OSD = 113,	/* On-screen display */
+	UCLASS_VIRTIO = 114,	/* VirtIO transport device */
+	UCLASS_W1 = 115,	/* Dallas 1-Wire bus */
+	UCLASS_W1_EEPROM = 116,	/* one-wire EEPROMs */
+	UCLASS_WDT = 117,	/* Watchdog Timer driver */
+	UCLASS_PVBLOCK = 118,	/* Xen virtual block device */
 
-	UCLASS_COUNT,
+	UCLASS_COUNT = 119,
 	UCLASS_INVALID = -1,
 };
 
-- 
2.35.1



More information about the U-Boot mailing list