All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Staging: irda: net: Code clean up
@ 2017-09-22  7:52 Georgiana Chelu
  2017-09-22  7:52 ` [PATCH v2 1/3] Staging: irda: net: Do not initialise statics to NULL Georgiana Chelu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Georgiana Chelu @ 2017-09-22  7:52 UTC (permalink / raw
  To: outreachy-kernel; +Cc: Samuel Ortiz, Greg Kroah-Hartman

Adjust the code to respect the Linux coding style convention.

Change in v2:
Use my right email address to sign off the patch set.

Georgiana Chelu (3):
  Staging: irda: net: Do not initialise statics to NULL
  Staging: irda: net: Use NOT operator instead of comparison to NULL
  Staging: irda: net: Fix style issues

 drivers/staging/irda/net/irda_device.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/3] Staging: irda: net: Do not initialise statics to NULL
  2017-09-22  7:52 [PATCH v2 0/3] Staging: irda: net: Code clean up Georgiana Chelu
@ 2017-09-22  7:52 ` Georgiana Chelu
  2017-09-22  7:52 ` [PATCH v2 2/3] Staging: irda: net: Use NOT operator instead of comparison " Georgiana Chelu
  2017-09-22  7:52 ` [PATCH v2 3/3] Staging: irda: net: Fix style issues Georgiana Chelu
  2 siblings, 0 replies; 4+ messages in thread
From: Georgiana Chelu @ 2017-09-22  7:52 UTC (permalink / raw
  To: outreachy-kernel; +Cc: Samuel Ortiz, Greg Kroah-Hartman

There is no need to initialize static variables to NULL
because they are stored in .bss segment. This segment
is initialized to 0 at the beginning of the code execution.

Issue found by checkpatch.pl.
ERROR: do not initialise statics to NULL

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---
 drivers/staging/irda/net/irda_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/irda/net/irda_device.c b/drivers/staging/irda/net/irda_device.c
index 890b90d0..3501478 100644
--- a/drivers/staging/irda/net/irda_device.c
+++ b/drivers/staging/irda/net/irda_device.c
@@ -54,8 +54,8 @@
 
 static void __irda_task_delete(struct irda_task *task);
 
-static hashbin_t *dongles = NULL;
-static hashbin_t *tasks = NULL;
+static hashbin_t *dongles;
+static hashbin_t *tasks;
 
 static void irda_task_timer_expired(void *data);
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/3] Staging: irda: net: Use NOT operator instead of comparison to NULL
  2017-09-22  7:52 [PATCH v2 0/3] Staging: irda: net: Code clean up Georgiana Chelu
  2017-09-22  7:52 ` [PATCH v2 1/3] Staging: irda: net: Do not initialise statics to NULL Georgiana Chelu
@ 2017-09-22  7:52 ` Georgiana Chelu
  2017-09-22  7:52 ` [PATCH v2 3/3] Staging: irda: net: Fix style issues Georgiana Chelu
  2 siblings, 0 replies; 4+ messages in thread
From: Georgiana Chelu @ 2017-09-22  7:52 UTC (permalink / raw
  To: outreachy-kernel; +Cc: Samuel Ortiz, Greg Kroah-Hartman

Fix issues find by checkpatch.pl.
CHECK: Comparison to NULL could be written "!dongles"
CHECK: Comparison to NULL could be written "!tasks"

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---
 drivers/staging/irda/net/irda_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/irda/net/irda_device.c b/drivers/staging/irda/net/irda_device.c
index 3501478..944eeaa 100644
--- a/drivers/staging/irda/net/irda_device.c
+++ b/drivers/staging/irda/net/irda_device.c
@@ -62,14 +62,14 @@ static void irda_task_timer_expired(void *data);
 int __init irda_device_init( void)
 {
 	dongles = hashbin_new(HB_NOLOCK);
-	if (dongles == NULL) {
+	if (!dongles) {
 		net_warn_ratelimited("IrDA: Can't allocate dongles hashbin!\n");
 		return -ENOMEM;
 	}
 	spin_lock_init(&dongles->hb_spinlock);
 
 	tasks = hashbin_new(HB_LOCK);
-	if (tasks == NULL) {
+	if (!tasks) {
 		net_warn_ratelimited("IrDA: Can't allocate tasks hashbin!\n");
 		hashbin_delete(dongles, NULL);
 		return -ENOMEM;
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 3/3] Staging: irda: net: Fix style issues
  2017-09-22  7:52 [PATCH v2 0/3] Staging: irda: net: Code clean up Georgiana Chelu
  2017-09-22  7:52 ` [PATCH v2 1/3] Staging: irda: net: Do not initialise statics to NULL Georgiana Chelu
  2017-09-22  7:52 ` [PATCH v2 2/3] Staging: irda: net: Use NOT operator instead of comparison " Georgiana Chelu
@ 2017-09-22  7:52 ` Georgiana Chelu
  2 siblings, 0 replies; 4+ messages in thread
From: Georgiana Chelu @ 2017-09-22  7:52 UTC (permalink / raw
  To: outreachy-kernel; +Cc: Samuel Ortiz, Greg Kroah-Hartman

Fix minor coding style issues found by checkpatch.pl.

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---
 drivers/staging/irda/net/irda_device.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/irda/net/irda_device.c b/drivers/staging/irda/net/irda_device.c
index 944eeaa..d33de8a 100644
--- a/drivers/staging/irda/net/irda_device.c
+++ b/drivers/staging/irda/net/irda_device.c
@@ -59,7 +59,7 @@ static hashbin_t *tasks;
 
 static void irda_task_timer_expired(void *data);
 
-int __init irda_device_init( void)
+int __init irda_device_init(void)
 {
 	dongles = hashbin_new(HB_NOLOCK);
 	if (!dongles) {
@@ -76,7 +76,8 @@ int __init irda_device_init( void)
 	}
 
 	/* We no longer initialise the driver ourselves here, we let
-	 * the system do it for us... - Jean II */
+	 * the system do it for us... - Jean II
+	 */
 
 	return 0;
 }
@@ -84,6 +85,7 @@ int __init irda_device_init( void)
 static void leftover_dongle(void *arg)
 {
 	struct dongle_reg *reg = arg;
+
 	net_warn_ratelimited("IrDA: Dongle type %x not unregistered\n",
 			     reg->type);
 }
@@ -107,7 +109,7 @@ void irda_device_set_media_busy(struct net_device *dev, int status)
 
 	pr_debug("%s(%s)\n", __func__, status ? "TRUE" : "FALSE");
 
-	self = (struct irlap_cb *) dev->atalk_ptr;
+	self = (struct irlap_cb *)dev->atalk_ptr;
 
 	/* Some drivers may enable the receive interrupt before calling
 	 * irlap_open(), or they may disable the receive interrupt
@@ -115,7 +117,8 @@ void irda_device_set_media_busy(struct net_device *dev, int status)
 	 * The IrDA stack is protected from this in irlap_driver_rcv().
 	 * However, the driver calls directly the wrapper, that calls
 	 * us directly. Make sure we protect ourselves.
-	 * Jean II */
+	 * Jean II
+	 */
 	if (!self || self->magic != LAP_MAGIC)
 		return;
 
@@ -133,7 +136,6 @@ void irda_device_set_media_busy(struct net_device *dev, int status)
 }
 EXPORT_SYMBOL(irda_device_set_media_busy);
 
-
 /*
  * Function irda_device_is_receiving (dev)
  *
@@ -169,7 +171,7 @@ static void __irda_task_delete(struct irda_task *task)
 static void irda_task_delete(struct irda_task *task)
 {
 	/* Unregister task */
-	hashbin_remove(tasks, (long) task, NULL);
+	hashbin_remove(tasks, (long)task, NULL);
 
 	__irda_task_delete(task);
 }
@@ -231,7 +233,7 @@ static int irda_task_kick(struct irda_task *task)
 		}
 		irda_task_delete(task);
 	} else if (timeout > 0) {
-		irda_start_timer(&task->timer, timeout, (void *) task,
+		irda_start_timer(&task->timer, timeout, (void *)task,
 				 irda_task_timer_expired);
 		finished = FALSE;
 	} else {
@@ -280,8 +282,8 @@ static void irda_device_setup(struct net_device *dev)
 
 /*
  * Funciton  alloc_irdadev
- * 	Allocates and sets up an IRDA device in a manner similar to
- * 	alloc_etherdev.
+ *      Allocates and sets up an IRDA device in a manner similar to
+ *      alloc_etherdev.
  */
 struct net_device *alloc_irdadev(int sizeof_priv)
 {
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-22  7:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-22  7:52 [PATCH v2 0/3] Staging: irda: net: Code clean up Georgiana Chelu
2017-09-22  7:52 ` [PATCH v2 1/3] Staging: irda: net: Do not initialise statics to NULL Georgiana Chelu
2017-09-22  7:52 ` [PATCH v2 2/3] Staging: irda: net: Use NOT operator instead of comparison " Georgiana Chelu
2017-09-22  7:52 ` [PATCH v2 3/3] Staging: irda: net: Fix style issues Georgiana Chelu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.