Skip to contentSkip to conversation

IR fixes for v4.11

PATCH New Sean Young 2 participants 7 messages Jan 20, 2017

Subsystems (2)
lore
Share & tools
lore

Sean Young

author maintainer
#0 lore raw

cover IR fixes for v4.11

Testing of lirc uncovered some issue with tx-only devices, and some other minor issues.

Sean Young (4):
[media] lirc: fix transmit-only read features [media] rc: remove excessive spaces from error message [media] lirc: LIRC_GET_MIN_TIMEOUT should be in range [media] lirc: fix null dereference for tx-only devices

 drivers/media/rc/ir-lirc-codec.c | 7 ++++---
 drivers/media/rc/lirc_dev.c      | 2 +-
 drivers/media/rc/rc-main.c       | 3 +--
 3 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.9.3
author maintainer
#1 lore raw

PATCH 1/4 lirc: fix transmit-only read features

An RC device which is transmit-only shouldn't have the LIRC_CAN_REC_MODE2 feature.

---
 drivers/media/rc/ir-lirc-codec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/rc/ir-lirc-codec.c +3 -2
index 9e41305..e944507 100644
@@ -347,7 +347,7 @@ static int ir_lirc_register(struct rc_dev *dev)
 	struct lirc_driver *drv;
 	struct lirc_buffer *rbuf;
 	int rc = -ENOMEM;
-	unsigned long features;
+	unsigned long features = 0;
 
 	drv = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
 	if (!drv)
@@ -361,7 +361,8 @@ static int ir_lirc_register(struct rc_dev *dev)
 	if (rc)
 		goto rbuf_init_failed;
 
-	features = LIRC_CAN_REC_MODE2;
+	if (dev->driver_type != RC_DRIVER_IR_RAW_TX)
+		features |= LIRC_CAN_REC_MODE2;
 	if (dev->tx_ir) {
 		features |= LIRC_CAN_SEND_PULSE;
 		if (dev->s_tx_mask)
Signature · 1 line
2.9.3
#2 lore raw

Re: [PATCH 1/4] [media] lirc: fix transmit-only read features

reproduce:

Hi Sean,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.10-rc4 next-20170120]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Sean-Young/IR-fixes-for-v4-11/20170121-051556
base:   git://linuxtv.org/media_tree.git master
config: x86_64-rhel-7.2 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

drivers/media/rc/ir-lirc-codec.c: In function 'ir_lirc_register':

>> drivers/media/rc/ir-lirc-codec.c:358:26: error: 'RC_DRIVER_IR_RAW_TX' undeclared (first use in this function)
     if (dev->driver_type != RC_DRIVER_IR_RAW_TX)
                             ^~~~~~~~~~~~~~~~~~~

drivers/media/rc/ir-lirc-codec.c:358:26: note: each undeclared identifier is reported only once for each function it appears in

vim +/RC_DRIVER_IR_RAW_TX +358 drivers/media/rc/ir-lirc-codec.c

352 goto rbuf_alloc_failed;
353
354 rc = lirc_buffer_init(rbuf, sizeof(int), LIRCBUF_SIZE);
355 if (rc)
356 goto rbuf_init_failed;
357

 > 358		if (dev->driver_type != RC_DRIVER_IR_RAW_TX)

359 features |= LIRC_CAN_REC_MODE2;
360 if (dev->tx_ir) {
361 features |= LIRC_CAN_SEND_PULSE;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#3 lore raw

Re: [PATCH 1/4] [media] lirc: fix transmit-only read features

In reply to Sean Young
reproduce:

Hi Sean,

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.10-rc4 next-20170120]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Sean-Young/IR-fixes-for-v4-11/20170121-051556
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-x016-201703 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/uapi/linux/capability.h:16,
from include/linux/capability.h:15,
from include/linux/sched.h:15,
from drivers/media/rc/ir-lirc-codec.c:15:
drivers/media/rc/ir-lirc-codec.c: In function 'ir_lirc_register':
drivers/media/rc/ir-lirc-codec.c:358:26: error: 'RC_DRIVER_IR_RAW_TX' undeclared (first use in this function)

     if (dev->driver_type != RC_DRIVER_IR_RAW_TX)
                             ^
   include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/media/rc/ir-lirc-codec.c:358:2: note: in expansion of macro 'if'
     if (dev->driver_type != RC_DRIVER_IR_RAW_TX)
     ^~
   drivers/media/rc/ir-lirc-codec.c:358:26: note: each undeclared identifier is reported only once for each function it appears in
     if (dev->driver_type != RC_DRIVER_IR_RAW_TX)
                             ^
   include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/media/rc/ir-lirc-codec.c:358:2: note: in expansion of macro 'if'
     if (dev->driver_type != RC_DRIVER_IR_RAW_TX)
     ^~

vim +/if +358 drivers/media/rc/ir-lirc-codec.c

342 struct lirc_buffer *rbuf;
343 int rc = -ENOMEM;
344 unsigned long features = 0;
345
346 drv = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
347 if (!drv)
348 return rc;
349
350 rbuf = kzalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
351 if (!rbuf)
352 goto rbuf_alloc_failed;
353
354 rc = lirc_buffer_init(rbuf, sizeof(int), LIRCBUF_SIZE);
355 if (rc)
356 goto rbuf_init_failed;
357

 > 358		if (dev->driver_type != RC_DRIVER_IR_RAW_TX)

359 features |= LIRC_CAN_REC_MODE2;
360 if (dev->tx_ir) {
361 features |= LIRC_CAN_SEND_PULSE;
362 if (dev->s_tx_mask)
363 features |= LIRC_CAN_SET_TRANSMITTER_MASK;
364 if (dev->s_tx_carrier)
365 features |= LIRC_CAN_SET_SEND_CARRIER;
366 if (dev->s_tx_duty_cycle)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

author maintainer
#4 lore raw

PATCH 2/4 rc: remove excessive spaces from error message

In reply to Sean Young

rc_core: Loaded IR protocol module ir-jvc-decoder, but protocol jvc still not available

---
 drivers/media/rc/rc-main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/rc/rc-main.c +1 -2
index 075d7a9..2424946 100644
@@ -1084,8 +1084,7 @@ static void ir_raw_load_modules(u64 *protocols)
 		if (!(*protocols & proto_names[i].type & ~available))
 			continue;
 
-		pr_err("Loaded IR protocol module %s, \
-		       but protocol %s still not available\n",
+		pr_err("Loaded IR protocol module %s, but protocol %s still not available\n",
 		       proto_names[i].module_name,
 		       proto_names[i].name);
 		*protocols &= ~proto_names[i].type;
Signature · 1 line
2.9.3
author maintainer
#5 lore raw

PATCH 3/4 lirc: LIRC_GET_MIN_TIMEOUT should be in range

In reply to Sean Young

LIRC_SET_REC_TIMEOUT can fail if the value returned by LIRC_GET_MIN_TIMEOUT is set due to rounding errors.

---
 drivers/media/rc/ir-lirc-codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/ir-lirc-codec.c +1 -1
index e944507..8517d51 100644
@@ -279,7 +279,7 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
 	case LIRC_GET_MIN_TIMEOUT:
 		if (!dev->max_timeout)
 			return -ENOSYS;
-		val = dev->min_timeout / 1000;
+		val = DIV_ROUND_UP(dev->min_timeout, 1000);
 		break;
 
 	case LIRC_GET_MAX_TIMEOUT:
Signature · 1 line
2.9.3
author maintainer
#6 lore raw

PATCH 4/4 lirc: fix null dereference for tx-only devices

In reply to Sean Young

tx-only RC devices do not have a receive buffer.

---
 drivers/media/rc/lirc_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/lirc_dev.c +1 -1
index 7f5d109..18b4dae 100644
@@ -472,7 +472,7 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file)
 		if (retval) {
 			module_put(cdev->owner);
 			ir->open--;
-		} else {
+		} else if (ir->buf) {
 			lirc_buffer_clear(ir->buf);
 		}
 		if (ir->task)
Signature · 1 line
2.9.3