Commit db82f17d authored by James Bottomley's avatar James Bottomley Committed by Linus Torvalds

[PATCH] Fix MCA for driver core update

This should fix the MCA problems.

I moved the name field to the struct mca_device because it was in such
extensive use, and this approach caused the least impact.
parent 4bbe238c
......@@ -295,7 +295,7 @@ static int __init mca_init(void)
mca_dev->pos_register = 0x7f;
outb_p(mca_dev->pos_register, MCA_MOTHERBOARD_SETUP_REG);
mca_dev->dev.name[0] = 0;
mca_dev->name[0] = 0;
mca_read_and_store_pos(mca_dev->pos);
mca_configure_adapter_status(mca_dev);
/* fake POS and slot for a motherboard */
......@@ -315,7 +315,7 @@ static int __init mca_init(void)
mca_dev->pos_register = 0xdf;
outb_p(mca_dev->pos_register, MCA_MOTHERBOARD_SETUP_REG);
mca_dev->dev.name[0] = 0;
mca_dev->name[0] = 0;
mca_read_and_store_pos(mca_dev->pos);
mca_configure_adapter_status(mca_dev);
/* fake POS and slot for the integrated video */
......@@ -414,13 +414,13 @@ static void mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag)
if(slot == MCA_INTEGSCSI) {
printk(KERN_CRIT "NMI: caused by MCA integrated SCSI adapter (%s)\n",
mca_dev->dev.name);
mca_dev->name);
} else if(slot == MCA_INTEGVIDEO) {
printk(KERN_CRIT "NMI: caused by MCA integrated video adapter (%s)\n",
mca_dev->dev.name);
mca_dev->name);
} else if(slot == MCA_MOTHERBOARD) {
printk(KERN_CRIT "NMI: caused by motherboard (%s)\n",
mca_dev->dev.name);
mca_dev->name);
}
/* More info available in POS 6 and 7? */
......
......@@ -134,7 +134,7 @@ struct mca_bus * __devinit mca_attach_bus(int bus)
return NULL;
memset(mca_bus, 0, sizeof(struct mca_bus));
sprintf(mca_bus->dev.bus_id,"mca%d",bus);
sprintf(mca_bus->dev.name,"Host %s MCA Bridge", bus ? "Secondary" : "Primary");
sprintf(mca_bus->name,"Host %s MCA Bridge", bus ? "Secondary" : "Primary");
device_register(&mca_bus->dev);
mca_root_busses[bus] = mca_bus;
......
......@@ -200,3 +200,18 @@ enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev)
{
return mca_dev->status;
}
EXPORT_SYMBOL(mca_device_status);
/**
* mca_device_set_name - set the name of the device
* @mca_device: device to set the name of
* @name: name to set
*/
void mca_device_set_name(struct mca_device *mca_dev, const char *name)
{
if(!mca_dev)
return;
strlcpy(mca_dev->name, name, sizeof(mca_dev->name));
}
EXPORT_SYMBOL(mca_device_set_name);
......@@ -278,7 +278,7 @@ void mca_set_adapter_name(int slot, char* name)
if(!mca_dev)
return;
strlcpy(mca_dev->dev.name, name, sizeof(mca_dev->dev.name));
mca_device_set_name(mca_dev, name);
}
EXPORT_SYMBOL(mca_set_adapter_name);
......@@ -297,7 +297,7 @@ char *mca_get_adapter_name(int slot)
if(!mca_dev)
return NULL;
return mca_dev->dev.name;
return mca_device_get_name(mca_dev);
}
EXPORT_SYMBOL(mca_get_adapter_name);
......
......@@ -215,7 +215,7 @@ int __init ultramca_probe(struct device *gen_dev)
printk(KERN_INFO "%s: %s found in slot %d\n",
dev->name, smc_mca_adapter_names[adapter], slot + 1);
strncpy(gen_dev->name, smc_mca_adapter_names[adapter], sizeof(gen_dev->name));
mca_device_set_name(mca_dev, smc_mca_adapter_names[adapter]);
mca_device_set_claim(mca_dev, 1);
ultra_found++;
......
......@@ -335,7 +335,7 @@ NCR_D700_probe(struct device *dev)
}
mca_device_set_claim(mca_dev, 1);
strlcpy(dev->name, "NCR_D700", sizeof(dev->name));
mca_device_set_name(mca_dev, "NCR_D700");
dev_set_drvdata(dev, p);
return 0;
}
......
......@@ -291,7 +291,7 @@ NCR_Q720_probe(struct device *dev)
}
mca_device_set_claim(mca_dev, 1);
strlcpy(dev->name, "NCR_Q720", sizeof(dev->name));
mca_device_set_name(mca_dev, "NCR_Q720");
dev_set_drvdata(dev, p);
return 0;
......
......@@ -100,7 +100,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
struct NCR_700_Host_Parameters *hostdata =
kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
printk(KERN_NOTICE "sim710: %s\n", dev->name);
printk(KERN_NOTICE "sim710: %s\n", dev->bus_id);
printk(KERN_NOTICE "sim710: irq = %d, clock = %d, base = 0x%lx, scsi_id = %d\n",
irq, clock, base_addr, scsi_id);
......@@ -255,7 +255,7 @@ sim710_mca_probe(struct device *dev)
} else {
return -ENODEV;
}
strlcpy(dev->name, name, sizeof(dev->name));
mca_device_set_name(mca_dev, name);
mca_device_set_claim(mca_dev, 1);
base = mca_device_transform_ioport(mca_dev, base);
irq_vector = mca_device_transform_irq(mca_dev, irq_vector);
......@@ -304,7 +304,7 @@ sim710_eisa_probe(struct device *dev)
scsi_id = ffs(val) - 1;
if(scsi_id > 7 || (val & ~(1<<scsi_id)) != 0) {
printk(KERN_ERR "sim710.c, EISA card %s has incorrect scsi_id, setting to 7\n", dev->name);
printk(KERN_ERR "sim710.c, EISA card %s has incorrect scsi_id, setting to 7\n", dev->bus_id);
scsi_id = 7;
}
} else {
......
......@@ -73,6 +73,7 @@ struct mca_device {
void *proc_dev;
#endif
struct device dev;
char name[32];
};
#define to_mca_device(mdev) container_of(mdev, struct mca_device, dev)
......@@ -92,6 +93,7 @@ struct mca_bus {
int number;
struct mca_bus_accessor_functions f;
struct device dev;
char name[32];
};
#define to_mca_bus(mdev) container_of(mdev, struct mca_bus, dev)
......@@ -118,6 +120,12 @@ extern void *mca_device_transform_memory(struct mca_device *mca_dev,
void *mem);
extern int mca_device_claimed(struct mca_device *mca_dev);
extern void mca_device_set_claim(struct mca_device *mca_dev, int val);
extern void mca_device_set_name(struct mca_device *mca_dev, const char *name);
static inline char *mca_device_get_name(struct mca_device *mca_dev)
{
return mca_dev ? mca_dev->name : NULL;
}
extern enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev);
extern struct bus_type mca_bus_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment