浏览代码

Staging: vme: Make vme_master_resource naming bus neutral

The vme_master_resource structure contains an item called "pci_resource".
Rename to make bus agnostic.

Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Martyn Welch 15 年之前
父节点
当前提交
8fafb47638

+ 0 - 1
drivers/staging/vme/TODO

@@ -37,7 +37,6 @@ chips. They are currently not supported at all by the API.
 Core
 Core
 ====
 ====
 
 
-- Rename vme_master_resource's "pci_resource" to be bus agnostic.
 - Improve generic sanity checks (Such as does an offset and size fit within a
 - Improve generic sanity checks (Such as does an offset and size fit within a
   window and parameter checking).
   window and parameter checking).
 
 

+ 24 - 24
drivers/staging/vme/bridges/vme_ca91cx42.c

@@ -526,8 +526,8 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
 	}
 	}
 	pdev = container_of(ca91cx42_bridge->parent, struct pci_dev, dev);
 	pdev = container_of(ca91cx42_bridge->parent, struct pci_dev, dev);
 
 
-	existing_size = (unsigned long long)(image->pci_resource.end -
-		image->pci_resource.start);
+	existing_size = (unsigned long long)(image->bus_resource.end -
+		image->bus_resource.start);
 
 
 	/* If the existing size is OK, return */
 	/* If the existing size is OK, return */
 	if (existing_size == (size - 1))
 	if (existing_size == (size - 1))
@@ -536,15 +536,15 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
 	if (existing_size != 0) {
 	if (existing_size != 0) {
 		iounmap(image->kern_base);
 		iounmap(image->kern_base);
 		image->kern_base = NULL;
 		image->kern_base = NULL;
-		if (image->pci_resource.name != NULL)
-			kfree(image->pci_resource.name);
-		release_resource(&(image->pci_resource));
-		memset(&(image->pci_resource), 0, sizeof(struct resource));
+		if (image->bus_resource.name != NULL)
+			kfree(image->bus_resource.name);
+		release_resource(&(image->bus_resource));
+		memset(&(image->bus_resource), 0, sizeof(struct resource));
 	}
 	}
 
 
-	if (image->pci_resource.name == NULL) {
-		image->pci_resource.name = kmalloc(VMENAMSIZ+3, GFP_KERNEL);
-		if (image->pci_resource.name == NULL) {
+	if (image->bus_resource.name == NULL) {
+		image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_KERNEL);
+		if (image->bus_resource.name == NULL) {
 			printk(KERN_ERR "Unable to allocate memory for resource"
 			printk(KERN_ERR "Unable to allocate memory for resource"
 				" name\n");
 				" name\n");
 			retval = -ENOMEM;
 			retval = -ENOMEM;
@@ -552,26 +552,26 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
 		}
 		}
 	}
 	}
 
 
-	sprintf((char *)image->pci_resource.name, "%s.%d",
+	sprintf((char *)image->bus_resource.name, "%s.%d",
 		ca91cx42_bridge->name, image->number);
 		ca91cx42_bridge->name, image->number);
 
 
-	image->pci_resource.start = 0;
-	image->pci_resource.end = (unsigned long)size;
-	image->pci_resource.flags = IORESOURCE_MEM;
+	image->bus_resource.start = 0;
+	image->bus_resource.end = (unsigned long)size;
+	image->bus_resource.flags = IORESOURCE_MEM;
 
 
 	retval = pci_bus_alloc_resource(pdev->bus,
 	retval = pci_bus_alloc_resource(pdev->bus,
-		&(image->pci_resource), size, size, PCIBIOS_MIN_MEM,
+		&(image->bus_resource), size, size, PCIBIOS_MIN_MEM,
 		0, NULL, NULL);
 		0, NULL, NULL);
 	if (retval) {
 	if (retval) {
 		printk(KERN_ERR "Failed to allocate mem resource for "
 		printk(KERN_ERR "Failed to allocate mem resource for "
 			"window %d size 0x%lx start 0x%lx\n",
 			"window %d size 0x%lx start 0x%lx\n",
 			image->number, (unsigned long)size,
 			image->number, (unsigned long)size,
-			(unsigned long)image->pci_resource.start);
+			(unsigned long)image->bus_resource.start);
 		goto err_resource;
 		goto err_resource;
 	}
 	}
 
 
 	image->kern_base = ioremap_nocache(
 	image->kern_base = ioremap_nocache(
-		image->pci_resource.start, size);
+		image->bus_resource.start, size);
 	if (image->kern_base == NULL) {
 	if (image->kern_base == NULL) {
 		printk(KERN_ERR "Failed to remap resource\n");
 		printk(KERN_ERR "Failed to remap resource\n");
 		retval = -ENOMEM;
 		retval = -ENOMEM;
@@ -583,10 +583,10 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image,
 	iounmap(image->kern_base);
 	iounmap(image->kern_base);
 	image->kern_base = NULL;
 	image->kern_base = NULL;
 err_remap:
 err_remap:
-	release_resource(&(image->pci_resource));
+	release_resource(&(image->bus_resource));
 err_resource:
 err_resource:
-	kfree(image->pci_resource.name);
-	memset(&(image->pci_resource), 0, sizeof(struct resource));
+	kfree(image->bus_resource.name);
+	memset(&(image->bus_resource), 0, sizeof(struct resource));
 err_name:
 err_name:
 	return retval;
 	return retval;
 }
 }
@@ -598,9 +598,9 @@ static void ca91cx42_free_resource(struct vme_master_resource *image)
 {
 {
 	iounmap(image->kern_base);
 	iounmap(image->kern_base);
 	image->kern_base = NULL;
 	image->kern_base = NULL;
-	release_resource(&(image->pci_resource));
-	kfree(image->pci_resource.name);
-	memset(&(image->pci_resource), 0, sizeof(struct resource));
+	release_resource(&(image->bus_resource));
+	kfree(image->bus_resource.name);
+	memset(&(image->bus_resource), 0, sizeof(struct resource));
 }
 }
 
 
 
 
@@ -646,7 +646,7 @@ int ca91cx42_master_set(struct vme_master_resource *image, int enabled,
 		goto err_res;
 		goto err_res;
 	}
 	}
 
 
-	pci_base = (unsigned long long)image->pci_resource.start;
+	pci_base = (unsigned long long)image->bus_resource.start;
 
 
 	/*
 	/*
 	 * Bound address is a valid address for the window, adjust
 	 * Bound address is a valid address for the window, adjust
@@ -1102,7 +1102,7 @@ static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		master_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
 		master_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
 			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
 			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
 		master_image->width_attr = VME_D8 | VME_D16 | VME_D32 | VME_D64;
 		master_image->width_attr = VME_D8 | VME_D16 | VME_D32 | VME_D64;
-		memset(&(master_image->pci_resource), 0,
+		memset(&(master_image->bus_resource), 0,
 			sizeof(struct resource));
 			sizeof(struct resource));
 		master_image->kern_base  = NULL;
 		master_image->kern_base  = NULL;
 		list_add_tail(&(master_image->list),
 		list_add_tail(&(master_image->list),

+ 25 - 25
drivers/staging/vme/bridges/vme_tsi148.c

@@ -855,8 +855,8 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
         }
         }
         pdev = container_of(tsi148_bridge->parent, struct pci_dev, dev);
         pdev = container_of(tsi148_bridge->parent, struct pci_dev, dev);
 
 
-	existing_size = (unsigned long long)(image->pci_resource.end -
-		image->pci_resource.start);
+	existing_size = (unsigned long long)(image->bus_resource.end -
+		image->bus_resource.start);
 
 
 	/* If the existing size is OK, return */
 	/* If the existing size is OK, return */
 	if ((size != 0) && (existing_size == (size - 1)))
 	if ((size != 0) && (existing_size == (size - 1)))
@@ -865,10 +865,10 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
 	if (existing_size != 0) {
 	if (existing_size != 0) {
 		iounmap(image->kern_base);
 		iounmap(image->kern_base);
 		image->kern_base = NULL;
 		image->kern_base = NULL;
-		if (image->pci_resource.name != NULL)
-			kfree(image->pci_resource.name);
-		release_resource(&(image->pci_resource));
-		memset(&(image->pci_resource), 0, sizeof(struct resource));
+		if (image->bus_resource.name != NULL)
+			kfree(image->bus_resource.name);
+		release_resource(&(image->bus_resource));
+		memset(&(image->bus_resource), 0, sizeof(struct resource));
 	}
 	}
 
 
 	/* Exit here if size is zero */
 	/* Exit here if size is zero */
@@ -876,9 +876,9 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
 		return 0;
 		return 0;
 	}
 	}
 
 
-	if (image->pci_resource.name == NULL) {
-		image->pci_resource.name = kmalloc(VMENAMSIZ+3, GFP_KERNEL);
-		if (image->pci_resource.name == NULL) {
+	if (image->bus_resource.name == NULL) {
+		image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_KERNEL);
+		if (image->bus_resource.name == NULL) {
 			printk(KERN_ERR "Unable to allocate memory for resource"
 			printk(KERN_ERR "Unable to allocate memory for resource"
 				" name\n");
 				" name\n");
 			retval = -ENOMEM;
 			retval = -ENOMEM;
@@ -886,26 +886,26 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
 		}
 		}
 	}
 	}
 
 
-	sprintf((char *)image->pci_resource.name, "%s.%d", tsi148_bridge->name,
+	sprintf((char *)image->bus_resource.name, "%s.%d", tsi148_bridge->name,
 		image->number);
 		image->number);
 
 
-	image->pci_resource.start = 0;
-	image->pci_resource.end = (unsigned long)size;
-	image->pci_resource.flags = IORESOURCE_MEM;
+	image->bus_resource.start = 0;
+	image->bus_resource.end = (unsigned long)size;
+	image->bus_resource.flags = IORESOURCE_MEM;
 
 
 	retval = pci_bus_alloc_resource(pdev->bus,
 	retval = pci_bus_alloc_resource(pdev->bus,
-		&(image->pci_resource), size, size, PCIBIOS_MIN_MEM,
+		&(image->bus_resource), size, size, PCIBIOS_MIN_MEM,
 		0, NULL, NULL);
 		0, NULL, NULL);
 	if (retval) {
 	if (retval) {
 		printk(KERN_ERR "Failed to allocate mem resource for "
 		printk(KERN_ERR "Failed to allocate mem resource for "
 			"window %d size 0x%lx start 0x%lx\n",
 			"window %d size 0x%lx start 0x%lx\n",
 			image->number, (unsigned long)size,
 			image->number, (unsigned long)size,
-			(unsigned long)image->pci_resource.start);
+			(unsigned long)image->bus_resource.start);
 		goto err_resource;
 		goto err_resource;
 	}
 	}
 
 
 	image->kern_base = ioremap_nocache(
 	image->kern_base = ioremap_nocache(
-		image->pci_resource.start, size);
+		image->bus_resource.start, size);
 	if (image->kern_base == NULL) {
 	if (image->kern_base == NULL) {
 		printk(KERN_ERR "Failed to remap resource\n");
 		printk(KERN_ERR "Failed to remap resource\n");
 		retval = -ENOMEM;
 		retval = -ENOMEM;
@@ -917,10 +917,10 @@ static int tsi148_alloc_resource(struct vme_master_resource *image,
 	iounmap(image->kern_base);
 	iounmap(image->kern_base);
 	image->kern_base = NULL;
 	image->kern_base = NULL;
 err_remap:
 err_remap:
-	release_resource(&(image->pci_resource));
+	release_resource(&(image->bus_resource));
 err_resource:
 err_resource:
-	kfree(image->pci_resource.name);
-	memset(&(image->pci_resource), 0, sizeof(struct resource));
+	kfree(image->bus_resource.name);
+	memset(&(image->bus_resource), 0, sizeof(struct resource));
 err_name:
 err_name:
 	return retval;
 	return retval;
 }
 }
@@ -932,9 +932,9 @@ static void tsi148_free_resource(struct vme_master_resource *image)
 {
 {
 	iounmap(image->kern_base);
 	iounmap(image->kern_base);
 	image->kern_base = NULL;
 	image->kern_base = NULL;
-	release_resource(&(image->pci_resource));
-	kfree(image->pci_resource.name);
-	memset(&(image->pci_resource), 0, sizeof(struct resource));
+	release_resource(&(image->bus_resource));
+	kfree(image->bus_resource.name);
+	memset(&(image->bus_resource), 0, sizeof(struct resource));
 }
 }
 
 
 /*
 /*
@@ -987,7 +987,7 @@ int tsi148_master_set( struct vme_master_resource *image, int enabled,
 		pci_bound = 0;
 		pci_bound = 0;
 		vme_offset = 0;
 		vme_offset = 0;
 	} else {
 	} else {
-		pci_base = (unsigned long long)image->pci_resource.start;
+		pci_base = (unsigned long long)image->bus_resource.start;
 
 
 		/*
 		/*
 		 * Bound address is a valid address for the window, adjust
 		 * Bound address is a valid address for the window, adjust
@@ -2423,7 +2423,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 			VME_2eSST160 | VME_2eSST267 | VME_2eSST320 | VME_SUPER |
 			VME_2eSST160 | VME_2eSST267 | VME_2eSST320 | VME_SUPER |
 			VME_USER | VME_PROG | VME_DATA;
 			VME_USER | VME_PROG | VME_DATA;
 		tsi148_device->flush_image->width_attr = VME_D16 | VME_D32;
 		tsi148_device->flush_image->width_attr = VME_D16 | VME_D32;
-		memset(&(tsi148_device->flush_image->pci_resource), 0,
+		memset(&(tsi148_device->flush_image->bus_resource), 0,
 			sizeof(struct resource));
 			sizeof(struct resource));
 		tsi148_device->flush_image->kern_base  = NULL;
 		tsi148_device->flush_image->kern_base  = NULL;
 	}
 	}
@@ -2450,7 +2450,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 			VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER |
 			VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER |
 			VME_PROG | VME_DATA;
 			VME_PROG | VME_DATA;
 		master_image->width_attr = VME_D16 | VME_D32;
 		master_image->width_attr = VME_D16 | VME_D32;
-		memset(&(master_image->pci_resource), 0,
+		memset(&(master_image->bus_resource), 0,
 			sizeof(struct resource));
 			sizeof(struct resource));
 		master_image->kern_base  = NULL;
 		master_image->kern_base  = NULL;
 		list_add_tail(&(master_image->list),
 		list_add_tail(&(master_image->list),

+ 1 - 1
drivers/staging/vme/vme_bridge.h

@@ -19,7 +19,7 @@ struct vme_master_resource {
 	vme_address_t address_attr;
 	vme_address_t address_attr;
 	vme_cycle_t cycle_attr;
 	vme_cycle_t cycle_attr;
 	vme_width_t width_attr;
 	vme_width_t width_attr;
-	struct resource pci_resource;	/* XXX Rename to be bus agnostic */
+	struct resource bus_resource;
 	void *kern_base;
 	void *kern_base;
 };
 };