From d09b3dae3e91bcc5c465c827950bcd40c1988093 Mon Sep 17 00:00:00 2001 From: stefan11111 Date: Sat, 13 Sep 2025 11:51:57 +0300 Subject: [PATCH] hw/xfree86/common: remove {fb,platform,pci,sbus}SlotClaimed These were global variables that were tracking how many slots of one kind were claimed by drivers, or if slots of one kind were claimed by drivers. There were used inconsistently, sometimes they were `int`'s, sometimes they were `Bool`'s. All they were doing was to kill the server in various circumstances, that were often incorrect and lead to bug reports, and guard against a very speciffic kind of driver code error in `xf86ClaimFbSlot`, that was also prone to false-positives. Now that both these uses were removed, these globals are no longer used, so we can remove them. Signed-off-by: stefan11111 --- hw/xfree86/common/xf86Bus.h | 5 ----- hw/xfree86/common/xf86fbBus.c | 3 --- hw/xfree86/common/xf86pciBus.c | 4 ---- hw/xfree86/common/xf86platformBus.c | 4 ---- hw/xfree86/common/xf86sbusBus.c | 3 --- 5 files changed, 19 deletions(-) diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h index d80ca29f2..719d7a3f0 100644 --- a/hw/xfree86/common/xf86Bus.h +++ b/hw/xfree86/common/xf86Bus.h @@ -67,11 +67,6 @@ extern BusRec primaryBus; int xf86AllocateEntity(void); BusType StringToBusType(const char *busID, const char **retID); -extern Bool fbSlotClaimed; -extern Bool sbusSlotClaimed; -extern int platformSlotClaimed; -extern int pciSlotClaimed; - Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func); Bool xf86DriverHasEntities(DriverPtr drvp); void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex); diff --git a/hw/xfree86/common/xf86fbBus.c b/hw/xfree86/common/xf86fbBus.c index d2bf034c1..22825d8ae 100644 --- a/hw/xfree86/common/xf86fbBus.c +++ b/hw/xfree86/common/xf86fbBus.c @@ -44,8 +44,6 @@ #include "xf86Bus.h" #include "xf86_OSproc.h" -Bool fbSlotClaimed = FALSE; - int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) { @@ -61,6 +59,5 @@ xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active) p->inUse = FALSE; xf86AddDevToEntity(num, dev); - fbSlotClaimed = TRUE; return num; } diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c index 07b6d50eb..7c8913bdd 100644 --- a/hw/xfree86/common/xf86pciBus.c +++ b/hw/xfree86/common/xf86pciBus.c @@ -53,8 +53,6 @@ #define PCI_VENDOR_GENERIC 0x00FF -/* Bus-specific globals */ -int pciSlotClaimed = 0; #define PCIINFOCLASSES(c) \ ( (((c) & 0x00ff0000) == (PCI_CLASS_PREHISTORIC << 16)) \ @@ -225,7 +223,6 @@ xf86ClaimPciSlot(struct pci_device *d, DriverPtr drvp, p->inUse = FALSE; if (dev) xf86AddDevToEntity(num, dev); - pciSlotClaimed++; return num; } @@ -247,7 +244,6 @@ xf86UnclaimPciSlot(struct pci_device *d, GDevPtr dev) if ((p->bus.type == BUS_PCI) && (p->bus.id.pci == d)) { /* Probably the slot should be deallocated? */ xf86RemoveDevFromEntity(i, dev); - pciSlotClaimed--; p->bus.type = BUS_NONE; return; } diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index b20189363..7a97986dd 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -58,8 +58,6 @@ #include "xf86Config.h" #include "xf86Crtc.h" -int platformSlotClaimed; - int xf86_num_platform_devices; struct xf86_platform_device *xf86_platform_devices; @@ -396,7 +394,6 @@ xf86ClaimPlatformSlot(struct xf86_platform_device * d, DriverPtr drvp, if (dev) xf86AddDevToEntity(num, dev); - platformSlotClaimed++; return num; } else @@ -414,7 +411,6 @@ xf86UnclaimPlatformSlot(struct xf86_platform_device *d, GDevPtr dev) if ((p->bus.type == BUS_PLATFORM) && (p->bus.id.plat == d)) { if (dev) xf86RemoveDevFromEntity(i, dev); - platformSlotClaimed--; p->bus.type = BUS_NONE; return 0; } diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c index 08dd84c5d..c31edd4c4 100644 --- a/hw/xfree86/common/xf86sbusBus.c +++ b/hw/xfree86/common/xf86sbusBus.c @@ -40,8 +40,6 @@ #include "xf86sbusBus_priv.h" #include "xf86Sbus.h" -Bool sbusSlotClaimed = FALSE; - static int xf86nSbusInfo; static void @@ -366,7 +364,6 @@ xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp, GDevPtr dev, Bool active) p->bus.id.sbus.fbNum = psdp->fbNum; p->active = active; p->inUse = FALSE; - sbusSlotClaimed = TRUE; return num; } else