From: Andrew Morton coding style repairs Cc: : Lew Glendenning Cc: : Ryan Jackson Cc: David Woodhouse Signed-off-by: Andrew Morton --- drivers/mtd/maps/esb2rom.c | 143 +++++++++++++---------------------- 1 file changed, 57 insertions(+), 86 deletions(-) diff -puN drivers/mtd/maps/esb2rom.c~mtd-maps-support-for-bios-flash-chips-on-intel-esb2-southbridge-tidy drivers/mtd/maps/esb2rom.c --- a/drivers/mtd/maps/esb2rom.c~mtd-maps-support-for-bios-flash-chips-on-intel-esb2-southbridge-tidy +++ a/drivers/mtd/maps/esb2rom.c @@ -57,41 +57,41 @@ #define FWH_SEL1 0xD0 #define FWH_SEL2 0xD4 -#define FWH_8MiB ( FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ - FWH_D8_EN | FWH_D0_EN | FWH_C8_EN | FWH_C0_EN | \ - FWH_70_EN | FWH_60_EN | FWH_50_EN | FWH_40_EN ) +#define FWH_8MiB (FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ + FWH_D8_EN | FWH_D0_EN | FWH_C8_EN | FWH_C0_EN | \ + FWH_70_EN | FWH_60_EN | FWH_50_EN | FWH_40_EN) -#define FWH_7MiB ( FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ - FWH_D8_EN | FWH_D0_EN | FWH_C8_EN | FWH_C0_EN | \ - FWH_70_EN | FWH_60_EN | FWH_50_EN ) +#define FWH_7MiB (FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ + FWH_D8_EN | FWH_D0_EN | FWH_C8_EN | FWH_C0_EN | \ + FWH_70_EN | FWH_60_EN | FWH_50_EN) -#define FWH_6MiB ( FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ - FWH_D8_EN | FWH_D0_EN | FWH_C8_EN | FWH_C0_EN | \ - FWH_70_EN | FWH_60_EN ) +#define FWH_6MiB (FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ + FWH_D8_EN | FWH_D0_EN | FWH_C8_EN | FWH_C0_EN | \ + FWH_70_EN | FWH_60_EN) -#define FWH_5MiB ( FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ - FWH_D8_EN | FWH_D0_EN | FWH_C8_EN | FWH_C0_EN | \ - FWH_70_EN ) +#define FWH_5MiB (FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ + FWH_D8_EN | FWH_D0_EN | FWH_C8_EN | FWH_C0_EN | \ + FWH_70_EN) -#define FWH_4MiB ( FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ - FWH_D8_EN | FWH_D0_EN | FWH_C8_EN | FWH_C0_EN ) +#define FWH_4MiB (FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ + FWH_D8_EN | FWH_D0_EN | FWH_C8_EN | FWH_C0_EN) -#define FWH_3_5MiB ( FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ - FWH_D8_EN | FWH_D0_EN | FWH_C8_EN ) +#define FWH_3_5MiB (FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ + FWH_D8_EN | FWH_D0_EN | FWH_C8_EN) -#define FWH_3MiB ( FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ - FWH_D8_EN | FWH_D0_EN ) +#define FWH_3MiB (FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ + FWH_D8_EN | FWH_D0_EN) -#define FWH_2_5MiB ( FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ - FWH_D8_EN ) +#define FWH_2_5MiB (FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN | \ + FWH_D8_EN) -#define FWH_2MiB ( FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN ) +#define FWH_2MiB (FWH_F8_EN | FWH_F0_EN | FWH_E8_EN | FWH_E0_EN) -#define FWH_1_5MiB ( FWH_F8_EN | FWH_F0_EN | FWH_E8_EN ) +#define FWH_1_5MiB (FWH_F8_EN | FWH_F0_EN | FWH_E8_EN) -#define FWH_1MiB ( FWH_F8_EN | FWH_F0_EN ) +#define FWH_1MiB (FWH_F8_EN | FWH_F0_EN) -#define FWH_0_5MiB ( FWH_F8_EN ) +#define FWH_0_5MiB (FWH_F8_EN) struct esb2rom_window { @@ -145,8 +145,8 @@ static void esb2rom_cleanup(struct esb2r } } -static int __devinit esb2rom_init_one (struct pci_dev *pdev, - const struct pci_device_id *ent) +static int __devinit esb2rom_init_one(struct pci_dev *pdev, + const struct pci_device_id *ent) { static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; struct esb2rom_window *window = &esb2rom_window; @@ -171,72 +171,49 @@ static int __devinit esb2rom_init_one (s /* pci_read_config_word(pdev, FWH_DEC_EN1, &word); - printk( KERN_DEBUG "Original FWH_DEC_EN1 : %x\n", word ); - pci_write_config_byte(pdev, FWH_DEC_EN1, 0xff ); + printk(KERN_DEBUG "Original FWH_DEC_EN1 : %x\n", word); + pci_write_config_byte(pdev, FWH_DEC_EN1, 0xff); pci_read_config_byte(pdev, FWH_DEC_EN1, &byte); - printk( KERN_DEBUG "New FWH_DEC_EN1 : %x\n", byte ); + printk(KERN_DEBUG "New FWH_DEC_EN1 : %x\n", byte); pci_read_config_byte(pdev, FWH_DEC_EN2, &byte); - printk( KERN_DEBUG "Original FWH_DEC_EN2 : %x\n", byte ); - pci_write_config_byte(pdev, FWH_DEC_EN2, 0x0f ); + printk(KERN_DEBUG "Original FWH_DEC_EN2 : %x\n", byte); + pci_write_config_byte(pdev, FWH_DEC_EN2, 0x0f); pci_read_config_byte(pdev, FWH_DEC_EN2, &byte); - printk( KERN_DEBUG "New FWH_DEC_EN2 : %x\n", byte ); + printk(KERN_DEBUG "New FWH_DEC_EN2 : %x\n", byte); */ /* Find a region continuous to the end of the ROM window */ window->phys = 0; pci_read_config_word(pdev, FWH_DEC_EN1, &word); - printk( KERN_DEBUG "pci_read_config_byte : %x\n", word ); + printk(KERN_DEBUG "pci_read_config_byte : %x\n", word); - if ( (word & FWH_8MiB) == FWH_8MiB) - { + if ((word & FWH_8MiB) == FWH_8MiB) window->phys = 0xff400000; - } - else if ( ( word & FWH_7MiB ) == FWH_7MiB ) - { + else if ((word & FWH_7MiB) == FWH_7MiB) window->phys = 0xff500000; - } - else if ( ( word & FWH_6MiB ) == FWH_6MiB ) - { + else if ((word & FWH_6MiB) == FWH_6MiB) window->phys = 0xff600000; - } - else if ( ( word & FWH_5MiB ) == FWH_5MiB ) - { + else if ((word & FWH_5MiB) == FWH_5MiB) window->phys = 0xFF700000; - } - else if ( ( word & FWH_4MiB ) == FWH_4MiB ) - { + else if ((word & FWH_4MiB) == FWH_4MiB) window->phys = 0xffc00000; - } - else if ( ( word & FWH_3_5MiB ) == FWH_3_5MiB ) - { + else if ((word & FWH_3_5MiB) == FWH_3_5MiB) window->phys = 0xffc80000; - } - else if ( ( word & FWH_3MiB ) == FWH_3MiB ) - { + else if ((word & FWH_3MiB) == FWH_3MiB) window->phys = 0xffd00000; - } - else if ( ( word & FWH_2_5MiB ) == FWH_2_5MiB ) - { + else if ((word & FWH_2_5MiB) == FWH_2_5MiB) window->phys = 0xffd80000; - } - else if ( ( word & FWH_2MiB ) == FWH_2MiB ) - { + else if ((word & FWH_2MiB) == FWH_2MiB) window->phys = 0xffe00000; - } - else if ( ( word & FWH_1_5MiB ) == FWH_1_5MiB ) - { + else if ((word & FWH_1_5MiB) == FWH_1_5MiB) window->phys = 0xffe80000; - } - else if ( ( word & FWH_1MiB ) == FWH_1MiB ) - { + else if ((word & FWH_1MiB) == FWH_1MiB) window->phys = 0xfff00000; - } - else if ( ( word & FWH_0_5MiB ) == FWH_0_5MiB ) - { + else if ((word & FWH_0_5MiB) == FWH_0_5MiB) window->phys = 0xfff80000; - } - /* reserved 0x0020 and 0x0010 */ + + /* reserved 0x0020 and 0x0010 */ window->phys -= 0x400000UL; window->size = (0xffffffffUL - window->phys) + 1UL; @@ -249,7 +226,7 @@ static int __devinit esb2rom_init_one (s printk(KERN_ERR MOD_NAME ": firmware access control, I can't enable writes\n"); goto out; } - pci_write_config_byte(pdev, BIOS_CNTL, byte | BIOS_WRITE_ENABLE ); + pci_write_config_byte(pdev, BIOS_CNTL, byte | BIOS_WRITE_ENABLE); /* * Try to reserve the window mem region. If this fails then @@ -288,19 +265,17 @@ static int __devinit esb2rom_init_one (s * (Insane hardware design, but most copied Intel's.) * ==> Probe at most the last 4M of the address space. */ - if (map_top < 0xffc00000) { + if (map_top < 0xffc00000) map_top = 0xffc00000; - } #endif /* Loop through and look for rom chips */ - while((map_top - 1) < 0xffffffffUL) { + while ((map_top - 1) < 0xffffffffUL) { struct cfi_private *cfi; unsigned long offset; int i; - if (!map) { + if (!map) map = kmalloc(sizeof(*map), GFP_KERNEL); - } if (!map) { printk(KERN_ERR MOD_NAME ": kmalloc failed"); goto out; @@ -322,8 +297,7 @@ static int __devinit esb2rom_init_one (s * needs to use a different method. */ for(map->map.bankwidth = 32; map->map.bankwidth; - map->map.bankwidth >>= 1) - { + map->map.bankwidth >>= 1) { char **probe_type; /* Skip bankwidths that are not supported */ if (!map_bankwidth_supported(map->map.bankwidth)) @@ -371,9 +345,8 @@ static int __devinit esb2rom_init_one (s map->map.virt = window->virt; map->map.phys = window->phys; cfi = map->map.fldrv_priv; - for(i = 0; i < cfi->numchips; i++) { + for(i = 0; i < cfi->numchips; i++) cfi->chips[i].start += offset; - } /* Now that the mtd devices is complete claim and export it */ map->mtd->owner = THIS_MODULE; @@ -383,7 +356,6 @@ static int __devinit esb2rom_init_one (s goto out; } - /* Calculate the new value of map_top */ map_top += map->mtd->size; @@ -404,7 +376,6 @@ static int __devinit esb2rom_init_one (s return 0; } - static void __devexit esb2rom_remove_one (struct pci_dev *pdev) { struct esb2rom_window *window = &esb2rom_window; @@ -446,17 +417,17 @@ static int __init init_esb2rom(void) pdev = NULL; for (id = esb2rom_pci_tbl; id->vendor; id++) { - printk( KERN_DEBUG "device id = %x\n", id->device ); + printk(KERN_DEBUG "device id = %x\n", id->device); pdev = pci_find_device(id->vendor, id->device, NULL); if (pdev) { - printk( KERN_DEBUG "matched device = %x\n", id->device ); + printk(KERN_DEBUG "matched device = %x\n", id->device); break; } } if (pdev) { - printk( KERN_DEBUG "matched device id %x\n", id->device ); + printk(KERN_DEBUG "matched device id %x\n", id->device); retVal = esb2rom_init_one(pdev, &esb2rom_pci_tbl[0]); - printk( KERN_DEBUG "retVal = %d\n", retVal ); + printk(KERN_DEBUG "retVal = %d\n", retVal); return retVal; } return -ENXIO; _