Staging: vme: Fix checkpatch errors on VME core.

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

Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Martyn Welch
2009-12-15 08:43:02 +00:00
committed by Greg Kroah-Hartman
parent 12b2d5c089
commit ead1f3e301
3 changed files with 126 additions and 127 deletions

View File

@@ -93,19 +93,19 @@ void * vme_alloc_consistent(struct vme_resource *resource, size_t size,
struct pci_dev *pdev; struct pci_dev *pdev;
if (resource == NULL) { if (resource == NULL) {
printk("No resource\n"); printk(KERN_ERR "No resource\n");
return NULL; return NULL;
} }
bridge = find_bridge(resource); bridge = find_bridge(resource);
if (bridge == NULL) { if (bridge == NULL) {
printk("Can't find bridge\n"); printk(KERN_ERR "Can't find bridge\n");
return NULL; return NULL;
} }
/* Find pci_dev container of dev */ /* Find pci_dev container of dev */
if (bridge->parent == NULL) { if (bridge->parent == NULL) {
printk("Dev entry NULL\n"); printk(KERN_ERR "Dev entry NULL\n");
return NULL; return NULL;
} }
pdev = container_of(bridge->parent, struct pci_dev, dev); 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; struct pci_dev *pdev;
if (resource == NULL) { if (resource == NULL) {
printk("No resource\n"); printk(KERN_ERR "No resource\n");
return; return;
} }
bridge = find_bridge(resource); bridge = find_bridge(resource);
if (bridge == NULL) { if (bridge == NULL) {
printk("Can't find bridge\n"); printk(KERN_ERR "Can't find bridge\n");
return; return;
} }
@@ -216,7 +216,7 @@ static int vme_check_window(vme_address_t aspace, unsigned long long vme_base,
/* User Defined */ /* User Defined */
break; break;
default: default:
printk("Invalid address space\n"); printk(KERN_ERR "Invalid address space\n");
retval = -EINVAL; retval = -EINVAL;
break; break;
} }
@@ -249,7 +249,7 @@ struct vme_resource * vme_slave_request(struct device *dev,
struct vme_slave_resource, list); struct vme_slave_resource, list);
if (slave_image == NULL) { if (slave_image == NULL) {
printk("Registered NULL Slave resource\n"); printk(KERN_ERR "Registered NULL Slave resource\n");
continue; continue;
} }
@@ -301,20 +301,20 @@ int vme_slave_set (struct vme_resource *resource, int enabled,
int retval; int retval;
if (resource->type != VME_SLAVE) { if (resource->type != VME_SLAVE) {
printk("Not a slave resource\n"); printk(KERN_ERR "Not a slave resource\n");
return -EINVAL; return -EINVAL;
} }
image = list_entry(resource->entry, struct vme_slave_resource, list); image = list_entry(resource->entry, struct vme_slave_resource, list);
if (bridge->slave_set == NULL) { if (bridge->slave_set == NULL) {
printk("Function not supported\n"); printk(KERN_ERR "Function not supported\n");
return -ENOSYS; return -ENOSYS;
} }
if (!(((image->address_attr & aspace) == aspace) && if (!(((image->address_attr & aspace) == aspace) &&
((image->cycle_attr & cycle) == cycle))) { ((image->cycle_attr & cycle) == cycle))) {
printk("Invalid attributes\n"); printk(KERN_ERR "Invalid attributes\n");
return -EINVAL; return -EINVAL;
} }
@@ -335,14 +335,14 @@ int vme_slave_get (struct vme_resource *resource, int *enabled,
struct vme_slave_resource *image; struct vme_slave_resource *image;
if (resource->type != VME_SLAVE) { if (resource->type != VME_SLAVE) {
printk("Not a slave resource\n"); printk(KERN_ERR "Not a slave resource\n");
return -EINVAL; return -EINVAL;
} }
image = list_entry(resource->entry, struct vme_slave_resource, list); image = list_entry(resource->entry, struct vme_slave_resource, list);
if (bridge->slave_get == NULL) { if (bridge->slave_get == NULL) {
printk("vme_slave_get not supported\n"); printk(KERN_ERR "vme_slave_get not supported\n");
return -EINVAL; return -EINVAL;
} }
@@ -356,14 +356,14 @@ void vme_slave_free(struct vme_resource *resource)
struct vme_slave_resource *slave_image; struct vme_slave_resource *slave_image;
if (resource->type != VME_SLAVE) { if (resource->type != VME_SLAVE) {
printk("Not a slave resource\n"); printk(KERN_ERR "Not a slave resource\n");
return; return;
} }
slave_image = list_entry(resource->entry, struct vme_slave_resource, slave_image = list_entry(resource->entry, struct vme_slave_resource,
list); list);
if (slave_image == NULL) { if (slave_image == NULL) {
printk("Can't find slave resource\n"); printk(KERN_ERR "Can't find slave resource\n");
return; return;
} }
@@ -461,21 +461,21 @@ int vme_master_set (struct vme_resource *resource, int enabled,
int retval; int retval;
if (resource->type != VME_MASTER) { if (resource->type != VME_MASTER) {
printk("Not a master resource\n"); printk(KERN_ERR "Not a master resource\n");
return -EINVAL; return -EINVAL;
} }
image = list_entry(resource->entry, struct vme_master_resource, list); image = list_entry(resource->entry, struct vme_master_resource, list);
if (bridge->master_set == NULL) { if (bridge->master_set == NULL) {
printk("vme_master_set not supported\n"); printk(KERN_WARNING "vme_master_set not supported\n");
return -EINVAL; return -EINVAL;
} }
if (!(((image->address_attr & aspace) == aspace) && if (!(((image->address_attr & aspace) == aspace) &&
((image->cycle_attr & cycle) == cycle) && ((image->cycle_attr & cycle) == cycle) &&
((image->width_attr & dwidth) == dwidth))) { ((image->width_attr & dwidth) == dwidth))) {
printk("Invalid attributes\n"); printk(KERN_WARNING "Invalid attributes\n");
return -EINVAL; return -EINVAL;
} }
@@ -496,14 +496,14 @@ int vme_master_get (struct vme_resource *resource, int *enabled,
struct vme_master_resource *image; struct vme_master_resource *image;
if (resource->type != VME_MASTER) { if (resource->type != VME_MASTER) {
printk("Not a master resource\n"); printk(KERN_ERR "Not a master resource\n");
return -EINVAL; return -EINVAL;
} }
image = list_entry(resource->entry, struct vme_master_resource, list); image = list_entry(resource->entry, struct vme_master_resource, list);
if (bridge->master_get == NULL) { if (bridge->master_get == NULL) {
printk("vme_master_set not supported\n"); printk(KERN_WARNING "vme_master_set not supported\n");
return -EINVAL; return -EINVAL;
} }
@@ -523,12 +523,12 @@ ssize_t vme_master_read (struct vme_resource *resource, void *buf, size_t count,
size_t length; size_t length;
if (bridge->master_read == NULL) { if (bridge->master_read == NULL) {
printk("Reading from resource not supported\n"); printk(KERN_WARNING "Reading from resource not supported\n");
return -EINVAL; return -EINVAL;
} }
if (resource->type != VME_MASTER) { if (resource->type != VME_MASTER) {
printk("Not a master resource\n"); printk(KERN_ERR "Not a master resource\n");
return -EINVAL; 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); length = vme_get_size(resource);
if (offset > length) { if (offset > length) {
printk("Invalid Offset\n"); printk(KERN_WARNING "Invalid Offset\n");
return -EFAULT; return -EFAULT;
} }
@@ -560,12 +560,12 @@ ssize_t vme_master_write (struct vme_resource *resource, void *buf,
size_t length; size_t length;
if (bridge->master_write == NULL) { if (bridge->master_write == NULL) {
printk("Writing to resource not supported\n"); printk(KERN_WARNING "Writing to resource not supported\n");
return -EINVAL; return -EINVAL;
} }
if (resource->type != VME_MASTER) { if (resource->type != VME_MASTER) {
printk("Not a master resource\n"); printk(KERN_ERR "Not a master resource\n");
return -EINVAL; return -EINVAL;
} }
@@ -574,7 +574,7 @@ ssize_t vme_master_write (struct vme_resource *resource, void *buf,
length = vme_get_size(resource); length = vme_get_size(resource);
if (offset > length) { if (offset > length) {
printk("Invalid Offset\n"); printk(KERN_WARNING "Invalid Offset\n");
return -EFAULT; return -EFAULT;
} }
@@ -595,12 +595,12 @@ unsigned int vme_master_rmw (struct vme_resource *resource, unsigned int mask,
struct vme_master_resource *image; struct vme_master_resource *image;
if (bridge->master_rmw == NULL) { if (bridge->master_rmw == NULL) {
printk("Writing to resource not supported\n"); printk(KERN_WARNING "Writing to resource not supported\n");
return -EINVAL; return -EINVAL;
} }
if (resource->type != VME_MASTER) { if (resource->type != VME_MASTER) {
printk("Not a master resource\n"); printk(KERN_ERR "Not a master resource\n");
return -EINVAL; return -EINVAL;
} }
@@ -615,14 +615,14 @@ void vme_master_free(struct vme_resource *resource)
struct vme_master_resource *master_image; struct vme_master_resource *master_image;
if (resource->type != VME_MASTER) { if (resource->type != VME_MASTER) {
printk("Not a master resource\n"); printk(KERN_ERR "Not a master resource\n");
return; return;
} }
master_image = list_entry(resource->entry, struct vme_master_resource, master_image = list_entry(resource->entry, struct vme_master_resource,
list); list);
if (master_image == NULL) { if (master_image == NULL) {
printk("Can't find master resource\n"); printk(KERN_ERR "Can't find master resource\n");
return; return;
} }
@@ -666,7 +666,7 @@ struct vme_resource *vme_dma_request(struct device *dev)
struct vme_dma_resource, list); struct vme_dma_resource, list);
if (dma_ctrlr == NULL) { if (dma_ctrlr == NULL) {
printk("Registered NULL DMA resource\n"); printk(KERN_ERR "Registered NULL DMA resource\n");
continue; continue;
} }
@@ -715,16 +715,15 @@ struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource)
struct vme_dma_list *dma_list; struct vme_dma_list *dma_list;
if (resource->type != VME_DMA) { if (resource->type != VME_DMA) {
printk("Not a DMA resource\n"); printk(KERN_ERR "Not a DMA resource\n");
return NULL; return NULL;
} }
ctrlr = list_entry(resource->entry, struct vme_dma_resource, list); ctrlr = list_entry(resource->entry, struct vme_dma_resource, list);
dma_list = (struct vme_dma_list *)kmalloc( dma_list = kmalloc(sizeof(struct vme_dma_list), GFP_KERNEL);
sizeof(struct vme_dma_list), GFP_KERNEL);
if (dma_list == NULL) { 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; return NULL;
} }
INIT_LIST_HEAD(&(dma_list->entries)); 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_attr *attributes;
struct vme_dma_pattern *pattern_attr; struct vme_dma_pattern *pattern_attr;
attributes = (struct vme_dma_attr *)kmalloc( attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
sizeof(struct vme_dma_attr), GFP_KERNEL);
if (attributes == NULL) { 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; goto err_attr;
} }
pattern_attr = (struct vme_dma_pattern *)kmalloc( pattern_attr = kmalloc(sizeof(struct vme_dma_pattern), GFP_KERNEL);
sizeof(struct vme_dma_pattern), GFP_KERNEL);
if (pattern_attr == NULL) { 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; 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 */ /* XXX Run some sanity checks here */
attributes = (struct vme_dma_attr *)kmalloc( attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
sizeof(struct vme_dma_attr), GFP_KERNEL);
if (attributes == NULL) { 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; goto err_attr;
} }
pci_attr = (struct vme_dma_pci *)kmalloc(sizeof(struct vme_dma_pci), pci_attr = kmalloc(sizeof(struct vme_dma_pci), GFP_KERNEL);
GFP_KERNEL);
if (pci_attr == NULL) { 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; 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 */ /* XXX Run some sanity checks here */
attributes = (struct vme_dma_attr *)kmalloc( attributes = kmalloc(
sizeof(struct vme_dma_attr), GFP_KERNEL); sizeof(struct vme_dma_attr), GFP_KERNEL);
if (attributes == NULL) { 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; goto err_attr;
} }
vme_attr = (struct vme_dma_vme *)kmalloc(sizeof(struct vme_dma_vme), vme_attr = kmalloc(sizeof(struct vme_dma_vme), GFP_KERNEL);
GFP_KERNEL);
if (vme_attr == NULL) { 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; goto err_vme;
} }
@@ -875,12 +875,12 @@ int vme_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src,
int retval; int retval;
if (bridge->dma_list_add == NULL) { 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; return -EINVAL;
} }
if (!mutex_trylock(&(list->mtx))) { if (!mutex_trylock(&(list->mtx))) {
printk("Link List already submitted\n"); printk(KERN_ERR "Link List already submitted\n");
return -EINVAL; return -EINVAL;
} }
@@ -898,7 +898,7 @@ int vme_dma_list_exec(struct vme_dma_list *list)
int retval; int retval;
if (bridge->dma_list_exec == NULL) { 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; return -EINVAL;
} }
@@ -918,12 +918,12 @@ int vme_dma_list_free(struct vme_dma_list *list)
int retval; int retval;
if (bridge->dma_list_empty == NULL) { 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; return -EINVAL;
} }
if (!mutex_trylock(&(list->mtx))) { if (!mutex_trylock(&(list->mtx))) {
printk("Link List in use\n"); printk(KERN_ERR "Link List in use\n");
return -EINVAL; return -EINVAL;
} }
@@ -933,7 +933,7 @@ int vme_dma_list_free(struct vme_dma_list *list)
*/ */
retval = bridge->dma_list_empty(list); retval = bridge->dma_list_empty(list);
if (retval) { if (retval) {
printk("Unable to empty link-list entries\n"); printk(KERN_ERR "Unable to empty link-list entries\n");
mutex_unlock(&(list->mtx)); mutex_unlock(&(list->mtx));
return retval; return retval;
} }
@@ -949,19 +949,19 @@ int vme_dma_free(struct vme_resource *resource)
struct vme_dma_resource *ctrlr; struct vme_dma_resource *ctrlr;
if (resource->type != VME_DMA) { if (resource->type != VME_DMA) {
printk("Not a DMA resource\n"); printk(KERN_ERR "Not a DMA resource\n");
return -EINVAL; return -EINVAL;
} }
ctrlr = list_entry(resource->entry, struct vme_dma_resource, list); ctrlr = list_entry(resource->entry, struct vme_dma_resource, list);
if (!mutex_trylock(&(ctrlr->mtx))) { if (!mutex_trylock(&(ctrlr->mtx))) {
printk("Resource busy, can't free\n"); printk(KERN_ERR "Resource busy, can't free\n");
return -EBUSY; return -EBUSY;
} }
if (!(list_empty(&(ctrlr->pending)) && list_empty(&(ctrlr->running)))) { 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)); mutex_unlock(&(ctrlr->mtx));
return -EBUSY; return -EBUSY;
} }
@@ -1084,7 +1084,7 @@ int vme_irq_generate(struct device *dev, int level, int statid)
} }
if (bridge->irq_generate == NULL) { if (bridge->irq_generate == NULL) {
printk("Interrupt generation not supported\n"); printk(KERN_WARNING "Interrupt generation not supported\n");
return -EINVAL; return -EINVAL;
} }
@@ -1297,7 +1297,7 @@ int vme_slot_get(struct device *bus)
} }
if (bridge->slot_get == NULL) { if (bridge->slot_get == NULL) {
printk("vme_slot_get not supported\n"); printk(KERN_WARNING "vme_slot_get not supported\n");
return -EINVAL; return -EINVAL;
} }
@@ -1419,9 +1419,9 @@ int vme_calc_slot(struct device *dev)
/* Determine slot number */ /* Determine slot number */
num = 0; num = 0;
while (num < VME_SLOTS_MAX) { while (num < VME_SLOTS_MAX) {
if(&(bridge->dev[num]) == dev) { if (&(bridge->dev[num]) == dev)
break; break;
}
num++; num++;
} }
if (num == VME_SLOTS_MAX) { if (num == VME_SLOTS_MAX) {
@@ -1438,7 +1438,7 @@ err_dev:
static struct vme_driver *dev_to_vme_driver(struct device *dev) static struct vme_driver *dev_to_vme_driver(struct device *dev)
{ {
if (dev->driver == NULL) 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); 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); driver = dev_to_vme_driver(dev);
bridge = dev_to_bridge(dev); bridge = dev_to_bridge(dev);
if(driver->probe != NULL) { if (driver->probe != NULL)
retval = driver->probe(dev, bridge->num, vme_calc_slot(dev)); retval = driver->probe(dev, bridge->num, vme_calc_slot(dev));
}
return retval; return retval;
} }
@@ -1509,9 +1508,8 @@ static int vme_bus_remove(struct device *dev)
driver = dev_to_vme_driver(dev); driver = dev_to_vme_driver(dev);
bridge = dev_to_bridge(dev); bridge = dev_to_bridge(dev);
if(driver->remove != NULL) { if (driver->remove != NULL)
retval = driver->remove(dev, bridge->num, vme_calc_slot(dev)); retval = driver->remove(dev, bridge->num, vme_calc_slot(dev));
}
return retval; return retval;
} }

View File

@@ -104,15 +104,16 @@ void vme_free_consistent(struct vme_resource *, size_t, void *,
size_t vme_get_size(struct vme_resource *); 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, int vme_slave_set(struct vme_resource *, int, unsigned long long,
unsigned long long, dma_addr_t, vme_address_t, vme_cycle_t); unsigned long long, dma_addr_t, vme_address_t, vme_cycle_t);
int vme_slave_get(struct vme_resource *, int *, unsigned long long *, int vme_slave_get(struct vme_resource *, int *, unsigned long long *,
unsigned long long *, dma_addr_t *, vme_address_t *, vme_cycle_t *); unsigned long long *, dma_addr_t *, vme_address_t *, vme_cycle_t *);
void vme_slave_free(struct vme_resource *); void vme_slave_free(struct vme_resource *);
struct vme_resource * vme_master_request(struct device *, vme_address_t, vme_cycle_t, struct vme_resource *vme_master_request(struct device *, vme_address_t,
vme_width_t); vme_cycle_t, vme_width_t);
int vme_master_set(struct vme_resource *, int, unsigned long long, int vme_master_set(struct vme_resource *, int, unsigned long long,
unsigned long long, vme_address_t, vme_cycle_t, vme_width_t); unsigned long long, vme_address_t, vme_cycle_t, vme_width_t);
int vme_master_get(struct vme_resource *, int *, unsigned long long *, int vme_master_get(struct vme_resource *, int *, unsigned long long *,