summaryrefslogtreecommitdiff
path: root/drivers/media/pci/cx88/cx88-input.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-11-19 19:27:30 -0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-11-25 07:50:20 -0200
commit399426cadf5b0539a5b2a4d805257ce8acc6aba2 (patch)
tree40dec68657fbd2904ec6da9c2082fd29d0f3b437 /drivers/media/pci/cx88/cx88-input.c
parent1d38971438157dc57f0a4be89abf23b472458633 (diff)
[media] cx88: make checkpatch.pl happy
Usually, I don't like fixing coding style issues on non-staging drivers, as it could be a mess pretty easy, and could become like a snow ball. That's the case of recent changes on two changesets: they disalign some statements. Yet, a care a lot with cx88 driver, as it was the first driver I touched at the Kernel, and I've been maintaining it since 2005. So, several of the coding style issues were due to my code. Per Andrey's suggestion, I ran checkpatch.pl in strict mode, with fixed several other issues, did some function alinments, but broke other alinments. So, I had to manually apply another round of manual fixes to make sure that everything is ok, and to make checkpatch happy with this patch. With this patch, checkpatch.pl is now happy when called with: ./scripts/checkpatch.pl -f --max-line-length=998 --ignore PREFER_PR_LEVEL Also, the 80-cols violations that made sense were fixed. Checkpatch would be happier if we convert it to use dev_foo(), but this is a more complex change. NOTE: there are some places with msleep(1). As this driver was written at the time that the default was to sleep at least 10ms on such calls (e. g. CONFIG_HZ=100), I replaced those calls by usleep_range(10000, 20000), with should be safe to avoid breakages. Fixes: 65bc2fe86e66 ("[media] cx88: convert it to use pr_foo() macros") Fixes: 7b61ba8ff838 ("[media] cx88: make checkpatch happier") Suggested-by: Andrey Utkin <andrey_utkin@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/pci/cx88/cx88-input.c')
-rw-r--r--drivers/media/pci/cx88/cx88-input.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
index c072b7ecc8d6..dcfea3502e42 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -62,11 +62,15 @@ static int ir_debug;
module_param(ir_debug, int, 0644); /* debug level [IR] */
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
-#define ir_dprintk(fmt, arg...) if (ir_debug) \
- printk(KERN_DEBUG "%s IR: " fmt, ir->core->name, ##arg)
+#define ir_dprintk(fmt, arg...) do { \
+ if (ir_debug) \
+ printk(KERN_DEBUG "%s IR: " fmt, ir->core->name, ##arg);\
+} while (0)
-#define dprintk(fmt, arg...) if (ir_debug) \
- printk(KERN_DEBUG "cx88 IR: " fmt, ##arg)
+#define dprintk(fmt, arg...) do { \
+ if (ir_debug) \
+ printk(KERN_DEBUG "cx88 IR: " fmt, ##arg); \
+} while (0)
/* ---------------------------------------------------------------------- */
@@ -79,16 +83,17 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
gpio = cx_read(ir->gpio_addr);
switch (core->boardnr) {
case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
- /* This board apparently uses a combination of 2 GPIO
- to represent the keys. Additionally, the second GPIO
- can be used for parity.
-
- Example:
-
- for key "5"
- gpio = 0x758, auxgpio = 0xe5 or 0xf5
- for key "Power"
- gpio = 0x758, auxgpio = 0xed or 0xfd
+ /*
+ * This board apparently uses a combination of 2 GPIO
+ * to represent the keys. Additionally, the second GPIO
+ * can be used for parity.
+ *
+ * Example:
+ *
+ * for key "5"
+ * gpio = 0x758, auxgpio = 0xe5 or 0xf5
+ * for key "Power"
+ * gpio = 0x758, auxgpio = 0xed or 0xfd
*/
auxgpio = cx_read(MO_GP1_IO);
@@ -142,7 +147,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
if (0 == (gpio & ir->mask_keyup))
rc_keydown_notimeout(ir->dev, RC_TYPE_NECX, scancode,
- 0);
+ 0);
else
rc_keyup(ir->dev);
@@ -231,12 +236,14 @@ int cx88_ir_start(struct cx88_core *core)
return 0;
}
+EXPORT_SYMBOL(cx88_ir_start);
void cx88_ir_stop(struct cx88_core *core)
{
if (core->ir->users)
__cx88_ir_stop(core);
}
+EXPORT_SYMBOL(cx88_ir_stop);
static int cx88_ir_open(struct rc_dev *rc)
{
@@ -508,7 +515,7 @@ int cx88_ir_fini(struct cx88_core *core)
struct cx88_IR *ir = core->ir;
/* skip detach on non attached boards */
- if (ir == NULL)
+ if (!ir)
return 0;
cx88_ir_stop(core);
@@ -576,7 +583,7 @@ static int get_key_pvr2000(struct IR_i2c *ir, enum rc_type *protocol,
}
dprintk("IR Key/Flags: (0x%02x/0x%02x)\n",
- code & 0xff, flags & 0xff);
+ code & 0xff, flags & 0xff);
*protocol = RC_TYPE_UNKNOWN;
*scancode = code & 0xff;
@@ -636,8 +643,8 @@ void cx88_i2c_init_ir(struct cx88_core *core)
info.platform_data = &core->init_data;
}
if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0,
- I2C_SMBUS_READ, 0,
- I2C_SMBUS_QUICK, NULL) >= 0) {
+ I2C_SMBUS_READ, 0,
+ I2C_SMBUS_QUICK, NULL) >= 0) {
info.addr = *addrp;
i2c_new_device(&core->i2c_adap, &info);
break;