From 75d864432cc41c45d46df9ea7d3afd7cccbc0148 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 14 Apr 2005 10:10:54 +0000 Subject: Use the magic of common symbols to allow struct dev to effectively grow at link time to accommodate whatever bus objects are included. --- src/drivers/bus/mca.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/drivers/bus/mca.c') diff --git a/src/drivers/bus/mca.c b/src/drivers/bus/mca.c index 28b99f77a..1715c5883 100644 --- a/src/drivers/bus/mca.c +++ b/src/drivers/bus/mca.c @@ -19,6 +19,14 @@ #define DBG(...) #endif +/* + * Ensure that there is sufficient space in the shared dev_bus + * structure for a struct pci_device. + * + */ +DEV_BUS( struct mca_device, mca_dev ); +static char mca_magic[0]; /* guaranteed unique symbol */ + /* * Fill in parameters for an MCA device based on slot number * @@ -53,14 +61,14 @@ static int fill_mca_device ( struct mca_device *mca ) { * Obtain a struct mca * from a struct dev * * * If dev has not previously been used for an MCA device scan, blank - * out dev.mca + * out struct mca */ struct mca_device * mca_device ( struct dev *dev ) { - struct mca_device *mca = &dev->mca; + struct mca_device *mca = dev->bus; - if ( dev->devid.bus_type != MCA_BUS_TYPE ) { + if ( mca->magic != mca_magic ) { memset ( mca, 0, sizeof ( *mca ) ); - dev->devid.bus_type = MCA_BUS_TYPE; + mca->magic = mca_magic; } mca->dev = dev; return mca; @@ -97,8 +105,10 @@ int find_mca_device ( struct mca_device *mca, struct mca_driver *driver ) { id->name, driver->name, id->id ); if ( mca->dev ) { mca->dev->name = driver->name; - mca->dev->devid.vendor_id = - GENERIC_MCA_VENDOR; + mca->dev->devid.bus_type + = MCA_BUS_TYPE; + mca->dev->devid.vendor_id + = GENERIC_MCA_VENDOR; mca->dev->devid.device_id = id->id; } mca->already_tried = 1; -- cgit v1.2.3-55-g7522