diff options
Diffstat (limited to 'drivers/macintosh/macio_asic.c')
| -rw-r--r-- | drivers/macintosh/macio_asic.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index c1fdf2896021..bede200e32e8 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -20,13 +20,15 @@ #include <linux/init.h> #include <linux/module.h> #include <linux/slab.h> +#include <linux/of.h> #include <linux/of_address.h> +#include <linux/of_device.h> +#include <linux/of_platform.h> #include <linux/of_irq.h> #include <asm/machdep.h> #include <asm/macio.h> #include <asm/pmac_feature.h> -#include <asm/prom.h> #undef DEBUG @@ -34,7 +36,7 @@ static struct macio_chip *macio_on_hold; -static int macio_bus_match(struct device *dev, struct device_driver *drv) +static int macio_bus_match(struct device *dev, const struct device_driver *drv) { const struct of_device_id * matches = drv->of_match_table; @@ -127,12 +129,17 @@ static int macio_device_resume(struct device * dev) return 0; } +static int macio_device_modalias(const struct device *dev, struct kobj_uevent_env *env) +{ + return of_device_uevent_modalias(dev, env); +} + extern const struct attribute_group *macio_dev_groups[]; -struct bus_type macio_bus_type = { +const struct bus_type macio_bus_type = { .name = "macio", .match = macio_bus_match, - .uevent = of_device_uevent_modalias, + .uevent = macio_device_modalias, .probe = macio_device_probe, .remove = macio_device_remove, .shutdown = macio_device_shutdown, @@ -380,7 +387,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, dma_set_max_seg_size(&dev->ofdev.dev, 65536); dma_set_seg_boundary(&dev->ofdev.dev, 0xffffffff); -#if defined(CONFIG_PCI) && defined(CONFIG_DMA_OPS) +#if defined(CONFIG_PCI) && defined(CONFIG_ARCH_HAS_DMA_OPS) /* Set the DMA ops to the ones from the PCI device, this could be * fishy if we didn't know that on PowerMac it's always direct ops * or iommu ops that will work fine @@ -389,7 +396,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, */ dev->ofdev.dev.archdata = chip->lbus.pdev->dev.archdata; dev->ofdev.dev.dma_ops = chip->lbus.pdev->dev.dma_ops; -#endif /* CONFIG_PCI && CONFIG_DMA_OPS */ +#endif /* CONFIG_PCI && CONFIG_ARCH_HAS_DMA_OPS */ #ifdef DEBUG printk("preparing mdev @%p, ofdev @%p, dev @%p, kobj @%p\n", @@ -423,7 +430,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip, if (of_device_register(&dev->ofdev) != 0) { printk(KERN_DEBUG"macio: device registration error for %s!\n", dev_name(&dev->ofdev.dev)); - kfree(dev); + put_device(&dev->ofdev.dev); return NULL; } @@ -472,7 +479,7 @@ static void macio_pci_add_devices(struct macio_chip *chip) root_res = &rdev->resource[0]; /* First scan 1st level */ - for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) { + for_each_child_of_node(pnode, np) { if (macio_skip_device(np)) continue; of_node_get(np); @@ -489,7 +496,7 @@ static void macio_pci_add_devices(struct macio_chip *chip) /* Add media bay devices if any */ if (mbdev) { pnode = mbdev->ofdev.dev.of_node; - for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) { + for_each_child_of_node(pnode, np) { if (macio_skip_device(np)) continue; of_node_get(np); @@ -502,7 +509,7 @@ static void macio_pci_add_devices(struct macio_chip *chip) /* Add serial ports if any */ if (sdev) { pnode = sdev->ofdev.dev.of_node; - for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) { + for_each_child_of_node(pnode, np) { if (macio_skip_device(np)) continue; of_node_get(np); @@ -756,7 +763,7 @@ MODULE_DEVICE_TABLE (pci, pci_ids); /* pci driver glue; this is a "new style" PCI driver module */ static struct pci_driver macio_pci_driver = { - .name = (char *) "macio", + .name = "macio", .id_table = pci_ids, .probe = macio_pci_probe, |
