aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-26 08:07:41 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-12-04 10:52:45 -0500
commita2ea5561173f5c2c14e6050b261d225acd99fa08 (patch)
treecdff8c08c5d0a7c5b321fd3427a18c271e5aefed
parent134e7e1cb378c438cc30169313888fb3ac3b6379 (diff)
[media] stv090x: remove export symbol for stv090x_set_gpio()
Drivers that use dvb_attach can have just one exported symbol, or they will cause compilation breakages depending on the selected frontends. As Jim reported: drivers/built-in.o: In function `technisat_usb2_set_voltage': technisat-usb2.c:(.text+0x3b4919): undefined reference to `stv090x_set_gpio' make: *** [vmlinux] Error 1 That happens because, on his configuration, the configuration is: CONFIG_DVB_USB=y CONFIG_DVB_STV090x=m Luis proposed ar way to fix, but that would just force the STV090x to be selected, even if one wants to use a device with a different frontend. Instead, let's do the right thing: move set_gpio to the configuration structure and fill it during dvb_attach(). This way, the driver can still call it, and dvb_attach() will load stv090x module only if the device really needs it. Reported by: Jim Davis <jim.epost@gmail.com> Cc: Luis Rodriguez <mcgrof@suse.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/dvb-frontends/stv090x.c9
-rw-r--r--drivers/media/dvb-frontends/stv090x.h16
-rw-r--r--drivers/media/usb/dvb-usb/technisat-usb2.c5
3 files changed, 14 insertions, 16 deletions
diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c
index f8050b984a8f..3489400bb08a 100644
--- a/drivers/media/dvb-frontends/stv090x.c
+++ b/drivers/media/dvb-frontends/stv090x.c
@@ -4870,8 +4870,8 @@ err:
4870 return -1; 4870 return -1;
4871} 4871}
4872 4872
4873int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio, u8 dir, u8 value, 4873static int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio, u8 dir,
4874 u8 xor_value) 4874 u8 value, u8 xor_value)
4875{ 4875{
4876 struct stv090x_state *state = fe->demodulator_priv; 4876 struct stv090x_state *state = fe->demodulator_priv;
4877 u8 reg = 0; 4877 u8 reg = 0;
@@ -4882,7 +4882,6 @@ int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio, u8 dir, u8 value,
4882 4882
4883 return stv090x_write_reg(state, STV090x_GPIOxCFG(gpio), reg); 4883 return stv090x_write_reg(state, STV090x_GPIOxCFG(gpio), reg);
4884} 4884}
4885EXPORT_SYMBOL(stv090x_set_gpio);
4886 4885
4887static struct dvb_frontend_ops stv090x_ops = { 4886static struct dvb_frontend_ops stv090x_ops = {
4888 .delsys = { SYS_DVBS, SYS_DVBS2, SYS_DSS }, 4887 .delsys = { SYS_DVBS, SYS_DVBS2, SYS_DSS },
@@ -4919,7 +4918,7 @@ static struct dvb_frontend_ops stv090x_ops = {
4919}; 4918};
4920 4919
4921 4920
4922struct dvb_frontend *stv090x_attach(const struct stv090x_config *config, 4921struct dvb_frontend *stv090x_attach(struct stv090x_config *config,
4923 struct i2c_adapter *i2c, 4922 struct i2c_adapter *i2c,
4924 enum stv090x_demodulator demod) 4923 enum stv090x_demodulator demod)
4925{ 4924{
@@ -4980,6 +4979,8 @@ struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
4980 if (config->diseqc_envelope_mode) 4979 if (config->diseqc_envelope_mode)
4981 stv090x_send_diseqc_burst(&state->frontend, SEC_MINI_A); 4980 stv090x_send_diseqc_burst(&state->frontend, SEC_MINI_A);
4982 4981
4982 config->set_gpio = stv090x_set_gpio;
4983
4983 dprintk(FE_ERROR, 1, "Attaching %s demodulator(%d) Cut=0x%02x", 4984 dprintk(FE_ERROR, 1, "Attaching %s demodulator(%d) Cut=0x%02x",
4984 state->device == STV0900 ? "STV0900" : "STV0903", 4985 state->device == STV0900 ? "STV0900" : "STV0903",
4985 demod, 4986 demod,
diff --git a/drivers/media/dvb-frontends/stv090x.h b/drivers/media/dvb-frontends/stv090x.h
index 0bd6adcfee8a..f7f452f435f2 100644
--- a/drivers/media/dvb-frontends/stv090x.h
+++ b/drivers/media/dvb-frontends/stv090x.h
@@ -101,18 +101,18 @@ struct stv090x_config {
101 int (*tuner_set_refclk) (struct dvb_frontend *fe, u32 refclk); 101 int (*tuner_set_refclk) (struct dvb_frontend *fe, u32 refclk);
102 int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status); 102 int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status);
103 void (*tuner_i2c_lock) (struct dvb_frontend *fe, int lock); 103 void (*tuner_i2c_lock) (struct dvb_frontend *fe, int lock);
104
105 /* dir = 0 -> output, dir = 1 -> input/open-drain */
106 int (*set_gpio)(struct dvb_frontend *fe, u8 gpio, u8 dir, u8 value,
107 u8 xor_value);
104}; 108};
105 109
106#if IS_ENABLED(CONFIG_DVB_STV090x) 110#if IS_ENABLED(CONFIG_DVB_STV090x)
107 111
108extern struct dvb_frontend *stv090x_attach(const struct stv090x_config *config, 112extern struct dvb_frontend *stv090x_attach(struct stv090x_config *config,
109 struct i2c_adapter *i2c, 113 struct i2c_adapter *i2c,
110 enum stv090x_demodulator demod); 114 enum stv090x_demodulator demod);
111 115
112/* dir = 0 -> output, dir = 1 -> input/open-drain */
113extern int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio,
114 u8 dir, u8 value, u8 xor_value);
115
116#else 116#else
117 117
118static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *config, 118static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *config,
@@ -123,12 +123,6 @@ static inline struct dvb_frontend *stv090x_attach(const struct stv090x_config *c
123 return NULL; 123 return NULL;
124} 124}
125 125
126static inline int stv090x_set_gpio(struct dvb_frontend *fe, u8 gpio,
127 u8 opd, u8 value, u8 xor_value)
128{
129 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
130 return -ENODEV;
131}
132#endif /* CONFIG_DVB_STV090x */ 126#endif /* CONFIG_DVB_STV090x */
133 127
134#endif /* __STV090x_H */ 128#endif /* __STV090x_H */
diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c
index 6b0b8b6b9e2a..5801ae7f672a 100644
--- a/drivers/media/usb/dvb-usb/technisat-usb2.c
+++ b/drivers/media/usb/dvb-usb/technisat-usb2.c
@@ -449,6 +449,8 @@ static int technisat_usb2_read_mac_address(struct dvb_usb_device *d,
449 return 0; 449 return 0;
450} 450}
451 451
452static struct stv090x_config technisat_usb2_stv090x_config;
453
452/* frontend attach */ 454/* frontend attach */
453static int technisat_usb2_set_voltage(struct dvb_frontend *fe, 455static int technisat_usb2_set_voltage(struct dvb_frontend *fe,
454 fe_sec_voltage_t voltage) 456 fe_sec_voltage_t voltage)
@@ -472,7 +474,8 @@ static int technisat_usb2_set_voltage(struct dvb_frontend *fe,
472 } 474 }
473 475
474 for (i = 0; i < 3; i++) 476 for (i = 0; i < 3; i++)
475 if (stv090x_set_gpio(fe, i+2, 0, gpio[i], 0) != 0) 477 if (technisat_usb2_stv090x_config.set_gpio(fe, i+2, 0,
478 gpio[i], 0) != 0)
476 return -EREMOTEIO; 479 return -EREMOTEIO;
477 return 0; 480 return 0;
478} 481}