diff --git a/board_enable.c b/board_enable.c
index 89d66ad..10608ad 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -30,38 +30,33 @@
 #define W836_DATA  0x2F
 
 /* Enter extended functions */
-static void
-w836xx_ext_enter(void)
+static void w836xx_ext_enter(void)
 {
 	outb(0x87, W836_INDEX);
 	outb(0x87, W836_INDEX);
 }
 
 /* Leave extended functions */
-static void
-w836xx_ext_leave(void)
+static void w836xx_ext_leave(void)
 {
 	outb(0xAA, W836_INDEX);
 }
 
 /* General functions for read/writing WB SuperIOs */
-static unsigned char
-wbsio_read(unsigned char index)
+static unsigned char wbsio_read(unsigned char index)
 {
 	outb(index, W836_INDEX);
 	return inb(W836_DATA);
 }
 
-static void
-wbsio_write(unsigned char index, unsigned char data)
+static void wbsio_write(unsigned char index, unsigned char data)
 {
 	outb(index, W836_INDEX);
 	outb(data, W836_DATA);
 }
 
 static void
-wbsio_mask(unsigned char index, unsigned char data,
-	   unsigned char mask)
+wbsio_mask(unsigned char index, unsigned char data, unsigned char mask)
 {
 	unsigned char tmp;
 
@@ -83,7 +78,7 @@
 	w836xx_ext_enter();
 
 	/* Is this the w83627hf? */
-	if (wbsio_read(0x20) != 0x52) { /* SIO device ID register */
+	if (wbsio_read(0x20) != 0x52) {	/* SIO device ID register */
 		fprintf(stderr, "\nERROR: %s: W83627HF: Wrong ID: 0x%02X.\n",
 			name, wbsio_read(0x20));
 		w836xx_ext_leave();
@@ -93,15 +88,15 @@
 	/* PIN89S: WDTO/GP24 multiplex -> GPIO24 */
 	wbsio_mask(0x2B, 0x10, 0x10);
 
-	wbsio_write(0x07, 0x08); /* Select logical device 8: GPIO port 2 */
+	wbsio_write(0x07, 0x08);	/* Select logical device 8: GPIO port 2 */
 
-	wbsio_mask(0x30, 0x01, 0x01); /* Activate logical device. */
+	wbsio_mask(0x30, 0x01, 0x01);	/* Activate logical device. */
 
-	wbsio_mask(0xF0, 0x00, 0x10); /* GPIO24 -> output */
+	wbsio_mask(0xF0, 0x00, 0x10);	/* GPIO24 -> output */
 
-	wbsio_mask(0xF2, 0x00, 0x10); /* Clear GPIO24 inversion */
+	wbsio_mask(0xF2, 0x00, 0x10);	/* Clear GPIO24 inversion */
 
-	wbsio_mask(0xF1, 0x10, 0x10); /* Raise GPIO24 */
+	wbsio_mask(0xF1, 0x10, 0x10);	/* Raise GPIO24 */
 
 	w836xx_ext_leave();
 
@@ -116,30 +111,30 @@
 
 static int board_via_epia_m(const char *name)
 {
-        struct pci_dev *dev;
-        unsigned int base;
-        uint8_t val;
+	struct pci_dev *dev;
+	unsigned int base;
+	uint8_t val;
 
-        dev = pci_dev_find(0x1106, 0x3177); /* VT8235 ISA bridge */
-        if (!dev) {
-                fprintf(stderr, "\nERROR: VT8235 ISA Bridge not found.\n");
-                return -1;
-        }
+	dev = pci_dev_find(0x1106, 0x3177);	/* VT8235 ISA bridge */
+	if (!dev) {
+		fprintf(stderr, "\nERROR: VT8235 ISA Bridge not found.\n");
+		return -1;
+	}
 
-        /* GPIO12-15 -> output */
-        val = pci_read_byte(dev, 0xE4);
-        val |= 0x10;
-        pci_write_byte(dev, 0xE4, val);
+	/* GPIO12-15 -> output */
+	val = pci_read_byte(dev, 0xE4);
+	val |= 0x10;
+	pci_write_byte(dev, 0xE4, val);
 
-        /* Get Power Management IO address. */
-        base = pci_read_word(dev, 0x88) & 0xFF80;
+	/* Get Power Management IO address. */
+	base = pci_read_word(dev, 0x88) & 0xFF80;
 
-        /* enable GPIO15 which is connected to write protect. */
-        val = inb(base + 0x4D);
-        val |= 0x80;
-        outb(val, base + 0x4D);
+	/* enable GPIO15 which is connected to write protect. */
+	val = inb(base + 0x4D);
+	val |= 0x80;
+	outb(val, base + 0x4D);
 
-        return 0;
+	return 0;
 }
 
 /*
@@ -149,29 +144,29 @@
 
 static int board_asus_a7v8x_mx(const char *name)
 {
-        struct pci_dev *dev;
-        uint8_t val;
+	struct pci_dev *dev;
+	uint8_t val;
 
-        dev = pci_dev_find(0x1106, 0x3177); /* VT8235 ISA bridge */
-        if (!dev) {
-                fprintf(stderr, "\nERROR: VT8235 ISA Bridge not found.\n");
-                return -1;
-        }
+	dev = pci_dev_find(0x1106, 0x3177);	/* VT8235 ISA bridge */
+	if (!dev) {
+		fprintf(stderr, "\nERROR: VT8235 ISA Bridge not found.\n");
+		return -1;
+	}
 
-        /* This bit is marked reserved actually */
-        val = pci_read_byte(dev, 0x59);
-        val &= 0x7F;
-        pci_write_byte(dev, 0x59, val);
+	/* This bit is marked reserved actually */
+	val = pci_read_byte(dev, 0x59);
+	val &= 0x7F;
+	pci_write_byte(dev, 0x59, val);
 
 	/* Raise ROM MEMW# line on Winbond w83697 SuperIO */
-        w836xx_ext_enter();
+	w836xx_ext_enter();
 
-	if (!(wbsio_read(0x24) & 0x02)) /* flash rom enabled? */
-		wbsio_mask(0x24, 0x08, 0x08); /* enable MEMW# */
+	if (!(wbsio_read(0x24) & 0x02))	/* flash rom enabled? */
+		wbsio_mask(0x24, 0x08, 0x08);	/* enable MEMW# */
 
 	w836xx_ext_leave();
 
-        return 0;
+	return 0;
 }
 
 /*
@@ -185,39 +180,39 @@
  */
 
 struct board_pciid_enable {
-        /* Any device, but make it sensible, like the isa bridge. */
-        uint16_t  first_vendor;
-        uint16_t  first_device;
-        uint16_t  first_card_vendor;
-        uint16_t  first_card_device;
+	/* Any device, but make it sensible, like the isa bridge. */
+	uint16_t first_vendor;
+	uint16_t first_device;
+	uint16_t first_card_vendor;
+	uint16_t first_card_device;
 
-        /* Any device, but make it sensible, like 
+	/* Any device, but make it sensible, like 
 	 * the host bridge. May be NULL
 	 */
-        uint16_t  second_vendor;
-        uint16_t  second_device;
-        uint16_t  second_card_vendor;
-        uint16_t  second_card_device;
+	uint16_t second_vendor;
+	uint16_t second_device;
+	uint16_t second_card_vendor;
+	uint16_t second_card_device;
 
-        /* From linuxbios table */
-        char  *lb_vendor;
-        char  *lb_part;
+	/* From linuxbios table */
+	char *lb_vendor;
+	char *lb_part;
 
-        char  *name;
-        int  (*enable)(const char *name);
+	char *name;
+	int (*enable) (const char *name);
 };
 
 struct board_pciid_enable board_pciid_enables[] = {
-	{ 0x1022, 0x7468, 0x0000, 0x0000,  0x0000, 0x0000, 0x0000, 0x0000,
-		"iwill", "dk8_htx", "IWILL DK8-HTX", w83627hf_gpio24_raise },
-	{ 0x1022, 0x746B, 0x1022, 0x36C0,  0x0000, 0x0000, 0x0000, 0x0000,
-		"AGAMI", "ARUMA", "agami Aruma", w83627hf_gpio24_raise },
-	{ 0x1106, 0x3177, 0x1106, 0xAA01,  0x1106, 0x3123, 0x1106, 0xAA01, 
-		NULL, NULL, "VIA EPIA M/MII/...", board_via_epia_m },
-	{ 0x1106, 0x3177, 0x1043, 0x80A1,  0x1106, 0x3205, 0x1043, 0x8118, 
-		NULL, NULL, "ASUS A7V8-MX SE", board_asus_a7v8x_mx },
+	{0x1022, 0x7468, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+	 "iwill", "dk8_htx", "IWILL DK8-HTX", w83627hf_gpio24_raise},
+	{0x1022, 0x746B, 0x1022, 0x36C0, 0x0000, 0x0000, 0x0000, 0x0000,
+	 "AGAMI", "ARUMA", "agami Aruma", w83627hf_gpio24_raise},
+	{0x1106, 0x3177, 0x1106, 0xAA01, 0x1106, 0x3123, 0x1106, 0xAA01,
+	 NULL, NULL, "VIA EPIA M/MII/...", board_via_epia_m},
+	{0x1106, 0x3177, 0x1043, 0x80A1, 0x1106, 0x3205, 0x1043, 0x8118,
+	 NULL, NULL, "ASUS A7V8-MX SE", board_asus_a7v8x_mx},
 
-        { 0, 0, 0, 0,  0, 0, 0, 0, NULL, NULL } /* Keep this */
+	{0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL}	/* Keep this */
 };
 
 /*
@@ -225,27 +220,27 @@
  * Require main pci-ids to match too as extra safety.
  *
  */
-static struct board_pciid_enable *
-board_match_linuxbios_name(char *vendor, char *part)
+static struct board_pciid_enable *board_match_linuxbios_name(char *vendor,
+							     char *part)
 {
-        struct board_pciid_enable *board = board_pciid_enables;
+	struct board_pciid_enable *board = board_pciid_enables;
 
-        for (; board->name; board++) {
-                if (!board->lb_vendor || strcmp(board->lb_vendor, vendor))
-                        continue;
+	for (; board->name; board++) {
+		if (!board->lb_vendor || strcmp(board->lb_vendor, vendor))
+			continue;
 
-                if (!board->lb_part || strcmp(board->lb_part, part))
-                        continue;
+		if (!board->lb_part || strcmp(board->lb_part, part))
+			continue;
 
-                if (!pci_dev_find(board->first_vendor, board->first_device))
-                        continue;
+		if (!pci_dev_find(board->first_vendor, board->first_device))
+			continue;
 
-                if (board->second_vendor &&
-                    !pci_dev_find(board->second_vendor, board->second_device))
-                        continue;
-                return board;
-        }
-        return NULL;
+		if (board->second_vendor &&
+		    !pci_dev_find(board->second_vendor, board->second_device))
+			continue;
+		return board;
+	}
+	return NULL;
 }
 
 /*
@@ -254,35 +249,35 @@
  */
 static struct board_pciid_enable *board_match_pci_card_ids(void)
 {
-        struct board_pciid_enable *board = board_pciid_enables;
+	struct board_pciid_enable *board = board_pciid_enables;
 
-        for (; board->name; board++) {
-                if (!board->first_card_vendor || !board->first_card_device)
-                        continue;
+	for (; board->name; board++) {
+		if (!board->first_card_vendor || !board->first_card_device)
+			continue;
 
-                if (!pci_card_find(board->first_vendor, board->first_device,
-                                   board->first_card_vendor,
-                                   board->first_card_device))
-                        continue;
+		if (!pci_card_find(board->first_vendor, board->first_device,
+				   board->first_card_vendor,
+				   board->first_card_device))
+			continue;
 
-                if (board->second_vendor) {
-                        if (board->second_card_vendor) {
-                                if (!pci_card_find(board->second_vendor,
-                                                   board->second_device,
-                                                   board->second_card_vendor,
-                                                   board->second_card_device))
-                                        continue;
-                        } else {
-                                if (!pci_dev_find(board->second_vendor,
-                                                  board->second_device))
-                                        continue;
-                        }
-                }
+		if (board->second_vendor) {
+			if (board->second_card_vendor) {
+				if (!pci_card_find(board->second_vendor,
+						   board->second_device,
+						   board->second_card_vendor,
+						   board->second_card_device))
+					continue;
+			} else {
+				if (!pci_dev_find(board->second_vendor,
+						  board->second_device))
+					continue;
+			}
+		}
 
-                return board;
-        }
+		return board;
+	}
 
-        return NULL;
+	return NULL;
 }
 
 /*
@@ -290,25 +285,25 @@
  */
 int board_flash_enable(char *vendor, char *part)
 {
-        struct board_pciid_enable *board = NULL;
-        int ret = 0;
+	struct board_pciid_enable *board = NULL;
+	int ret = 0;
 
-        if (vendor && part)
-                board = board_match_linuxbios_name(vendor, part);
+	if (vendor && part)
+		board = board_match_linuxbios_name(vendor, part);
 
-        if (!board)
-                board = board_match_pci_card_ids();
+	if (!board)
+		board = board_match_pci_card_ids();
 
-        if (board) {
-                printf("Found board \"%s\": Enabling flash write... ",
-                       board->name);
+	if (board) {
+		printf("Found board \"%s\": Enabling flash write... ",
+		       board->name);
 
-                ret = board->enable(board->name);
-                if (ret)
-                        printf("Failed!\n");
-                else
-                        printf("OK.\n");
-        }
+		ret = board->enable(board->name);
+		if (ret)
+			printf("Failed!\n");
+		else
+			printf("OK.\n");
+	}
 
-        return ret;
+	return ret;
 }
