aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndy Walls <awalls@md.metrocast.net>2011-01-15 20:32:33 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-01-19 08:46:08 -0500
commit8090232a237ab62e22307fc060097da1a283dd66 (patch)
treeb51f10f8805b75a55bb8ab23d3b699075aa0bf82 /drivers
parentb757730b022b4b1367d0435fcaa1b0a01e8aef42 (diff)
[media] lirc_zilog: Remove unneeded tests for existence of the IR Tx function
The driver is now structured so that it must handle an IR Tx unit for a Z8 IR chip, or it refuses to handle that Z8 IR chip. This allows us to assume that ir->tx != NULL in a few places in the driver, and also allows us to always report Tx is available to userspace. Get rid of unneeded tests for ir->tx == NULL and always report that Tx is available. Signed-off-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/lirc/lirc_zilog.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c
index f7aa5e4e98b3..24d4b52bd79e 100644
--- a/drivers/staging/lirc/lirc_zilog.c
+++ b/drivers/staging/lirc/lirc_zilog.c
@@ -206,8 +206,7 @@ static int add_to_buf(struct IR *ir)
206 return -ENODATA; 206 return -ENODATA;
207 } 207 }
208 schedule_timeout((100 * HZ + 999) / 1000); 208 schedule_timeout((100 * HZ + 999) / 1000);
209 if (ir->tx != NULL) 209 ir->tx->need_boot = 1;
210 ir->tx->need_boot = 1;
211 210
212 ++failures; 211 ++failures;
213 mutex_unlock(&ir->ir_lock); 212 mutex_unlock(&ir->ir_lock);
@@ -1010,10 +1009,9 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
1010 int result; 1009 int result;
1011 unsigned long mode, features = 0; 1010 unsigned long mode, features = 0;
1012 1011
1012 features |= LIRC_CAN_SEND_PULSE;
1013 if (ir->rx != NULL) 1013 if (ir->rx != NULL)
1014 features |= LIRC_CAN_REC_LIRCCODE; 1014 features |= LIRC_CAN_REC_LIRCCODE;
1015 if (ir->tx != NULL)
1016 features |= LIRC_CAN_SEND_PULSE;
1017 1015
1018 switch (cmd) { 1016 switch (cmd) {
1019 case LIRC_GET_LENGTH: 1017 case LIRC_GET_LENGTH:
@@ -1040,15 +1038,9 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
1040 result = -EINVAL; 1038 result = -EINVAL;
1041 break; 1039 break;
1042 case LIRC_GET_SEND_MODE: 1040 case LIRC_GET_SEND_MODE:
1043 if (!(features&LIRC_CAN_SEND_MASK))
1044 return -ENOSYS;
1045
1046 result = put_user(LIRC_MODE_PULSE, (unsigned long *) arg); 1041 result = put_user(LIRC_MODE_PULSE, (unsigned long *) arg);
1047 break; 1042 break;
1048 case LIRC_SET_SEND_MODE: 1043 case LIRC_SET_SEND_MODE:
1049 if (!(features&LIRC_CAN_SEND_MASK))
1050 return -ENOSYS;
1051
1052 result = get_user(mode, (unsigned long *) arg); 1044 result = get_user(mode, (unsigned long *) arg);
1053 if (!result && mode != LIRC_MODE_PULSE) 1045 if (!result && mode != LIRC_MODE_PULSE)
1054 return -EINVAL; 1046 return -EINVAL;
@@ -1380,12 +1372,9 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
1380 * after registering with lirc as otherwise hotplug seems to take 1372 * after registering with lirc as otherwise hotplug seems to take
1381 * 10s to create the lirc device. 1373 * 10s to create the lirc device.
1382 */ 1374 */
1383 if (ir->tx != NULL) { 1375 ret = tx_init(ir->tx);
1384 /* Special TX init */ 1376 if (ret != 0)
1385 ret = tx_init(ir->tx); 1377 goto out_unregister;
1386 if (ret != 0)
1387 goto out_unregister;
1388 }
1389 1378
1390 zilog_info("probe of IR %s on %s (i2c-%d) done. IR unit ready.\n", 1379 zilog_info("probe of IR %s on %s (i2c-%d) done. IR unit ready.\n",
1391 tx_probe ? "Tx" : "Rx", adap->name, adap->nr); 1380 tx_probe ? "Tx" : "Rx", adap->name, adap->nr);