]> err.no Git - linux-2.6/blobdiff - arch/sparc/kernel/ioport.c
[SPARC]: Replace kmalloc+memset with kzalloc
[linux-2.6] / arch / sparc / kernel / ioport.c
index ae4c667c906f5caf0ef2d049bc5b35382330be03..cbbc98846b0081cfe322622dcca604a222b207b4 100644 (file)
@@ -25,7 +25,7 @@
  * <zaitcev> Sounds reasonable
  */
 
-#include <linux/config.h>
+#include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -40,6 +40,7 @@
 #include <asm/vaddrs.h>
 #include <asm/oplib.h>
 #include <asm/prom.h>
+#include <asm/of_device.h>
 #include <asm/sbus.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
@@ -143,6 +144,21 @@ void __iomem *sbus_ioremap(struct resource *phyres, unsigned long offset,
            phyres->start + offset, size, name);
 }
 
+void __iomem *of_ioremap(struct resource *res, unsigned long offset,
+                        unsigned long size, char *name)
+{
+       return _sparc_alloc_io(res->flags & 0xF,
+                              res->start + offset,
+                              size, name);
+}
+EXPORT_SYMBOL(of_ioremap);
+
+void of_iounmap(void __iomem *base, unsigned long size)
+{
+       iounmap(base);
+}
+EXPORT_SYMBOL(of_iounmap);
+
 /*
  */
 void sbus_iounmap(volatile void __iomem *addr, unsigned long size)
@@ -208,7 +224,7 @@ _sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz)
        pa &= PAGE_MASK;
        sparc_mapiorange(bus, pa, res->start, res->end - res->start + 1);
 
-       return (void __iomem *) (res->start + offset);
+       return (void __iomem *)(unsigned long)(res->start + offset);
 }
 
 /*
@@ -301,9 +317,8 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
        if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) == 0)
                goto err_nopages;
 
-       if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
+       if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL)
                goto err_nomem;
-       memset((char*)res, 0, sizeof(struct resource));
 
        if (allocate_resource(&_sparc_dvma, res, len_total,
            _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
@@ -325,7 +340,7 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
                res->name = sdev->prom_name;
        }
 
-       return (void *)res->start;
+       return (void *)(unsigned long)res->start;
 
 err_noiommu:
        release_resource(res);
@@ -491,6 +506,7 @@ void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *s
 
 void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp)
 {
+#ifndef CONFIG_SUN4
        struct device_node *parent = dp->parent;
 
        if (sparc_cpu_model != sun4d &&
@@ -507,6 +523,7 @@ void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp)
 
                iounit_init(dp->node, parent->node, sbus);
        }
+#endif
 }
 
 void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp)
@@ -571,12 +588,11 @@ void *pci_alloc_consistent(struct pci_dev *pdev, size_t len, dma_addr_t *pba)
                return NULL;
        }
 
-       if ((res = kmalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
+       if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) {
                free_pages(va, order);
                printk("pci_alloc_consistent: no core\n");
                return NULL;
        }
-       memset((char*)res, 0, sizeof(struct resource));
 
        if (allocate_resource(&_sparc_dvma, res, len_total,
            _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) {
@@ -819,7 +835,9 @@ _sparc_io_get_info(char *buf, char **start, off_t fpos, int length, int *eof,
                if (p + 32 >= e)        /* Better than nothing */
                        break;
                if ((nm = r->name) == 0) nm = "???";
-               p += sprintf(p, "%08lx-%08lx: %s\n", r->start, r->end, nm);
+               p += sprintf(p, "%016llx-%016llx: %s\n",
+                               (unsigned long long)r->start,
+                               (unsigned long long)r->end, nm);
        }
 
        return p-buf;