[PATCH 460/641] Staging: sep: use ioremap helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Alan Cox <alan@xxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/staging/sep/sep_driver.c |   42 ++++++++-----------------------------
 1 files changed, 9 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index aa86436..87f8a11 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -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 */
-- 
1.6.4.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux