linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] [media] staging: lirc: mostly checkpatch cleanups
@ 2015-09-04 20:04 Maciek Borzecki
  2015-09-04 20:04 ` [PATCH 1/3] [media] staging: lirc: remove unnecessary braces Maciek Borzecki
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maciek Borzecki @ 2015-09-04 20:04 UTC (permalink / raw)
  To: linux-media, devel, Mauro Carvalho Chehab, Jarod Wilson,
	Greg Kroah-Hartman
  Cc: maciek.borzecki

A tiny patch series that addresses warnings or errors identified by
checkpatch.

The patches were first submitted to driver-devel sometime in June.
While on driver-devel, Sudip Mukherjee helped to cleanup all
issues. I'm resending the set to linux-media so that they can be
picked up for the media tree.

The first patch fixes minor warning with unnecessary brakes around
single statement block. The second fixes non-tab indentation. The
third patch does away with a custom dprintk() in favor of dev_dbg and
pr_debug().


Maciek Borzecki (3):
  [media] staging: lirc: remove unnecessary braces
  [media] staging: lirc: fix indentation
  [media] staging: 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 | 32 ++++++++++----------------------
 3 files changed, 16 insertions(+), 28 deletions(-)

-- 
2.5.1


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

* [PATCH 1/3] [media] staging: lirc: remove unnecessary braces
  2015-09-04 20:04 [PATCH 0/3] [media] staging: lirc: mostly checkpatch cleanups Maciek Borzecki
@ 2015-09-04 20:04 ` Maciek Borzecki
  2015-09-04 20:04 ` [PATCH 2/3] [media] staging: lirc: fix indentation Maciek Borzecki
  2015-09-04 20:04 ` [PATCH 3/3] [media] staging: lirc: lirc_serial: use dynamic debugs Maciek Borzecki
  2 siblings, 0 replies; 4+ messages in thread
From: Maciek Borzecki @ 2015-09-04 20:04 UTC (permalink / raw)
  To: linux-media, devel, Mauro Carvalho Chehab, Jarod Wilson,
	Greg Kroah-Hartman
  Cc: maciek.borzecki

Remove unnecessary braces where appropriate.

This removes the following checkpatch warnings:
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 ++++----
 1 file changed, 4 insertions(+), 4 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;
-- 
2.5.1


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

* [PATCH 2/3] [media] staging: lirc: fix indentation
  2015-09-04 20:04 [PATCH 0/3] [media] staging: lirc: mostly checkpatch cleanups Maciek Borzecki
  2015-09-04 20:04 ` [PATCH 1/3] [media] staging: lirc: remove unnecessary braces Maciek Borzecki
@ 2015-09-04 20:04 ` Maciek Borzecki
  2015-09-04 20:04 ` [PATCH 3/3] [media] staging: lirc: lirc_serial: use dynamic debugs Maciek Borzecki
  2 siblings, 0 replies; 4+ messages in thread
From: Maciek Borzecki @ 2015-09-04 20:04 UTC (permalink / raw)
  To: linux-media, devel, Mauro Carvalho Chehab, Jarod Wilson,
	Greg Kroah-Hartman
  Cc: maciek.borzecki

Fix non-tab indentation.

This resolves the following checkpatch problem:
ERROR: code indent should use tabs where possible

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

diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c
index 9e5674341abe7368e5ec228f737e4c2d766f7d80..904a4667bbb8bebe3cb43bf5201be9d533ada07a 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.5.1


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

* [PATCH 3/3] [media] staging: lirc: lirc_serial: use dynamic debugs
  2015-09-04 20:04 [PATCH 0/3] [media] staging: lirc: mostly checkpatch cleanups Maciek Borzecki
  2015-09-04 20:04 ` [PATCH 1/3] [media] staging: lirc: remove unnecessary braces Maciek Borzecki
  2015-09-04 20:04 ` [PATCH 2/3] [media] staging: lirc: fix indentation Maciek Borzecki
@ 2015-09-04 20:04 ` Maciek Borzecki
  2 siblings, 0 replies; 4+ messages in thread
From: Maciek Borzecki @ 2015-09-04 20:04 UTC (permalink / raw)
  To: linux-media, devel, Mauro Carvalho Chehab, Jarod Wilson,
	Greg Kroah-Hartman
  Cc: maciek.borzecki

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 | 32 ++++++++++----------------------
 1 file changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c
index 465796a686c417f2c23716c8fcc32e9d51489eed..64a7b2fc5289b6c1c0c0cabfa865756fb92208ed 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);
@@ -352,10 +344,9 @@ 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, "
-		"clk/jiffy=%ld, pulse=%ld, space=%ld\n",
-		freq, duty_cycle, __this_cpu_read(cpu_info.loops_per_jiffy),
-		pulse_width, space_width);
+	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),
+		 pulse_width, space_width, conv_us_to_clocks);
 	return 0;
 }
 #else /* ! USE_RDTSC */
@@ -377,8 +368,8 @@ 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",
-		freq, pulse_width, space_width);
+	pr_debug("in init_timing_params, freq=%d pulse=%ld, space=%ld\n",
+		 freq, pulse_width, space_width);
 	return 0;
 }
 #endif /* USE_RDTSC */
@@ -500,7 +491,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);
@@ -790,7 +781,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;
 }
 
@@ -895,7 +886,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;
 
@@ -907,7 +898,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;
 
@@ -1102,7 +1093,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");
 }
 
 
@@ -1153,6 +1144,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.5.1


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

end of thread, other threads:[~2015-09-04 20:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-04 20:04 [PATCH 0/3] [media] staging: lirc: mostly checkpatch cleanups Maciek Borzecki
2015-09-04 20:04 ` [PATCH 1/3] [media] staging: lirc: remove unnecessary braces Maciek Borzecki
2015-09-04 20:04 ` [PATCH 2/3] [media] staging: lirc: fix indentation Maciek Borzecki
2015-09-04 20:04 ` [PATCH 3/3] [media] staging: lirc: lirc_serial: use dynamic debugs Maciek Borzecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).