Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

authored by

Michael Krufky and committed by
Mauro Carvalho Chehab
ab6c46e2 bdb0aace

+6 -4
+6 -4
drivers/media/video/tuner-i2c.h
··· 83 83 84 84 #define tuner_printk(kernlvl, i2cprops, fmt, arg...) do { \ 85 85 printk(kernlvl "%s %d-%04x: " fmt, i2cprops.name, \ 86 - i2c_adapter_id(i2cprops.adap), \ 86 + i2cprops.adap ? \ 87 + i2c_adapter_id(i2cprops.adap) : -1, \ 87 88 i2cprops.addr, ##arg); \ 88 89 } while (0) 89 90 ··· 129 128 ({ \ 130 129 int __ret = 0; \ 131 130 list_for_each_entry(state, &list, hybrid_tuner_instance_list) { \ 132 - if ((i2c_adapter_id(state->i2c_props.adap) == \ 133 - i2c_adapter_id(i2cadap)) && \ 134 - (state->i2c_props.addr == i2caddr)) { \ 131 + if ((state->i2c_props.addr == i2caddr) && \ 132 + ((state->i2c_props.adap ? \ 133 + i2c_adapter_id(state->i2c_props.adap) : -1) == \ 134 + (i2cadap ? i2c_adapter_id(i2cadap) : -1))) { \ 135 135 __tuner_info(state->i2c_props, \ 136 136 "attaching existing instance\n"); \ 137 137 state->i2c_props.count++; \