Commit 63c867d7 authored by Vandana BN's avatar Vandana BN Committed by Greg Kroah-Hartman

Staging: kpc2000: kpc_dma: Resolve warning Missing blank line after...

Staging: kpc2000: kpc_dma: Resolve warning Missing blank line after declarations & labels not to be indented.

This patch resloves below warnings reported by checkpath in kpc_dma
WARNING: Missing a blank line after declarations
WARNING: labels should not be indented
CHECK: Please don't use multiple blank lines
CHECK: Please use a blank line after function/struct/union/enum
declarations
Signed-off-by: default avatarVandana BN <bnvandana@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3544d3f7
...@@ -27,6 +27,7 @@ void ndd_irq_worker(struct work_struct *ws) ...@@ -27,6 +27,7 @@ void ndd_irq_worker(struct work_struct *ws)
{ {
struct kpc_dma_descriptor *cur; struct kpc_dma_descriptor *cur;
struct kpc_dma_device *eng = container_of(ws, struct kpc_dma_device, irq_work); struct kpc_dma_device *eng = container_of(ws, struct kpc_dma_device, irq_work);
lock_engine(eng); lock_engine(eng);
if (GetEngineCompletePtr(eng) == 0) if (GetEngineCompletePtr(eng) == 0)
...@@ -67,7 +68,6 @@ void ndd_irq_worker(struct work_struct *ws) ...@@ -67,7 +68,6 @@ void ndd_irq_worker(struct work_struct *ws)
unlock_engine(eng); unlock_engine(eng);
} }
/********** DMA Engine Init/Teardown **********/ /********** DMA Engine Init/Teardown **********/
void start_dma_engine(struct kpc_dma_device *eng) void start_dma_engine(struct kpc_dma_device *eng)
{ {
...@@ -91,6 +91,7 @@ int setup_dma_engine(struct kpc_dma_device *eng, u32 desc_cnt) ...@@ -91,6 +91,7 @@ int setup_dma_engine(struct kpc_dma_device *eng, u32 desc_cnt)
dma_addr_t head_handle; dma_addr_t head_handle;
unsigned int i; unsigned int i;
int rv; int rv;
dev_dbg(&eng->pldev->dev, "Setting up DMA engine [%p]\n", eng); dev_dbg(&eng->pldev->dev, "Setting up DMA engine [%p]\n", eng);
caps = GetEngineCapabilities(eng); caps = GetEngineCapabilities(eng);
...@@ -159,6 +160,7 @@ int setup_dma_engine(struct kpc_dma_device *eng, u32 desc_cnt) ...@@ -159,6 +160,7 @@ int setup_dma_engine(struct kpc_dma_device *eng, u32 desc_cnt)
void stop_dma_engine(struct kpc_dma_device *eng) void stop_dma_engine(struct kpc_dma_device *eng)
{ {
unsigned long timeout; unsigned long timeout;
dev_dbg(&eng->pldev->dev, "Destroying DMA engine [%p]\n", eng); dev_dbg(&eng->pldev->dev, "Destroying DMA engine [%p]\n", eng);
// Disable the descriptor engine // Disable the descriptor engine
...@@ -220,6 +222,7 @@ void destroy_dma_engine(struct kpc_dma_device *eng) ...@@ -220,6 +222,7 @@ void destroy_dma_engine(struct kpc_dma_device *eng)
for (i = 0 ; i < eng->desc_pool_cnt ; i++) { for (i = 0 ; i < eng->desc_pool_cnt ; i++) {
struct kpc_dma_descriptor *next = cur->Next; struct kpc_dma_descriptor *next = cur->Next;
dma_addr_t next_handle = cur->DescNextDescPtr; dma_addr_t next_handle = cur->DescNextDescPtr;
dma_pool_free(eng->desc_pool, cur, cur_handle); dma_pool_free(eng->desc_pool, cur, cur_handle);
cur_handle = next_handle; cur_handle = next_handle;
cur = next; cur = next;
...@@ -230,13 +233,12 @@ void destroy_dma_engine(struct kpc_dma_device *eng) ...@@ -230,13 +233,12 @@ void destroy_dma_engine(struct kpc_dma_device *eng)
free_irq(eng->irq, eng); free_irq(eng->irq, eng);
} }
/********** Helper Functions **********/ /********** Helper Functions **********/
int count_descriptors_available(struct kpc_dma_device *eng) int count_descriptors_available(struct kpc_dma_device *eng)
{ {
u32 count = 0; u32 count = 0;
struct kpc_dma_descriptor *cur = eng->desc_next; struct kpc_dma_descriptor *cur = eng->desc_next;
while (cur != eng->desc_completed) { while (cur != eng->desc_completed) {
BUG_ON(cur == NULL); BUG_ON(cur == NULL);
count++; count++;
......
...@@ -21,6 +21,7 @@ unsigned int count_pages(unsigned long iov_base, size_t iov_len) ...@@ -21,6 +21,7 @@ unsigned int count_pages(unsigned long iov_base, size_t iov_len)
{ {
unsigned long first = (iov_base & PAGE_MASK) >> PAGE_SHIFT; unsigned long first = (iov_base & PAGE_MASK) >> PAGE_SHIFT;
unsigned long last = ((iov_base+iov_len-1) & PAGE_MASK) >> PAGE_SHIFT; unsigned long last = ((iov_base+iov_len-1) & PAGE_MASK) >> PAGE_SHIFT;
return last - first + 1; return last - first + 1;
} }
...@@ -28,6 +29,7 @@ static inline ...@@ -28,6 +29,7 @@ static inline
unsigned int count_parts_for_sge(struct scatterlist *sg) unsigned int count_parts_for_sge(struct scatterlist *sg)
{ {
unsigned int sg_length = sg_dma_len(sg); unsigned int sg_length = sg_dma_len(sg);
sg_length += (0x80000-1); sg_length += (0x80000-1);
return (sg_length / 0x80000); return (sg_length / 0x80000);
} }
...@@ -262,6 +264,7 @@ int kpc_dma_open(struct inode *inode, struct file *filp) ...@@ -262,6 +264,7 @@ int kpc_dma_open(struct inode *inode, struct file *filp)
{ {
struct dev_private_data *priv; struct dev_private_data *priv;
struct kpc_dma_device *ldev = kpc_dma_lookup_device(iminor(inode)); struct kpc_dma_device *ldev = kpc_dma_lookup_device(iminor(inode));
if (ldev == NULL) if (ldev == NULL)
return -ENODEV; return -ENODEV;
...@@ -287,6 +290,7 @@ int kpc_dma_close(struct inode *inode, struct file *filp) ...@@ -287,6 +290,7 @@ int kpc_dma_close(struct inode *inode, struct file *filp)
struct kpc_dma_descriptor *cur; struct kpc_dma_descriptor *cur;
struct dev_private_data *priv = (struct dev_private_data *)filp->private_data; struct dev_private_data *priv = (struct dev_private_data *)filp->private_data;
struct kpc_dma_device *eng = priv->ldev; struct kpc_dma_device *eng = priv->ldev;
dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_close(inode = [%p], filp = [%p]) priv = [%p], ldev = [%p]\n", inode, filp, priv, priv->ldev); dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_close(inode = [%p], filp = [%p]) priv = [%p], ldev = [%p]\n", inode, filp, priv, priv->ldev);
lock_engine(eng); lock_engine(eng);
...@@ -321,6 +325,7 @@ static ...@@ -321,6 +325,7 @@ static
int kpc_dma_aio_cancel(struct kiocb *kcb) int kpc_dma_aio_cancel(struct kiocb *kcb)
{ {
struct dev_private_data *priv = (struct dev_private_data *)kcb->ki_filp->private_data; struct dev_private_data *priv = (struct dev_private_data *)kcb->ki_filp->private_data;
dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_aio_cancel(kcb = [%p]) priv = [%p], ldev = [%p]\n", kcb, priv, priv->ldev); dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_aio_cancel(kcb = [%p]) priv = [%p], ldev = [%p]\n", kcb, priv, priv->ldev);
return 0; return 0;
} }
...@@ -329,6 +334,7 @@ static ...@@ -329,6 +334,7 @@ static
ssize_t kpc_dma_aio_read(struct kiocb *kcb, const struct iovec *iov, unsigned long iov_count, loff_t pos) ssize_t kpc_dma_aio_read(struct kiocb *kcb, const struct iovec *iov, unsigned long iov_count, loff_t pos)
{ {
struct dev_private_data *priv = (struct dev_private_data *)kcb->ki_filp->private_data; struct dev_private_data *priv = (struct dev_private_data *)kcb->ki_filp->private_data;
dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_aio_read(kcb = [%p], iov = [%p], iov_count = %ld, pos = %lld) priv = [%p], ldev = [%p]\n", kcb, iov, iov_count, pos, priv, priv->ldev); dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_aio_read(kcb = [%p], iov = [%p], iov_count = %ld, pos = %lld) priv = [%p], ldev = [%p]\n", kcb, iov, iov_count, pos, priv, priv->ldev);
if (priv->ldev->dir != DMA_FROM_DEVICE) if (priv->ldev->dir != DMA_FROM_DEVICE)
...@@ -348,6 +354,7 @@ static ...@@ -348,6 +354,7 @@ static
ssize_t kpc_dma_aio_write(struct kiocb *kcb, const struct iovec *iov, unsigned long iov_count, loff_t pos) ssize_t kpc_dma_aio_write(struct kiocb *kcb, const struct iovec *iov, unsigned long iov_count, loff_t pos)
{ {
struct dev_private_data *priv = (struct dev_private_data *)kcb->ki_filp->private_data; struct dev_private_data *priv = (struct dev_private_data *)kcb->ki_filp->private_data;
dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_aio_write(kcb = [%p], iov = [%p], iov_count = %ld, pos = %lld) priv = [%p], ldev = [%p]\n", kcb, iov, iov_count, pos, priv, priv->ldev); dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_aio_write(kcb = [%p], iov = [%p], iov_count = %ld, pos = %lld) priv = [%p], ldev = [%p]\n", kcb, iov, iov_count, pos, priv, priv->ldev);
if (priv->ldev->dir != DMA_TO_DEVICE) if (priv->ldev->dir != DMA_TO_DEVICE)
...@@ -368,6 +375,7 @@ static ...@@ -368,6 +375,7 @@ static
ssize_t kpc_dma_read(struct file *filp, char __user *user_buf, size_t count, loff_t *ppos) ssize_t kpc_dma_read(struct file *filp, char __user *user_buf, size_t count, loff_t *ppos)
{ {
struct dev_private_data *priv = (struct dev_private_data *)filp->private_data; struct dev_private_data *priv = (struct dev_private_data *)filp->private_data;
dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_read(filp = [%p], user_buf = [%p], count = %zu, ppos = [%p]) priv = [%p], ldev = [%p]\n", filp, user_buf, count, ppos, priv, priv->ldev); dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_read(filp = [%p], user_buf = [%p], count = %zu, ppos = [%p]) priv = [%p], ldev = [%p]\n", filp, user_buf, count, ppos, priv, priv->ldev);
if (priv->ldev->dir != DMA_FROM_DEVICE) if (priv->ldev->dir != DMA_FROM_DEVICE)
...@@ -380,6 +388,7 @@ static ...@@ -380,6 +388,7 @@ static
ssize_t kpc_dma_write(struct file *filp, const char __user *user_buf, size_t count, loff_t *ppos) ssize_t kpc_dma_write(struct file *filp, const char __user *user_buf, size_t count, loff_t *ppos)
{ {
struct dev_private_data *priv = (struct dev_private_data *)filp->private_data; struct dev_private_data *priv = (struct dev_private_data *)filp->private_data;
dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_write(filp = [%p], user_buf = [%p], count = %zu, ppos = [%p]) priv = [%p], ldev = [%p]\n", filp, user_buf, count, ppos, priv, priv->ldev); dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_write(filp = [%p], user_buf = [%p], count = %zu, ppos = [%p]) priv = [%p], ldev = [%p]\n", filp, user_buf, count, ppos, priv, priv->ldev);
if (priv->ldev->dir != DMA_TO_DEVICE) if (priv->ldev->dir != DMA_TO_DEVICE)
...@@ -392,6 +401,7 @@ static ...@@ -392,6 +401,7 @@ static
long kpc_dma_ioctl(struct file *filp, unsigned int ioctl_num, unsigned long ioctl_param) long kpc_dma_ioctl(struct file *filp, unsigned int ioctl_num, unsigned long ioctl_param)
{ {
struct dev_private_data *priv = (struct dev_private_data *)filp->private_data; struct dev_private_data *priv = (struct dev_private_data *)filp->private_data;
dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_ioctl(filp = [%p], ioctl_num = 0x%x, ioctl_param = 0x%lx) priv = [%p], ldev = [%p]\n", filp, ioctl_num, ioctl_param, priv, priv->ldev); dev_dbg(&priv->ldev->pldev->dev, "kpc_dma_ioctl(filp = [%p], ioctl_num = 0x%x, ioctl_param = 0x%lx) priv = [%p], ldev = [%p]\n", filp, ioctl_num, ioctl_param, priv, priv->ldev);
switch (ioctl_num) { switch (ioctl_num) {
...@@ -408,7 +418,6 @@ long kpc_dma_ioctl(struct file *filp, unsigned int ioctl_num, unsigned long ioc ...@@ -408,7 +418,6 @@ long kpc_dma_ioctl(struct file *filp, unsigned int ioctl_num, unsigned long ioc
return -ENOTTY; return -ENOTTY;
} }
struct file_operations kpc_dma_fops = { struct file_operations kpc_dma_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = kpc_dma_open, .open = kpc_dma_open,
......
...@@ -19,11 +19,11 @@ static DEFINE_MUTEX(kpc_dma_mtx); ...@@ -19,11 +19,11 @@ static DEFINE_MUTEX(kpc_dma_mtx);
static int assigned_major_num; static int assigned_major_num;
static LIST_HEAD(kpc_dma_list); static LIST_HEAD(kpc_dma_list);
/********** kpc_dma_list list management **********/ /********** kpc_dma_list list management **********/
struct kpc_dma_device *kpc_dma_lookup_device(int minor) struct kpc_dma_device *kpc_dma_lookup_device(int minor)
{ {
struct kpc_dma_device *c; struct kpc_dma_device *c;
mutex_lock(&kpc_dma_mtx); mutex_lock(&kpc_dma_mtx);
list_for_each_entry(c, &kpc_dma_list, list) { list_for_each_entry(c, &kpc_dma_list, list) {
if (c->pldev->id == minor) { if (c->pldev->id == minor) {
...@@ -31,7 +31,7 @@ struct kpc_dma_device *kpc_dma_lookup_device(int minor) ...@@ -31,7 +31,7 @@ struct kpc_dma_device *kpc_dma_lookup_device(int minor)
} }
} }
c = NULL; // not-found case c = NULL; // not-found case
out: out:
mutex_unlock(&kpc_dma_mtx); mutex_unlock(&kpc_dma_mtx);
return c; return c;
} }
...@@ -55,6 +55,7 @@ static ssize_t show_engine_regs(struct device *dev, struct device_attribute *at ...@@ -55,6 +55,7 @@ static ssize_t show_engine_regs(struct device *dev, struct device_attribute *at
{ {
struct kpc_dma_device *ldev; struct kpc_dma_device *ldev;
struct platform_device *pldev = to_platform_device(dev); struct platform_device *pldev = to_platform_device(dev);
if (!pldev) if (!pldev)
return 0; return 0;
ldev = platform_get_drvdata(pldev); ldev = platform_get_drvdata(pldev);
...@@ -89,7 +90,6 @@ static const struct attribute *ndd_attr_list[] = { ...@@ -89,7 +90,6 @@ static const struct attribute *ndd_attr_list[] = {
struct class *kpc_dma_class; struct class *kpc_dma_class;
/********** Platform Driver Functions **********/ /********** Platform Driver Functions **********/
static static
int kpc_dma_probe(struct platform_device *pldev) int kpc_dma_probe(struct platform_device *pldev)
...@@ -99,6 +99,7 @@ int kpc_dma_probe(struct platform_device *pldev) ...@@ -99,6 +99,7 @@ int kpc_dma_probe(struct platform_device *pldev)
dev_t dev; dev_t dev;
struct kpc_dma_device *ldev = kzalloc(sizeof(struct kpc_dma_device), GFP_KERNEL); struct kpc_dma_device *ldev = kzalloc(sizeof(struct kpc_dma_device), GFP_KERNEL);
if (!ldev) { if (!ldev) {
dev_err(&pldev->dev, "kpc_dma_probe: unable to kzalloc space for kpc_dma_device\n"); dev_err(&pldev->dev, "kpc_dma_probe: unable to kzalloc space for kpc_dma_device\n");
rv = -ENOMEM; rv = -ENOMEM;
...@@ -178,6 +179,7 @@ static ...@@ -178,6 +179,7 @@ static
int kpc_dma_remove(struct platform_device *pldev) int kpc_dma_remove(struct platform_device *pldev)
{ {
struct kpc_dma_device *ldev = platform_get_drvdata(pldev); struct kpc_dma_device *ldev = platform_get_drvdata(pldev);
if (!ldev) if (!ldev)
return -ENXIO; return -ENXIO;
...@@ -193,7 +195,6 @@ int kpc_dma_remove(struct platform_device *pldev) ...@@ -193,7 +195,6 @@ int kpc_dma_remove(struct platform_device *pldev)
return 0; return 0;
} }
/********** Driver Functions **********/ /********** Driver Functions **********/
struct platform_driver kpc_dma_plat_driver_i = { struct platform_driver kpc_dma_plat_driver_i = {
.probe = kpc_dma_probe, .probe = kpc_dma_probe,
...@@ -231,11 +232,11 @@ int __init kpc_dma_driver_init(void) ...@@ -231,11 +232,11 @@ int __init kpc_dma_driver_init(void)
return err; return err;
fail_platdriver_register: fail_platdriver_register:
class_destroy(kpc_dma_class); class_destroy(kpc_dma_class);
fail_class_create: fail_class_create:
__unregister_chrdev(KPC_DMA_CHAR_MAJOR, 0, KPC_DMA_NUM_MINORS, "kpc_dma"); __unregister_chrdev(KPC_DMA_CHAR_MAJOR, 0, KPC_DMA_NUM_MINORS, "kpc_dma");
fail_chrdev_register: fail_chrdev_register:
return err; return err;
} }
module_init(kpc_dma_driver_init); module_init(kpc_dma_driver_init);
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include "../kpc.h" #include "../kpc.h"
struct kp2000_device; struct kp2000_device;
struct kpc_dma_device { struct kpc_dma_device {
struct list_head list; struct list_head list;
...@@ -157,15 +156,18 @@ void WriteEngineControl(struct kpc_dma_device *eng, u32 value) ...@@ -157,15 +156,18 @@ void WriteEngineControl(struct kpc_dma_device *eng, u32 value)
{ {
writel(value, eng->eng_regs + 1); writel(value, eng->eng_regs + 1);
} }
static inline static inline
u32 GetEngineControl(struct kpc_dma_device *eng) u32 GetEngineControl(struct kpc_dma_device *eng)
{ {
return readl(eng->eng_regs + 1); return readl(eng->eng_regs + 1);
} }
static inline static inline
void SetClearEngineControl(struct kpc_dma_device *eng, u32 set_bits, u32 clear_bits) void SetClearEngineControl(struct kpc_dma_device *eng, u32 set_bits, u32 clear_bits)
{ {
u32 val = GetEngineControl(eng); u32 val = GetEngineControl(eng);
val |= set_bits; val |= set_bits;
val &= ~clear_bits; val &= ~clear_bits;
WriteEngineControl(eng, val); WriteEngineControl(eng, val);
...@@ -176,16 +178,19 @@ void SetEngineNextPtr(struct kpc_dma_device *eng, struct kpc_dma_descriptor *de ...@@ -176,16 +178,19 @@ void SetEngineNextPtr(struct kpc_dma_device *eng, struct kpc_dma_descriptor *de
{ {
writel(desc->MyDMAAddr, eng->eng_regs + 2); writel(desc->MyDMAAddr, eng->eng_regs + 2);
} }
static inline static inline
void SetEngineSWPtr(struct kpc_dma_device *eng, struct kpc_dma_descriptor *desc) void SetEngineSWPtr(struct kpc_dma_device *eng, struct kpc_dma_descriptor *desc)
{ {
writel(desc->MyDMAAddr, eng->eng_regs + 3); writel(desc->MyDMAAddr, eng->eng_regs + 3);
} }
static inline static inline
void ClearEngineCompletePtr(struct kpc_dma_device *eng) void ClearEngineCompletePtr(struct kpc_dma_device *eng)
{ {
writel(0, eng->eng_regs + 4); writel(0, eng->eng_regs + 4);
} }
static inline static inline
u32 GetEngineCompletePtr(struct kpc_dma_device *eng) u32 GetEngineCompletePtr(struct kpc_dma_device *eng)
{ {
...@@ -206,7 +211,6 @@ void unlock_engine(struct kpc_dma_device *eng) ...@@ -206,7 +211,6 @@ void unlock_engine(struct kpc_dma_device *eng)
mutex_unlock(&eng->sem); mutex_unlock(&eng->sem);
} }
/// Shared Functions /// Shared Functions
void start_dma_engine(struct kpc_dma_device *eng); void start_dma_engine(struct kpc_dma_device *eng);
int setup_dma_engine(struct kpc_dma_device *eng, u32 desc_cnt); int setup_dma_engine(struct kpc_dma_device *eng, u32 desc_cnt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment