aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/lirc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/media/lirc')
-rw-r--r--drivers/staging/media/lirc/lirc_bt829.c9
-rw-r--r--drivers/staging/media/lirc/lirc_imon.c17
-rw-r--r--drivers/staging/media/lirc/lirc_parallel.c5
-rw-r--r--drivers/staging/media/lirc/lirc_sasem.c5
-rw-r--r--drivers/staging/media/lirc/lirc_serial.c13
-rw-r--r--drivers/staging/media/lirc/lirc_sir.c1
-rw-r--r--drivers/staging/media/lirc/lirc_zilog.c9
7 files changed, 28 insertions, 31 deletions
diff --git a/drivers/staging/media/lirc/lirc_bt829.c b/drivers/staging/media/lirc/lirc_bt829.c
index fe010542ab4b..4c806ba41323 100644
--- a/drivers/staging/media/lirc/lirc_bt829.c
+++ b/drivers/staging/media/lirc/lirc_bt829.c
@@ -71,6 +71,7 @@ static struct lirc_driver atir_driver;
static struct pci_dev *do_pci_probe(void)
{
struct pci_dev *my_dev;
+
my_dev = pci_get_device(PCI_VENDOR_ID_ATI,
PCI_DEVICE_ID_ATI_264VT, NULL);
if (my_dev) {
@@ -96,6 +97,7 @@ static int atir_add_to_buf(void *data, struct lirc_buffer *buf)
{
unsigned char key;
int status;
+
status = poll_main();
key = (status >> 8) & 0xFF;
if (status & 0xFF) {
@@ -229,6 +231,7 @@ static void do_i2c_start(void)
static void do_i2c_stop(void)
{
unsigned char bits;
+
bits = do_get_bits() & 0xFD;
do_set_bits(bits);
cycle_delay(1);
@@ -333,6 +336,7 @@ static unsigned char seems_rd_byte(void)
static void do_set_bits(unsigned char new_bits)
{
int reg_val;
+
reg_val = read_index(0x34);
if (new_bits & 2) {
reg_val &= 0xFFFFFFDF;
@@ -383,16 +387,15 @@ static unsigned char do_get_bits(void)
static unsigned int read_index(unsigned char index)
{
unsigned char __iomem *addr;
- unsigned int value;
/* addr = pci_addr_lin + DATA_PCI_OFF + ((index & 0xFF) << 2); */
addr = pci_addr_lin + ((index & 0xFF) << 2);
- value = readl(addr);
- return value;
+ return readl(addr);
}
static void write_index(unsigned char index, unsigned int reg_val)
{
unsigned char __iomem *addr;
+
addr = pci_addr_lin + ((index & 0xFF) << 2);
writel(reg_val, addr);
}
diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c
index 96c76b33770b..726cc3a31856 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -489,7 +489,6 @@ static void usb_tx_callback(struct urb *urb)
*/
static int ir_open(void *data)
{
- int retval = 0;
struct imon_context *context;
/* prevent races with disconnect */
@@ -506,7 +505,7 @@ static int ir_open(void *data)
dev_info(context->driver->dev, "IR port opened\n");
mutex_unlock(&driver_lock);
- return retval;
+ return 0;
}
/**
@@ -615,8 +614,8 @@ static void imon_incoming_packet(struct imon_context *context,
return;
if (len != 8) {
- dev_warn(dev, "imon %s: invalid incoming packet "
- "size (len = %d, intf%d)\n", __func__, len, intf);
+ dev_warn(dev, "imon %s: invalid incoming packet size (len = %d, intf%d)\n",
+ __func__, len, intf);
return;
}
@@ -925,9 +924,8 @@ static int imon_probe(struct usb_interface *interface,
}
}
- dev_info(dev, "iMON device (%04x:%04x, intf%d) on "
- "usb<%d:%d> initialized\n", vendor, product, ifnum,
- usbdev->bus->busnum, usbdev->devnum);
+ dev_info(dev, "iMON device (%04x:%04x, intf%d) on usb<%d:%d> initialized\n",
+ vendor, product, ifnum, usbdev->bus->busnum, usbdev->devnum);
unlock:
mutex_unlock(&context->ctx_lock);
@@ -1021,7 +1019,6 @@ static int imon_suspend(struct usb_interface *intf, pm_message_t message)
static int imon_resume(struct usb_interface *intf)
{
- int rc = 0;
struct imon_context *context = usb_get_intfdata(intf);
usb_fill_int_urb(context->rx_urb, context->usbdev,
@@ -1031,9 +1028,7 @@ static int imon_resume(struct usb_interface *intf)
usb_rx_callback, context,
context->rx_endpoint->bInterval);
- rc = usb_submit_urb(context->rx_urb, GFP_ATOMIC);
-
- return rc;
+ return usb_submit_urb(context->rx_urb, GFP_ATOMIC);
}
module_usb_driver(imon_driver);
diff --git a/drivers/staging/media/lirc/lirc_parallel.c b/drivers/staging/media/lirc/lirc_parallel.c
index 672858a089f3..5156c2181016 100644
--- a/drivers/staging/media/lirc/lirc_parallel.c
+++ b/drivers/staging/media/lirc/lirc_parallel.c
@@ -177,10 +177,9 @@ static unsigned int init_lirc_timer(void)
pr_notice("using default timer: %u Hz\n",
default_timer);
return default_timer;
- } else {
- pr_info("%u Hz timer detected\n", newtimer);
- return newtimer; /* use detected value */
}
+ pr_info("%u Hz timer detected\n", newtimer);
+ return newtimer; /* use detected value */
}
pr_notice("no timer detected\n");
diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c
index 81f90e17e1e6..86ad811fda24 100644
--- a/drivers/staging/media/lirc/lirc_sasem.c
+++ b/drivers/staging/media/lirc/lirc_sasem.c
@@ -474,8 +474,6 @@ static void usb_tx_callback(struct urb *urb)
/* notify waiters that write has finished */
atomic_set(&context->tx.busy, 0);
complete(&context->tx.finished);
-
- return;
}
/**
@@ -562,7 +560,6 @@ static void ir_close(void *data)
}
mutex_unlock(&context->ctx_lock);
- return;
}
/**
@@ -664,7 +661,6 @@ static void usb_rx_callback(struct urb *urb)
}
usb_submit_urb(context->rx_urb, GFP_ATOMIC);
- return;
}
@@ -713,6 +709,7 @@ static int sasem_probe(struct usb_interface *interface,
struct usb_endpoint_descriptor *ep;
int ep_dir;
int ep_type;
+
ep = &iface_desc->endpoint [i].desc;
ep_dir = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK;
ep_type = ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c
index bae0d467093e..181b92bfe25d 100644
--- a/drivers/staging/media/lirc/lirc_serial.c
+++ b/drivers/staging/media/lirc/lirc_serial.c
@@ -496,6 +496,7 @@ static long send_pulse_homebrew_softcarrier(unsigned long length)
{
int flag;
unsigned long actual, target, d;
+
length <<= 8;
actual = 0; target = 0; flag = 0;
@@ -528,11 +529,10 @@ static long send_pulse_homebrew(unsigned long length)
if (softcarrier)
return send_pulse_homebrew_softcarrier(length);
- else {
- on();
- safe_udelay(length);
- return 0;
- }
+
+ on();
+ safe_udelay(length);
+ return 0;
}
static void send_space_irdeo(long length)
@@ -948,7 +948,6 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
case LIRC_GET_LENGTH:
return -ENOIOCTLCMD;
- break;
case LIRC_SET_SEND_DUTY_CYCLE:
dprintk("SET_SEND_DUTY_CYCLE\n");
@@ -961,7 +960,6 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
if (value <= 0 || value > 100)
return -EINVAL;
return init_timing_params(value, freq);
- break;
case LIRC_SET_SEND_CARRIER:
dprintk("SET_SEND_CARRIER\n");
@@ -974,7 +972,6 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
if (value > 500000 || value < 20000)
return -EINVAL;
return init_timing_params(duty_cycle, value);
- break;
default:
return lirc_dev_fop_ioctl(filep, cmd, arg);
diff --git a/drivers/staging/media/lirc/lirc_sir.c b/drivers/staging/media/lirc/lirc_sir.c
index 79da3adf1bd5..2ee55eaf2a53 100644
--- a/drivers/staging/media/lirc/lirc_sir.c
+++ b/drivers/staging/media/lirc/lirc_sir.c
@@ -280,6 +280,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
u32 __user *uptr = (u32 __user *)arg;
int retval = 0;
u32 value = 0;
+
if (cmd == LIRC_GET_FEATURES)
value = LIRC_CAN_SEND_PULSE | LIRC_CAN_REC_MODE2;
else if (cmd == LIRC_GET_SEND_MODE)
diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c
index 3259aacfd350..567feba0011c 100644
--- a/drivers/staging/media/lirc/lirc_zilog.c
+++ b/drivers/staging/media/lirc/lirc_zilog.c
@@ -258,7 +258,6 @@ static void release_ir_rx(struct kref *ref)
/* Don't put_ir_device(rx->ir) here; lock can't be freed yet */
ir->rx = NULL;
/* Don't do the kfree(rx) here; we still need to kill the poll thread */
- return;
}
static int put_ir_rx(struct IR_rx *rx, bool ir_devices_lock_held)
@@ -512,7 +511,6 @@ static int set_use_inc(void *data)
static void set_use_dec(void *data)
{
- return;
}
/* safe read of a uint32 (always network byte order) */
@@ -618,6 +616,7 @@ static int get_key_data(unsigned char *buf,
for (base = 0, lim = keys - 1; lim; lim >>= 1) {
/* Seek to block */
unsigned char *key_data;
+
pos = base + (lim >> 1);
key_data = key_block + (ndiffs + 1) * pos;
@@ -628,6 +627,7 @@ static int get_key_data(unsigned char *buf,
/* found, so unpack the diffs */
for (i = 0; i < ndiffs; ++i) {
unsigned char val;
+
if (!read_uint8(&key_data, endp, &val) ||
diffs[i] >= TX_BLOCK_SIZE)
goto corrupt;
@@ -656,6 +656,7 @@ static int send_data_block(struct IR_tx *tx, unsigned char *data_block)
for (i = 0; i < TX_BLOCK_SIZE;) {
int tosend = TX_BLOCK_SIZE - i;
+
if (tosend > 4)
tosend = 4;
buf[0] = (unsigned char)(i + 1);
@@ -838,6 +839,7 @@ static int fw_load(struct IR_tx *tx)
goto corrupt;
for (i = 0; i < num_global_fixed; ++i) {
unsigned char pos, val;
+
if (!read_uint8(&data, tx_data->endp, &pos) ||
!read_uint8(&data, tx_data->endp, &val) ||
pos >= TX_BLOCK_SIZE)
@@ -1336,6 +1338,7 @@ static int close(struct inode *node, struct file *filep)
{
/* find our IR struct */
struct IR *ir = filep->private_data;
+
if (ir == NULL) {
zilog_error("close: no private_data attached to the file!\n");
return -ENODEV;
@@ -1402,6 +1405,7 @@ static int ir_remove(struct i2c_client *client)
{
if (strncmp("ir_tx_z8", client->name, 8) == 0) {
struct IR_tx *tx = i2c_get_clientdata(client);
+
if (tx != NULL) {
mutex_lock(&tx->client_lock);
tx->c = NULL;
@@ -1410,6 +1414,7 @@ static int ir_remove(struct i2c_client *client)
}
} else if (strncmp("ir_rx_z8", client->name, 8) == 0) {
struct IR_rx *rx = i2c_get_clientdata(client);
+
if (rx != NULL) {
mutex_lock(&rx->client_lock);
rx->c = NULL;