/* These routines are here to provide compatibility with how powerpc
  * handles IRQ mapping for OF device nodes.  We precompute and permanently
- * register them in the of_device objects, whereas powerpc computes them
+ * register them in the platform_device objects, whereas powerpc computes them
  * on request.
  */
 static inline void irq_dispose_mapping(unsigned int virq)
 
 #endif
 } 
 
-static inline void apc_free(struct of_device *op)
+static inline void apc_free(struct platform_device *op)
 {
        of_iounmap(&op->resource[0], regs, resource_size(&op->resource[0]));
 }
 
 static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };
 
-static int __devinit apc_probe(struct of_device *op,
+static int __devinit apc_probe(struct platform_device *op,
                               const struct of_device_id *match)
 {
        int err;
 
 
 MODULE_DEVICE_TABLE(of, auxio_match);
 
-static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match)
+static int __devinit auxio_probe(struct platform_device *dev,
+                                const struct of_device_id *match)
 {
        struct device_node *dp = dev->dev.of_node;
        unsigned long size;
 
        }
 }
 
-static int __devinit clock_board_probe(struct of_device *op,
+static int __devinit clock_board_probe(struct platform_device *op,
                                       const struct of_device_id *match)
 {
        struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL);
        },
 };
 
-static int __devinit fhc_probe(struct of_device *op,
+static int __devinit fhc_probe(struct platform_device *op,
                               const struct of_device_id *match)
 {
        struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
 
        }
 }
 
-static int __devinit jbusmc_probe(struct of_device *op,
+static int __devinit jbusmc_probe(struct platform_device *op,
                                  const struct of_device_id *match)
 {
        const struct linux_prom64_registers *mem_regs;
                                      chmc_read_mcreg(p, CHMCTRL_DECODE4));
 }
 
-static int __devinit chmc_probe(struct of_device *op,
+static int __devinit chmc_probe(struct platform_device *op,
                                const struct of_device_id *match)
 {
        struct device_node *dp = op->dev.of_node;
        goto out;
 }
 
-static int __devinit us3mc_probe(struct of_device *op,
+static int __devinit us3mc_probe(struct platform_device *op,
                                const struct of_device_id *match)
 {
        if (mc_type == MC_TYPE_SAFARI)
        return -ENODEV;
 }
 
-static void __devexit chmc_destroy(struct of_device *op, struct chmc *p)
+static void __devexit chmc_destroy(struct platform_device *op, struct chmc *p)
 {
        list_del(&p->list);
        of_iounmap(&op->resource[0], p->regs, 0x48);
        kfree(p);
 }
 
-static void __devexit jbusmc_destroy(struct of_device *op, struct jbusmc *p)
+static void __devexit jbusmc_destroy(struct platform_device *op, struct jbusmc *p)
 {
        mc_list_del(&p->list);
        of_iounmap(&op->resource[0], p->regs, JBUSMC_REGS_SIZE);
        kfree(p);
 }
 
-static int __devexit us3mc_remove(struct of_device *op)
+static int __devexit us3mc_remove(struct platform_device *op)
 {
        void *p = dev_get_drvdata(&op->dev);
 
 
 static void *sbus_alloc_coherent(struct device *dev, size_t len,
                                 dma_addr_t *dma_addrp, gfp_t gfp)
 {
-       struct of_device *op = to_of_device(dev);
+       struct platform_device *op = to_platform_device(dev);
        unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
        unsigned long va;
        struct resource *res;
 
 
 static int of_resource_verbose;
 
-static void __init build_device_resources(struct of_device *op,
+static void __init build_device_resources(struct platform_device *op,
                                          struct device *parent)
 {
-       struct of_device *p_op;
+       struct platform_device *p_op;
        struct of_bus *bus;
        int na, ns;
        int index, num_reg;
        if (!parent)
                return;
 
-       p_op = to_of_device(parent);
+       p_op = to_platform_device(parent);
        bus = of_match_bus(p_op->dev.of_node);
        bus->count_cells(op->dev.of_node, &na, &ns);
 
        }
 }
 
-static struct of_device * __init scan_one_device(struct device_node *dp,
+static struct platform_device * __init scan_one_device(struct device_node *dp,
                                                 struct device *parent)
 {
-       struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
+       struct platform_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
        const struct linux_prom_irqs *intr;
        struct dev_archdata *sd;
        int len, i;
 static void __init scan_tree(struct device_node *dp, struct device *parent)
 {
        while (dp) {
-               struct of_device *op = scan_one_device(dp, parent);
+               struct platform_device *op = scan_one_device(dp, parent);
 
                if (op)
                        scan_tree(dp->child, &op->dev);
 static int __init scan_of_devices(void)
 {
        struct device_node *root = of_find_node_by_path("/");
-       struct of_device *parent;
+       struct platform_device *parent;
 
        parent = scan_one_device(root, NULL);
        if (!parent)
 
 
 static int of_resource_verbose;
 
-static void __init build_device_resources(struct of_device *op,
+static void __init build_device_resources(struct platform_device *op,
                                          struct device *parent)
 {
-       struct of_device *p_op;
+       struct platform_device *p_op;
        struct of_bus *bus;
        int na, ns;
        int index, num_reg;
        if (!parent)
                return;
 
-       p_op = to_of_device(parent);
+       p_op = to_platform_device(parent);
        bus = of_match_bus(p_op->dev.of_node);
        bus->count_cells(op->dev.of_node, &na, &ns);
 
 
 static int of_irq_verbose;
 
-static unsigned int __init build_one_device_irq(struct of_device *op,
+static unsigned int __init build_one_device_irq(struct platform_device *op,
                                                struct device *parent,
                                                unsigned int irq)
 {
        return irq;
 }
 
-static struct of_device * __init scan_one_device(struct device_node *dp,
+static struct platform_device * __init scan_one_device(struct device_node *dp,
                                                 struct device *parent)
 {
-       struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
+       struct platform_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
        const unsigned int *irq;
        struct dev_archdata *sd;
        int len, i;
 static void __init scan_tree(struct device_node *dp, struct device *parent)
 {
        while (dp) {
-               struct of_device *op = scan_one_device(dp, parent);
+               struct platform_device *op = scan_one_device(dp, parent);
 
                if (op)
                        scan_tree(dp->child, &op->dev);
 static int __init scan_of_devices(void)
 {
        struct device_node *root = of_find_node_by_path("/");
-       struct of_device *parent;
+       struct platform_device *parent;
 
        parent = scan_one_device(root, NULL);
        if (!parent)
 
 
 static int node_match(struct device *dev, void *data)
 {
-       struct of_device *op = to_of_device(dev);
+       struct platform_device *op = to_platform_device(dev);
        struct device_node *dp = data;
 
        return (op->dev.of_node == dp);
 }
 
-struct of_device *of_find_device_by_node(struct device_node *dp)
+struct platform_device *of_find_device_by_node(struct device_node *dp)
 {
        struct device *dev = bus_find_device(&platform_bus_type, NULL,
                                             dp, node_match);
 
        if (dev)
-               return to_of_device(dev);
+               return to_platform_device(dev);
 
        return NULL;
 }
 
 unsigned int irq_of_parse_and_map(struct device_node *node, int index)
 {
-       struct of_device *op = of_find_device_by_node(node);
+       struct platform_device *op = of_find_device_by_node(node);
 
        if (!op || index >= op->archdata.num_irqs)
                return 0;
 EXPORT_SYMBOL(irq_of_parse_and_map);
 
 /* Take the archdata values for IOMMU, STC, and HOSTDATA found in
- * BUS and propagate to all child of_device objects.
+ * BUS and propagate to all child platform_device objects.
  */
-void of_propagate_archdata(struct of_device *bus)
+void of_propagate_archdata(struct platform_device *bus)
 {
        struct dev_archdata *bus_sd = &bus->dev.archdata;
        struct device_node *bus_dp = bus->dev.of_node;
        struct device_node *dp;
 
        for (dp = bus_dp->child; dp; dp = dp->sibling) {
-               struct of_device *op = of_find_device_by_node(dp);
+               struct platform_device *op = of_find_device_by_node(dp);
 
                op->dev.archdata.iommu = bus_sd->iommu;
                op->dev.archdata.stc = bus_sd->stc;
 
  * into physical address resources, we only have to figure out the register
  * mapping.
  */
-static void pci_parse_of_addrs(struct of_device *op,
+static void pci_parse_of_addrs(struct platform_device *op,
                               struct device_node *node,
                               struct pci_dev *dev)
 {
 {
        struct dev_archdata *sd;
        struct pci_slot *slot;
-       struct of_device *op;
+       struct platform_device *op;
        struct pci_dev *dev;
        const char *type;
        u32 class;
 
 }
 
 static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
-                                      struct of_device *op, u32 portid)
+                                      struct platform_device *op, u32 portid)
 {
        const struct linux_prom64_registers *regs;
        struct device_node *dp = op->dev.of_node;
        return 0;
 }
 
-static int __devinit fire_probe(struct of_device *op,
+static int __devinit fire_probe(struct platform_device *op,
                                const struct of_device_id *match)
 {
        struct device_node *dp = op->dev.of_node;
 
        char                            *name;
 
        /* OBP specific information. */
-       struct of_device                *op;
+       struct platform_device          *op;
        u64                             ino_bitmap;
 
        /* PBM I/O and Memory space resources. */
 
 #define  PSYCHO_ECCCTRL_CE      0x2000000000000000UL /* Enable CE INterrupts */
 static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
 {
-       struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node);
+       struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
        unsigned long base = pbm->controller_regs;
        u64 tmp;
        int err;
 #define PSYCHO_MEMSPACE_SIZE   0x07fffffffUL
 
 static void __devinit psycho_pbm_init(struct pci_pbm_info *pbm,
-                                     struct of_device *op, int is_pbm_a)
+                                     struct platform_device *op, int is_pbm_a)
 {
        psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO);
        psycho_pbm_strbuf_init(pbm, is_pbm_a);
 
 #define PSYCHO_CONFIGSPACE     0x001000000UL
 
-static int __devinit psycho_probe(struct of_device *op,
+static int __devinit psycho_probe(struct platform_device *op,
                                  const struct of_device_id *match)
 {
        const struct linux_prom64_registers *pr_regs;
 
 static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
 {
        struct device_node *dp = pbm->op->dev.of_node;
-       struct of_device *op;
+       struct platform_device *op;
        unsigned long base = pbm->controller_regs;
        u64 tmp;
        int err;
 }
 
 static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
-                                    struct of_device *op)
+                                    struct platform_device *op)
 {
        psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE);
        pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR;
        sabre_scan_bus(pbm, &op->dev);
 }
 
-static int __devinit sabre_probe(struct of_device *op,
+static int __devinit sabre_probe(struct platform_device *op,
                                 const struct of_device_id *match)
 {
        const struct linux_prom64_registers *pr_regs;
 
  */
 static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
 {
-       struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node);
+       struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
        u64 tmp, err_mask, err_no_mask;
        int err;
 
 
 static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
 {
-       struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node);
+       struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
        u64 tmp, err_mask, err_no_mask;
        int err;
 
 }
 
 static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm,
-                                    struct of_device *op, u32 portid,
+                                    struct platform_device *op, u32 portid,
                                     int chip_type)
 {
        const struct linux_prom64_registers *regs;
        return NULL;
 }
 
-static int __devinit __schizo_init(struct of_device *op, unsigned long chip_type)
+static int __devinit __schizo_init(struct platform_device *op, unsigned long chip_type)
 {
        struct device_node *dp = op->dev.of_node;
        struct pci_pbm_info *pbm;
        return err;
 }
 
-static int __devinit schizo_probe(struct of_device *op,
+static int __devinit schizo_probe(struct platform_device *op,
                                  const struct of_device_id *match)
 {
        return __schizo_init(op, (unsigned long) match->data);
 
 #endif /* !(CONFIG_PCI_MSI) */
 
 static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
-                                       struct of_device *op, u32 devhandle)
+                                       struct platform_device *op, u32 devhandle)
 {
        struct device_node *dp = op->dev.of_node;
        int err;
        return 0;
 }
 
-static int __devinit pci_sun4v_probe(struct of_device *op,
+static int __devinit pci_sun4v_probe(struct platform_device *op,
                                     const struct of_device_id *match)
 {
        const struct linux_prom64_registers *regs;
 
 #endif
 }
 
-static int __devinit pmc_probe(struct of_device *op,
+static int __devinit pmc_probe(struct platform_device *op,
                               const struct of_device_id *match)
 {
        regs = of_ioremap(&op->resource[0], 0,
 
        return 1;
 }
 
-static int __devinit power_probe(struct of_device *op, const struct of_device_id *match)
+static int __devinit power_probe(struct platform_device *op, const struct of_device_id *match)
 {
        struct resource *res = &op->resource[0];
        unsigned int irq = op->archdata.irqs[0];
 
                                      void *_data)
 {
        struct device_node *central_dp = _data;
-       struct of_device *central_op = of_find_device_by_node(central_dp);
+       struct platform_device *central_op = of_find_device_by_node(central_dp);
        struct resource *res;
        unsigned long imap, iclr;
        u32 tmp;
 
 
 }
 
-void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct of_device *op,
+void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op,
                            const char *chip_name, int chip_type)
 {
        struct device_node *dp = op->dev.of_node;
 
                             unsigned long write_complete_offset);
 
 extern void psycho_pbm_init_common(struct pci_pbm_info *pbm,
-                                  struct of_device *op,
+                                  struct platform_device *op,
                                   const char *chip_name, int chip_type);
 
 #endif /* _PSYCHO_COMMON_H */
 
 void sbus_set_sbus64(struct device *dev, int bursts)
 {
        struct iommu *iommu = dev->archdata.iommu;
-       struct of_device *op = to_of_device(dev);
+       struct platform_device *op = to_platform_device(dev);
        const struct linux_prom_registers *regs;
        unsigned long cfg_reg;
        int slot;
        return imap + diff;
 }
 
-static unsigned int sbus_build_irq(struct of_device *op, unsigned int ino)
+static unsigned int sbus_build_irq(struct platform_device *op, unsigned int ino)
 {
        struct iommu *iommu = op->dev.archdata.iommu;
        unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
 #define  SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved                  */
 static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
 {
-       struct of_device *op = dev_id;
+       struct platform_device *op = dev_id;
        struct iommu *iommu = op->dev.archdata.iommu;
        unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
        unsigned long afsr_reg, afar_reg;
 #define  SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved                  */
 static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
 {
-       struct of_device *op = dev_id;
+       struct platform_device *op = dev_id;
        struct iommu *iommu = op->dev.archdata.iommu;
        unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
        unsigned long afsr_reg, afar_reg;
 #define  SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved                  */
 static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
 {
-       struct of_device *op = dev_id;
+       struct platform_device *op = dev_id;
        struct iommu *iommu = op->dev.archdata.iommu;
        unsigned long afsr_reg, afar_reg, reg_base;
        unsigned long afsr, afar, error_bits;
 #define SYSIO_CE_INO           0x35
 #define SYSIO_SBUSERR_INO      0x36
 
-static void __init sysio_register_error_handlers(struct of_device *op)
+static void __init sysio_register_error_handlers(struct platform_device *op)
 {
        struct iommu *iommu = op->dev.archdata.iommu;
        unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
 }
 
 /* Boot time initialization. */
-static void __init sbus_iommu_init(struct of_device *op)
+static void __init sbus_iommu_init(struct platform_device *op)
 {
        const struct linux_prom64_registers *pr;
        struct device_node *dp = op->dev.of_node;
        struct device_node *dp;
 
        for_each_node_by_name(dp, "sbus") {
-               struct of_device *op = of_find_device_by_node(dp);
+               struct platform_device *op = of_find_device_by_node(dp);
 
                sbus_iommu_init(op);
                of_propagate_archdata(op);
 
        },
 };
 
-static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match)
+static int __devinit clock_probe(struct platform_device *op, const struct of_device_id *match)
 {
        struct device_node *dp = op->dev.of_node;
        const char *model = of_get_property(dp, "model", NULL);
 
        .num_resources  = 1,
 };
 
-static int __devinit rtc_probe(struct of_device *op, const struct of_device_id *match)
+static int __devinit rtc_probe(struct platform_device *op, const struct of_device_id *match)
 {
        struct resource *r;
 
        .num_resources  = 1,
 };
 
-static int __devinit bq4802_probe(struct of_device *op, const struct of_device_id *match)
+static int __devinit bq4802_probe(struct platform_device *op, const struct of_device_id *match)
 {
 
        printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n",
        },
 };
 
-static int __devinit mostek_probe(struct of_device *op, const struct of_device_id *match)
+static int __devinit mostek_probe(struct platform_device *op, const struct of_device_id *match)
 {
        struct device_node *dp = op->dev.of_node;
 
 
 #define IOPERM        (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID)
 #define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM)
 
-static void __init iounit_iommu_init(struct of_device *op)
+static void __init iounit_iommu_init(struct platform_device *op)
 {
        struct iounit_struct *iounit;
        iopte_t *xpt, *xptend;
        struct device_node *dp;
 
        for_each_node_by_name(dp, "sbi") {
-               struct of_device *op = of_find_device_by_node(dp);
+               struct platform_device *op = of_find_device_by_node(dp);
 
                iounit_iommu_init(op);
                of_propagate_archdata(op);
 
 #define IOPERM        (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID)
 #define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ)
 
-static void __init sbus_iommu_init(struct of_device *op)
+static void __init sbus_iommu_init(struct platform_device *op)
 {
        struct iommu_struct *iommu;
        unsigned int impl, vers;
        struct device_node *dp;
 
        for_each_node_by_name(dp, "iommu") {
-               struct of_device *op = of_find_device_by_node(dp);
+               struct platform_device *op = of_find_device_by_node(dp);
 
                sbus_iommu_init(op);
                of_propagate_archdata(op);