2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 12:43:55 +08:00

[media] lirc_zilog: Restore checks for existence of the IR_tx object

This reverts commit 8090232a23 and
adds an additional check for ir->tx == NULL.

The user may need us to handle an RX only unit.  Apparently
there are TV capture units in existence with Rx only wiring
and/or RX only firmware for the on-board Zilog Z8 IR unit.

Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Andy Walls 2011-01-26 21:06:43 -03:00 committed by Mauro Carvalho Chehab
parent b443ac5a28
commit 12d896e1c1

View File

@ -209,7 +209,8 @@ static int add_to_buf(struct IR *ir)
return -ENODATA; return -ENODATA;
} }
schedule_timeout((100 * HZ + 999) / 1000); schedule_timeout((100 * HZ + 999) / 1000);
ir->tx->need_boot = 1; if (ir->tx != NULL)
ir->tx->need_boot = 1;
++failures; ++failures;
mutex_unlock(&ir->ir_lock); mutex_unlock(&ir->ir_lock);
@ -1032,9 +1033,10 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
int result; int result;
unsigned long mode, features = 0; unsigned long mode, features = 0;
features |= LIRC_CAN_SEND_PULSE;
if (ir->rx != NULL) if (ir->rx != NULL)
features |= LIRC_CAN_REC_LIRCCODE; features |= LIRC_CAN_REC_LIRCCODE;
if (ir->tx != NULL)
features |= LIRC_CAN_SEND_PULSE;
switch (cmd) { switch (cmd) {
case LIRC_GET_LENGTH: case LIRC_GET_LENGTH:
@ -1061,9 +1063,15 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
result = -EINVAL; result = -EINVAL;
break; break;
case LIRC_GET_SEND_MODE: case LIRC_GET_SEND_MODE:
if (!(features&LIRC_CAN_SEND_MASK))
return -ENOSYS;
result = put_user(LIRC_MODE_PULSE, (unsigned long *) arg); result = put_user(LIRC_MODE_PULSE, (unsigned long *) arg);
break; break;
case LIRC_SET_SEND_MODE: case LIRC_SET_SEND_MODE:
if (!(features&LIRC_CAN_SEND_MASK))
return -ENOSYS;
result = get_user(mode, (unsigned long *) arg); result = get_user(mode, (unsigned long *) arg);
if (!result && mode != LIRC_MODE_PULSE) if (!result && mode != LIRC_MODE_PULSE)
return -EINVAL; return -EINVAL;
@ -1242,8 +1250,10 @@ static int ir_remove(struct i2c_client *client)
} }
/* Good-bye Tx */ /* Good-bye Tx */
i2c_set_clientdata(ir->tx->c, NULL); if (ir->tx != NULL) {
kfree(ir->tx); i2c_set_clientdata(ir->tx->c, NULL);
kfree(ir->tx);
}
/* Good-bye IR */ /* Good-bye IR */
del_ir_device(ir); del_ir_device(ir);
@ -1393,9 +1403,12 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
* after registering with lirc as otherwise hotplug seems to take * after registering with lirc as otherwise hotplug seems to take
* 10s to create the lirc device. * 10s to create the lirc device.
*/ */
ret = tx_init(ir->tx); if (ir->tx != NULL) {
if (ret != 0) /* Special TX init */
goto out_unregister; ret = tx_init(ir->tx);
if (ret != 0)
goto out_unregister;
}
zilog_info("probe of IR %s on %s (i2c-%d) done. IR unit ready.\n", zilog_info("probe of IR %s on %s (i2c-%d) done. IR unit ready.\n",
tx_probe ? "Tx" : "Rx", adap->name, adap->nr); tx_probe ? "Tx" : "Rx", adap->name, adap->nr);