fix drivers/staging/android several coding style issues
cover fix drivers/staging/android several coding style issues
patches based on linux-next next-20150825
Corrections based on checkpatch.pl with --strict
Peng Sun (8):
fix staging:android style issue:spaces preferred around that '-' fix staging:android style issue:No space is necessary after a cast fix staging:android style issue:Alignment should match open
parenthesis
fix staging:android style issue:Prefer kernel type 'u32' over
'uint32_t'
fix staging:android style issue:Please use a blank line after
function/struct/union/enum declarations
fix staging:android style issue:Comparison to NULL could be written fix staging:android style issue:definition without comment fix staging:android style issue:Please don't use multiple blank lines
drivers/staging/android/ashmem.c | 15 ++++++++------- drivers/staging/android/lowmemorykiller.c | 9 +++++---- drivers/staging/android/sw_sync.c | 6 +++--- drivers/staging/android/sync.c | 22 +++++++++++----------- drivers/staging/android/sync.h | 4 ++-- drivers/staging/android/timed_gpio.c | 15 ++++++++------- 6 files changed, 37 insertions(+), 34 deletions(-)
--
1.9.1
PATCH 1/8 fix staging:android style issue:spaces preferred around that '-'
--- drivers/staging/android/ashmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/android/ashmem.c +2 -1
@@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend)/* Case #3: We overlap from the rear, so adjust it */ if (range->pgend <= pgend) { -range_shrink (range, range->pgstart, pgstart-1 ); +range_shrink (range, range->pgstart, + pgstart -1 );continue ; }
Signature · 1 line
1.9.1
PATCH 2/8 fix staging:android style issue:No space is necessary after a cast
--- drivers/staging/android/ashmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ashmem.c +2 -2
@@ -716,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,if (unlikely ((pin.offset | pin.len) & ~PAGE_MASK ))return -EINVAL ; -if (unlikely (((__u32) -1 ) - pin.offset < pin.len)) +if (unlikely (((__u32)-1 ) - pin.offset < pin.len))return -EINVAL ;if (unlikely (PAGE_ALIGN (asma->size) < pin.offset + pin.len))
@@ -760,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = -EINVAL ;if (!asma->file) { ret =0 ; - asma->size = (size_t ) arg; + asma->size = (size_t )arg; }break ;case ASHMEM_GET_SIZE :
Signature · 1 line
1.9.1
PATCH 3/8 fix staging:android style issue:Alignment should match open parenthesis
--- drivers/staging/android/ashmem.c | 8 ++++---- drivers/staging/android/lowmemorykiller.c | 4 ++-- drivers/staging/android/sync.c | 4 ++-- drivers/staging/android/sync.h | 2 +- drivers/staging/android/timed_gpio.c | 12 +++++++----- 5 files changed, 16 insertions(+), 14 deletions(-)
drivers/staging/android/ashmem.c +4 -4
@@ -834,16 +834,16 @@ static int __init ashmem_init(void)int ret; ashmem_area_cachep =kmem_cache_create ("ashmem_area_cache" , -sizeof (struct ashmem_area ), -0 ,0 ,NULL ); +sizeof (struct ashmem_area ), +0 ,0 ,NULL );if (unlikely (!ashmem_area_cachep)) {pr_err ("failed to create slab cache\n" );return -ENOMEM ; } ashmem_range_cachep =kmem_cache_create ("ashmem_range_cache" , -sizeof (struct ashmem_range ), -0 ,0 ,NULL ); +sizeof (struct ashmem_range ), +0 ,0 ,NULL );if (unlikely (!ashmem_range_cachep)) {pr_err ("failed to create slab cache\n" );return -ENOMEM ;
drivers/staging/android/lowmemorykiller.c +2 -2
@@ -104,8 +104,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) }lowmem_print (3 ,"lowmem_scan %lu, %x, ofree %d %d, ma %hd\n" , - sc->nr_to_scan, sc->gfp_mask, other_free, - other_file, min_score_adj); + sc->nr_to_scan, sc->gfp_mask, other_free, + other_file, min_score_adj);if (min_score_adj ==OOM_SCORE_ADJ_MAX +1 ) { lowmem_print(5, "lowmem_scan %lu, %x, return 0\n",
drivers/staging/android/sync.c +2 -2
@@ -313,7 +313,7 @@ struct sync_fence *sync_fence_merge(const char *name,EXPORT_SYMBOL (sync_fence_merge);int sync_fence_wake_up_wq (wait_queue_t *curr,unsigned mode, -int wake_flags,void *key) +int wake_flags,void *key) {struct sync_fence_waiter *wait;
@@ -353,7 +353,7 @@ int sync_fence_wait_async(struct sync_fence *fence,EXPORT_SYMBOL (sync_fence_wait_async);int sync_fence_cancel_async (struct sync_fence *fence, -struct sync_fence_waiter *waiter) +struct sync_fence_waiter *waiter) {unsigned long flags;int ret =0 ;
drivers/staging/android/sync.h +1 -1
@@ -351,6 +351,6 @@ void sync_dump(void);# define sync_dump ()#endif int sync_fence_wake_up_wq (wait_queue_t *curr,unsigned mode, -int wake_flags,void *key); +int wake_flags,void *key);#endif /* _LINUX_SYNC_H */
drivers/staging/android/timed_gpio.c +7 -5
@@ -76,8 +76,9 @@ static void gpio_enable(struct timed_output_dev *dev, int value) value = data->max_timeout;hrtimer_start (&data->timer, -ktime_set (value /1000 , (value %1000 ) *1000000 ), -HRTIMER_MODE_REL ); +ktime_set (value /1000 , (value %1000 ) * +1000000 ), +HRTIMER_MODE_REL ); }spin_unlock_irqrestore (&data->lock, flags);
@@ -94,8 +95,9 @@ static int timed_gpio_probe(struct platform_device *pdev)return -EBUSY ; gpio_data =devm_kzalloc (&pdev->dev, -sizeof (struct timed_gpio_data ) * pdata->num_gpios, -GFP_KERNEL ); +sizeof (struct timed_gpio_data ) * + pdata->num_gpios, +GFP_KERNEL );if (!gpio_data)return -ENOMEM ;
@@ -104,7 +106,7 @@ static int timed_gpio_probe(struct platform_device *pdev) gpio_dat = &gpio_data[i];hrtimer_init (&gpio_dat->timer,CLOCK_MONOTONIC , -HRTIMER_MODE_REL ); +HRTIMER_MODE_REL ); gpio_dat->timer.function = gpio_timer_func;spin_lock_init (&gpio_dat->lock);
Signature · 1 line
1.9.1
PATCH 4/8 fix staging:android style issue:Prefer kernel type 'u32' over 'uint32_t'
--- drivers/staging/android/lowmemorykiller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/lowmemorykiller.c +1 -1
@@ -42,7 +42,7 @@#include <linux/profile.h> #include <linux/notifier.h> -static uint32_t lowmem_debug_level =1 ; +static u32 lowmem_debug_level =1 ;static short lowmem_adj[6 ] = {0 ,1 ,
Signature · 1 line
1.9.1
PATCH 5/8 fix staging:android style issue:Please use a blank line after function/struct/union/enum declarations
--- drivers/staging/android/lowmemorykiller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/android/lowmemorykiller.c +2 -1
@@ -49,6 +49,7 @@ static short lowmem_adj[6] = {6 , 12, }; +static int lowmem_adj_size =4 ;static int lowmem_minfree[6 ] = { 3 * 512, /* 6MB */
@@ -56,8 +57,8 @@ static int lowmem_minfree[6] = {4 *1024 ,/* 16MB */ 16 * 1024, /* 64MB */ }; -static int lowmem_minfree_size =4 ; +static int lowmem_minfree_size =4 ;static unsigned long lowmem_deathpending_timeout; #define lowmem_print(level, x...) \
Signature · 1 line
1.9.1
PATCH 6/8 fix staging:android style issue:Comparison to NULL could be written
--- drivers/staging/android/sw_sync.c | 6 +++--- drivers/staging/android/sync.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/staging/android/sw_sync.c +3 -3
@@ -145,7 +145,7 @@ static int sw_sync_open(struct inode *inode, struct file *file)get_task_comm (task_comm, current); obj =sw_sync_timeline_create (task_comm); -if (obj ==NULL ) +if (!obj)return -ENOMEM ; file->private_data = obj;
@@ -179,14 +179,14 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj, } pt =sw_sync_pt_create (obj, data.value); -if (pt ==NULL ) { +if (!pt) { err = -ENOMEM ; goto err; } data.name[sizeof (data.name) -1 ] ='\0' ; fence =sync_fence_create (data.name, pt); -if (fence ==NULL ) { +if (!fence) {sync_pt_free (pt); err = -ENOMEM ; goto err;
drivers/staging/android/sync.c +9 -9
@@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,return NULL ; obj =kzalloc (size,GFP_KERNEL ); -if (obj ==NULL ) +if (!obj)return NULL ;kref_init (&obj->kref);
@@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size)return NULL ; pt =kzalloc (size,GFP_KERNEL ); -if (pt ==NULL ) +if (!pt)return NULL ;spin_lock_irqsave (&obj->child_list_lock, flags);
@@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const char *name)struct sync_fence *fence; fence =kzalloc (size,GFP_KERNEL ); -if (fence ==NULL ) +if (!fence)return NULL ; fence->file = anon_inode_getfile("sync_fence", &sync_fence_fops,
@@ -193,7 +193,7 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt)struct sync_fence *fence; fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name); -if (fence ==NULL ) +if (!fence)return NULL ; fence->num_fences =1 ;
@@ -215,7 +215,7 @@ struct sync_fence *sync_fence_fdget(int fd) {struct file *file =fget (fd); -if (file ==NULL ) +if (!file)return NULL ;if (file->f_op != &sync_fence_fops)
@@ -262,7 +262,7 @@ struct sync_fence *sync_fence_merge(const char *name, unsigned long size = offsetof(struct sync_fence, cbs[num_fences]); fence =sync_fence_alloc (size, name); -if (fence ==NULL ) +if (!fence)return NULL ;atomic_set (&fence->status, num_fences);
@@ -583,14 +583,14 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg) } fence2 =sync_fence_fdget (data.fd2); -if (fence2 ==NULL ) { +if (!fence2) { err = -ENOENT ; goto err_put_fd; } data.name[sizeof (data.name) -1 ] ='\0' ; fence3 =sync_fence_merge (data.name, fence, fence2); -if (fence3 ==NULL ) { +if (!fence3) { err = -ENOMEM ; goto err_put_fence2; }
@@ -666,7 +666,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *fence, size =4096 ; data =kzalloc (size,GFP_KERNEL ); -if (data ==NULL ) +if (!data)return -ENOMEM ;strlcpy (data->name, fence->name,sizeof (data->name));
Signature · 1 line
1.9.1
PATCH 7/8 fix staging:android style issue:definition without comment
--- drivers/staging/android/sync.h | 2 +- drivers/staging/android/timed_gpio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/sync.h +1 -1
@@ -94,11 +94,11 @@ struct sync_timeline {const struct sync_timeline_ops *ops;char name[32 ]; -/* protected by child_list_lock */ bool destroyed;int context, value;struct list_head child_list_head; +/* protect field destroyed */ spinlock_t child_list_lock;struct list_head active_list_head;
drivers/staging/android/timed_gpio.c +1 -1
@@ -29,7 +29,7 @@struct timed_gpio_data {struct timed_output_dev dev;struct hrtimer timer; -spinlock_t lock; +spinlock_t lock;/* protect structure fields */ unsigned gpio;int max_timeout;u8 active_low;
Signature · 1 line
1.9.1
PATCH 8/8 fix staging:android style issue:Please don't use multiple blank lines
--- drivers/staging/android/timed_gpio.c | 1 - 1 file changed, 1 deletion(-)
drivers/staging/android/timed_gpio.c +0 -1
@@ -25,7 +25,6 @@#include "timed_output.h" #include "timed_gpio.h" -struct timed_gpio_data {struct timed_output_dev dev;struct hrtimer timer;
Signature · 1 line
1.9.1
Re: [PATCH 3/8] fix staging:android style issue:Alignment should match open parenthesis
In reply to Peng SunQuoted 1 line · Peng Sun
Signed-off-by Peng Sun <[email protected]>
Please always add a changelog message. Also, you need to fix the subject. The convention is to use something like: "a: b: ..."
So in this case it should be something like: "staging: android: ..." You can look at git log drivers/staging/android for inspiration. This applies to all of your other patches as well. Finally, I don't think there is a point in using deep threading in this case.
Greg KH
maintainerQuoted 9 lines · Peng Sun
patches based on linux-next next-20150825
Corrections based on checkpatch.pl with --strictPeng Sun (8):
fix staging:android style issue:spaces preferred around that '-' fix staging:android style issue:No space is necessary after a cast fix staging:android style issue:Alignment should match open
parenthesis
fix staging:android style issue:Prefer kernel type 'u32' over
Quoted 6 lines
'uint32_t'fix staging:android style issue:Please use a blank line after
function/struct/union/enum declarations
fix staging:android style issue:Comparison to NULL could be written fix staging:android style issue:definition without comment fix staging:android style issue:Please don't use multiple blank lines
You sent out 3 different series, and I don't know which should be applied. So please fix up and resend just the one you want applied.
Note, the "style issue:" shouldn't be in the subject, look at how other commits are titled.
thanks,
greg k-h