Random ITE Super I/O fixes.
[coreboot.git] / src / superio / ite / it8705f / superio.c
index de3640832f7d9828db961d4d57ce383ff9d033fa..04cdd2908399ddbaaa4430a358cefa5d6f8d887b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * This file is part of the LinuxBIOS project.
+ * This file is part of the coreboot project.
  *
  * Copyright (C) 2006 Uwe Hermann <uwe@hermann-uwe.de>
  *
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-/* This chip doesn't seem to have keyboard and mouse support. */
-
+#include <device/device.h>
+#include <device/pnp.h>
 #include <uart8250.h>
+#include <stdlib.h>
 #include "chip.h"
 #include "it8705f.h"
 
 static void init(device_t dev)
 {
-       struct superio_ite_it8705f_config *conf;
+       struct superio_ite_it8705f_config *conf = dev->chip_info;
        struct resource *res0, *res1;
 
-       if (!dev->enabled) {
+       if (!dev->enabled)
                return;
-       }
 
-       conf = dev->chip_info;
-
-       switch (dev->path.u.pnp.device) {
+       switch (dev->path.pnp.device) {
        case IT8705F_FDC: /* TODO. */
                break;
        case IT8705F_SP1:
@@ -71,18 +69,17 @@ static struct device_operations ops = {
 
 /* TODO: FDC, PP, EC, GPIO, GAME, IR, MIDI. */
 static struct pnp_info pnp_dev_info[] = {
- { &ops, IT8705F_SP1,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
- { &ops, IT8705F_SP2,  PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0x7f8, 0 }, },
      { &ops, IT8705F_SP1,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
      { &ops, IT8705F_SP2,  PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0x7f8, 0 }, },
 };
 
 static void enable_dev(struct device *dev)
 {
        pnp_enable_devices(dev, &pnp_ops,
-               sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info);
+               ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
 }
 
 struct chip_operations superio_ite_it8705f_ops = {
        CHIP_NAME("ITE IT8705F Super I/O")
        .enable_dev = enable_dev,
 };
-