[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1276337681-4327-1-git-send-email-henuxd@gmail.com>
Date: Sat, 12 Jun 2010 13:14:41 +0300
From: Henri Häkkinen <henuxd@...il.com>
To: gregkh@...e.de, mithlesh@...syssoft.com, wfp5p@...ginia.edu,
reodge@...il.com, andrea.gelmini@...ma.net, henuxd@...il.com
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging:comedi: Fixed coding convention issues.
Cleaned up and fixed coding convention issues as reporteed by
checkpatch.pl tool on the file `drivers.c'.
Signed-off-by: Henri Häkkinen <henuxd@...il.com>
---
drivers/staging/comedi/drivers.c | 85 +++++++++++++++++++------------------
1 files changed, 44 insertions(+), 41 deletions(-)
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 4a29ed7..55521d5 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -117,8 +117,8 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it)
for (driv = comedi_drivers; driv; driv = driv->next) {
if (!try_module_get(driv->module)) {
- printk
- (KERN_INFO "comedi: failed to increment module count, skipping\n");
+ printk(KERN_INFO "comedi: failed to increment module "
+ "count, skipping\n");
continue;
}
if (driv->num_names) {
@@ -205,9 +205,8 @@ int comedi_driver_unregister(struct comedi_driver *driver)
mutex_lock(&dev->mutex);
if (dev->attached && dev->driver == driver) {
if (dev->use_count)
- printk
- (KERN_WARNING "BUG! detaching device with use_count=%d\n",
- dev->use_count);
+ printk(KERN_WARNING "BUG! detaching device "
+ "with use_count=%d\n", dev->use_count);
comedi_device_detach(dev);
}
mutex_unlock(&dev->mutex);
@@ -441,21 +440,19 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
if (async->buf_page_list) {
unsigned i;
for (i = 0; i < async->n_buf_pages; ++i) {
- if (async->buf_page_list[i].virt_addr) {
- clear_bit(PG_reserved, &(virt_to_page(async->buf_page_list[i].virt_addr)->flags));
+ void *virt_addr = async->buf_page_list[i].virt_addr;
+ dma_addr_t dma_addr = async->buf_page_list[i].dma_addr;
+
+ if (virt_addr) {
+ struct page *page = virt_to_page(virt_addr);
+ clear_bit(PG_reserved, &page->flags);
if (s->async_dma_dir != DMA_NONE) {
dma_free_coherent(dev->hw_dev,
PAGE_SIZE,
- async->
- buf_page_list
- [i].virt_addr,
- async->
- buf_page_list
- [i].dma_addr);
+ virt_addr,
+ dma_addr);
} else {
- free_page((unsigned long)
- async->buf_page_list[i].
- virt_addr);
+ free_page((unsigned long) virt_addr);
}
}
}
@@ -478,26 +475,29 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
}
if (pages) {
for (i = 0; i < n_pages; i++) {
+ struct comedi_buf_page *buf_page =
+ &async->buf_page_list[i];
+ dma_addr_t dma_addr = buf_page->dma_addr;
+ struct page *page;
+
if (s->async_dma_dir != DMA_NONE) {
- async->buf_page_list[i].virt_addr =
+ buf_page->virt_addr =
dma_alloc_coherent(dev->hw_dev,
PAGE_SIZE,
- &async->
- buf_page_list
- [i].dma_addr,
+ &dma_addr,
GFP_KERNEL |
__GFP_COMP);
} else {
- async->buf_page_list[i].virt_addr =
+ buf_page->virt_addr =
(void *)
get_zeroed_page(GFP_KERNEL);
}
- if (async->buf_page_list[i].virt_addr == NULL)
+ if (buf_page->virt_addr == NULL)
break;
- set_bit(PG_reserved,
- &(virt_to_page(async->buf_page_list[i].virt_addr)->flags));
- pages[i] = virt_to_page(async->buf_page_list[i].virt_addr);
+ page = virt_to_page(buf_page->virt_addr);
+ set_bit(PG_reserved, &page->flags);
+ pages[i] = page;
}
}
if (i == n_pages) {
@@ -510,24 +510,27 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
/* Some allocation failed above. */
if (async->buf_page_list) {
for (i = 0; i < n_pages; i++) {
- if (async->buf_page_list[i].virt_addr ==
- NULL) {
+ struct comedi_buf_page *buf_page =
+ &async->buf_page_list[i];
+ void *virt_addr =
+ buf_page->virt_addr;
+ dma_addr_t dma_addr =
+ buf_page->dma_addr;
+ struct page *page =
+ virt_to_page(virt_addr);
+
+ if (virt_addr == NULL)
break;
- }
- clear_bit(PG_reserved, &(virt_to_page(async->buf_page_list[i].virt_addr)->flags));
+
+ clear_bit(PG_reserved, &page->flags);
if (s->async_dma_dir != DMA_NONE) {
dma_free_coherent(dev->hw_dev,
PAGE_SIZE,
- async->
- buf_page_list
- [i].virt_addr,
- async->
- buf_page_list
- [i].dma_addr);
+ virt_addr,
+ dma_addr);
} else {
free_page((unsigned long)
- async->buf_page_list
- [i].virt_addr);
+ virt_addr);
}
}
vfree(async->buf_page_list);
@@ -646,8 +649,8 @@ unsigned comedi_buf_write_free(struct comedi_async *async, unsigned int nbytes)
{
if ((int)(async->buf_write_count + nbytes -
async->buf_write_alloc_count) > 0) {
- printk
- (KERN_INFO "comedi: attempted to write-free more bytes than have been write-allocated.\n");
+ printk(KERN_INFO "comedi: attempted to write-free more bytes "
+ "than have been write-allocated.\n");
nbytes = async->buf_write_alloc_count - async->buf_write_count;
}
async->buf_write_count += nbytes;
@@ -683,8 +686,8 @@ unsigned comedi_buf_read_free(struct comedi_async *async, unsigned int nbytes)
smp_mb();
if ((int)(async->buf_read_count + nbytes -
async->buf_read_alloc_count) > 0) {
- printk(KERN_INFO
- "comedi: attempted to read-free more bytes than have been read-allocated.\n");
+ printk(KERN_INFO "comedi: attempted to read-free more bytes "
+ "than have been read-allocated.\n");
nbytes = async->buf_read_alloc_count - async->buf_read_count;
}
async->buf_read_count += nbytes;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists