From 7ee9ded220199f3be0b5d587ff9e2a1fdf7b6e2c Mon Sep 17 00:00:00 2001 From: Eli Billauer Date: Wed, 31 Jul 2013 11:22:43 +0300 Subject: [PATCH] staging: xillybus: Fixed sparse errors Changes: * xillybus.h: __iomem added to struct xilly_endpoint -> registers to suppress "different address spaces" errors. * xillybus_core.c: __user added as required for the same reason. * The two member names of struct xilly_endpoint_hardware of the form sync_single_for_{cpu,device} were changed to something that won't look like the well-known functions. * All *.c files: Variables and functions made static as required. Reported-by: Greg Kroah-Hartman Signed-off-by: Eli Billauer Signed-off-by: Greg Kroah-Hartman --- drivers/staging/xillybus/xillybus.h | 6 ++--- drivers/staging/xillybus/xillybus_core.c | 28 ++++++++++++------------ drivers/staging/xillybus/xillybus_of.c | 6 ++--- drivers/staging/xillybus/xillybus_pcie.c | 6 ++--- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/staging/xillybus/xillybus.h b/drivers/staging/xillybus/xillybus.h index b62faeb31c53..d3fc8aa896de 100644 --- a/drivers/staging/xillybus/xillybus.h +++ b/drivers/staging/xillybus/xillybus.h @@ -122,7 +122,7 @@ struct xilly_endpoint { struct list_head ep_list; int dma_using_dac; /* =1 if 64-bit DMA is used, =0 otherwise. */ - u32 *registers; + __iomem u32 *registers; int fatal_error; struct mutex register_mutex; @@ -150,11 +150,11 @@ struct xilly_endpoint { struct xilly_endpoint_hardware { struct module *owner; - void (*sync_single_for_cpu)(struct xilly_endpoint *, + void (*hw_sync_sgl_for_cpu)(struct xilly_endpoint *, dma_addr_t, size_t, int); - void (*sync_single_for_device)(struct xilly_endpoint *, + void (*hw_sync_sgl_for_device)(struct xilly_endpoint *, dma_addr_t, size_t, int); diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 9ccd6aa7e8c5..3d7471a72077 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -71,7 +71,7 @@ static struct class *xillybus_class; static LIST_HEAD(list_of_endpoints); static struct mutex ep_list_lock; -struct workqueue_struct *xillybus_wq; +static struct workqueue_struct *xillybus_wq; /* * Locking scheme: Mutexes protect invocations of character device methods. @@ -145,7 +145,7 @@ irqreturn_t xillybus_isr(int irq, void *data) buf_size = ep->msg_buf_size/sizeof(u32); - ep->ephw->sync_single_for_cpu(ep, + ep->ephw->hw_sync_sgl_for_cpu(ep, ep->msgbuf_dma_addr, ep->msg_buf_size, DMA_FROM_DEVICE); @@ -163,7 +163,7 @@ irqreturn_t xillybus_isr(int irq, void *data) pr_err("xillybus: Lost sync with " "interrupt messages. Stopping.\n"); else { - ep->ephw->sync_single_for_device( + ep->ephw->hw_sync_sgl_for_device( ep, ep->msgbuf_dma_addr, ep->msg_buf_size, @@ -297,7 +297,7 @@ irqreturn_t xillybus_isr(int irq, void *data) } } - ep->ephw->sync_single_for_device(ep, + ep->ephw->hw_sync_sgl_for_device(ep, ep->msgbuf_dma_addr, ep->msg_buf_size, DMA_FROM_DEVICE); @@ -796,7 +796,7 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) return rc; } - endpoint->ephw->sync_single_for_cpu( + endpoint->ephw->hw_sync_sgl_for_cpu( channel->endpoint, channel->wr_buffers[0]->dma_addr, channel->wr_buf_size, @@ -832,8 +832,8 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) return 0; /* Success */ } -static ssize_t xillybus_read(struct file *filp, char *userbuf, size_t count, - loff_t *f_pos) +static ssize_t xillybus_read(struct file *filp, char __user *userbuf, + size_t count, loff_t *f_pos) { ssize_t rc; unsigned long flags; @@ -917,7 +917,7 @@ static ssize_t xillybus_read(struct file *filp, char *userbuf, size_t count, if (!empty) { /* Go on, now without the spinlock */ if (bufpos == 0) /* Position zero means it's virgin */ - channel->endpoint->ephw->sync_single_for_cpu( + channel->endpoint->ephw->hw_sync_sgl_for_cpu( channel->endpoint, channel->wr_buffers[bufidx]->dma_addr, channel->wr_buf_size, @@ -934,7 +934,7 @@ static ssize_t xillybus_read(struct file *filp, char *userbuf, size_t count, if (bufferdone) { channel->endpoint->ephw-> - sync_single_for_device + hw_sync_sgl_for_device ( channel->endpoint, channel->wr_buffers[bufidx]-> @@ -1243,7 +1243,7 @@ static int xillybus_myflush(struct xilly_channel *channel, long timeout) else channel->rd_host_buf_idx++; - channel->endpoint->ephw->sync_single_for_device( + channel->endpoint->ephw->hw_sync_sgl_for_device( channel->endpoint, channel->rd_buffers[bufidx]->dma_addr, channel->rd_buf_size, @@ -1362,7 +1362,7 @@ static void xillybus_autoflush(struct work_struct *work) } -static ssize_t xillybus_write(struct file *filp, const char *userbuf, +static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, size_t count, loff_t *f_pos) { ssize_t rc; @@ -1471,7 +1471,7 @@ static ssize_t xillybus_write(struct file *filp, const char *userbuf, if ((bufpos == 0) || /* Zero means it's virgin */ (channel->rd_leftovers[3] != 0)) { - channel->endpoint->ephw->sync_single_for_cpu( + channel->endpoint->ephw->hw_sync_sgl_for_cpu( channel->endpoint, channel->rd_buffers[bufidx]->dma_addr, channel->rd_buf_size, @@ -1494,7 +1494,7 @@ static ssize_t xillybus_write(struct file *filp, const char *userbuf, if (bufferdone) { channel->endpoint->ephw-> - sync_single_for_device( + hw_sync_sgl_for_device( channel->endpoint, channel->rd_buffers[bufidx]-> dma_addr, @@ -1867,7 +1867,7 @@ static int xillybus_release(struct inode *inode, struct file *filp) return 0; } -loff_t xillybus_llseek(struct file *filp, loff_t offset, int whence) +static loff_t xillybus_llseek(struct file *filp, loff_t offset, int whence) { struct xilly_channel *channel = filp->private_data; loff_t pos = filp->f_pos; diff --git a/drivers/staging/xillybus/xillybus_of.c b/drivers/staging/xillybus/xillybus_of.c index 122d9ba1b28b..92c2931f4348 100644 --- a/drivers/staging/xillybus/xillybus_of.c +++ b/drivers/staging/xillybus/xillybus_of.c @@ -85,7 +85,7 @@ static dma_addr_t xilly_map_single_of(struct xilly_cleanup *mem, return addr; } -void xilly_unmap_single_of(struct xilly_dma *entry) +static void xilly_unmap_single_of(struct xilly_dma *entry) { dma_unmap_single(entry->dev, entry->dma_addr, @@ -95,8 +95,8 @@ void xilly_unmap_single_of(struct xilly_dma *entry) static struct xilly_endpoint_hardware of_hw = { .owner = THIS_MODULE, - .sync_single_for_cpu = xilly_dma_sync_single_for_cpu_of, - .sync_single_for_device = xilly_dma_sync_single_for_device_of, + .hw_sync_sgl_for_cpu = xilly_dma_sync_single_for_cpu_of, + .hw_sync_sgl_for_device = xilly_dma_sync_single_for_device_of, .map_single = xilly_map_single_of, .unmap_single = xilly_unmap_single_of }; diff --git a/drivers/staging/xillybus/xillybus_pcie.c b/drivers/staging/xillybus/xillybus_pcie.c index ad45bdb2a715..67013652358b 100644 --- a/drivers/staging/xillybus/xillybus_pcie.c +++ b/drivers/staging/xillybus/xillybus_pcie.c @@ -112,7 +112,7 @@ static dma_addr_t xilly_map_single_pci(struct xilly_cleanup *mem, return addr; } -void xilly_unmap_single_pci(struct xilly_dma *entry) +static void xilly_unmap_single_pci(struct xilly_dma *entry) { pci_unmap_single(entry->pdev, entry->dma_addr, @@ -122,8 +122,8 @@ void xilly_unmap_single_pci(struct xilly_dma *entry) static struct xilly_endpoint_hardware pci_hw = { .owner = THIS_MODULE, - .sync_single_for_cpu = xilly_dma_sync_single_for_cpu_pci, - .sync_single_for_device = xilly_dma_sync_single_for_device_pci, + .hw_sync_sgl_for_cpu = xilly_dma_sync_single_for_cpu_pci, + .hw_sync_sgl_for_device = xilly_dma_sync_single_for_device_pci, .map_single = xilly_map_single_pci, .unmap_single = xilly_unmap_single_pci }; -- 2.20.1