aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:35 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-01 17:09:35 -0500
commit537f06c5deaffbbe155bcc898369f889e7f3e647 (patch)
treeb50e791f9a33a7e510dd7439ec047ca08c857b9f
parent422278ef9585b0be62b1bd6d48935a7529aa5094 (diff)
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: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 725187bc6003..7fa30acf0fc5 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -240,22 +240,12 @@ static int ide_system_bus_speed(void)
240#define pci_default 0 240#define pci_default 0
241#endif /* CONFIG_PCI */ 241#endif /* CONFIG_PCI */
242 242
243 if (!system_bus_speed) { 243 /* user supplied value */
244 if (idebus_parameter) { 244 if (idebus_parameter)
245 /* user supplied value */ 245 return idebus_parameter;
246 system_bus_speed = idebus_parameter; 246
247 } else if (pci_dev_present(pci_default)) { 247 /* safe default value for PCI or VESA and PCI*/
248 /* safe default value for PCI */ 248 return pci_dev_present(pci_default) ? 33 : 50;
249 system_bus_speed = 33;
250 } else {
251 /* safe default value for VESA and PCI */
252 system_bus_speed = 50;
253 }
254 printk(KERN_INFO "ide: Assuming %dMHz system bus speed "
255 "for PIO modes%s\n", system_bus_speed,
256 idebus_parameter ? "" : "; override with idebus=xx");
257 }
258 return system_bus_speed;
259} 249}
260 250
261ide_hwif_t * ide_find_port(unsigned long base) 251ide_hwif_t * ide_find_port(unsigned long base)
@@ -912,7 +902,7 @@ static int set_unmaskirq(ide_drive_t *drive, int arg)
912 902
913int system_bus_clock (void) 903int system_bus_clock (void)
914{ 904{
915 return((int) ((!system_bus_speed) ? ide_system_bus_speed() : system_bus_speed )); 905 return system_bus_speed;
916} 906}
917 907
918EXPORT_SYMBOL(system_bus_clock); 908EXPORT_SYMBOL(system_bus_clock);
@@ -1667,6 +1657,10 @@ static int __init ide_init(void)
1667 printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n"); 1657 printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n");
1668 system_bus_speed = ide_system_bus_speed(); 1658 system_bus_speed = ide_system_bus_speed();
1669 1659
1660 printk(KERN_INFO "ide: Assuming %dMHz system bus speed "
1661 "for PIO modes%s\n", system_bus_speed,
1662 idebus_parameter ? "" : "; override with idebus=xx");
1663
1670 ret = bus_register(&ide_bus_type); 1664 ret = bus_register(&ide_bus_type);
1671 if (ret < 0) { 1665 if (ret < 0) {
1672 printk(KERN_WARNING "IDE: bus_register error: %d\n", ret); 1666 printk(KERN_WARNING "IDE: bus_register error: %d\n", ret);