Skip to contentSkip to conversation

staging: android: fix multiple checkpatch issues

PATCH Superseded Ioana Ciornei 2 participants 8 messages Nov 1, 2015 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover staging: android: fix multiple checkpatch issues

This patchset fixes multiple checkpatch.pl issues.

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 1/5 staging: android: replace explicit NULL comparison

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

---
 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 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.

---
 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 3/5 staging: android: properly align function arguments

In reply to Ioana Ciornei

FIx alingment issues by properly indenting function arguments int accordance with the kernel coding style.

---
 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

Re: [Outreachy kernel] [PATCH 3/5] staging: android: properly align function arguments

Quoted 2 lines · Ioana Ciornei

FIx alingment issues by properly indenting function arguments int accordance with the kernel coding style.

Kind of a lot of typos here: FIx -> Fix, int -> in

julia

Quoted 90 lines
---
 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 · 8 lines
2.1.4

-- 
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1aa855620c3b81b4883c6a3a751186f53dd9de6d.1446385932.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
#5 lore raw

Re: [Outreachy kernel] [PATCH 3/5] staging: android: properly align function arguments

Quoted 6 lines · Julia Lawall
Quoted 2 lines · Ioana Ciornei

FIx alingment issues by properly indenting function arguments int accordance with the kernel coding style.

Kind of a lot of typos here: FIx -> Fix, int -> in

Sorry about that. I should have double checked it.

Ioana

Quoted 93 lines

julia

Quoted 90 lines
---
 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 -6
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);
 
--

2.1.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1aa855620c3b81b4883c6a3a751186f53dd9de6d.1446385932.git.ciorneiioana%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Signature · 3 lines
Ioana Ciornei
Facultatea de Automatica si Calculatoare, UPB
Tel. 0753 861 668
#6 lore raw

PATCH 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.

---
 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
#7 lore raw

PATCH 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.

---
 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