[PATCH] staging: xillybus: fix some coding style errors
This includes: - keep "else" on the same line as the closing brace - don't use "else" after "return" - don't issue a message for an out-of-memory error - blank line after a declaration Signed-off-by: Vincent Bernat --- drivers/staging/xillybus/xillybus_core.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index ab6502caa72c..2d59734744e5 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -138,7 +138,6 @@ irqreturn_t xillybus_isr(int irq, void *data) * guaranteed no interrupt will occur, but in theory, the cache * lines may not be updated. So a memory barrier is issued. */ - smp_rmb(); buf = ep->msgbuf_addr; @@ -546,8 +545,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, channel->rd_buffers = buffers; rc = xilly_get_dma_buffers(ep, &rd_alloc, buffers, bufnum, bytebufsize); - } - else if (channelnum > 0) { + } else if (channelnum > 0) { channel->num_wr_buffers = bufnum; channel->seekable = seekable; @@ -610,8 +608,8 @@ static void xilly_scan_idt(struct xilly_endpoint *endpoint, "IDT device name list overflow. Aborting.\n"); idt_handle->chandesc = NULL; return; - } else - idt_handle->chandesc = scan; + } + idt_handle->chandesc = scan; len = endpoint->idtlen - (3 + ((int) (scan - idt))); @@ -722,6 +720,7 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, while (1) { /* Note that we may drop mutex within this loop */ int bytes_to_do = count - bytes_done; + spin_lock_irqsave(&channel->wr_spinlock, flags); empty = channel->wr_empty; @@ -1963,10 +1962,8 @@ struct xilly_endpoint *xillybus_init_endpoint(struct pci_dev *pdev, struct xilly_endpoint *endpoint; endpoint = devm_kzalloc(dev, sizeof(*endpoint), GFP_KERNEL); - if (!endpoint) { - dev_err(dev, "Failed to allocate memory. Aborting.\n"); + if (!endpoint) return NULL; - } endpoint->pdev = pdev; endpoint->dev = dev; -- 2.0.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: visorchipset: fix sparse warnings about static declaration
Some functions were prototyped as static but the actual definition wasn't. While this is valid (the function is static because the two declarations don't conflict and the first one is static), this makes sparse unhappy and cause confusion of normal people too. Signed-off-by: Vincent Bernat --- .../unisys/visorchipset/visorchipset_main.c| 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 58a441dd602e..65541dad014c 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -367,8 +367,9 @@ static void controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER * msgHdr, int response, ULTRA_SEGMENT_STATE state); -ssize_t toolaction_show(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t toolaction_show(struct device *dev, + struct device_attribute *attr, + char *buf) { U8 toolAction; @@ -378,8 +379,9 @@ ssize_t toolaction_show(struct device *dev, struct device_attribute *attr, return scnprintf(buf, PAGE_SIZE, "%u\n", toolAction); } -ssize_t toolaction_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t toolaction_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { U8 toolAction; @@ -395,8 +397,9 @@ ssize_t toolaction_store(struct device *dev, struct device_attribute *attr, return -EIO; } -ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t boottotool_show(struct device *dev, + struct device_attribute *attr, + char *buf) { ULTRA_EFI_SPAR_INDICATION efiSparIndication; @@ -408,8 +411,9 @@ ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, efiSparIndication.BootToTool); } -ssize_t boottotool_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t boottotool_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { int val; ULTRA_EFI_SPAR_INDICATION efiSparIndication; @@ -2003,7 +2007,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) return TRUE; } -HOSTADDRESS controlvm_get_channel_address(void) +static HOSTADDRESS controlvm_get_channel_address(void) { U64 addr = 0; U32 size = 0; -- 2.0.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: visorchipset: fix sparse warnings about static declaration
Some functions were prototyped as static but the actual definition wasn't. While this is valid (the function is static because the two declarations don't conflict and the first one is static), this makes sparse unhappy and cause confusion of normal people too. Signed-off-by: Vincent Bernat --- .../unisys/visorchipset/visorchipset_main.c| 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 156a72fdabd9..c40ff24a30b9 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -339,8 +339,9 @@ static void controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER * msgHdr, int response, ULTRA_SEGMENT_STATE state); -ssize_t toolaction_show(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t toolaction_show(struct device *dev, + struct device_attribute *attr, + char *buf) { u8 toolAction; @@ -350,8 +351,9 @@ ssize_t toolaction_show(struct device *dev, struct device_attribute *attr, return scnprintf(buf, PAGE_SIZE, "%u\n", toolAction); } -ssize_t toolaction_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t toolaction_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { u8 toolAction; int ret; @@ -369,8 +371,9 @@ ssize_t toolaction_store(struct device *dev, struct device_attribute *attr, return count; } -ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t boottotool_show(struct device *dev, + struct device_attribute *attr, + char *buf) { ULTRA_EFI_SPAR_INDICATION efiSparIndication; @@ -382,8 +385,9 @@ ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, efiSparIndication.BootToTool); } -ssize_t boottotool_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t boottotool_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { int val, ret; ULTRA_EFI_SPAR_INDICATION efiSparIndication; @@ -1932,7 +1936,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) return TRUE; } -HOSTADDRESS controlvm_get_channel_address(void) +static HOSTADDRESS controlvm_get_channel_address(void) { U64 addr = 0; U32 size = 0; -- 2.0.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: xillybus: fix some coding style errors
❦ 9 août 2014 20:34 -0700, Greg Kroah-Hartman : >> This includes: >> - keep "else" on the same line as the closing brace >> - don't use "else" after "return" > >> - don't issue a message for an out-of-memory error >> - blank line after a declaration >> >> Signed-off-by: Vincent Bernat >> --- >> drivers/staging/xillybus/xillybus_core.c | 13 + >> 1 file changed, 5 insertions(+), 8 deletions(-) > > This patch doesn't apply at all, as I think you made it against an old > kernel tree :( Hi Greg! You already applied this patch. It is almost one month old. Dunno why you received it a second time. -- Make sure special cases are truly special. - The Elements of Programming Style (Kernighan & Plauger) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel