[PATCH] small fixes for 2.3.14

Mikael Pettersson (mikpe@csd.uu.se)
Fri, 20 Aug 1999 13:21:07 +0200 (MET DST)


Here's a couple of small fixes for 2.3.14.

* drivers/block/floppy.c: floppy_setup() returns int not void now,
which causes a type conflict when it is passed to mod_setup().
Since mod_setup() is called only once and with constant actual
parameters, I chose to propagate the actual parameters instead of
changing mod_setup()'s formal parameter to "int (*setup)(char*)".

* arch/i386/kernel/apm.c:
- apm_get_battery_status() isn't used anymore since it's subsumed
by apm_get_power_status().
- unused variable "nbat" in apm_get_info().
- apm_init() was made into a "module_init" thing, so it has to
return an "int" status now, not "void".

* arch/i386/kernel/irq.c:
- irq_controller_lock should be initialized with "SPIN_LOCK_UNLOCKED",
not "{0}". Matters for UP kernels and every gcc newer than 2.7.x.
- free_irq() was updated in 2.3.14, but the control flow when the
irq is found wasn't preserved. This causes unnecessary iterations
in the loop and spurious "Trying to free free IRQ%d" log messages.

/Mikael

--- linux-2.3.14/drivers/block/floppy.c.orig Thu Aug 19 18:41:42 1999
+++ linux-2.3.14/drivers/block/floppy.c Fri Aug 20 12:19:59 1999
@@ -4384,8 +4384,9 @@
}
}

-static void __init mod_setup(char *pattern, void (*setup)(char *))
+static void __init mod_setup(void)
{
+ const char *pattern = "floppy=";
unsigned long i;
char c;
int j;
@@ -4405,7 +4406,7 @@
if (!c || c == ' ' || c == '\t'){
if (j){
buffer[j] = '\0';
- setup(buffer);
+ floppy_setup(buffer);
}
j=0;
} else
@@ -4436,7 +4437,7 @@
if(floppy)
parse_floppy_cfg_string(floppy);
else
- mod_setup("floppy=", floppy_setup);
+ mod_setup();

return floppy_init();
}
--- linux-2.3.14/arch/i386/kernel/apm.c.orig Thu Aug 19 18:41:36 1999
+++ linux-2.3.14/arch/i386/kernel/apm.c Fri Aug 20 13:02:07 1999
@@ -643,33 +643,6 @@
return APM_SUCCESS;
}

-static int apm_get_battery_status(u_short which, u_short *status,
- u_short *bat, u_short *life, u_short *nbat)
-{
- u32 eax;
- u32 ebx;
- u32 ecx;
- u32 edx;
- u32 esi;
-
- if (apm_bios_info.version < 0x0102) {
- /* pretend we only have one battery. */
- if (which != 1)
- return APM_BAD_DEVICE;
- *nbat = 1;
- return apm_get_power_status(status, bat, life);
- }
-
- if (apm_bios_call(0x530a, (0x8000 | (which)), 0, &eax,
- &ebx, &ecx, &edx, &esi))
- return (eax >> 8) & 0xff;
- *status = ebx;
- *bat = ecx;
- *life = edx;
- *nbat = esi;
- return APM_SUCCESS;
-}
-
static int __init apm_engage_power_management(u_short device)
{
u32 eax;
@@ -1232,7 +1205,6 @@
unsigned short bx;
unsigned short cx;
unsigned short dx;
- unsigned short nbat;
unsigned short error;
unsigned short ac_line_status = 0xff;
unsigned short battery_status = 0xff;
@@ -1442,7 +1414,7 @@

if (apm_bios_info.version == 0) {
printk(KERN_INFO "apm: BIOS not found.\n");
- return;
+ return -1;
}
printk(KERN_INFO
"apm: BIOS version %d.%d Flags 0x%02x (Driver version %s)\n",
@@ -1452,7 +1424,7 @@
driver_version);
if ((apm_bios_info.flags & APM_32_BIT_SUPPORT) == 0) {
printk(KERN_INFO "apm: no 32 bit BIOS support\n");
- return;
+ return -1;
}

/*
@@ -1481,7 +1453,7 @@

if (apm_disabled) {
printk(KERN_NOTICE "apm: disabled on user request.\n");
- return;
+ return -1;
}

#ifdef CONFIG_SMP
@@ -1540,6 +1512,7 @@
misc_register(&apm_device);

kernel_thread(apm, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD);
+ return 0;
}

module_init(apm_init)
--- linux-2.3.14/arch/i386/kernel/irq.c.orig Thu Aug 19 18:41:36 1999
+++ linux-2.3.14/arch/i386/kernel/irq.c Fri Aug 20 12:19:59 1999
@@ -72,7 +72,7 @@
* system. We never hold this lock when we call the actual
* IRQ handler.
*/
-spinlock_t irq_controller_lock ={0};
+spinlock_t irq_controller_lock = SPIN_LOCK_UNLOCKED;
/*
* Controller mappings for all interrupt sources:
*/
@@ -634,8 +634,10 @@
irq_desc[irq].status |= IRQ_DISABLED;
irq_desc[irq].handler->shutdown(irq);
}
+ break;
}
- printk("Trying to free free IRQ%d\n",irq);
+ if (!action)
+ printk("Trying to free free IRQ%d\n",irq);
spin_unlock_irqrestore(&irq_controller_lock,flags);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/