]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
Staging: sep: use ioremap helpers
authorAlan Cox <alan@linux.intel.com>
Fri, 14 Aug 2009 14:49:35 +0000 (15:49 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 19:02:15 +0000 (12:02 -0700)
Whee lots of code vanishes. While we are it note various existing stuff
that couldn't work but was ifdeffed in this area.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/sep/sep_driver.c

index aa864362ad347a5ce16174e80ae02f7b8574aeef..87f8a1192762bde6cbe32531c7a5e6ca717145d4 100644 (file)
@@ -2454,8 +2454,6 @@ static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id
        struct sep_device *sep;
        int counter;
        int size;               /* size of memory for allocation */
-       unsigned long iosize;
-       unsigned long bar0, end0;
 
        edbg("Sep pci probe starting\n");
        if (sep_dev != NULL) {
@@ -2496,6 +2494,8 @@ static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id
        }
        /* now set the memory regions */
 #if (SEP_DRIVER_RECONFIG_MESSAGE_AREA == 1)
+       /* Note: this test section will need moving before it could ever
+          work as the registers are not yet mapped ! */
        /* send the new SHARED MESSAGE AREA to the SEP */
        sep_write_reg(sep, HW_HOST_HOST_SEP_GPR1_REG_ADDR, sep->shared_bus);
 
@@ -2521,43 +2521,19 @@ static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id
                goto end_function_deallocate_sep_shared_area;
        }
        edbg("SEP Driver: create flow workqueue \n");
-       /* load the rom code */
-       sep_load_rom_code(sep);
-
        sep->pdev = pci_dev_get(pdev);
 
-       /* get the io memory start address */
-       bar0 = pci_resource_start(pdev, 0);
-       if (!bar0) {
-               edbg("SEP Driver error pci resource start\n");
-               goto end_function_deallocate_sep_shared_area;
-       }
-
-       /* get the io memory end address */
-       end0 = pci_resource_end(pdev, 0);
-       if (!end0) {
-               edbg("SEP Driver error pci resource end\n");
-               goto end_function_deallocate_sep_shared_area;
-       }
-
-       iosize = end0 - bar0 + 1;
-
-       edbg("SEP Driver:io_bus is %08lx\n", bar0);
-
-       edbg("SEP Driver:io_memory_end_phyaical_address is %08lx\n", end0);
-
-       edbg("SEP Driver:io_memory_size is %08lx\n", iosize);
-
-       sep->reg_addr = ioremap_nocache(bar0, iosize);
+       sep->reg_addr = pci_ioremap_bar(pdev, 0);
        if (!sep->reg_addr) {
-               edbg("SEP Driver error ioremap of io memory\n");
+               edbg("sep: ioremap of registers failed.\n");
                goto end_function_deallocate_sep_shared_area;
        }
+       edbg("SEP Driver:reg_addr is %p\n", sep->reg_addr);
 
-       edbg("SEP Driver:io_addr is %p\n", sep->reg_addr);
+       /* load the rom code */
+       sep_load_rom_code(sep);
 
        /* set up system base address and shared memory location */
-
        sep->rar_addr = dma_alloc_coherent(&sep->pdev->dev,
                        2 * SEP_RAR_IO_MEM_REGION_SIZE,
                        &sep->rar_bus, GFP_KERNEL);
@@ -2567,6 +2543,7 @@ static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id
                goto end_function_uniomap;
        }
 
+
        edbg("SEP Driver:rar_bus is %08llx\n", (unsigned long long)sep->rar_bus);
        edbg("SEP Driver:rar_virtual is %p\n", sep->rar_addr);
 
@@ -2585,8 +2562,7 @@ static int __devinit sep_probe(struct pci_dev *pdev, const struct pci_device_id
        error = request_irq(pdev->irq, sep_inthandler, IRQF_SHARED, "sep_driver", sep);
        if (error)
                goto end_function_free_res;
-
-       goto end_function;
+       return 0;
        edbg("SEP Driver: about to write IMR REG_ADDR");
 
        /* set the IMR register - open only GPR 2 */