Commit bbdd11fa authored by Manu Abraham's avatar Manu Abraham Committed by Mauro Carvalho Chehab

V4L/DVB (4432): Fix Circular dependencies

Signed-off-by: default avatarManu Abraham <manu@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent e4a49d76
...@@ -1715,6 +1715,15 @@ static int dst_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_paramet ...@@ -1715,6 +1715,15 @@ static int dst_get_frontend(struct dvb_frontend *fe, struct dvb_frontend_paramet
static void dst_release(struct dvb_frontend *fe) static void dst_release(struct dvb_frontend *fe)
{ {
struct dst_state *state = fe->demodulator_priv; struct dst_state *state = fe->demodulator_priv;
if (state->dst_ca) {
dvb_unregister_device(state->dst_ca);
#ifdef CONFIG_DVB_CORE_ATTACH
symbol_put(dst_ca_attach);
#endif
}
#ifdef CONFIG_DVB_CORE_ATTACH
symbol_put(dst_attach);
#endif
kfree(state); kfree(state);
} }
...@@ -1752,11 +1761,6 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad ...@@ -1752,11 +1761,6 @@ struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter *dvb_ad
} }
state->frontend.demodulator_priv = state; state->frontend.demodulator_priv = state;
/* Attach other DST peripherals if any */
/* Conditional Access device */
if (state->dst_hw_cap & DST_TYPE_HAS_CA)
dst_ca_attach(state, dvb_adapter);
return state; /* Manu (DST is a card not a frontend) */ return state; /* Manu (DST is a card not a frontend) */
} }
......
...@@ -699,11 +699,17 @@ static struct dvb_device dvbdev_ca = { ...@@ -699,11 +699,17 @@ static struct dvb_device dvbdev_ca = {
.fops = &dst_ca_fops .fops = &dst_ca_fops
}; };
void dst_ca_attach(struct dst_state *dst, struct dvb_adapter *dvb_adapter) struct dvb_device *dst_ca_attach(struct dst_state *dst, struct dvb_adapter *dvb_adapter)
{ {
struct dvb_device *dvbdev; struct dvb_device *dvbdev;
dprintk(verbose, DST_CA_ERROR, 1, "registering DST-CA device"); dprintk(verbose, DST_CA_ERROR, 1, "registering DST-CA device");
dvb_register_device(dvb_adapter, &dvbdev, &dvbdev_ca, dst, DVB_DEVICE_CA); if (dvb_register_device(dvb_adapter, &dvbdev, &dvbdev_ca, dst, DVB_DEVICE_CA) == 0) {
dst->dst_ca = dvbdev;
return dst->dst_ca;
}
return NULL;
} }
EXPORT_SYMBOL(dst_ca_attach); EXPORT_SYMBOL(dst_ca_attach);
......
...@@ -140,6 +140,7 @@ struct dst_state { ...@@ -140,6 +140,7 @@ struct dst_state {
char *tuner_name; char *tuner_name;
struct mutex dst_mutex; struct mutex dst_mutex;
u8 fw_name[8]; u8 fw_name[8];
struct dvb_device *dst_ca;
}; };
struct tuner_types { struct tuner_types {
...@@ -178,7 +179,7 @@ int write_dst(struct dst_state *state, u8 * data, u8 len); ...@@ -178,7 +179,7 @@ int write_dst(struct dst_state *state, u8 * data, u8 len);
int read_dst(struct dst_state *state, u8 * ret, u8 len); int read_dst(struct dst_state *state, u8 * ret, u8 len);
u8 dst_check_sum(u8 * buf, u32 len); u8 dst_check_sum(u8 * buf, u32 len);
struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter *dvb_adapter); struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter *dvb_adapter);
void dst_ca_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter); struct dvb_device *dst_ca_attach(struct dst_state *state, struct dvb_adapter *dvb_adapter);
int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int delay); int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, int delay);
int dst_command(struct dst_state* state, u8 * data, u8 len); int dst_command(struct dst_state* state, u8 * data, u8 len);
......
...@@ -669,13 +669,17 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) ...@@ -669,13 +669,17 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
state->config = &dst_config; state->config = &dst_config;
state->i2c = card->i2c_adapter; state->i2c = card->i2c_adapter;
state->bt = card->bt; state->bt = card->bt;
state->dst_ca = NULL;
/* DST is not a frontend, attaching the ASIC */ /* DST is not a frontend, attaching the ASIC */
if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) { if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) {
printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__); printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__);
break; break;
} }
/* Attach other DST peripherals if any */
/* Conditional Access device */
card->fe = &state->frontend; card->fe = &state->frontend;
if (state->dst_hw_cap & DST_TYPE_HAS_CA)
dvb_attach(dst_ca_attach, state, &card->dvb_adapter);
break; break;
case BTTV_BOARD_PINNACLESAT: case BTTV_BOARD_PINNACLESAT:
......
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