ide: cleanup ide_system_bus_speed()

Use the facts that:

* When ide_init() is called 'system_bus_speed' always equals zero.

* system_bus_clock() is never called before ide_init().

and:

* Move printk() from ide_system_bus_speed() to ide_init().

* Don't assign 'system_bus_speed' in ide_system_bus_speed().

* Don't call ide_system_bus_speed() in system_bus_clock().
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 422278ef
...@@ -240,22 +240,12 @@ static int ide_system_bus_speed(void) ...@@ -240,22 +240,12 @@ static int ide_system_bus_speed(void)
#define pci_default 0 #define pci_default 0
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
if (!system_bus_speed) { /* user supplied value */
if (idebus_parameter) { if (idebus_parameter)
/* user supplied value */ return idebus_parameter;
system_bus_speed = idebus_parameter;
} else if (pci_dev_present(pci_default)) { /* safe default value for PCI or VESA and PCI*/
/* safe default value for PCI */ return pci_dev_present(pci_default) ? 33 : 50;
system_bus_speed = 33;
} else {
/* safe default value for VESA and PCI */
system_bus_speed = 50;
}
printk(KERN_INFO "ide: Assuming %dMHz system bus speed "
"for PIO modes%s\n", system_bus_speed,
idebus_parameter ? "" : "; override with idebus=xx");
}
return system_bus_speed;
} }
ide_hwif_t * ide_find_port(unsigned long base) ide_hwif_t * ide_find_port(unsigned long base)
...@@ -912,7 +902,7 @@ static int set_unmaskirq(ide_drive_t *drive, int arg) ...@@ -912,7 +902,7 @@ static int set_unmaskirq(ide_drive_t *drive, int arg)
int system_bus_clock (void) int system_bus_clock (void)
{ {
return((int) ((!system_bus_speed) ? ide_system_bus_speed() : system_bus_speed )); return system_bus_speed;
} }
EXPORT_SYMBOL(system_bus_clock); EXPORT_SYMBOL(system_bus_clock);
...@@ -1667,6 +1657,10 @@ static int __init ide_init(void) ...@@ -1667,6 +1657,10 @@ static int __init ide_init(void)
printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n"); printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n");
system_bus_speed = ide_system_bus_speed(); system_bus_speed = ide_system_bus_speed();
printk(KERN_INFO "ide: Assuming %dMHz system bus speed "
"for PIO modes%s\n", system_bus_speed,
idebus_parameter ? "" : "; override with idebus=xx");
ret = bus_register(&ide_bus_type); ret = bus_register(&ide_bus_type);
if (ret < 0) { if (ret < 0) {
printk(KERN_WARNING "IDE: bus_register error: %d\n", ret); printk(KERN_WARNING "IDE: bus_register error: %d\n", ret);
......
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