Commit ab6c46e2 authored by Michael Krufky's avatar Michael Krufky Committed by Mauro Carvalho Chehab

V4L/DVB (7184): make hybrid_tuner_request_state tolerant of devices without i2c adapters

Some dvb demodulators access the tuner directly without using i2c.
In these cases, i2c_adap may be NULL.  This patch fixes
hybrid_tuner_request_state to allow for NULL i2c_adapters.
Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent bdb0aace
...@@ -83,7 +83,8 @@ static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props, ...@@ -83,7 +83,8 @@ static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props,
#define tuner_printk(kernlvl, i2cprops, fmt, arg...) do { \ #define tuner_printk(kernlvl, i2cprops, fmt, arg...) do { \
printk(kernlvl "%s %d-%04x: " fmt, i2cprops.name, \ printk(kernlvl "%s %d-%04x: " fmt, i2cprops.name, \
i2c_adapter_id(i2cprops.adap), \ i2cprops.adap ? \
i2c_adapter_id(i2cprops.adap) : -1, \
i2cprops.addr, ##arg); \ i2cprops.addr, ##arg); \
} while (0) } while (0)
...@@ -128,9 +129,10 @@ static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props, ...@@ -128,9 +129,10 @@ static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props,
({ \ ({ \
int __ret = 0; \ int __ret = 0; \
list_for_each_entry(state, &list, hybrid_tuner_instance_list) { \ list_for_each_entry(state, &list, hybrid_tuner_instance_list) { \
if ((i2c_adapter_id(state->i2c_props.adap) == \ if ((state->i2c_props.addr == i2caddr) && \
i2c_adapter_id(i2cadap)) && \ ((state->i2c_props.adap ? \
(state->i2c_props.addr == i2caddr)) { \ i2c_adapter_id(state->i2c_props.adap) : -1) == \
(i2cadap ? i2c_adapter_id(i2cadap) : -1))) { \
__tuner_info(state->i2c_props, \ __tuner_info(state->i2c_props, \
"attaching existing instance\n"); \ "attaching existing instance\n"); \
state->i2c_props.count++; \ state->i2c_props.count++; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment