The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2 00/11] parport cleanup
@ 2015-10-28  9:11 Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 01/11] parport: fix a trivial typo Sudip Mukherjee
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

Hi Greg,
A small series of checkpatch cleanup on parport. This is the first set.
v1 had a problem with the From: line.
Its only cleanup and no other change is done. All the patches are also
sent along with this pull request for your convenience.
This is my first pull request. Did i mess it up?


The following changes since commit 32b88194f71d6ae7768a29f87fbba454728273ee:

  Linux 4.3-rc7 (2015-10-25 10:39:47 +0900)

are available in the git repository at:

  https://github.com/sudipm-mukherjee/parport.git tags/parport_cleanup1

for you to fetch changes up to e9df91f248c0addfba54555eee8d633d4511cd24:

  parport: avoid assignment in if (2015-10-28 13:53:10 +0530)

----------------------------------------------------------------
Geliang Tang (1):
  parport: fix a trivial typo

Sudip Mukherjee (10):
  parport: remove trailing white space
  parport: EXPORT_SYMBOL should follow function
  parport: fix coding style
  parport: code indent should use tabs
  parport: quoted strings should not be split
  parport: remove braces
  parport: remove unnecessary out of memory message
  parport: change style of NULL comparison
  parport: remove unneeded space
  parport: avoid assignment in if

 drivers/parport/share.c | 246 +++++++++++++++++++++++++-----------------------
 1 file changed, 126 insertions(+), 120 deletions(-)

-- 
1.9.1


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

* [PATCH v2 01/11] parport: fix a trivial typo
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 02/11] parport: remove trailing white space Sudip Mukherjee
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Geliang Tang

From: Geliang Tang <geliangtang@163.com>

s/regsiter/register/

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 5ce5ef2..8931696 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -148,7 +148,7 @@ void parport_bus_exit(void)
 /*
  * iterates through all the drivers registered with the bus and sends the port
  * details to the match_port callback of the driver, so that the driver can
- * know about the new port that just regsitered with the bus and decide if it
+ * know about the new port that just registered with the bus and decide if it
  * wants to use this new port.
  */
 static int driver_check(struct device_driver *dev_drv, void *_port)
-- 
1.9.1


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

* [PATCH v2 02/11] parport: remove trailing white space
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 01/11] parport: fix a trivial typo Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 03/11] parport: EXPORT_SYMBOL should follow function Sudip Mukherjee
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

Trailing white space is not accepted in kernel coding style. Remove
them.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 8931696..b7fcb7f 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -1,6 +1,6 @@
 /*
  * Parallel-port resource manager code.
- * 
+ *
  * Authors: David Campbell <campbell@tirian.che.curtin.edu.au>
  *          Tim Waugh <tim@cyberelk.demon.co.uk>
  *          Jose Renau <renau@acm.org>
@@ -93,7 +93,7 @@ static struct parport_operations dead_ops = {
 	.ecp_write_data	= dead_write,		/* ecp */
 	.ecp_read_data	= dead_read,
 	.ecp_write_addr	= dead_write,
- 
+
 	.compat_write_data	= dead_write,	/* compat */
 	.nibble_read_data	= dead_read,	/* nibble */
 	.byte_read_data		= dead_read,	/* byte */
@@ -689,7 +689,7 @@ void parport_remove_port(struct parport *port)
 struct pardevice *
 parport_register_device(struct parport *port, const char *name,
 			int (*pf)(void *), void (*kf)(void *),
-			void (*irq_func)(void *), 
+			void (*irq_func)(void *),
 			int flags, void *handle)
 {
 	struct pardevice *tmp;
@@ -730,7 +730,7 @@ parport_register_device(struct parport *port, const char *name,
 	if (!try_module_get(port->ops->owner)) {
 		return NULL;
 	}
-		
+
 	parport_get_port (port);
 
 	tmp = kmalloc(sizeof(struct pardevice), GFP_KERNEL);
-- 
1.9.1


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

* [PATCH v2 03/11] parport: EXPORT_SYMBOL should follow function
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 01/11] parport: fix a trivial typo Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 02/11] parport: remove trailing white space Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 04/11] parport: fix coding style Sudip Mukherjee
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

All symbols were exported at the end of the file but they are supposed
to be exported just after the function. And checkpatch was complaining
about it.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index b7fcb7f..d85e566 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -343,6 +343,7 @@ void parport_unregister_driver (struct parport_driver *drv)
 	}
 	mutex_unlock(&registration_lock);
 }
+EXPORT_SYMBOL(parport_unregister_driver);
 
 static void free_port(struct device *dev)
 {
@@ -378,6 +379,7 @@ struct parport *parport_get_port (struct parport *port)
 
 	return to_parport_dev(dev);
 }
+EXPORT_SYMBOL(parport_get_port);
 
 void parport_del_port(struct parport *port)
 {
@@ -398,6 +400,7 @@ void parport_put_port (struct parport *port)
 {
 	put_device(&port->bus_dev);
 }
+EXPORT_SYMBOL(parport_put_port);
 
 /**
  *	parport_register_port - register a parallel port
@@ -508,6 +511,7 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 
 	return tmp;
 }
+EXPORT_SYMBOL(parport_register_port);
 
 /**
  *	parport_announce_port - tell device drivers about a parallel port
@@ -555,6 +559,7 @@ void parport_announce_port (struct parport *port)
 	}
 	mutex_unlock(&registration_lock);
 }
+EXPORT_SYMBOL(parport_announce_port);
 
 /**
  *	parport_remove_port - deregister a parallel port
@@ -616,6 +621,7 @@ void parport_remove_port(struct parport *port)
 			parport_put_port(slave);
 	}
 }
+EXPORT_SYMBOL(parport_remove_port);
 
 /**
  *	parport_register_device - register a device on a parallel port
@@ -810,6 +816,7 @@ parport_register_device(struct parport *port, const char *name,
 
 	return NULL;
 }
+EXPORT_SYMBOL(parport_register_device);
 
 static void free_pardevice(struct device *dev)
 {
@@ -1025,6 +1032,7 @@ void parport_unregister_device(struct pardevice *dev)
 	module_put(port->ops->owner);
 	parport_put_port (port);
 }
+EXPORT_SYMBOL(parport_unregister_device);
 
 /**
  *	parport_find_number - find a parallel port by number
@@ -1055,6 +1063,7 @@ struct parport *parport_find_number (int number)
 	spin_unlock (&parportlist_lock);
 	return result;
 }
+EXPORT_SYMBOL(parport_find_number);
 
 /**
  *	parport_find_base - find a parallel port by base address
@@ -1085,6 +1094,7 @@ struct parport *parport_find_base (unsigned long base)
 	spin_unlock (&parportlist_lock);
 	return result;
 }
+EXPORT_SYMBOL(parport_find_base);
 
 /**
  *	parport_claim - claim access to a parallel port device
@@ -1197,6 +1207,7 @@ blocked:
 	write_unlock_irqrestore (&port->cad_lock, flags);
 	return -EAGAIN;
 }
+EXPORT_SYMBOL(parport_claim);
 
 /**
  *	parport_claim_or_block - claim access to a parallel port device
@@ -1259,6 +1270,7 @@ int parport_claim_or_block(struct pardevice *dev)
 	dev->waiting = 0;
 	return r;
 }
+EXPORT_SYMBOL(parport_claim_or_block);
 
 /**
  *	parport_release - give up access to a parallel port device
@@ -1330,6 +1342,7 @@ void parport_release(struct pardevice *dev)
 			pd->wakeup(pd->private);
 	}
 }
+EXPORT_SYMBOL(parport_release);
 
 irqreturn_t parport_irq_handler(int irq, void *dev_id)
 {
@@ -1339,22 +1352,6 @@ irqreturn_t parport_irq_handler(int irq, void *dev_id)
 
 	return IRQ_HANDLED;
 }
-
-/* Exported symbols for modules. */
-
-EXPORT_SYMBOL(parport_claim);
-EXPORT_SYMBOL(parport_claim_or_block);
-EXPORT_SYMBOL(parport_release);
-EXPORT_SYMBOL(parport_register_port);
-EXPORT_SYMBOL(parport_announce_port);
-EXPORT_SYMBOL(parport_remove_port);
-EXPORT_SYMBOL(parport_unregister_driver);
-EXPORT_SYMBOL(parport_register_device);
-EXPORT_SYMBOL(parport_unregister_device);
-EXPORT_SYMBOL(parport_get_port);
-EXPORT_SYMBOL(parport_put_port);
-EXPORT_SYMBOL(parport_find_number);
-EXPORT_SYMBOL(parport_find_base);
 EXPORT_SYMBOL(parport_irq_handler);
 
 MODULE_LICENSE("GPL");
-- 
1.9.1


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

* [PATCH v2 04/11] parport: fix coding style
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
                   ` (2 preceding siblings ...)
  2015-10-28  9:11 ` [PATCH v2 03/11] parport: EXPORT_SYMBOL should follow function Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 05/11] parport: code indent should use tabs Sudip Mukherjee
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

The multi-line comments were not according to the kernel coding style.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 69 +++++++++++++++++++++++++++++++------------------
 1 file changed, 44 insertions(+), 25 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index d85e566..840c730 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -207,8 +207,10 @@ static void detach_driver_chain(struct parport *port)
 /* Ask kmod for some lowlevel drivers. */
 static void get_lowlevel_driver (void)
 {
-	/* There is no actual module called this: you should set
-	 * up an alias for modutils. */
+	/*
+	 * There is no actual module called this: you should set
+	 * up an alias for modutils.
+	 */
 	request_module ("parport_lowlevel");
 }
 
@@ -728,11 +730,12 @@ parport_register_device(struct parport *port, const char *name,
 		}
 	}
 
-	/* We up our own module reference count, and that of the port
-           on which a device is to be registered, to ensure that
-           neither of us gets unloaded while we sleep in (e.g.)
-           kmalloc.
-         */
+	/*
+	 * We up our own module reference count, and that of the port
+	 * on which a device is to be registered, to ensure that
+	 * neither of us gets unloaded while we sleep in (e.g.)
+	 * kmalloc.
+	 */
 	if (!try_module_get(port->ops->owner)) {
 		return NULL;
 	}
@@ -783,9 +786,11 @@ parport_register_device(struct parport *port, const char *name,
 	}
 
 	tmp->next = port->physport->devices;
-	wmb(); /* Make sure that tmp->next is written before it's
-                  added to the list; see comments marked 'no locking
-                  required' */
+	wmb(); /*
+		* Make sure that tmp->next is written before it's
+		* added to the list; see comments marked 'no locking
+		* required'
+		*/
 	if (port->physport->devices)
 		port->physport->devices->prev = tmp;
 	port->physport->devices = tmp;
@@ -1008,8 +1013,10 @@ void parport_unregister_device(struct pardevice *dev)
 
 	spin_unlock(&port->pardevice_lock);
 
-	/* Make sure we haven't left any pointers around in the wait
-	 * list. */
+	/*
+	 * Make sure we haven't left any pointers around in the wait
+	 * list.
+	 */
 	spin_lock_irq(&port->waitlist_lock);
 	if (dev->waitprev || dev->waitnext || port->waithead == dev) {
 		if (dev->waitprev)
@@ -1131,8 +1138,10 @@ int parport_claim(struct pardevice *dev)
 			goto blocked;
 
 		if (port->cad != oldcad) {
-			/* I think we'll actually deadlock rather than
-                           get here, but just in case.. */
+			/*
+			 * I think we'll actually deadlock rather than
+			 * get here, but just in case..
+			 */
 			printk(KERN_WARNING
 			       "%s: %s released port when preempted!\n",
 			       port->name, oldcad->name);
@@ -1185,9 +1194,11 @@ int parport_claim(struct pardevice *dev)
 	return 0;
 
 blocked:
-	/* If this is the first time we tried to claim the port, register an
-	   interest.  This is only allowed for devices sleeping in
-	   parport_claim_or_block(), or those with a wakeup function.  */
+	/*
+	 * If this is the first time we tried to claim the port, register an
+	 * interest.  This is only allowed for devices sleeping in
+	 * parport_claim_or_block(), or those with a wakeup function.
+	 */
 
 	/* The cad_lock is still held for writing here */
 	if (dev->waiting & 2 || dev->wakeup) {
@@ -1223,8 +1234,10 @@ int parport_claim_or_block(struct pardevice *dev)
 {
 	int r;
 
-	/* Signal to parport_claim() that we can wait even without a
-	   wakeup function.  */
+	/*
+	 * Signal to parport_claim() that we can wait even without a
+	 * wakeup function.
+	 */
 	dev->waiting = 2;
 
 	/* Try to claim the port.  If this fails, we need to sleep.  */
@@ -1242,8 +1255,10 @@ int parport_claim_or_block(struct pardevice *dev)
 		 * See also parport_release()
 		 */
 
-		/* If dev->waiting is clear now, an interrupt
-		   gave us the port and we would deadlock if we slept.  */
+		/*
+		 * If dev->waiting is clear now, an interrupt
+		 * gave us the port and we would deadlock if we slept.
+		 */
 		if (dev->waiting) {
 			wait_event_interruptible(dev->wait_q,
 						 !dev->waiting);
@@ -1316,8 +1331,10 @@ void parport_release(struct pardevice *dev)
 	/* Save control registers */
 	port->ops->save_state(port, dev->state);
 
-	/* If anybody is waiting, find out who's been there longest and
-	   then wake them up. (Note: no locking required) */
+	/*
+	 * If anybody is waiting, find out who's been there longest and
+	 * then wake them up. (Note: no locking required)
+	 */
 	/* !!! LOCKING IS NEEDED HERE */
 	for (pd = port->waithead; pd; pd = pd->waitnext) {
 		if (pd->waiting & 2) { /* sleeping in claim_or_block */
@@ -1334,8 +1351,10 @@ void parport_release(struct pardevice *dev)
 		}
 	}
 
-	/* Nobody was waiting, so walk the list to see if anyone is
-	   interested in being woken up. (Note: no locking required) */
+	/*
+	 * Nobody was waiting, so walk the list to see if anyone is
+	 * interested in being woken up. (Note: no locking required)
+	 */
 	/* !!! LOCKING IS NEEDED HERE */
 	for (pd = port->devices; (port->cad == NULL) && pd; pd = pd->next) {
 		if (pd->wakeup && pd != dev)
-- 
1.9.1


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

* [PATCH v2 05/11] parport: code indent should use tabs
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
                   ` (3 preceding siblings ...)
  2015-10-28  9:11 ` [PATCH v2 04/11] parport: fix coding style Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 06/11] parport: quoted strings should not be split Sudip Mukherjee
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

Code should be indented using tabs and not by space.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 840c730..388c138 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -455,7 +455,7 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 	tmp->dma = dma;
 	tmp->muxport = tmp->daisy = tmp->muxsel = -1;
 	tmp->modes = 0;
- 	INIT_LIST_HEAD(&tmp->list);
+	INIT_LIST_HEAD(&tmp->list);
 	tmp->devices = tmp->cad = NULL;
 	tmp->flags = 0;
 	tmp->ops = ops;
-- 
1.9.1


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

* [PATCH v2 06/11] parport: quoted strings should not be split
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
                   ` (4 preceding siblings ...)
  2015-10-28  9:11 ` [PATCH v2 05/11] parport: code indent should use tabs Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 07/11] parport: remove braces Sudip Mukherjee
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

user visible strings should not be split as that affects the ability to
grep.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 388c138..dcad902 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -537,9 +537,8 @@ void parport_announce_port (struct parport *port)
 #endif
 
 	if (!port->dev)
-		printk(KERN_WARNING "%s: fix this legacy "
-				"no-device port driver!\n",
-				port->name);
+		printk(KERN_WARNING "%s: fix this legacy no-device port driver!\n",
+		       port->name);
 
 	parport_proc_register(port);
 	mutex_lock(&registration_lock);
@@ -778,8 +777,8 @@ parport_register_device(struct parport *port, const char *name,
 		if (port->physport->devices) {
 			spin_unlock (&port->physport->pardevice_lock);
 			printk (KERN_DEBUG
-				"%s: cannot grant exclusive access for "
-				"device %s\n", port->name, name);
+				"%s: cannot grant exclusive access for device %s\n",
+				port->name, name);
 			goto out_free_all;
 		}
 		port->flags |= PARPORT_FLAG_EXCL;
@@ -1276,9 +1275,8 @@ int parport_claim_or_block(struct pardevice *dev)
 
 #ifdef PARPORT_DEBUG_SHARING
 		if (dev->port->physport->cad != dev)
-			printk(KERN_DEBUG "%s: exiting parport_claim_or_block "
-			       "but %s owns port!\n", dev->name,
-			       dev->port->physport->cad ?
+			printk(KERN_DEBUG "%s: exiting parport_claim_or_block but %s owns port!\n",
+			       dev->name, dev->port->physport->cad ?
 			       dev->port->physport->cad->name:"nobody");
 #endif
 	}
@@ -1306,8 +1304,8 @@ void parport_release(struct pardevice *dev)
 	write_lock_irqsave(&port->cad_lock, flags);
 	if (port->cad != dev) {
 		write_unlock_irqrestore (&port->cad_lock, flags);
-		printk(KERN_WARNING "%s: %s tried to release parport "
-		       "when not owner\n", port->name, dev->name);
+		printk(KERN_WARNING "%s: %s tried to release parport when not owner\n",
+		       port->name, dev->name);
 		return;
 	}
 
-- 
1.9.1


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

* [PATCH v2 07/11] parport: remove braces
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
                   ` (5 preceding siblings ...)
  2015-10-28  9:11 ` [PATCH v2 06/11] parport: quoted strings should not be split Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 08/11] parport: remove unnecessary out of memory message Sudip Mukherjee
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

checkpatch was complaining about braces for single statement block.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index dcad902..5dbd6f4 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -735,9 +735,8 @@ parport_register_device(struct parport *port, const char *name,
 	 * neither of us gets unloaded while we sleep in (e.g.)
 	 * kmalloc.
 	 */
-	if (!try_module_get(port->ops->owner)) {
+	if (!try_module_get(port->ops->owner))
 		return NULL;
-	}
 
 	parport_get_port (port);
 
@@ -1261,9 +1260,8 @@ int parport_claim_or_block(struct pardevice *dev)
 		if (dev->waiting) {
 			wait_event_interruptible(dev->wait_q,
 						 !dev->waiting);
-			if (signal_pending (current)) {
+			if (signal_pending (current))
 				return -EINTR;
-			}
 			r = 1;
 		} else {
 			r = 0;
-- 
1.9.1


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

* [PATCH v2 08/11] parport: remove unnecessary out of memory message
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
                   ` (6 preceding siblings ...)
  2015-10-28  9:11 ` [PATCH v2 07/11] parport: remove braces Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 09/11] parport: change style of NULL comparison Sudip Mukherjee
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

If kmalloc() or kzalloc() fails we will get sufficient messages in the logs,
no need to print these extra messages.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 5dbd6f4..441333b 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -444,10 +444,8 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 	int ret;
 
 	tmp = kzalloc(sizeof(struct parport), GFP_KERNEL);
-	if (!tmp) {
-		printk(KERN_WARNING "parport: memory squeeze\n");
+	if (!tmp)
 		return NULL;
-	}
 
 	/* Init our structure */
 	tmp->base = base;
@@ -473,7 +471,6 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 
 	name = kmalloc(15, GFP_KERNEL);
 	if (!name) {
-		printk(KERN_ERR "parport: memory squeeze\n");
 		kfree(tmp);
 		return NULL;
 	}
@@ -741,16 +738,12 @@ parport_register_device(struct parport *port, const char *name,
 	parport_get_port (port);
 
 	tmp = kmalloc(sizeof(struct pardevice), GFP_KERNEL);
-	if (tmp == NULL) {
-		printk(KERN_WARNING "%s: memory squeeze, couldn't register %s.\n", port->name, name);
+	if (tmp == NULL)
 		goto out;
-	}
 
 	tmp->state = kmalloc(sizeof(struct parport_state), GFP_KERNEL);
-	if (tmp->state == NULL) {
-		printk(KERN_WARNING "%s: memory squeeze, couldn't register %s.\n", port->name, name);
+	if (tmp->state == NULL)
 		goto out_free_pardevice;
-	}
 
 	tmp->name = name;
 	tmp->port = port;
-- 
1.9.1


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

* [PATCH v2 09/11] parport: change style of NULL comparison
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
                   ` (7 preceding siblings ...)
  2015-10-28  9:11 ` [PATCH v2 08/11] parport: remove unnecessary out of memory message Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 10/11] parport: remove unneeded space Sudip Mukherjee
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

checkpatch was complaining about NULL comparisons.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 441333b..ccd7df4 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -738,11 +738,11 @@ parport_register_device(struct parport *port, const char *name,
 	parport_get_port (port);
 
 	tmp = kmalloc(sizeof(struct pardevice), GFP_KERNEL);
-	if (tmp == NULL)
+	if (!tmp)
 		goto out;
 
 	tmp->state = kmalloc(sizeof(struct parport_state), GFP_KERNEL);
-	if (tmp->state == NULL)
+	if (!tmp->state)
 		goto out_free_pardevice;
 
 	tmp->name = name;
@@ -971,7 +971,7 @@ void parport_unregister_device(struct pardevice *dev)
 	struct parport *port;
 
 #ifdef PARPORT_PARANOID
-	if (dev == NULL) {
+	if (!dev) {
 		printk(KERN_ERR "parport_unregister_device: passed NULL\n");
 		return;
 	}
@@ -1345,7 +1345,7 @@ void parport_release(struct pardevice *dev)
 	 * interested in being woken up. (Note: no locking required)
 	 */
 	/* !!! LOCKING IS NEEDED HERE */
-	for (pd = port->devices; (port->cad == NULL) && pd; pd = pd->next) {
+	for (pd = port->devices; !port->cad && pd; pd = pd->next) {
 		if (pd->wakeup && pd != dev)
 			pd->wakeup(pd->private);
 	}
-- 
1.9.1


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

* [PATCH v2 10/11] parport: remove unneeded space
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
                   ` (8 preceding siblings ...)
  2015-10-28  9:11 ` [PATCH v2 09/11] parport: change style of NULL comparison Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-10-28  9:11 ` [PATCH v2 11/11] parport: avoid assignment in if Sudip Mukherjee
  2015-12-22  4:28 ` [PATCH v2 00/11] parport cleanup Sudip Mukherjee
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

checkpatch complains that space is prohibited between function name and
open parenthesis '('.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 94 ++++++++++++++++++++++++-------------------------
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index ccd7df4..b68f194 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -54,16 +54,16 @@ static LIST_HEAD(drivers);
 static DEFINE_MUTEX(registration_lock);
 
 /* What you can do to a port that's gone away.. */
-static void dead_write_lines (struct parport *p, unsigned char b){}
-static unsigned char dead_read_lines (struct parport *p) { return 0; }
-static unsigned char dead_frob_lines (struct parport *p, unsigned char b,
+static void dead_write_lines(struct parport *p, unsigned char b){}
+static unsigned char dead_read_lines(struct parport *p) { return 0; }
+static unsigned char dead_frob_lines(struct parport *p, unsigned char b,
 			     unsigned char c) { return 0; }
-static void dead_onearg (struct parport *p){}
-static void dead_initstate (struct pardevice *d, struct parport_state *s) { }
-static void dead_state (struct parport *p, struct parport_state *s) { }
-static size_t dead_write (struct parport *p, const void *b, size_t l, int f)
+static void dead_onearg(struct parport *p){}
+static void dead_initstate(struct pardevice *d, struct parport_state *s) { }
+static void dead_state(struct parport *p, struct parport_state *s) { }
+static size_t dead_write(struct parport *p, const void *b, size_t l, int f)
 { return 0; }
-static size_t dead_read (struct parport *p, void *b, size_t l, int f)
+static size_t dead_read(struct parport *p, void *b, size_t l, int f)
 { return 0; }
 static struct parport_operations dead_ops = {
 	.write_data	= dead_write_lines,	/* data */
@@ -194,7 +194,7 @@ static void detach_driver_chain(struct parport *port)
 	struct parport_driver *drv;
 	/* caller has exclusive registration_lock */
 	list_for_each_entry(drv, &drivers, list)
-		drv->detach (port);
+		drv->detach(port);
 
 	/*
 	 * call the detach function of the drivers registered in
@@ -205,13 +205,13 @@ static void detach_driver_chain(struct parport *port)
 }
 
 /* Ask kmod for some lowlevel drivers. */
-static void get_lowlevel_driver (void)
+static void get_lowlevel_driver(void)
 {
 	/*
 	 * There is no actual module called this: you should set
 	 * up an alias for modutils.
 	 */
-	request_module ("parport_lowlevel");
+	request_module("parport_lowlevel");
 }
 
 /*
@@ -267,7 +267,7 @@ int __parport_register_driver(struct parport_driver *drv, struct module *owner,
 			      const char *mod_name)
 {
 	if (list_empty(&portlist))
-		get_lowlevel_driver ();
+		get_lowlevel_driver();
 
 	if (drv->devmodel) {
 		/* using device model */
@@ -330,7 +330,7 @@ static int port_detach(struct device *dev, void *_drv)
  *	finished by the time this function returns.
  **/
 
-void parport_unregister_driver (struct parport_driver *drv)
+void parport_unregister_driver(struct parport_driver *drv)
 {
 	struct parport *port;
 
@@ -375,7 +375,7 @@ static void free_port(struct device *dev)
  *	until the matching parport_put_port() call.
  **/
 
-struct parport *parport_get_port (struct parport *port)
+struct parport *parport_get_port(struct parport *port)
 {
 	struct device *dev = get_device(&port->bus_dev);
 
@@ -398,7 +398,7 @@ EXPORT_SYMBOL(parport_del_port);
  *	zero (port is no longer used), free_port is called.
  **/
 
-void parport_put_port (struct parport *port)
+void parport_put_port(struct parport *port)
 {
 	put_device(&port->bus_dev);
 }
@@ -458,7 +458,7 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 	tmp->flags = 0;
 	tmp->ops = ops;
 	tmp->physport = tmp;
-	memset (tmp->probe_info, 0, 5 * sizeof (struct parport_device_info));
+	memset(tmp->probe_info, 0, 5 * sizeof(struct parport_device_info));
 	rwlock_init(&tmp->cad_lock);
 	spin_lock_init(&tmp->waitlist_lock);
 	spin_lock_init(&tmp->pardevice_lock);
@@ -466,7 +466,7 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,
 	tmp->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
 	sema_init(&tmp->ieee1284.irq, 0);
 	tmp->spintime = parport_default_spintime;
-	atomic_set (&tmp->ref_count, 1);
+	atomic_set(&tmp->ref_count, 1);
 	INIT_LIST_HEAD(&tmp->full_list);
 
 	name = kmalloc(15, GFP_KERNEL);
@@ -524,7 +524,7 @@ EXPORT_SYMBOL(parport_register_port);
  *	functions will be called, with @port as the parameter.
  **/
 
-void parport_announce_port (struct parport *port)
+void parport_announce_port(struct parport *port)
 {
 	int i;
 
@@ -549,7 +549,7 @@ void parport_announce_port (struct parport *port)
 	spin_unlock_irq(&parportlist_lock);
 
 	/* Let drivers know that new port(s) has arrived. */
-	attach_driver_chain (port);
+	attach_driver_chain(port);
 	for (i = 1; i < 3; i++) {
 		struct parport *slave = port->slaves[i-1];
 		if (slave)
@@ -585,7 +585,7 @@ void parport_remove_port(struct parport *port)
 	mutex_lock(&registration_lock);
 
 	/* Spread the word. */
-	detach_driver_chain (port);
+	detach_driver_chain(port);
 
 #ifdef CONFIG_PARPORT_1284
 	/* Forget the IEEE1284.3 topology of the port. */
@@ -700,7 +700,7 @@ parport_register_device(struct parport *port, const char *name,
 
 	if (port->physport->flags & PARPORT_FLAG_EXCL) {
 		/* An exclusive device is registered. */
-		printk (KERN_DEBUG "%s: no more devices allowed\n",
+		printk(KERN_DEBUG "%s: no more devices allowed\n",
 			port->name);
 		return NULL;
 	}
@@ -735,7 +735,7 @@ parport_register_device(struct parport *port, const char *name,
 	if (!try_module_get(port->ops->owner))
 		return NULL;
 
-	parport_get_port (port);
+	parport_get_port(port);
 
 	tmp = kmalloc(sizeof(struct pardevice), GFP_KERNEL);
 	if (!tmp)
@@ -767,8 +767,8 @@ parport_register_device(struct parport *port, const char *name,
 
 	if (flags & PARPORT_DEV_EXCL) {
 		if (port->physport->devices) {
-			spin_unlock (&port->physport->pardevice_lock);
-			printk (KERN_DEBUG
+			spin_unlock(&port->physport->pardevice_lock);
+			printk(KERN_DEBUG
 				"%s: cannot grant exclusive access for device %s\n",
 				port->name, name);
 			goto out_free_all;
@@ -807,7 +807,7 @@ parport_register_device(struct parport *port, const char *name,
  out_free_pardevice:
 	kfree(tmp);
  out:
-	parport_put_port (port);
+	parport_put_port(port);
 	module_put(port->ops->owner);
 
 	return NULL;
@@ -988,7 +988,7 @@ void parport_unregister_device(struct pardevice *dev)
 	if (port->cad == dev) {
 		printk(KERN_DEBUG "%s: %s forgot to release port\n",
 		       port->name, dev->name);
-		parport_release (dev);
+		parport_release(dev);
 	}
 
 	spin_lock(&port->pardevice_lock);
@@ -1028,7 +1028,7 @@ void parport_unregister_device(struct pardevice *dev)
 		kfree(dev);
 
 	module_put(port->ops->owner);
-	parport_put_port (port);
+	parport_put_port(port);
 }
 EXPORT_SYMBOL(parport_unregister_device);
 
@@ -1044,21 +1044,21 @@ EXPORT_SYMBOL(parport_unregister_device);
  *	gives you, use parport_put_port().
  */
 
-struct parport *parport_find_number (int number)
+struct parport *parport_find_number(int number)
 {
 	struct parport *port, *result = NULL;
 
 	if (list_empty(&portlist))
-		get_lowlevel_driver ();
+		get_lowlevel_driver();
 
-	spin_lock (&parportlist_lock);
+	spin_lock(&parportlist_lock);
 	list_for_each_entry(port, &portlist, list) {
 		if (port->number == number) {
-			result = parport_get_port (port);
+			result = parport_get_port(port);
 			break;
 		}
 	}
-	spin_unlock (&parportlist_lock);
+	spin_unlock(&parportlist_lock);
 	return result;
 }
 EXPORT_SYMBOL(parport_find_number);
@@ -1075,21 +1075,21 @@ EXPORT_SYMBOL(parport_find_number);
  *	gives you, use parport_put_port().
  */
 
-struct parport *parport_find_base (unsigned long base)
+struct parport *parport_find_base(unsigned long base)
 {
 	struct parport *port, *result = NULL;
 
 	if (list_empty(&portlist))
-		get_lowlevel_driver ();
+		get_lowlevel_driver();
 
-	spin_lock (&parportlist_lock);
+	spin_lock(&parportlist_lock);
 	list_for_each_entry(port, &portlist, list) {
 		if (port->base == base) {
-			result = parport_get_port (port);
+			result = parport_get_port(port);
 			break;
 		}
 	}
-	spin_unlock (&parportlist_lock);
+	spin_unlock(&parportlist_lock);
 	return result;
 }
 EXPORT_SYMBOL(parport_find_base);
@@ -1119,7 +1119,7 @@ int parport_claim(struct pardevice *dev)
 	}
 
 	/* Preempt any current device */
-	write_lock_irqsave (&port->cad_lock, flags);
+	write_lock_irqsave(&port->cad_lock, flags);
 	if ((oldcad = port->cad) != NULL) {
 		if (oldcad->preempt) {
 			if (oldcad->preempt(oldcad->private))
@@ -1146,7 +1146,7 @@ int parport_claim(struct pardevice *dev)
 		dev->waiting = 0;
 
 		/* Take ourselves out of the wait list again.  */
-		spin_lock_irq (&port->waitlist_lock);
+		spin_lock_irq(&port->waitlist_lock);
 		if (dev->waitprev)
 			dev->waitprev->waitnext = dev->waitnext;
 		else
@@ -1155,7 +1155,7 @@ int parport_claim(struct pardevice *dev)
 			dev->waitnext->waitprev = dev->waitprev;
 		else
 			port->waittail = dev->waitprev;
-		spin_unlock_irq (&port->waitlist_lock);
+		spin_unlock_irq(&port->waitlist_lock);
 		dev->waitprev = dev->waitnext = NULL;
 	}
 
@@ -1172,7 +1172,7 @@ int parport_claim(struct pardevice *dev)
 	/* If it's a daisy chain device, select it. */
 	if (dev->daisy >= 0) {
 		/* This could be lazier. */
-		if (!parport_daisy_select (port, dev->daisy,
+		if (!parport_daisy_select(port, dev->daisy,
 					   IEEE1284_MODE_COMPAT))
 			port->daisy = dev->daisy;
 	}
@@ -1193,7 +1193,7 @@ blocked:
 
 	/* The cad_lock is still held for writing here */
 	if (dev->waiting & 2 || dev->wakeup) {
-		spin_lock (&port->waitlist_lock);
+		spin_lock(&port->waitlist_lock);
 		if (test_and_set_bit(0, &dev->waiting) == 0) {
 			/* First add ourselves to the end of the wait list. */
 			dev->waitnext = NULL;
@@ -1204,9 +1204,9 @@ blocked:
 			} else
 				port->waithead = port->waittail = dev;
 		}
-		spin_unlock (&port->waitlist_lock);
+		spin_unlock(&port->waitlist_lock);
 	}
-	write_unlock_irqrestore (&port->cad_lock, flags);
+	write_unlock_irqrestore(&port->cad_lock, flags);
 	return -EAGAIN;
 }
 EXPORT_SYMBOL(parport_claim);
@@ -1253,7 +1253,7 @@ int parport_claim_or_block(struct pardevice *dev)
 		if (dev->waiting) {
 			wait_event_interruptible(dev->wait_q,
 						 !dev->waiting);
-			if (signal_pending (current))
+			if (signal_pending(current))
 				return -EINTR;
 			r = 1;
 		} else {
@@ -1294,7 +1294,7 @@ void parport_release(struct pardevice *dev)
 	/* Make sure that dev is the current device */
 	write_lock_irqsave(&port->cad_lock, flags);
 	if (port->cad != dev) {
-		write_unlock_irqrestore (&port->cad_lock, flags);
+		write_unlock_irqrestore(&port->cad_lock, flags);
 		printk(KERN_WARNING "%s: %s tried to release parport when not owner\n",
 		       port->name, dev->name);
 		return;
@@ -1309,7 +1309,7 @@ void parport_release(struct pardevice *dev)
 
 	/* If this is a daisy device, deselect it. */
 	if (dev->daisy >= 0) {
-		parport_daisy_deselect_all (port);
+		parport_daisy_deselect_all(port);
 		port->daisy = -1;
 	}
 #endif
-- 
1.9.1


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

* [PATCH v2 11/11] parport: avoid assignment in if
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
                   ` (9 preceding siblings ...)
  2015-10-28  9:11 ` [PATCH v2 10/11] parport: remove unneeded space Sudip Mukherjee
@ 2015-10-28  9:11 ` Sudip Mukherjee
  2015-12-22  4:28 ` [PATCH v2 00/11] parport cleanup Sudip Mukherjee
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-10-28  9:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

It is not an usual practise to assign some value to a variable in the if
test condition.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
 drivers/parport/share.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index b68f194..3308427 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -1120,7 +1120,8 @@ int parport_claim(struct pardevice *dev)
 
 	/* Preempt any current device */
 	write_lock_irqsave(&port->cad_lock, flags);
-	if ((oldcad = port->cad) != NULL) {
+	oldcad = port->cad;
+	if (oldcad) {
 		if (oldcad->preempt) {
 			if (oldcad->preempt(oldcad->private))
 				goto blocked;
-- 
1.9.1


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

* Re: [PATCH v2 00/11] parport cleanup
  2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
                   ` (10 preceding siblings ...)
  2015-10-28  9:11 ` [PATCH v2 11/11] parport: avoid assignment in if Sudip Mukherjee
@ 2015-12-22  4:28 ` Sudip Mukherjee
  11 siblings, 0 replies; 13+ messages in thread
From: Sudip Mukherjee @ 2015-12-22  4:28 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel

On Wed, Oct 28, 2015 at 02:41:29PM +0530, Sudip Mukherjee wrote:
> Hi Greg,
> A small series of checkpatch cleanup on parport. This is the first set.
> v1 had a problem with the From: line.
> Its only cleanup and no other change is done. All the patches are also
> sent along with this pull request for your convenience.
> This is my first pull request. Did i mess it up?

Hi Greg,
A gentle ping on this series.

regards
sudip

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

end of thread, other threads:[~2015-12-22  4:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-28  9:11 [PATCH v2 00/11] parport cleanup Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 01/11] parport: fix a trivial typo Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 02/11] parport: remove trailing white space Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 03/11] parport: EXPORT_SYMBOL should follow function Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 04/11] parport: fix coding style Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 05/11] parport: code indent should use tabs Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 06/11] parport: quoted strings should not be split Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 07/11] parport: remove braces Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 08/11] parport: remove unnecessary out of memory message Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 09/11] parport: change style of NULL comparison Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 10/11] parport: remove unneeded space Sudip Mukherjee
2015-10-28  9:11 ` [PATCH v2 11/11] parport: avoid assignment in if Sudip Mukherjee
2015-12-22  4:28 ` [PATCH v2 00/11] parport cleanup Sudip Mukherjee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox