Skip to contentSkip to conversation

staging: android: fix multiple checkpatch issues

PATCH In review Ioana Ciornei 2 participants 8 messages Nov 1, 2015 – Nov 4, 2015 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging: android: fix multiple checkpatch issues

This patchset fixes multiple checkpatch.pl issues.

Changes in v2:
- fix typos in the commit description of the patch 3/5

Ioana Ciornei (5):
staging: android: replace explicit NULL comparison
staging: android: replace uint32_t with u32
staging: android: properly align function arguments
staging: android: remove multiple blank lines
staging: android: add comment to spinlock_t definition

 drivers/staging/android/ion/compat_ion.c  |  6 +++---
 drivers/staging/android/lowmemorykiller.c |  6 +++---
 drivers/staging/android/sync.c            | 22 +++++++++++-----------
 drivers/staging/android/timed_gpio.c      | 13 ++++++-------
 4 files changed, 23 insertions(+), 24 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 1/5 staging: android: replace explicit NULL comparison

This patch replaces explicit NULL comparison with ! operator in order to simplify the code

---
Changes in v2:
- nothing

 drivers/staging/android/ion/compat_ion.c |  6 +++---
 drivers/staging/android/sync.c           | 18 +++++++++---------
 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/staging/android/ion/compat_ion.c +3 -3
index a402fda..9a978d2 100644
@@ -137,7 +137,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 		data32 = compat_ptr(arg);
 		data = compat_alloc_user_space(sizeof(*data));
-		if (data == NULL)
+		if (!data)
 			return -EFAULT;
 
 		err = compat_get_ion_allocation_data(data32, data);
@@ -156,7 +156,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 		data32 = compat_ptr(arg);
 		data = compat_alloc_user_space(sizeof(*data));
-		if (data == NULL)
+		if (!data)
 			return -EFAULT;
 
 		err = compat_get_ion_handle_data(data32, data);
@@ -173,7 +173,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 		data32 = compat_ptr(arg);
 		data = compat_alloc_user_space(sizeof(*data));
-		if (data == NULL)
+		if (!data)
 			return -EFAULT;
 
 		err = compat_get_ion_custom_data(data32, data);
drivers/staging/android/sync.c +9 -9
index f83e00c..5413f28 100644
@@ -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
2.1.4
#2 lore raw

PATCH v2 2/5 staging: android: replace uint32_t with u32

In reply to Ioana Ciornei

This patch makes use of the preferred kernel types such as u16, u32.

---
Changes in v2:
- nothing

 drivers/staging/android/lowmemorykiller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/lowmemorykiller.c +1 -1
index e679d84..de65db7 100644
@@ -43,7 +43,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
2.1.4
#3 lore raw

PATCH v2 3/5 staging: android: properly align function arguments

In reply to Ioana Ciornei

Fix alingment issues by properly indenting function arguments in accordance with the kernel coding style.

---
Changes in v2:
- fix typos in the commit description

 drivers/staging/android/lowmemorykiller.c |  4 ++--
 drivers/staging/android/sync.c            |  4 ++--
 drivers/staging/android/timed_gpio.c      | 10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/staging/android/lowmemorykiller.c +2 -2
index de65db7..8b5a4a8 100644
@@ -105,8 +105,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
index 5413f28..e0c1acb 100644
@@ -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/timed_gpio.c +5 -5
index ce11726..5246f42 100644
@@ -76,8 +76,8 @@ 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 +94,8 @@ 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(*gpio_data) * pdata->num_gpios,
+				 GFP_KERNEL);
 	if (!gpio_data)
 		return -ENOMEM;
 
@@ -104,7 +104,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
2.1.4
#4 lore raw

PATCH v2 4/5 staging: android: remove multiple blank lines

In reply to Ioana Ciornei

This patch removes multiple blank lines in order to follow the linux kernel coding style.

---
Changes in v2:
- nothing

 drivers/staging/android/timed_gpio.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/android/timed_gpio.c +0 -1
index 5246f42..bcd9924 100644
@@ -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
2.1.4
#5 lore raw

PATCH v2 5/5 staging: android: add comment to spinlock_t definition

In reply to Ioana Ciornei

Add comment to the spinlock_t fields of struct timed_gpio_data in order to follow the linux coding style.

---
Changes in v2:
- nothing

 drivers/staging/android/timed_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/timed_gpio.c +1 -1
index bcd9924..99f8473 100644
@@ -28,7 +28,7 @@
 struct timed_gpio_data {
 	struct timed_output_dev dev;
 	struct hrtimer timer;
-	spinlock_t lock;
+	spinlock_t lock; /* protects the fields of timed_gpio_data */
 	unsigned gpio;
 	int max_timeout;
 	u8 active_low;
Signature · 1 line
2.1.4
maintainer
#6 lore raw

Re: [Outreachy kernel] [PATCH v2 5/5] staging: android: add comment to spinlock_t definition

Quoted 16 lines · Ioana Ciornei

Add comment to the spinlock_t fields of struct timed_gpio_data in order to follow the linux coding style.

---
Changes in v2:
- nothing

 drivers/staging/android/timed_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/android/timed_gpio.c +0 -0
index bcd9924..99f8473 100644

drivers/staging/android/timed_gpio.c line 31

Quoted 5 lines
drivers/staging/android/timed_gpio.c +1 -1
@@ -28,7 +28,7 @@
 struct timed_gpio_data {
 	struct timed_output_dev dev;
 	struct hrtimer timer;
-	spinlock_t lock;
+	spinlock_t lock; /* protects the fields of timed_gpio_data */

Not really, that's not what this lock protects, please re-read the driver to figure this out exactly. But, I wouldn't really worry about this, I need to just delete this driver, no one uses it anymore...

thanks,

greg k-h

#7 lore raw

Re: [Outreachy kernel] [PATCH v2 5/5] staging: android: add comment to spinlock_t definition

Quoted 12 lines · Greg KH
Quoted 11 lines · Ioana Ciornei

Add comment to the spinlock_t fields of struct timed_gpio_data in order to follow the linux coding style.

---
Changes in v2:
- nothing

 drivers/staging/android/timed_gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/staging/android/timed_gpio.c line 31

Quoted 10 lines
drivers/staging/android/timed_gpio.c +1 -1
index bcd9924..99f8473 100644
@@ -28,7 +28,7 @@
 struct timed_gpio_data {
      struct timed_output_dev dev;
      struct hrtimer timer;
-     spinlock_t lock;
+     spinlock_t lock; /* protects the fields of timed_gpio_data */

Not really, that's not what this lock protects, please re-read the driver to figure this out exactly. But, I wouldn't really worry about this, I need to just delete this driver, no one uses it anymore...

Ok. So no version 3?

Thanks,

Ioana

Quoted 3 lines

thanks,

greg k-h