mirror of
https://github.com/torvalds/linux.git
synced 2026-01-12 00:42:35 +08:00
media: tuners: Constify struct tunertype, tuner_range and tuner_params
'struct tunertype', 'struct tuner_range' and 'struct tuner_params' are not modified in this driver. Constifying these structures moves some data to a read-only section, so increase overall security. On a x86_64, with allmodconfig: Before: ====== 2877 8554 0 11431 2ca7 drivers/media/tuners/tuner-types.o After: ===== text data bss dec hex filename 11421 48 0 11469 2ccd drivers/media/tuners/tuner-types.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
committed by
Hans Verkuil
parent
d22d91fb1d
commit
70d4fd1200
@@ -112,7 +112,7 @@ struct tuner_simple_priv {
|
||||
struct list_head hybrid_tuner_instance_list;
|
||||
|
||||
unsigned int type;
|
||||
struct tunertype *tun;
|
||||
const struct tunertype *tun;
|
||||
|
||||
u32 frequency;
|
||||
u32 bandwidth;
|
||||
@@ -232,11 +232,11 @@ static inline char *tuner_param_name(enum param_type type)
|
||||
return name;
|
||||
}
|
||||
|
||||
static struct tuner_params *simple_tuner_params(struct dvb_frontend *fe,
|
||||
enum param_type desired_type)
|
||||
static const struct tuner_params *simple_tuner_params(struct dvb_frontend *fe,
|
||||
enum param_type desired_type)
|
||||
{
|
||||
struct tuner_simple_priv *priv = fe->tuner_priv;
|
||||
struct tunertype *tun = priv->tun;
|
||||
const struct tunertype *tun = priv->tun;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < tun->count; i++)
|
||||
@@ -257,7 +257,7 @@ static struct tuner_params *simple_tuner_params(struct dvb_frontend *fe,
|
||||
}
|
||||
|
||||
static int simple_config_lookup(struct dvb_frontend *fe,
|
||||
struct tuner_params *t_params,
|
||||
const struct tuner_params *t_params,
|
||||
unsigned *frequency, u8 *config, u8 *cb)
|
||||
{
|
||||
struct tuner_simple_priv *priv = fe->tuner_priv;
|
||||
@@ -549,7 +549,7 @@ static int simple_set_tv_freq(struct dvb_frontend *fe,
|
||||
u8 buffer[4];
|
||||
int rc, IFPCoff, i;
|
||||
enum param_type desired_type;
|
||||
struct tuner_params *t_params;
|
||||
const struct tuner_params *t_params;
|
||||
|
||||
/* IFPCoff = Video Intermediate Frequency - Vif:
|
||||
940 =16*58.75 NTSC/J (Japan)
|
||||
@@ -664,12 +664,12 @@ static int simple_set_tv_freq(struct dvb_frontend *fe,
|
||||
static int simple_set_radio_freq(struct dvb_frontend *fe,
|
||||
struct analog_parameters *params)
|
||||
{
|
||||
struct tunertype *tun;
|
||||
const struct tunertype *tun;
|
||||
struct tuner_simple_priv *priv = fe->tuner_priv;
|
||||
u8 buffer[4];
|
||||
u16 div;
|
||||
int rc, j;
|
||||
struct tuner_params *t_params;
|
||||
const struct tuner_params *t_params;
|
||||
unsigned int freq = params->frequency;
|
||||
bool mono = params->audmode == V4L2_TUNER_MODE_MONO;
|
||||
|
||||
@@ -848,8 +848,8 @@ static u32 simple_dvb_configure(struct dvb_frontend *fe, u8 *buf,
|
||||
{
|
||||
/* This function returns the tuned frequency on success, 0 on error */
|
||||
struct tuner_simple_priv *priv = fe->tuner_priv;
|
||||
struct tunertype *tun = priv->tun;
|
||||
struct tuner_params *t_params;
|
||||
const struct tunertype *tun = priv->tun;
|
||||
const struct tuner_params *t_params;
|
||||
u8 config, cb;
|
||||
u32 div;
|
||||
int ret;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -168,7 +168,7 @@ struct tuner_params {
|
||||
u16 iffreq;
|
||||
|
||||
unsigned int count;
|
||||
struct tuner_range *ranges;
|
||||
const struct tuner_range *ranges;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -189,7 +189,7 @@ struct tuner_params {
|
||||
struct tunertype {
|
||||
char *name;
|
||||
unsigned int count;
|
||||
struct tuner_params *params;
|
||||
const struct tuner_params *params;
|
||||
|
||||
u16 min;
|
||||
u16 max;
|
||||
@@ -199,7 +199,7 @@ struct tunertype {
|
||||
u8 *sleepdata;
|
||||
};
|
||||
|
||||
extern struct tunertype tuners[];
|
||||
extern const struct tunertype tuners[];
|
||||
extern unsigned const int tuner_count;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user