Commit ead1f3e3 authored by Martyn Welch's avatar Martyn Welch Committed by Greg Kroah-Hartman
Browse files

Staging: vme: Fix checkpatch errors on VME core.



Running checkpatch on the core VME code highlights many errors. Fix them.

Signed-off-by: default avatarMartyn Welch <martyn.welch@gefanuc.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 12b2d5c0
Loading
Loading
Loading
Loading
+110 −112
Original line number Diff line number Diff line
@@ -93,19 +93,19 @@ void * vme_alloc_consistent(struct vme_resource *resource, size_t size,
	struct pci_dev *pdev;

	if (resource == NULL) {
		printk("No resource\n");
		printk(KERN_ERR "No resource\n");
		return NULL;
	}

	bridge = find_bridge(resource);
	if (bridge == NULL) {
		printk("Can't find bridge\n");
		printk(KERN_ERR "Can't find bridge\n");
		return NULL;
	}

	/* Find pci_dev container of dev */
	if (bridge->parent == NULL) {
		printk("Dev entry NULL\n");
		printk(KERN_ERR "Dev entry NULL\n");
		return NULL;
	}
	pdev = container_of(bridge->parent, struct pci_dev, dev);
@@ -127,13 +127,13 @@ void vme_free_consistent(struct vme_resource *resource, size_t size,
	struct pci_dev *pdev;

	if (resource == NULL) {
		printk("No resource\n");
		printk(KERN_ERR "No resource\n");
		return;
	}

	bridge = find_bridge(resource);
	if (bridge == NULL) {
		printk("Can't find bridge\n");
		printk(KERN_ERR "Can't find bridge\n");
		return;
	}

@@ -216,7 +216,7 @@ static int vme_check_window(vme_address_t aspace, unsigned long long vme_base,
		/* User Defined */
		break;
	default:
		printk("Invalid address space\n");
		printk(KERN_ERR "Invalid address space\n");
		retval = -EINVAL;
		break;
	}
@@ -249,7 +249,7 @@ struct vme_resource * vme_slave_request(struct device *dev,
			struct vme_slave_resource, list);

		if (slave_image == NULL) {
			printk("Registered NULL Slave resource\n");
			printk(KERN_ERR "Registered NULL Slave resource\n");
			continue;
		}

@@ -301,20 +301,20 @@ int vme_slave_set (struct vme_resource *resource, int enabled,
	int retval;

	if (resource->type != VME_SLAVE) {
		printk("Not a slave resource\n");
		printk(KERN_ERR "Not a slave resource\n");
		return -EINVAL;
	}

	image = list_entry(resource->entry, struct vme_slave_resource, list);

	if (bridge->slave_set == NULL) {
		printk("Function not supported\n");
		printk(KERN_ERR "Function not supported\n");
		return -ENOSYS;
	}

	if (!(((image->address_attr & aspace) == aspace) &&
		((image->cycle_attr & cycle) == cycle))) {
		printk("Invalid attributes\n");
		printk(KERN_ERR "Invalid attributes\n");
		return -EINVAL;
	}

@@ -335,14 +335,14 @@ int vme_slave_get (struct vme_resource *resource, int *enabled,
	struct vme_slave_resource *image;

	if (resource->type != VME_SLAVE) {
		printk("Not a slave resource\n");
		printk(KERN_ERR "Not a slave resource\n");
		return -EINVAL;
	}

	image = list_entry(resource->entry, struct vme_slave_resource, list);

	if (bridge->slave_get == NULL) {
		printk("vme_slave_get not supported\n");
		printk(KERN_ERR "vme_slave_get not supported\n");
		return -EINVAL;
	}

@@ -356,14 +356,14 @@ void vme_slave_free(struct vme_resource *resource)
	struct vme_slave_resource *slave_image;

	if (resource->type != VME_SLAVE) {
		printk("Not a slave resource\n");
		printk(KERN_ERR "Not a slave resource\n");
		return;
	}

	slave_image = list_entry(resource->entry, struct vme_slave_resource,
		list);
	if (slave_image == NULL) {
		printk("Can't find slave resource\n");
		printk(KERN_ERR "Can't find slave resource\n");
		return;
	}

@@ -461,21 +461,21 @@ int vme_master_set (struct vme_resource *resource, int enabled,
	int retval;

	if (resource->type != VME_MASTER) {
		printk("Not a master resource\n");
		printk(KERN_ERR "Not a master resource\n");
		return -EINVAL;
	}

	image = list_entry(resource->entry, struct vme_master_resource, list);

	if (bridge->master_set == NULL) {
		printk("vme_master_set not supported\n");
		printk(KERN_WARNING "vme_master_set not supported\n");
		return -EINVAL;
	}

	if (!(((image->address_attr & aspace) == aspace) &&
		((image->cycle_attr & cycle) == cycle) &&
		((image->width_attr & dwidth) == dwidth))) {
		printk("Invalid attributes\n");
		printk(KERN_WARNING "Invalid attributes\n");
		return -EINVAL;
	}

@@ -496,14 +496,14 @@ int vme_master_get (struct vme_resource *resource, int *enabled,
	struct vme_master_resource *image;

	if (resource->type != VME_MASTER) {
		printk("Not a master resource\n");
		printk(KERN_ERR "Not a master resource\n");
		return -EINVAL;
	}

	image = list_entry(resource->entry, struct vme_master_resource, list);

	if (bridge->master_get == NULL) {
		printk("vme_master_set not supported\n");
		printk(KERN_WARNING "vme_master_set not supported\n");
		return -EINVAL;
	}

@@ -523,12 +523,12 @@ ssize_t vme_master_read (struct vme_resource *resource, void *buf, size_t count,
	size_t length;

	if (bridge->master_read == NULL) {
		printk("Reading from resource not supported\n");
		printk(KERN_WARNING "Reading from resource not supported\n");
		return -EINVAL;
	}

	if (resource->type != VME_MASTER) {
		printk("Not a master resource\n");
		printk(KERN_ERR "Not a master resource\n");
		return -EINVAL;
	}

@@ -537,7 +537,7 @@ ssize_t vme_master_read (struct vme_resource *resource, void *buf, size_t count,
	length = vme_get_size(resource);

	if (offset > length) {
		printk("Invalid Offset\n");
		printk(KERN_WARNING "Invalid Offset\n");
		return -EFAULT;
	}

@@ -560,12 +560,12 @@ ssize_t vme_master_write (struct vme_resource *resource, void *buf,
	size_t length;

	if (bridge->master_write == NULL) {
		printk("Writing to resource not supported\n");
		printk(KERN_WARNING "Writing to resource not supported\n");
		return -EINVAL;
	}

	if (resource->type != VME_MASTER) {
		printk("Not a master resource\n");
		printk(KERN_ERR "Not a master resource\n");
		return -EINVAL;
	}

@@ -574,7 +574,7 @@ ssize_t vme_master_write (struct vme_resource *resource, void *buf,
	length = vme_get_size(resource);

	if (offset > length) {
		printk("Invalid Offset\n");
		printk(KERN_WARNING "Invalid Offset\n");
		return -EFAULT;
	}

@@ -595,12 +595,12 @@ unsigned int vme_master_rmw (struct vme_resource *resource, unsigned int mask,
	struct vme_master_resource *image;

	if (bridge->master_rmw == NULL) {
		printk("Writing to resource not supported\n");
		printk(KERN_WARNING "Writing to resource not supported\n");
		return -EINVAL;
	}

	if (resource->type != VME_MASTER) {
		printk("Not a master resource\n");
		printk(KERN_ERR "Not a master resource\n");
		return -EINVAL;
	}

@@ -615,14 +615,14 @@ void vme_master_free(struct vme_resource *resource)
	struct vme_master_resource *master_image;

	if (resource->type != VME_MASTER) {
		printk("Not a master resource\n");
		printk(KERN_ERR "Not a master resource\n");
		return;
	}

	master_image = list_entry(resource->entry, struct vme_master_resource,
		list);
	if (master_image == NULL) {
		printk("Can't find master resource\n");
		printk(KERN_ERR "Can't find master resource\n");
		return;
	}

@@ -666,7 +666,7 @@ struct vme_resource *vme_dma_request(struct device *dev)
			struct vme_dma_resource, list);

		if (dma_ctrlr == NULL) {
			printk("Registered NULL DMA resource\n");
			printk(KERN_ERR "Registered NULL DMA resource\n");
			continue;
		}

@@ -715,16 +715,15 @@ struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource)
	struct vme_dma_list *dma_list;

	if (resource->type != VME_DMA) {
		printk("Not a DMA resource\n");
		printk(KERN_ERR "Not a DMA resource\n");
		return NULL;
	}

	ctrlr = list_entry(resource->entry, struct vme_dma_resource, list);

	dma_list = (struct vme_dma_list *)kmalloc(
		sizeof(struct vme_dma_list), GFP_KERNEL);
	dma_list = kmalloc(sizeof(struct vme_dma_list), GFP_KERNEL);
	if (dma_list == NULL) {
		printk("Unable to allocate memory for new dma list\n");
		printk(KERN_ERR "Unable to allocate memory for new dma list\n");
		return NULL;
	}
	INIT_LIST_HEAD(&(dma_list->entries));
@@ -744,17 +743,17 @@ struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern,
	struct vme_dma_attr *attributes;
	struct vme_dma_pattern *pattern_attr;

	attributes = (struct vme_dma_attr *)kmalloc(
		sizeof(struct vme_dma_attr), GFP_KERNEL);
	attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
	if (attributes == NULL) {
		printk("Unable to allocate memory for attributes structure\n");
		printk(KERN_ERR "Unable to allocate memory for attributes "
			"structure\n");
		goto err_attr;
	}

	pattern_attr = (struct vme_dma_pattern *)kmalloc(
		sizeof(struct vme_dma_pattern), GFP_KERNEL);
	pattern_attr = kmalloc(sizeof(struct vme_dma_pattern), GFP_KERNEL);
	if (pattern_attr == NULL) {
		printk("Unable to allocate memory for pattern attributes\n");
		printk(KERN_ERR "Unable to allocate memory for pattern "
			"attributes\n");
		goto err_pat;
	}

@@ -784,17 +783,17 @@ struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address)

	/* XXX Run some sanity checks here */

	attributes = (struct vme_dma_attr *)kmalloc(
		sizeof(struct vme_dma_attr), GFP_KERNEL);
	attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
	if (attributes == NULL) {
		printk("Unable to allocate memory for attributes structure\n");
		printk(KERN_ERR "Unable to allocate memory for attributes "
			"structure\n");
		goto err_attr;
	}

	pci_attr = (struct vme_dma_pci *)kmalloc(sizeof(struct vme_dma_pci),
		GFP_KERNEL);
	pci_attr = kmalloc(sizeof(struct vme_dma_pci), GFP_KERNEL);
	if (pci_attr == NULL) {
		printk("Unable to allocate memory for pci attributes\n");
		printk(KERN_ERR "Unable to allocate memory for pci "
			"attributes\n");
		goto err_pci;
	}

@@ -826,17 +825,18 @@ struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address,

	/* XXX Run some sanity checks here */

	attributes = (struct vme_dma_attr *)kmalloc(
	attributes = kmalloc(
		sizeof(struct vme_dma_attr), GFP_KERNEL);
	if (attributes == NULL) {
		printk("Unable to allocate memory for attributes structure\n");
		printk(KERN_ERR "Unable to allocate memory for attributes "
			"structure\n");
		goto err_attr;
	}

	vme_attr = (struct vme_dma_vme *)kmalloc(sizeof(struct vme_dma_vme),
		GFP_KERNEL);
	vme_attr = kmalloc(sizeof(struct vme_dma_vme), GFP_KERNEL);
	if (vme_attr == NULL) {
		printk("Unable to allocate memory for vme attributes\n");
		printk(KERN_ERR "Unable to allocate memory for vme "
			"attributes\n");
		goto err_vme;
	}

@@ -875,12 +875,12 @@ int vme_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src,
	int retval;

	if (bridge->dma_list_add == NULL) {
		printk("Link List DMA generation not supported\n");
		printk(KERN_WARNING "Link List DMA generation not supported\n");
		return -EINVAL;
	}

	if (!mutex_trylock(&(list->mtx))) {
		printk("Link List already submitted\n");
		printk(KERN_ERR "Link List already submitted\n");
		return -EINVAL;
	}

@@ -898,7 +898,7 @@ int vme_dma_list_exec(struct vme_dma_list *list)
	int retval;

	if (bridge->dma_list_exec == NULL) {
		printk("Link List DMA execution not supported\n");
		printk(KERN_ERR "Link List DMA execution not supported\n");
		return -EINVAL;
	}

@@ -918,12 +918,12 @@ int vme_dma_list_free(struct vme_dma_list *list)
	int retval;

	if (bridge->dma_list_empty == NULL) {
		printk("Emptying of Link Lists not supported\n");
		printk(KERN_WARNING "Emptying of Link Lists not supported\n");
		return -EINVAL;
	}

	if (!mutex_trylock(&(list->mtx))) {
		printk("Link List in use\n");
		printk(KERN_ERR "Link List in use\n");
		return -EINVAL;
	}

@@ -933,7 +933,7 @@ int vme_dma_list_free(struct vme_dma_list *list)
	 */
	retval = bridge->dma_list_empty(list);
	if (retval) {
		printk("Unable to empty link-list entries\n");
		printk(KERN_ERR "Unable to empty link-list entries\n");
		mutex_unlock(&(list->mtx));
		return retval;
	}
@@ -949,19 +949,19 @@ int vme_dma_free(struct vme_resource *resource)
	struct vme_dma_resource *ctrlr;

	if (resource->type != VME_DMA) {
		printk("Not a DMA resource\n");
		printk(KERN_ERR "Not a DMA resource\n");
		return -EINVAL;
	}

	ctrlr = list_entry(resource->entry, struct vme_dma_resource, list);

	if (!mutex_trylock(&(ctrlr->mtx))) {
		printk("Resource busy, can't free\n");
		printk(KERN_ERR "Resource busy, can't free\n");
		return -EBUSY;
	}

	if (!(list_empty(&(ctrlr->pending)) && list_empty(&(ctrlr->running)))) {
		printk("Resource still processing transfers\n");
		printk(KERN_WARNING "Resource still processing transfers\n");
		mutex_unlock(&(ctrlr->mtx));
		return -EBUSY;
	}
@@ -1084,7 +1084,7 @@ int vme_irq_generate(struct device *dev, int level, int statid)
	}

	if (bridge->irq_generate == NULL) {
		printk("Interrupt generation not supported\n");
		printk(KERN_WARNING "Interrupt generation not supported\n");
		return -EINVAL;
	}

@@ -1297,7 +1297,7 @@ int vme_slot_get(struct device *bus)
	}

	if (bridge->slot_get == NULL) {
		printk("vme_slot_get not supported\n");
		printk(KERN_WARNING "vme_slot_get not supported\n");
		return -EINVAL;
	}

@@ -1419,9 +1419,9 @@ int vme_calc_slot(struct device *dev)
	/* Determine slot number */
	num = 0;
	while (num < VME_SLOTS_MAX) {
		if(&(bridge->dev[num]) == dev) {
		if (&(bridge->dev[num]) == dev)
			break;
		}

		num++;
	}
	if (num == VME_SLOTS_MAX) {
@@ -1438,7 +1438,7 @@ err_dev:
static struct vme_driver *dev_to_vme_driver(struct device *dev)
{
	if (dev->driver == NULL)
		printk("Bugger dev->driver is NULL\n");
		printk(KERN_ERR "Bugger dev->driver is NULL\n");

	return container_of(dev->driver, struct vme_driver, driver);
}
@@ -1493,9 +1493,8 @@ static int vme_bus_probe(struct device *dev)
	driver = dev_to_vme_driver(dev);
	bridge = dev_to_bridge(dev);

	if(driver->probe != NULL) {
	if (driver->probe != NULL)
		retval = driver->probe(dev, bridge->num, vme_calc_slot(dev));
	}

	return retval;
}
@@ -1509,9 +1508,8 @@ static int vme_bus_remove(struct device *dev)
	driver = dev_to_vme_driver(dev);
	bridge = dev_to_bridge(dev);

	if(driver->remove != NULL) {
	if (driver->remove != NULL)
		retval = driver->remove(dev, bridge->num, vme_calc_slot(dev));
	}

	return retval;
}
+12 −11
Original line number Diff line number Diff line
@@ -104,15 +104,16 @@ void vme_free_consistent(struct vme_resource *, size_t, void *,

size_t vme_get_size(struct vme_resource *);

struct vme_resource * vme_slave_request(struct device *, vme_address_t, vme_cycle_t);
struct vme_resource *vme_slave_request(struct device *, vme_address_t,
	vme_cycle_t);
int vme_slave_set(struct vme_resource *, int, unsigned long long,
	unsigned long long, dma_addr_t, vme_address_t, vme_cycle_t);
int vme_slave_get(struct vme_resource *, int *, unsigned long long *,
	unsigned long long *, dma_addr_t *, vme_address_t *, vme_cycle_t *);
void vme_slave_free(struct vme_resource *);

struct vme_resource * vme_master_request(struct device *, vme_address_t, vme_cycle_t,
	vme_width_t);
struct vme_resource *vme_master_request(struct device *, vme_address_t,
	vme_cycle_t, vme_width_t);
int vme_master_set(struct vme_resource *, int, unsigned long long,
	unsigned long long, vme_address_t, vme_cycle_t, vme_width_t);
int vme_master_get(struct vme_resource *, int *, unsigned long long *,
+4 −4

File changed.

Contains only whitespace changes.