All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: lirc: mostly checkpatch cleanups
@ 2015-07-17 20:57 Maciek Borzecki
       [not found] ` <cover.1437165849.git.maciek.borzecki@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Maciek Borzecki @ 2015-07-17 20:57 UTC (permalink / raw)
  To: driverdev-devel, Greg Kroah-Hartman, Mauro Carvalho Chehab

A tiny patch series that addresses warnings identified by
checkpatch. The first patch fixes minor warning with unnecessary
brakes around single statement block.

The second patch does away with a custom dprintk() in favor of dev_dbg
and pr_debug(). The patch is sent separately as the change is more
'invasive' than the first one.

Maciek Borzecki (2):
  staging: media: lirc: fix various checkpatch warnings
  staging: media: lirc: lirc_serial: use dynamic debugs

 drivers/staging/media/lirc/lirc_imon.c   |  8 ++++----
 drivers/staging/media/lirc/lirc_sasem.c  |  4 ++--
 drivers/staging/media/lirc/lirc_serial.c | 25 +++++++------------------
 3 files changed, 13 insertions(+), 24 deletions(-)

-- 
2.4.6

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 1/2] staging: media: lirc: fix various checkpatch warnings
       [not found] ` <cover.1437165849.git.maciek.borzecki@gmail.com>
@ 2015-07-17 20:57   ` Maciek Borzecki
  2015-07-20  5:38     ` Sudip Mukherjee
  2015-07-17 20:57   ` [PATCH 2/2] staging: media: lirc: lirc_serial: use dynamic debugs Maciek Borzecki
  1 sibling, 1 reply; 9+ messages in thread
From: Maciek Borzecki @ 2015-07-17 20:57 UTC (permalink / raw)
  To: driverdev-devel, Greg Kroah-Hartman, Mauro Carvalho Chehab

Remove unnecessary brakes where appropriate.

This removes the following checkpatch warning:
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 drivers/staging/media/lirc/lirc_imon.c  | 8 ++++----
 drivers/staging/media/lirc/lirc_sasem.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c
index 62ec9f70dae4cd87dcf6fb60b1dd81df3d568b19..05d47dc8ffb8a987dc65287d36096a78cd5f96cd 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -785,13 +785,13 @@ static int imon_probe(struct usb_interface *interface,
 	}
 
 	driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
-	if (!driver) {
+	if (!driver)
 		goto free_context;
-	}
+
 	rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
-	if (!rbuf) {
+	if (!rbuf)
 		goto free_driver;
-	}
+
 	if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) {
 		dev_err(dev, "%s: lirc_buffer_init failed\n", __func__);
 		goto free_rbuf;
diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c
index 9e5674341abe7368e5ec228f737e4c2d766f7d80..8113c999ee00dbdb065aa100f27956a922f36bf9 100644
--- a/drivers/staging/media/lirc/lirc_sasem.c
+++ b/drivers/staging/media/lirc/lirc_sasem.c
@@ -181,10 +181,10 @@ static void deregister_from_lirc(struct sasem_context *context)
 	if (retval)
 		dev_err(&context->dev->dev,
 			"%s: unable to deregister from lirc (%d)\n",
-		       __func__, retval);
+			__func__, retval);
 	else
 		dev_info(&context->dev->dev,
-		         "Deregistered Sasem driver (minor:%d)\n", minor);
+			"Deregistered Sasem driver (minor:%d)\n", minor);
 
 }
 
-- 
2.4.6

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 2/2] staging: media: lirc: lirc_serial: use dynamic debugs
       [not found] ` <cover.1437165849.git.maciek.borzecki@gmail.com>
  2015-07-17 20:57   ` [PATCH 1/2] staging: media: lirc: fix various checkpatch warnings Maciek Borzecki
@ 2015-07-17 20:57   ` Maciek Borzecki
  1 sibling, 0 replies; 9+ messages in thread
From: Maciek Borzecki @ 2015-07-17 20:57 UTC (permalink / raw)
  To: driverdev-devel, Greg Kroah-Hartman, Mauro Carvalho Chehab

Replace custom debug macro dprintk() with pr_debug() or
dev_dbg(). Remove unused module param `debug`.

This removes the following checkpatch warning:
WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(...  to printk(KERN_DEBUG ...
+                       printk(KERN_DEBUG LIRC_DRIVER_NAME ": " \

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 drivers/staging/media/lirc/lirc_serial.c | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c
index dc7984455c3a7a051ea8db668c2fbeb9f64b43f3..c427202665d221cf1a2cbb6f446110fe43652a1d 100644
--- a/drivers/staging/media/lirc/lirc_serial.c
+++ b/drivers/staging/media/lirc/lirc_serial.c
@@ -109,17 +109,9 @@ static bool iommap;
 static int ioshift;
 static bool softcarrier = true;
 static bool share_irq;
-static bool debug;
 static int sense = -1;	/* -1 = auto, 0 = active high, 1 = active low */
 static bool txsense;	/* 0 = active high, 1 = active low */
 
-#define dprintk(fmt, args...)					\
-	do {							\
-		if (debug)					\
-			printk(KERN_DEBUG LIRC_DRIVER_NAME ": "	\
-			       fmt, ## args);			\
-	} while (0)
-
 /* forward declarations */
 static long send_pulse_irdeo(unsigned long length);
 static long send_pulse_homebrew(unsigned long length);
@@ -356,7 +348,7 @@ static int init_timing_params(unsigned int new_duty_cycle,
 	/* Derive pulse and space from the period */
 	pulse_width = period * duty_cycle / 100;
 	space_width = period - pulse_width;
-	dprintk("in init_timing_params, freq=%d, duty_cycle=%d, "
+	pr_debug("in init_timing_params, freq=%d, duty_cycle=%d, "
 		"clk/jiffy=%ld, pulse=%ld, space=%ld, "
 		"conv_us_to_clocks=%ld\n",
 		freq, duty_cycle, __this_cpu_read(cpu_info.loops_per_jiffy),
@@ -382,7 +374,7 @@ static int init_timing_params(unsigned int new_duty_cycle,
 	period = 256 * 1000000L / freq;
 	pulse_width = period * duty_cycle / 100;
 	space_width = period - pulse_width;
-	dprintk("in init_timing_params, freq=%d pulse=%ld, space=%ld\n",
+	pr_debug("in init_timing_params, freq=%d pulse=%ld, space=%ld\n",
 		freq, pulse_width, space_width);
 	return 0;
 }
@@ -555,7 +547,7 @@ static void rbwrite(int l)
 {
 	if (lirc_buffer_full(&rbuf)) {
 		/* no new signals will be accepted */
-		dprintk("Buffer overrun\n");
+		pr_debug("Buffer overrun\n");
 		return;
 	}
 	lirc_buffer_write(&rbuf, (void *)&l);
@@ -845,7 +837,7 @@ static int lirc_serial_probe(struct platform_device *dev)
 		dev_info(&dev->dev, "Manually using active %s receiver\n",
 			 sense ? "low" : "high");
 
-	dprintk("Interrupt %d, port %04x obtained\n", irq, io);
+	dev_dbg(&dev->dev, "Interrupt %d, port %04x obtained\n", irq, io);
 	return 0;
 }
 
@@ -950,7 +942,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 		return -ENOIOCTLCMD;
 
 	case LIRC_SET_SEND_DUTY_CYCLE:
-		dprintk("SET_SEND_DUTY_CYCLE\n");
+		pr_debug("SET_SEND_DUTY_CYCLE\n");
 		if (!(hardware[type].features&LIRC_CAN_SET_SEND_DUTY_CYCLE))
 			return -ENOIOCTLCMD;
 
@@ -962,7 +954,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 		return init_timing_params(value, freq);
 
 	case LIRC_SET_SEND_CARRIER:
-		dprintk("SET_SEND_CARRIER\n");
+		pr_debug("SET_SEND_CARRIER\n");
 		if (!(hardware[type].features&LIRC_CAN_SET_SEND_CARRIER))
 			return -ENOIOCTLCMD;
 
@@ -1157,7 +1149,7 @@ static void __exit lirc_serial_exit_module(void)
 {
 	lirc_unregister_driver(driver.minor);
 	lirc_serial_exit();
-	dprintk("cleaned up module\n");
+	pr_debug("cleaned up module\n");
 }
 
 
@@ -1208,6 +1200,3 @@ MODULE_PARM_DESC(txsense, "Sense of transmitter circuit"
 
 module_param(softcarrier, bool, S_IRUGO);
 MODULE_PARM_DESC(softcarrier, "Software carrier (0 = off, 1 = on, default on)");
-
-module_param(debug, bool, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(debug, "Enable debugging messages");
-- 
2.4.6

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH 1/2] staging: media: lirc: fix various checkpatch warnings
  2015-07-17 20:57   ` [PATCH 1/2] staging: media: lirc: fix various checkpatch warnings Maciek Borzecki
@ 2015-07-20  5:38     ` Sudip Mukherjee
  2015-07-20  6:57       ` Maciek Borzecki
  2015-07-20 16:10       ` [PATCH v2] " Maciek Borzecki
  0 siblings, 2 replies; 9+ messages in thread
From: Sudip Mukherjee @ 2015-07-20  5:38 UTC (permalink / raw)
  To: Maciek Borzecki
  Cc: Greg Kroah-Hartman, driverdev-devel, Mauro Carvalho Chehab

On Fri, Jul 17, 2015 at 10:57:44PM +0200, Maciek Borzecki wrote:
> Remove unnecessary brakes where appropriate.

brakes or braces?

regards
sudip
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH 1/2] staging: media: lirc: fix various checkpatch warnings
  2015-07-20  5:38     ` Sudip Mukherjee
@ 2015-07-20  6:57       ` Maciek Borzecki
  2015-07-20 16:10       ` [PATCH v2] " Maciek Borzecki
  1 sibling, 0 replies; 9+ messages in thread
From: Maciek Borzecki @ 2015-07-20  6:57 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Greg Kroah-Hartman, driverdev-devel, Mauro Carvalho Chehab

On Mon, Jul 20, 2015 at 7:38 AM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> On Fri, Jul 17, 2015 at 10:57:44PM +0200, Maciek Borzecki wrote:
>> Remove unnecessary brakes where appropriate.
>
> brakes or braces?

Right, I obviously meant braces. Unfortunate typo that the
spellchecker is still fine with.

Let me send a v2 of this.

Regards,
-- 
Maciek Borzecki
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH v2] staging: media: lirc: fix various checkpatch warnings
  2015-07-20  5:38     ` Sudip Mukherjee
  2015-07-20  6:57       ` Maciek Borzecki
@ 2015-07-20 16:10       ` Maciek Borzecki
  2015-07-21  6:19         ` Sudip Mukherjee
  1 sibling, 1 reply; 9+ messages in thread
From: Maciek Borzecki @ 2015-07-20 16:10 UTC (permalink / raw)
  To: driverdev-devel, Greg Kroah-Hartman, Mauro Carvalho Chehab,
	Sudip Mukherjee
  Cc: Maciek Borzecki

Remove unnecessary braces where appropriate. Fix non-tab
indentation.

This removes the following checkpatch warnings:
WARNING: braces {} are not necessary for single statement blocks

ERROR: code indent should use tabs where possible

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 drivers/staging/media/lirc/lirc_imon.c  | 8 ++++----
 drivers/staging/media/lirc/lirc_sasem.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c
index 62ec9f70dae4cd87dcf6fb60b1dd81df3d568b19..05d47dc8ffb8a987dc65287d36096a78cd5f96cd 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -785,13 +785,13 @@ static int imon_probe(struct usb_interface *interface,
 	}
 
 	driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
-	if (!driver) {
+	if (!driver)
 		goto free_context;
-	}
+
 	rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
-	if (!rbuf) {
+	if (!rbuf)
 		goto free_driver;
-	}
+
 	if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) {
 		dev_err(dev, "%s: lirc_buffer_init failed\n", __func__);
 		goto free_rbuf;
diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c
index 9e5674341abe7368e5ec228f737e4c2d766f7d80..8113c999ee00dbdb065aa100f27956a922f36bf9 100644
--- a/drivers/staging/media/lirc/lirc_sasem.c
+++ b/drivers/staging/media/lirc/lirc_sasem.c
@@ -181,10 +181,10 @@ static void deregister_from_lirc(struct sasem_context *context)
 	if (retval)
 		dev_err(&context->dev->dev,
 			"%s: unable to deregister from lirc (%d)\n",
-		       __func__, retval);
+			__func__, retval);
 	else
 		dev_info(&context->dev->dev,
-		         "Deregistered Sasem driver (minor:%d)\n", minor);
+			"Deregistered Sasem driver (minor:%d)\n", minor);
 
 }
 
-- 
2.4.6

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

* Re: [PATCH v2] staging: media: lirc: fix various checkpatch warnings
  2015-07-20 16:10       ` [PATCH v2] " Maciek Borzecki
@ 2015-07-21  6:19         ` Sudip Mukherjee
  2015-07-21  6:28           ` Maciek Borzecki
  0 siblings, 1 reply; 9+ messages in thread
From: Sudip Mukherjee @ 2015-07-21  6:19 UTC (permalink / raw)
  To: Maciek Borzecki
  Cc: Greg Kroah-Hartman, driverdev-devel, Mauro Carvalho Chehab

On Mon, Jul 20, 2015 at 06:10:04PM +0200, Maciek Borzecki wrote:
> Remove unnecessary braces where appropriate. Fix non-tab
> indentation.
> 
> This removes the following checkpatch warnings:
> WARNING: braces {} are not necessary for single statement blocks
> 
> ERROR: code indent should use tabs where possible
That becomes 2 different types of change.
This change was in your v1 also, I didn't notice :(
Please do only one type of change in one patch,

regards
sudip
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2] staging: media: lirc: fix various checkpatch warnings
  2015-07-21  6:19         ` Sudip Mukherjee
@ 2015-07-21  6:28           ` Maciek Borzecki
  2015-07-21  7:04             ` Sudip Mukherjee
  0 siblings, 1 reply; 9+ messages in thread
From: Maciek Borzecki @ 2015-07-21  6:28 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Greg Kroah-Hartman, driverdev-devel, Mauro Carvalho Chehab

On Tue, Jul 21, 2015 at 8:19 AM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:
> On Mon, Jul 20, 2015 at 06:10:04PM +0200, Maciek Borzecki wrote:
>> Remove unnecessary braces where appropriate. Fix non-tab
>> indentation.
>>
>> This removes the following checkpatch warnings:
>> WARNING: braces {} are not necessary for single statement blocks
>>
>> ERROR: code indent should use tabs where possible
> That becomes 2 different types of change.
> This change was in your v1 also, I didn't notice :(
> Please do only one type of change in one patch,

Could you look at the second patch[1] for any potential issues as well?
I'll then resubmit the whole set to avoid going back and forth.

[1] http://article.gmane.org/gmane.linux.drivers.driver-project.devel/72155

Regards,
-- 
Maciek Borzecki
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2] staging: media: lirc: fix various checkpatch warnings
  2015-07-21  6:28           ` Maciek Borzecki
@ 2015-07-21  7:04             ` Sudip Mukherjee
  0 siblings, 0 replies; 9+ messages in thread
From: Sudip Mukherjee @ 2015-07-21  7:04 UTC (permalink / raw)
  To: Maciek Borzecki
  Cc: driverdev-devel, Greg Kroah-Hartman, Mauro Carvalho Chehab

On Tue, Jul 21, 2015 at 08:28:06AM +0200, Maciek Borzecki wrote:
> On Tue, Jul 21, 2015 at 8:19 AM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> > On Mon, Jul 20, 2015 at 06:10:04PM +0200, Maciek Borzecki wrote:
> >> Remove unnecessary braces where appropriate. Fix non-tab
> >> indentation.
> >>
> >> This removes the following checkpatch warnings:
> >> WARNING: braces {} are not necessary for single statement blocks
> >>
> >> ERROR: code indent should use tabs where possible
> > That becomes 2 different types of change.
> > This change was in your v1 also, I didn't notice :(
> > Please do only one type of change in one patch,
> 
> Could you look at the second patch[1] for any potential issues as well?
> I'll then resubmit the whole set to avoid going back and forth.
> 
> [1] http://article.gmane.org/gmane.linux.drivers.driver-project.devel/72155
There was a minor alignment issue, when you changed it to pr_debug from
dprintk. run your patch through --strict option of checkpatch. other
than that looked ok.

regards
sudip

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

end of thread, other threads:[~2015-07-21  7:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-17 20:57 [PATCH 0/2] staging: lirc: mostly checkpatch cleanups Maciek Borzecki
     [not found] ` <cover.1437165849.git.maciek.borzecki@gmail.com>
2015-07-17 20:57   ` [PATCH 1/2] staging: media: lirc: fix various checkpatch warnings Maciek Borzecki
2015-07-20  5:38     ` Sudip Mukherjee
2015-07-20  6:57       ` Maciek Borzecki
2015-07-20 16:10       ` [PATCH v2] " Maciek Borzecki
2015-07-21  6:19         ` Sudip Mukherjee
2015-07-21  6:28           ` Maciek Borzecki
2015-07-21  7:04             ` Sudip Mukherjee
2015-07-17 20:57   ` [PATCH 2/2] staging: media: lirc: lirc_serial: use dynamic debugs Maciek Borzecki

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.