Commit 0067cc99 authored by Paolo Ciarrocchi's avatar Paolo Ciarrocchi Committed by Ingo Molnar

x86: coding style fixes to arch/x86/kernel/mca_32.c

Before:
   total: 42 errors, 3 warnings, 469 lines checked
After:
   total: 0 errors, 3 warnings, 479 lines checked

No code changed:

arch/x86/kernel/mca_32.o:

   text	   data	    bss	    dec	    hex	filename
   1832	    288	      5	   2125	    84d	mca_32.o.before
   1832	    288	      5	   2125	    84d	mca_32.o.after

md5:
   c0e45e2b743ce26349eb07dc53e80b94  mca_32.o.before.asm
   c0e45e2b743ce26349eb07dc53e80b94  mca_32.o.after.asm
Signed-off-by: default avatarPaolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent f73920cd
...@@ -53,9 +53,9 @@ ...@@ -53,9 +53,9 @@
#include <linux/init.h> #include <linux/init.h>
#include <asm/arch_hooks.h> #include <asm/arch_hooks.h>
static unsigned char which_scsi = 0; static unsigned char which_scsi;
int MCA_bus = 0; int MCA_bus;
EXPORT_SYMBOL(MCA_bus); EXPORT_SYMBOL(MCA_bus);
/* /*
...@@ -68,15 +68,17 @@ static DEFINE_SPINLOCK(mca_lock); ...@@ -68,15 +68,17 @@ static DEFINE_SPINLOCK(mca_lock);
/* Build the status info for the adapter */ /* Build the status info for the adapter */
static void mca_configure_adapter_status(struct mca_device *mca_dev) { static void mca_configure_adapter_status(struct mca_device *mca_dev)
{
mca_dev->status = MCA_ADAPTER_NONE; mca_dev->status = MCA_ADAPTER_NONE;
mca_dev->pos_id = mca_dev->pos[0] mca_dev->pos_id = mca_dev->pos[0]
+ (mca_dev->pos[1] << 8); + (mca_dev->pos[1] << 8);
if(!mca_dev->pos_id && mca_dev->slot < MCA_MAX_SLOT_NR) { if (!mca_dev->pos_id && mca_dev->slot < MCA_MAX_SLOT_NR) {
/* id = 0x0000 usually indicates hardware failure, /*
* id = 0x0000 usually indicates hardware failure,
* however, ZP Gu (zpg@castle.net> reports that his 9556 * however, ZP Gu (zpg@castle.net> reports that his 9556
* has 0x0000 as id and everything still works. There * has 0x0000 as id and everything still works. There
* also seem to be an adapter with id = 0x0000; the * also seem to be an adapter with id = 0x0000; the
...@@ -87,9 +89,10 @@ static void mca_configure_adapter_status(struct mca_device *mca_dev) { ...@@ -87,9 +89,10 @@ static void mca_configure_adapter_status(struct mca_device *mca_dev) {
mca_dev->status = MCA_ADAPTER_ERROR; mca_dev->status = MCA_ADAPTER_ERROR;
return; return;
} else if(mca_dev->pos_id != 0xffff) { } else if (mca_dev->pos_id != 0xffff) {
/* 0xffff usually indicates that there's no adapter, /*
* 0xffff usually indicates that there's no adapter,
* however, some integrated adapters may have 0xffff as * however, some integrated adapters may have 0xffff as
* their id and still be valid. Examples are on-board * their id and still be valid. Examples are on-board
* VGA of the 55sx, the integrated SCSI of the 56 & 57, * VGA of the 55sx, the integrated SCSI of the 56 & 57,
...@@ -99,19 +102,19 @@ static void mca_configure_adapter_status(struct mca_device *mca_dev) { ...@@ -99,19 +102,19 @@ static void mca_configure_adapter_status(struct mca_device *mca_dev) {
mca_dev->status = MCA_ADAPTER_NORMAL; mca_dev->status = MCA_ADAPTER_NORMAL;
} }
if((mca_dev->pos_id == 0xffff || if ((mca_dev->pos_id == 0xffff ||
mca_dev->pos_id == 0x0000) && mca_dev->slot >= MCA_MAX_SLOT_NR) { mca_dev->pos_id == 0x0000) && mca_dev->slot >= MCA_MAX_SLOT_NR) {
int j; int j;
for(j = 2; j < 8; j++) { for (j = 2; j < 8; j++) {
if(mca_dev->pos[j] != 0xff) { if (mca_dev->pos[j] != 0xff) {
mca_dev->status = MCA_ADAPTER_NORMAL; mca_dev->status = MCA_ADAPTER_NORMAL;
break; break;
} }
} }
} }
if(!(mca_dev->pos[2] & MCA_ENABLED)) { if (!(mca_dev->pos[2] & MCA_ENABLED)) {
/* enabled bit is in POS 2 */ /* enabled bit is in POS 2 */
...@@ -133,7 +136,7 @@ static struct resource mca_standard_resources[] = { ...@@ -133,7 +136,7 @@ static struct resource mca_standard_resources[] = {
#define MCA_STANDARD_RESOURCES ARRAY_SIZE(mca_standard_resources) #define MCA_STANDARD_RESOURCES ARRAY_SIZE(mca_standard_resources)
/** /*
* mca_read_and_store_pos - read the POS registers into a memory buffer * mca_read_and_store_pos - read the POS registers into a memory buffer
* @pos: a char pointer to 8 bytes, contains the POS register value on * @pos: a char pointer to 8 bytes, contains the POS register value on
* successful return * successful return
...@@ -141,12 +144,14 @@ static struct resource mca_standard_resources[] = { ...@@ -141,12 +144,14 @@ static struct resource mca_standard_resources[] = {
* Returns 1 if a card actually exists (i.e. the pos isn't * Returns 1 if a card actually exists (i.e. the pos isn't
* all 0xff) or 0 otherwise * all 0xff) or 0 otherwise
*/ */
static int mca_read_and_store_pos(unsigned char *pos) { static int mca_read_and_store_pos(unsigned char *pos)
{
int j; int j;
int found = 0; int found = 0;
for(j=0; j<8; j++) { for (j = 0; j < 8; j++) {
if((pos[j] = inb_p(MCA_POS_REG(j))) != 0xff) { pos[j] = inb_p(MCA_POS_REG(j));
if (pos[j] != 0xff) {
/* 0xff all across means no device. 0x00 means /* 0xff all across means no device. 0x00 means
* something's broken, but a device is * something's broken, but a device is
* probably there. However, if you get 0x00 * probably there. However, if you get 0x00
...@@ -167,11 +172,11 @@ static unsigned char mca_pc_read_pos(struct mca_device *mca_dev, int reg) ...@@ -167,11 +172,11 @@ static unsigned char mca_pc_read_pos(struct mca_device *mca_dev, int reg)
unsigned char byte; unsigned char byte;
unsigned long flags; unsigned long flags;
if(reg < 0 || reg >= 8) if (reg < 0 || reg >= 8)
return 0; return 0;
spin_lock_irqsave(&mca_lock, flags); spin_lock_irqsave(&mca_lock, flags);
if(mca_dev->pos_register) { if (mca_dev->pos_register) {
/* Disable adapter setup, enable motherboard setup */ /* Disable adapter setup, enable motherboard setup */
outb_p(0, MCA_ADAPTER_SETUP_REG); outb_p(0, MCA_ADAPTER_SETUP_REG);
...@@ -203,7 +208,7 @@ static void mca_pc_write_pos(struct mca_device *mca_dev, int reg, ...@@ -203,7 +208,7 @@ static void mca_pc_write_pos(struct mca_device *mca_dev, int reg,
{ {
unsigned long flags; unsigned long flags;
if(reg < 0 || reg >= 8) if (reg < 0 || reg >= 8)
return; return;
spin_lock_irqsave(&mca_lock, flags); spin_lock_irqsave(&mca_lock, flags);
...@@ -227,17 +232,17 @@ static void mca_pc_write_pos(struct mca_device *mca_dev, int reg, ...@@ -227,17 +232,17 @@ static void mca_pc_write_pos(struct mca_device *mca_dev, int reg,
} }
/* for the primary MCA bus, we have identity transforms */ /* for the primary MCA bus, we have identity transforms */
static int mca_dummy_transform_irq(struct mca_device * mca_dev, int irq) static int mca_dummy_transform_irq(struct mca_device *mca_dev, int irq)
{ {
return irq; return irq;
} }
static int mca_dummy_transform_ioport(struct mca_device * mca_dev, int port) static int mca_dummy_transform_ioport(struct mca_device *mca_dev, int port)
{ {
return port; return port;
} }
static void *mca_dummy_transform_memory(struct mca_device * mca_dev, void *mem) static void *mca_dummy_transform_memory(struct mca_device *mca_dev, void *mem)
{ {
return mem; return mem;
} }
...@@ -251,7 +256,8 @@ static int __init mca_init(void) ...@@ -251,7 +256,8 @@ static int __init mca_init(void)
short mca_builtin_scsi_ports[] = {0xf7, 0xfd, 0x00}; short mca_builtin_scsi_ports[] = {0xf7, 0xfd, 0x00};
struct mca_bus *bus; struct mca_bus *bus;
/* WARNING: Be careful when making changes here. Putting an adapter /*
* WARNING: Be careful when making changes here. Putting an adapter
* and the motherboard simultaneously into setup mode may result in * and the motherboard simultaneously into setup mode may result in
* damage to chips (according to The Indispensible PC Hardware Book * damage to chips (according to The Indispensible PC Hardware Book
* by Hans-Peter Messmer). Also, we disable system interrupts (so * by Hans-Peter Messmer). Also, we disable system interrupts (so
...@@ -283,7 +289,7 @@ static int __init mca_init(void) ...@@ -283,7 +289,7 @@ static int __init mca_init(void)
/* get the motherboard device */ /* get the motherboard device */
mca_dev = kzalloc(sizeof(struct mca_device), GFP_KERNEL); mca_dev = kzalloc(sizeof(struct mca_device), GFP_KERNEL);
if(unlikely(!mca_dev)) if (unlikely(!mca_dev))
goto out_nomem; goto out_nomem;
/* /*
...@@ -309,7 +315,7 @@ static int __init mca_init(void) ...@@ -309,7 +315,7 @@ static int __init mca_init(void)
mca_register_device(MCA_PRIMARY_BUS, mca_dev); mca_register_device(MCA_PRIMARY_BUS, mca_dev);
mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
if(unlikely(!mca_dev)) if (unlikely(!mca_dev))
goto out_unlock_nomem; goto out_unlock_nomem;
/* Put motherboard into video setup mode, read integrated video /* Put motherboard into video setup mode, read integrated video
...@@ -326,7 +332,8 @@ static int __init mca_init(void) ...@@ -326,7 +332,8 @@ static int __init mca_init(void)
mca_dev->slot = MCA_INTEGVIDEO; mca_dev->slot = MCA_INTEGVIDEO;
mca_register_device(MCA_PRIMARY_BUS, mca_dev); mca_register_device(MCA_PRIMARY_BUS, mca_dev);
/* Put motherboard into scsi setup mode, read integrated scsi /*
* Put motherboard into scsi setup mode, read integrated scsi
* POS registers, and turn motherboard setup off. * POS registers, and turn motherboard setup off.
* *
* It seems there are two possible SCSI registers. Martin says that * It seems there are two possible SCSI registers. Martin says that
...@@ -338,18 +345,18 @@ static int __init mca_init(void) ...@@ -338,18 +345,18 @@ static int __init mca_init(void)
* machine. * machine.
*/ */
for(i = 0; (which_scsi = mca_builtin_scsi_ports[i]) != 0; i++) { for (i = 0; (which_scsi = mca_builtin_scsi_ports[i]) != 0; i++) {
outb_p(which_scsi, MCA_MOTHERBOARD_SETUP_REG); outb_p(which_scsi, MCA_MOTHERBOARD_SETUP_REG);
if(mca_read_and_store_pos(pos)) if (mca_read_and_store_pos(pos))
break; break;
} }
if(which_scsi) { if (which_scsi) {
/* found a scsi card */ /* found a scsi card */
mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
if(unlikely(!mca_dev)) if (unlikely(!mca_dev))
goto out_unlock_nomem; goto out_unlock_nomem;
for(j = 0; j < 8; j++) for (j = 0; j < 8; j++)
mca_dev->pos[j] = pos[j]; mca_dev->pos[j] = pos[j];
mca_configure_adapter_status(mca_dev); mca_configure_adapter_status(mca_dev);
...@@ -364,21 +371,22 @@ static int __init mca_init(void) ...@@ -364,21 +371,22 @@ static int __init mca_init(void)
outb_p(0xff, MCA_MOTHERBOARD_SETUP_REG); outb_p(0xff, MCA_MOTHERBOARD_SETUP_REG);
/* Now loop over MCA slots: put each adapter into setup mode, and /*
* Now loop over MCA slots: put each adapter into setup mode, and
* read its POS registers. Then put adapter setup off. * read its POS registers. Then put adapter setup off.
*/ */
for(i=0; i<MCA_MAX_SLOT_NR; i++) { for (i = 0; i < MCA_MAX_SLOT_NR; i++) {
outb_p(0x8|(i&0xf), MCA_ADAPTER_SETUP_REG); outb_p(0x8|(i&0xf), MCA_ADAPTER_SETUP_REG);
if(!mca_read_and_store_pos(pos)) if (!mca_read_and_store_pos(pos))
continue; continue;
mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC); mca_dev = kzalloc(sizeof(struct mca_device), GFP_ATOMIC);
if(unlikely(!mca_dev)) if (unlikely(!mca_dev))
goto out_unlock_nomem; goto out_unlock_nomem;
for(j=0; j<8; j++) for (j = 0; j < 8; j++)
mca_dev->pos[j]=pos[j]; mca_dev->pos[j] = pos[j];
mca_dev->driver_loaded = 0; mca_dev->driver_loaded = 0;
mca_dev->slot = i; mca_dev->slot = i;
...@@ -414,20 +422,20 @@ mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag) ...@@ -414,20 +422,20 @@ mca_handle_nmi_device(struct mca_device *mca_dev, int check_flag)
{ {
int slot = mca_dev->slot; int slot = mca_dev->slot;
if(slot == MCA_INTEGSCSI) { if (slot == MCA_INTEGSCSI) {
printk(KERN_CRIT "NMI: caused by MCA integrated SCSI adapter (%s)\n", printk(KERN_CRIT "NMI: caused by MCA integrated SCSI adapter (%s)\n",
mca_dev->name); mca_dev->name);
} else if(slot == MCA_INTEGVIDEO) { } else if (slot == MCA_INTEGVIDEO) {
printk(KERN_CRIT "NMI: caused by MCA integrated video adapter (%s)\n", printk(KERN_CRIT "NMI: caused by MCA integrated video adapter (%s)\n",
mca_dev->name); mca_dev->name);
} else if(slot == MCA_MOTHERBOARD) { } else if (slot == MCA_MOTHERBOARD) {
printk(KERN_CRIT "NMI: caused by motherboard (%s)\n", printk(KERN_CRIT "NMI: caused by motherboard (%s)\n",
mca_dev->name); mca_dev->name);
} }
/* More info available in POS 6 and 7? */ /* More info available in POS 6 and 7? */
if(check_flag) { if (check_flag) {
unsigned char pos6, pos7; unsigned char pos6, pos7;
pos6 = mca_device_read_pos(mca_dev, 6); pos6 = mca_device_read_pos(mca_dev, 6);
...@@ -447,8 +455,9 @@ static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data) ...@@ -447,8 +455,9 @@ static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data)
pos5 = mca_device_read_pos(mca_dev, 5); pos5 = mca_device_read_pos(mca_dev, 5);
if(!(pos5 & 0x80)) { if (!(pos5 & 0x80)) {
/* Bit 7 of POS 5 is reset when this adapter has a hardware /*
* Bit 7 of POS 5 is reset when this adapter has a hardware
* error. Bit 7 it reset if there's error information * error. Bit 7 it reset if there's error information
* available in POS 6 and 7. * available in POS 6 and 7.
*/ */
...@@ -460,7 +469,8 @@ static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data) ...@@ -460,7 +469,8 @@ static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data)
void __kprobes mca_handle_nmi(void) void __kprobes mca_handle_nmi(void)
{ {
/* First try - scan the various adapters and see if a specific /*
* First try - scan the various adapters and see if a specific
* adapter was responsible for the error. * adapter was responsible for the error.
*/ */
bus_for_each_dev(&mca_bus_type, NULL, NULL, mca_handle_nmi_callback); bus_for_each_dev(&mca_bus_type, NULL, NULL, mca_handle_nmi_callback);
......
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