[media] rc-core: lirc use unsigned int

Durations can never be negative, so it makes sense to consistently use
unsigned int for LIRC transmission. Contrary to the initial impression,
this shouldn't actually change the userspace API.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
此提交包含在:
David Härdeman
2011-04-28 12:13:58 -03:00
提交者 Mauro Carvalho Chehab
父節點 8a8cc952d3
當前提交 5588dc2b02
共有 9 個檔案被更改,包括 25 行新增44 行删除

查看文件

@@ -103,19 +103,19 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
{
struct lirc_codec *lirc;
struct rc_dev *dev;
int *txbuf; /* buffer with values to transmit */
int ret = 0;
unsigned int *txbuf; /* buffer with values to transmit */
ssize_t ret = 0;
size_t count;
lirc = lirc_get_pdata(file);
if (!lirc)
return -EFAULT;
if (n % sizeof(int))
if (n < sizeof(unsigned) || n % sizeof(unsigned))
return -EINVAL;
count = n / sizeof(int);
if (count > LIRCBUF_SIZE || count % 2 == 0 || n % sizeof(int) != 0)
count = n / sizeof(unsigned);
if (count > LIRCBUF_SIZE || count % 2 == 0)
return -EINVAL;
txbuf = memdup_user(buf, n);
@@ -129,7 +129,10 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
}
if (dev->tx_ir)
ret = dev->tx_ir(dev, txbuf, (u32)n);
ret = dev->tx_ir(dev, txbuf, count);
if (ret > 0)
ret *= sizeof(unsigned);
out:
kfree(txbuf);