Commit 2e4e98e7 authored by lawrence rust's avatar lawrence rust Committed by Mauro Carvalho Chehab

V4L/DVB: drivers/media: Make static data tables and strings const

Making static data const avoids allocation of additional r/w memory and
reduces initialisation time.  It also provides some additional opportunities
for compiler optimisations.
Signed-off-by: default avatarLawrence Rust <lvr@softsystem.co.uk>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent f71d7681
...@@ -1042,7 +1042,7 @@ static const struct dvb_tuner_ops xc5000_tuner_ops = { ...@@ -1042,7 +1042,7 @@ static const struct dvb_tuner_ops xc5000_tuner_ops = {
struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c, struct i2c_adapter *i2c,
struct xc5000_config *cfg) const struct xc5000_config *cfg)
{ {
struct xc5000_priv *priv = NULL; struct xc5000_priv *priv = NULL;
int instance; int instance;
......
...@@ -53,11 +53,11 @@ struct xc5000_config { ...@@ -53,11 +53,11 @@ struct xc5000_config {
(defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE)) (defined(CONFIG_MEDIA_TUNER_XC5000_MODULE) && defined(MODULE))
extern struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, extern struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c, struct i2c_adapter *i2c,
struct xc5000_config *cfg); const struct xc5000_config *cfg);
#else #else
static inline struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, static inline struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c, struct i2c_adapter *i2c,
struct xc5000_config *cfg) const struct xc5000_config *cfg)
{ {
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
return NULL; return NULL;
......
...@@ -260,7 +260,7 @@ struct dvb_frontend_ops { ...@@ -260,7 +260,7 @@ struct dvb_frontend_ops {
int (*init)(struct dvb_frontend* fe); int (*init)(struct dvb_frontend* fe);
int (*sleep)(struct dvb_frontend* fe); int (*sleep)(struct dvb_frontend* fe);
int (*write)(struct dvb_frontend* fe, u8* buf, int len); int (*write)(struct dvb_frontend* fe, const u8 buf[], int len);
/* if this is set, it overrides the default swzigzag */ /* if this is set, it overrides the default swzigzag */
int (*tune)(struct dvb_frontend* fe, int (*tune)(struct dvb_frontend* fe,
......
...@@ -75,7 +75,7 @@ static int jdvbt90502_single_reg_write(struct jdvbt90502_state *state, ...@@ -75,7 +75,7 @@ static int jdvbt90502_single_reg_write(struct jdvbt90502_state *state,
return 0; return 0;
} }
static int _jdvbt90502_write(struct dvb_frontend *fe, u8 *buf, int len) static int _jdvbt90502_write(struct dvb_frontend *fe, const u8 buf[], int len)
{ {
struct jdvbt90502_state *state = fe->demodulator_priv; struct jdvbt90502_state *state = fe->demodulator_priv;
int err, i; int err, i;
......
...@@ -310,7 +310,7 @@ static int cx24110_set_symbolrate (struct cx24110_state* state, u32 srate) ...@@ -310,7 +310,7 @@ static int cx24110_set_symbolrate (struct cx24110_state* state, u32 srate)
} }
static int _cx24110_pll_write (struct dvb_frontend* fe, u8 *buf, int len) static int _cx24110_pll_write (struct dvb_frontend* fe, const u8 buf[], int len)
{ {
struct cx24110_state *state = fe->demodulator_priv; struct cx24110_state *state = fe->demodulator_priv;
......
...@@ -662,7 +662,7 @@ static void lgs8gxx_release(struct dvb_frontend *fe) ...@@ -662,7 +662,7 @@ static void lgs8gxx_release(struct dvb_frontend *fe)
} }
static int lgs8gxx_write(struct dvb_frontend *fe, u8 *buf, int len) static int lgs8gxx_write(struct dvb_frontend *fe, const u8 buf[], int len)
{ {
struct lgs8gxx_state *priv = fe->demodulator_priv; struct lgs8gxx_state *priv = fe->demodulator_priv;
......
...@@ -69,7 +69,7 @@ static int mt352_single_write(struct dvb_frontend *fe, u8 reg, u8 val) ...@@ -69,7 +69,7 @@ static int mt352_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
return 0; return 0;
} }
static int _mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen) static int _mt352_write(struct dvb_frontend* fe, const u8 ibuf[], int ilen)
{ {
int err,i; int err,i;
for (i=0; i < ilen-1; i++) for (i=0; i < ilen-1; i++)
......
...@@ -63,7 +63,7 @@ static inline struct dvb_frontend* mt352_attach(const struct mt352_config* confi ...@@ -63,7 +63,7 @@ static inline struct dvb_frontend* mt352_attach(const struct mt352_config* confi
} }
#endif // CONFIG_DVB_MT352 #endif // CONFIG_DVB_MT352
static inline int mt352_write(struct dvb_frontend *fe, u8 *buf, int len) { static inline int mt352_write(struct dvb_frontend *fe, const u8 buf[], int len) {
int r = 0; int r = 0;
if (fe->ops.write) if (fe->ops.write)
r = fe->ops.write(fe, buf, len); r = fe->ops.write(fe, buf, len);
......
...@@ -268,7 +268,7 @@ static int si21_writereg(struct si21xx_state *state, u8 reg, u8 data) ...@@ -268,7 +268,7 @@ static int si21_writereg(struct si21xx_state *state, u8 reg, u8 data)
return (ret != 1) ? -EREMOTEIO : 0; return (ret != 1) ? -EREMOTEIO : 0;
} }
static int si21_write(struct dvb_frontend *fe, u8 *buf, int len) static int si21_write(struct dvb_frontend *fe, const u8 buf[], int len)
{ {
struct si21xx_state *state = fe->demodulator_priv; struct si21xx_state *state = fe->demodulator_priv;
......
...@@ -506,7 +506,7 @@ static struct dvb_tuner_ops stb6100_ops = { ...@@ -506,7 +506,7 @@ static struct dvb_tuner_ops stb6100_ops = {
}; };
struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe, struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
struct stb6100_config *config, const struct stb6100_config *config,
struct i2c_adapter *i2c) struct i2c_adapter *i2c)
{ {
struct stb6100_state *state = NULL; struct stb6100_state *state = NULL;
......
...@@ -97,13 +97,13 @@ struct stb6100_state { ...@@ -97,13 +97,13 @@ struct stb6100_state {
#if defined(CONFIG_DVB_STB6100) || (defined(CONFIG_DVB_STB6100_MODULE) && defined(MODULE)) #if defined(CONFIG_DVB_STB6100) || (defined(CONFIG_DVB_STB6100_MODULE) && defined(MODULE))
extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe, extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
struct stb6100_config *config, const struct stb6100_config *config,
struct i2c_adapter *i2c); struct i2c_adapter *i2c);
#else #else
static inline struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe, static inline struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
struct stb6100_config *config, const struct stb6100_config *config,
struct i2c_adapter *i2c) struct i2c_adapter *i2c)
{ {
printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__); printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
......
...@@ -78,7 +78,7 @@ static int stv0288_writeregI(struct stv0288_state *state, u8 reg, u8 data) ...@@ -78,7 +78,7 @@ static int stv0288_writeregI(struct stv0288_state *state, u8 reg, u8 data)
return (ret != 1) ? -EREMOTEIO : 0; return (ret != 1) ? -EREMOTEIO : 0;
} }
static int stv0288_write(struct dvb_frontend *fe, u8 *buf, int len) static int stv0288_write(struct dvb_frontend *fe, const u8 buf[], int len)
{ {
struct stv0288_state *state = fe->demodulator_priv; struct stv0288_state *state = fe->demodulator_priv;
......
...@@ -92,7 +92,7 @@ static int stv0299_writeregI (struct stv0299_state* state, u8 reg, u8 data) ...@@ -92,7 +92,7 @@ static int stv0299_writeregI (struct stv0299_state* state, u8 reg, u8 data)
return (ret != 1) ? -EREMOTEIO : 0; return (ret != 1) ? -EREMOTEIO : 0;
} }
static int stv0299_write(struct dvb_frontend* fe, u8 *buf, int len) static int stv0299_write(struct dvb_frontend* fe, const u8 buf[], int len)
{ {
struct stv0299_state* state = fe->demodulator_priv; struct stv0299_state* state = fe->demodulator_priv;
......
...@@ -65,7 +65,7 @@ struct stv0299_config ...@@ -65,7 +65,7 @@ struct stv0299_config
* First of each pair is the register, second is the value. * First of each pair is the register, second is the value.
* List should be terminated with an 0xff, 0xff pair. * List should be terminated with an 0xff, 0xff pair.
*/ */
u8* inittab; const u8* inittab;
/* master clock to use */ /* master clock to use */
u32 mclk; u32 mclk;
......
...@@ -598,7 +598,7 @@ static int tda1004x_decode_fec(int tdafec) ...@@ -598,7 +598,7 @@ static int tda1004x_decode_fec(int tdafec)
return -1; return -1;
} }
static int tda1004x_write(struct dvb_frontend* fe, u8 *buf, int len) static int tda1004x_write(struct dvb_frontend* fe, const u8 buf[], int len)
{ {
struct tda1004x_state* state = fe->demodulator_priv; struct tda1004x_state* state = fe->demodulator_priv;
......
...@@ -64,7 +64,7 @@ static int zl10353_single_write(struct dvb_frontend *fe, u8 reg, u8 val) ...@@ -64,7 +64,7 @@ static int zl10353_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
return 0; return 0;
} }
static int zl10353_write(struct dvb_frontend *fe, u8 *ibuf, int ilen) static int zl10353_write(struct dvb_frontend *fe, const u8 ibuf[], int ilen)
{ {
int err, i; int err, i;
for (i = 0; i < ilen - 1; i++) for (i = 0; i < ilen - 1; i++)
......
...@@ -94,7 +94,7 @@ typedef struct cx88_audio_dev snd_cx88_card_t; ...@@ -94,7 +94,7 @@ typedef struct cx88_audio_dev snd_cx88_card_t;
****************************************************************************/ ****************************************************************************/
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static const char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1}; static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 1};
module_param_array(enable, bool, NULL, 0444); module_param_array(enable, bool, NULL, 0444);
...@@ -131,7 +131,7 @@ static int _cx88_start_audio_dma(snd_cx88_card_t *chip) ...@@ -131,7 +131,7 @@ static int _cx88_start_audio_dma(snd_cx88_card_t *chip)
{ {
struct cx88_audio_buffer *buf = chip->buf; struct cx88_audio_buffer *buf = chip->buf;
struct cx88_core *core=chip->core; struct cx88_core *core=chip->core;
struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25]; const struct sram_channel *audio_ch = &cx88_sram_channels[SRAM_CH25];
/* Make sure RISC/FIFO are off before changing FIFO/RISC settings */ /* Make sure RISC/FIFO are off before changing FIFO/RISC settings */
cx_clear(MO_AUD_DMACNTRL, 0x11); cx_clear(MO_AUD_DMACNTRL, 0x11);
...@@ -197,7 +197,7 @@ static int _cx88_stop_audio_dma(snd_cx88_card_t *chip) ...@@ -197,7 +197,7 @@ static int _cx88_stop_audio_dma(snd_cx88_card_t *chip)
/* /*
* BOARD Specific: IRQ dma bits * BOARD Specific: IRQ dma bits
*/ */
static char *cx88_aud_irqs[32] = { static const char *cx88_aud_irqs[32] = {
"dn_risci1", "up_risci1", "rds_dn_risc1", /* 0-2 */ "dn_risci1", "up_risci1", "rds_dn_risc1", /* 0-2 */
NULL, /* reserved */ NULL, /* reserved */
"dn_risci2", "up_risci2", "rds_dn_risc2", /* 4-6 */ "dn_risci2", "up_risci2", "rds_dn_risc2", /* 4-6 */
...@@ -308,7 +308,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip) ...@@ -308,7 +308,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
* Digital hardware definition * Digital hardware definition
*/ */
#define DEFAULT_FIFO_SIZE 4096 #define DEFAULT_FIFO_SIZE 4096
static struct snd_pcm_hardware snd_cx88_digital_hw = { static const struct snd_pcm_hardware snd_cx88_digital_hw = {
.info = SNDRV_PCM_INFO_MMAP | .info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_BLOCK_TRANSFER |
...@@ -533,7 +533,7 @@ static struct snd_pcm_ops snd_cx88_pcm_ops = { ...@@ -533,7 +533,7 @@ static struct snd_pcm_ops snd_cx88_pcm_ops = {
/* /*
* create a PCM device * create a PCM device
*/ */
static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, char *name) static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, const char *name)
{ {
int err; int err;
struct snd_pcm *pcm; struct snd_pcm *pcm;
...@@ -614,7 +614,7 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol, ...@@ -614,7 +614,7 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
static const DECLARE_TLV_DB_SCALE(snd_cx88_db_scale, -6300, 100, 0); static const DECLARE_TLV_DB_SCALE(snd_cx88_db_scale, -6300, 100, 0);
static struct snd_kcontrol_new snd_cx88_volume = { static const struct snd_kcontrol_new snd_cx88_volume = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_TLV_READ, SNDRV_CTL_ELEM_ACCESS_TLV_READ,
...@@ -656,7 +656,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol, ...@@ -656,7 +656,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
return ret; return ret;
} }
static struct snd_kcontrol_new snd_cx88_dac_switch = { static const struct snd_kcontrol_new snd_cx88_dac_switch = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Playback Switch", .name = "Playback Switch",
.info = snd_ctl_boolean_mono_info, .info = snd_ctl_boolean_mono_info,
...@@ -665,7 +665,7 @@ static struct snd_kcontrol_new snd_cx88_dac_switch = { ...@@ -665,7 +665,7 @@ static struct snd_kcontrol_new snd_cx88_dac_switch = {
.private_value = (1<<8), .private_value = (1<<8),
}; };
static struct snd_kcontrol_new snd_cx88_source_switch = { static const struct snd_kcontrol_new snd_cx88_source_switch = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Capture Switch", .name = "Capture Switch",
.info = snd_ctl_boolean_mono_info, .info = snd_ctl_boolean_mono_info,
...@@ -683,7 +683,7 @@ static struct snd_kcontrol_new snd_cx88_source_switch = { ...@@ -683,7 +683,7 @@ static struct snd_kcontrol_new snd_cx88_source_switch = {
* Only boards with eeprom and byte 1 at eeprom=1 have it * Only boards with eeprom and byte 1 at eeprom=1 have it
*/ */
static struct pci_device_id cx88_audio_pci_tbl[] __devinitdata = { static const struct pci_device_id const cx88_audio_pci_tbl[] __devinitdata = {
{0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
{0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
{0, } {0, }
......
...@@ -2673,10 +2673,10 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) ...@@ -2673,10 +2673,10 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/* some GDI (was: Modular Technology) specific stuff */ /* some GDI (was: Modular Technology) specific stuff */
static struct { static const struct {
int id; int id;
int fm; int fm;
char *name; const char *name;
} gdi_tuner[] = { } gdi_tuner[] = {
[ 0x01 ] = { .id = TUNER_ABSENT, [ 0x01 ] = { .id = TUNER_ABSENT,
.name = "NTSC_M" }, .name = "NTSC_M" },
...@@ -2710,7 +2710,7 @@ static struct { ...@@ -2710,7 +2710,7 @@ static struct {
static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data) static void gdi_eeprom(struct cx88_core *core, u8 *eeprom_data)
{ {
char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner)) const char *name = (eeprom_data[0x0d] < ARRAY_SIZE(gdi_tuner))
? gdi_tuner[eeprom_data[0x0d]].name : NULL; ? gdi_tuner[eeprom_data[0x0d]].name : NULL;
info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown"); info_printk(core, "GDI: tuner=%s\n", name ? name : "unknown");
......
...@@ -253,7 +253,7 @@ cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf) ...@@ -253,7 +253,7 @@ cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf)
* 0x0c00 - FIFOs * 0x0c00 - FIFOs
*/ */
struct sram_channel cx88_sram_channels[] = { const struct sram_channel const cx88_sram_channels[] = {
[SRAM_CH21] = { [SRAM_CH21] = {
.name = "video y / packed", .name = "video y / packed",
.cmds_start = 0x180040, .cmds_start = 0x180040,
...@@ -353,7 +353,7 @@ struct sram_channel cx88_sram_channels[] = { ...@@ -353,7 +353,7 @@ struct sram_channel cx88_sram_channels[] = {
}; };
int cx88_sram_channel_setup(struct cx88_core *core, int cx88_sram_channel_setup(struct cx88_core *core,
struct sram_channel *ch, const struct sram_channel *ch,
unsigned int bpl, u32 risc) unsigned int bpl, u32 risc)
{ {
unsigned int i,lines; unsigned int i,lines;
...@@ -394,7 +394,7 @@ int cx88_sram_channel_setup(struct cx88_core *core, ...@@ -394,7 +394,7 @@ int cx88_sram_channel_setup(struct cx88_core *core,
static int cx88_risc_decode(u32 risc) static int cx88_risc_decode(u32 risc)
{ {
static char *instr[16] = { static const char * const instr[16] = {
[ RISC_SYNC >> 28 ] = "sync", [ RISC_SYNC >> 28 ] = "sync",
[ RISC_WRITE >> 28 ] = "write", [ RISC_WRITE >> 28 ] = "write",
[ RISC_WRITEC >> 28 ] = "writec", [ RISC_WRITEC >> 28 ] = "writec",
...@@ -406,14 +406,14 @@ static int cx88_risc_decode(u32 risc) ...@@ -406,14 +406,14 @@ static int cx88_risc_decode(u32 risc)
[ RISC_WRITECM >> 28 ] = "writecm", [ RISC_WRITECM >> 28 ] = "writecm",
[ RISC_WRITECR >> 28 ] = "writecr", [ RISC_WRITECR >> 28 ] = "writecr",
}; };
static int incr[16] = { static int const incr[16] = {
[ RISC_WRITE >> 28 ] = 2, [ RISC_WRITE >> 28 ] = 2,
[ RISC_JUMP >> 28 ] = 2, [ RISC_JUMP >> 28 ] = 2,
[ RISC_WRITERM >> 28 ] = 3, [ RISC_WRITERM >> 28 ] = 3,
[ RISC_WRITECM >> 28 ] = 3, [ RISC_WRITECM >> 28 ] = 3,
[ RISC_WRITECR >> 28 ] = 4, [ RISC_WRITECR >> 28 ] = 4,
}; };
static char *bits[] = { static const char * const bits[] = {
"12", "13", "14", "resync", "12", "13", "14", "resync",
"cnt0", "cnt1", "18", "19", "cnt0", "cnt1", "18", "19",
"20", "21", "22", "23", "20", "21", "22", "23",
...@@ -432,9 +432,9 @@ static int cx88_risc_decode(u32 risc) ...@@ -432,9 +432,9 @@ static int cx88_risc_decode(u32 risc)
void cx88_sram_channel_dump(struct cx88_core *core, void cx88_sram_channel_dump(struct cx88_core *core,
struct sram_channel *ch) const struct sram_channel *ch)
{ {
static char *name[] = { static const char * const name[] = {
"initial risc", "initial risc",
"cdt base", "cdt base",
"cdt size", "cdt size",
...@@ -489,14 +489,14 @@ void cx88_sram_channel_dump(struct cx88_core *core, ...@@ -489,14 +489,14 @@ void cx88_sram_channel_dump(struct cx88_core *core,
core->name,cx_read(ch->cnt2_reg)); core->name,cx_read(ch->cnt2_reg));
} }
static char *cx88_pci_irqs[32] = { static const char *cx88_pci_irqs[32] = {
"vid", "aud", "ts", "vip", "hst", "5", "6", "tm1", "vid", "aud", "ts", "vip", "hst", "5", "6", "tm1",
"src_dma", "dst_dma", "risc_rd_err", "risc_wr_err", "src_dma", "dst_dma", "risc_rd_err", "risc_wr_err",
"brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err", "brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err",
"i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1" "i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
}; };
void cx88_print_irqbits(char *name, char *tag, char **strings, void cx88_print_irqbits(const char *name, const char *tag, const char *strings[],
int len, u32 bits, u32 mask) int len, u32 bits, u32 mask)
{ {
unsigned int i; unsigned int i;
...@@ -770,7 +770,7 @@ static const u32 xtal = 28636363; ...@@ -770,7 +770,7 @@ static const u32 xtal = 28636363;
static int set_pll(struct cx88_core *core, int prescale, u32 ofreq) static int set_pll(struct cx88_core *core, int prescale, u32 ofreq)
{ {
static u32 pre[] = { 0, 0, 0, 3, 2, 1 }; static const u32 pre[] = { 0, 0, 0, 3, 2, 1 };
u64 pll; u64 pll;
u32 reg; u32 reg;
int i; int i;
...@@ -1020,15 +1020,15 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm) ...@@ -1020,15 +1020,15 @@ int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm)
struct video_device *cx88_vdev_init(struct cx88_core *core, struct video_device *cx88_vdev_init(struct cx88_core *core,
struct pci_dev *pci, struct pci_dev *pci,
struct video_device *template, const struct video_device *template_,
char *type) const char *type)
{ {
struct video_device *vfd; struct video_device *vfd;
vfd = video_device_alloc(); vfd = video_device_alloc();
if (NULL == vfd) if (NULL == vfd)
return NULL; return NULL;
*vfd = *template; *vfd = *template_;
vfd->v4l2_dev = &core->v4l2_dev; vfd->v4l2_dev = &core->v4l2_dev;
vfd->parent = &pci->dev; vfd->parent = &pci->dev;
vfd->release = video_device_release; vfd->release = video_device_release;
......
...@@ -230,7 +230,7 @@ static s32 detect_btsc(struct cx88_core *core, s16 x[], u32 N) ...@@ -230,7 +230,7 @@ static s32 detect_btsc(struct cx88_core *core, s16 x[], u32 N)
static s16 *read_rds_samples(struct cx88_core *core, u32 *N) static s16 *read_rds_samples(struct cx88_core *core, u32 *N)
{ {
struct sram_channel *srch = &cx88_sram_channels[SRAM_CH27]; const struct sram_channel *srch = &cx88_sram_channels[SRAM_CH27];
s16 *samples; s16 *samples;
unsigned int i; unsigned int i;
......
This diff is collapsed.
...@@ -108,7 +108,7 @@ static const struct i2c_algo_bit_data cx8800_i2c_algo_template = { ...@@ -108,7 +108,7 @@ static const struct i2c_algo_bit_data cx8800_i2c_algo_template = {
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
static char *i2c_devs[128] = { static const char * const i2c_devs[128] = {
[ 0x1c >> 1 ] = "lgdt330x", [ 0x1c >> 1 ] = "lgdt330x",
[ 0x86 >> 1 ] = "tda9887/cx22702", [ 0x86 >> 1 ] = "tda9887/cx22702",
[ 0xa0 >> 1 ] = "eeprom", [ 0xa0 >> 1 ] = "eeprom",
...@@ -117,7 +117,7 @@ static char *i2c_devs[128] = { ...@@ -117,7 +117,7 @@ static char *i2c_devs[128] = {
[ 0xc8 >> 1 ] = "xc5000", [ 0xc8 >> 1 ] = "xc5000",
}; };
static void do_i2c_scan(char *name, struct i2c_client *c) static void do_i2c_scan(const char *name, struct i2c_client *c)
{ {
unsigned char buf; unsigned char buf;
int i,rc; int i,rc;
......
...@@ -313,7 +313,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) ...@@ -313,7 +313,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
static void do_cancel_buffers(struct cx8802_dev *dev, char *reason, int restart) static void do_cancel_buffers(struct cx8802_dev *dev, const char *reason, int restart)
{ {
struct cx88_dmaqueue *q = &dev->mpegq; struct cx88_dmaqueue *q = &dev->mpegq;
struct cx88_buffer *buf; struct cx88_buffer *buf;
...@@ -358,7 +358,7 @@ static void cx8802_timeout(unsigned long data) ...@@ -358,7 +358,7 @@ static void cx8802_timeout(unsigned long data)
do_cancel_buffers(dev,"timeout",1); do_cancel_buffers(dev,"timeout",1);
} }
static char *cx88_mpeg_irqs[32] = { static const char * cx88_mpeg_irqs[32] = {
"ts_risci1", NULL, NULL, NULL, "ts_risci1", NULL, NULL, NULL,
"ts_risci2", NULL, NULL, NULL, "ts_risci2", NULL, NULL, NULL,
"ts_oflow", NULL, NULL, NULL, "ts_oflow", NULL, NULL, NULL,
...@@ -849,7 +849,7 @@ static void __devexit cx8802_remove(struct pci_dev *pci_dev) ...@@ -849,7 +849,7 @@ static void __devexit cx8802_remove(struct pci_dev *pci_dev)
kfree(dev); kfree(dev);
} }
static struct pci_device_id cx8802_pci_tbl[] = { static const struct pci_device_id cx8802_pci_tbl[] = {
{ {
.vendor = 0x14f1, .vendor = 0x14f1,
.device = 0x8802, .device = 0x8802,
......
...@@ -70,7 +70,7 @@ MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, " ...@@ -70,7 +70,7 @@ MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, "
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
static char *aud_ctl_names[64] = { static const char * const aud_ctl_names[64] = {
[EN_BTSC_FORCE_MONO] = "BTSC_FORCE_MONO", [EN_BTSC_FORCE_MONO] = "BTSC_FORCE_MONO",
[EN_BTSC_FORCE_STEREO] = "BTSC_FORCE_STEREO", [EN_BTSC_FORCE_STEREO] = "BTSC_FORCE_STEREO",
[EN_BTSC_FORCE_SAP] = "BTSC_FORCE_SAP", [EN_BTSC_FORCE_SAP] = "BTSC_FORCE_SAP",
...@@ -809,8 +809,8 @@ void cx88_newstation(struct cx88_core *core) ...@@ -809,8 +809,8 @@ void cx88_newstation(struct cx88_core *core)
void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t) void cx88_get_stereo(struct cx88_core *core, struct v4l2_tuner *t)
{ {
static char *m[] = { "stereo", "dual mono", "mono", "sap" }; static const char * const m[] = { "stereo", "dual mono", "mono", "sap" };
static char *p[] = { "no pilot", "pilot c1", "pilot c2", "?" }; static const char * const p[] = { "no pilot", "pilot c1", "pilot c2", "?" };
u32 reg, mode, pilot; u32 reg, mode, pilot;
reg = cx_read(AUD_STATUS); reg = cx_read(AUD_STATUS);
......
...@@ -230,7 +230,7 @@ static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb) ...@@ -230,7 +230,7 @@ static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
cx88_free_buffer(q,buf); cx88_free_buffer(q,buf);
} }
struct videobuf_queue_ops cx8800_vbi_qops = { const struct videobuf_queue_ops cx8800_vbi_qops = {
.buf_setup = vbi_setup, .buf_setup = vbi_setup,
.buf_prepare = vbi_prepare, .buf_prepare = vbi_prepare,
.buf_queue = vbi_queue, .buf_queue = vbi_queue,
......
...@@ -78,7 +78,7 @@ MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes"); ...@@ -78,7 +78,7 @@ MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes");
/* ------------------------------------------------------------------- */ /* ------------------------------------------------------------------- */
/* static data */ /* static data */
static struct cx8800_fmt formats[] = { static const struct cx8800_fmt formats[] = {
{ {
.name = "8 bpp, gray", .name = "8 bpp, gray",
.fourcc = V4L2_PIX_FMT_GREY, .fourcc = V4L2_PIX_FMT_GREY,
...@@ -142,7 +142,7 @@ static struct cx8800_fmt formats[] = { ...@@ -142,7 +142,7 @@ static struct cx8800_fmt formats[] = {
}, },
}; };
static struct cx8800_fmt* format_by_fourcc(unsigned int fourcc) static const struct cx8800_fmt* format_by_fourcc(unsigned int fourcc)
{ {
unsigned int i; unsigned int i;
...@@ -159,7 +159,7 @@ static const struct v4l2_queryctrl no_ctl = { ...@@ -159,7 +159,7 @@ static const struct v4l2_queryctrl no_ctl = {
.flags = V4L2_CTRL_FLAG_DISABLED, .flags = V4L2_CTRL_FLAG_DISABLED,
}; };
static struct cx88_ctrl cx8800_ctls[] = { static const struct cx88_ctrl cx8800_ctls[] = {
/* --- video --- */ /* --- video --- */
{ {
.v = { .v = {
...@@ -288,7 +288,7 @@ static struct cx88_ctrl cx8800_ctls[] = { ...@@ -288,7 +288,7 @@ static struct cx88_ctrl cx8800_ctls[] = {
.shift = 0, .shift = 0,
} }
}; };
static const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls); enum { CX8800_CTLS = ARRAY_SIZE(cx8800_ctls) };
/* Must be sorted from low to high control ID! */ /* Must be sorted from low to high control ID! */
const u32 cx88_user_ctrls[] = { const u32 cx88_user_ctrls[] = {
...@@ -306,7 +306,7 @@ const u32 cx88_user_ctrls[] = { ...@@ -306,7 +306,7 @@ const u32 cx88_user_ctrls[] = {
}; };
EXPORT_SYMBOL(cx88_user_ctrls); EXPORT_SYMBOL(cx88_user_ctrls);
static const u32 *ctrl_classes[] = { static const u32 * const ctrl_classes[] = {
cx88_user_ctrls, cx88_user_ctrls,
NULL NULL
}; };
...@@ -710,7 +710,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) ...@@ -710,7 +710,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
cx88_free_buffer(q,buf); cx88_free_buffer(q,buf);
} }
static struct videobuf_queue_ops cx8800_video_qops = { static const struct videobuf_queue_ops cx8800_video_qops = {
.buf_setup = buffer_setup, .buf_setup = buffer_setup,
.buf_prepare = buffer_prepare, .buf_prepare = buffer_prepare,
.buf_queue = buffer_queue, .buf_queue = buffer_queue,
...@@ -944,7 +944,7 @@ video_mmap(struct file *file, struct vm_area_struct * vma) ...@@ -944,7 +944,7 @@ video_mmap(struct file *file, struct vm_area_struct * vma)
int cx88_get_control (struct cx88_core *core, struct v4l2_control *ctl) int cx88_get_control (struct cx88_core *core, struct v4l2_control *ctl)
{ {
struct cx88_ctrl *c = NULL; const struct cx88_ctrl *c = NULL;
u32 value; u32 value;
int i; int i;
...@@ -976,7 +976,7 @@ EXPORT_SYMBOL(cx88_get_control); ...@@ -976,7 +976,7 @@ EXPORT_SYMBOL(cx88_get_control);
int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl) int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
{ {
struct cx88_ctrl *c = NULL; const struct cx88_ctrl *c = NULL;
u32 value,mask; u32 value,mask;
int i; int i;
...@@ -1072,7 +1072,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, ...@@ -1072,7 +1072,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core; struct cx88_core *core = ((struct cx8800_fh *)priv)->dev->core;
struct cx8800_fmt *fmt; const struct cx8800_fmt *fmt;
enum v4l2_field field; enum v4l2_field field;
unsigned int maxw, maxh; unsigned int maxw, maxh;
...@@ -1247,7 +1247,7 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *tvnorms) ...@@ -1247,7 +1247,7 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *tvnorms)
/* only one input in this sample driver */ /* only one input in this sample driver */
int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i) int cx88_enum_input (struct cx88_core *core,struct v4l2_input *i)
{ {
static const char *iname[] = { static const char * const iname[] = {
[ CX88_VMUX_COMPOSITE1 ] = "Composite1", [ CX88_VMUX_COMPOSITE1 ] = "Composite1",
[ CX88_VMUX_COMPOSITE2 ] = "Composite2", [ CX88_VMUX_COMPOSITE2 ] = "Composite2",
[ CX88_VMUX_COMPOSITE3 ] = "Composite3", [ CX88_VMUX_COMPOSITE3 ] = "Composite3",
...@@ -1579,7 +1579,7 @@ static void cx8800_vid_timeout(unsigned long data) ...@@ -1579,7 +1579,7 @@ static void cx8800_vid_timeout(unsigned long data)
spin_unlock_irqrestore(&dev->slock,flags); spin_unlock_irqrestore(&dev->slock,flags);
} }
static char *cx88_vid_irqs[32] = { static const char *cx88_vid_irqs[32] = {
"y_risci1", "u_risci1", "v_risci1", "vbi_risc1", "y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
"y_risci2", "u_risci2", "v_risci2", "vbi_risc2", "y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
"y_oflow", "u_oflow", "v_oflow", "vbi_oflow", "y_oflow", "u_oflow", "v_oflow", "vbi_oflow",
...@@ -1724,7 +1724,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { ...@@ -1724,7 +1724,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
static struct video_device cx8800_vbi_template; static struct video_device cx8800_vbi_template;
static struct video_device cx8800_video_template = { static const struct video_device cx8800_video_template = {
.name = "cx8800-video", .name = "cx8800-video",
.fops = &video_fops, .fops = &video_fops,
.ioctl_ops = &video_ioctl_ops, .ioctl_ops = &video_ioctl_ops,
...@@ -1759,7 +1759,7 @@ static const struct v4l2_ioctl_ops radio_ioctl_ops = { ...@@ -1759,7 +1759,7 @@ static const struct v4l2_ioctl_ops radio_ioctl_ops = {
#endif #endif
}; };
static struct video_device cx8800_radio_template = { static const struct video_device cx8800_radio_template = {
.name = "cx8800-radio", .name = "cx8800-radio",
.fops = &radio_fops, .fops = &radio_fops,
.ioctl_ops = &radio_ioctl_ops, .ioctl_ops = &radio_ioctl_ops,
...@@ -1886,7 +1886,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, ...@@ -1886,7 +1886,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
switch (core->boardnr) { switch (core->boardnr) {
case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD: case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: { case CX88_BOARD_DVICO_FUSIONHDTV_7_GOLD: {
static struct i2c_board_info rtc_info = { static const struct i2c_board_info rtc_info = {
I2C_BOARD_INFO("isl1208", 0x6f) I2C_BOARD_INFO("isl1208", 0x6f)
}; };
...@@ -2083,7 +2083,7 @@ static int cx8800_resume(struct pci_dev *pci_dev) ...@@ -2083,7 +2083,7 @@ static int cx8800_resume(struct pci_dev *pci_dev)
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
static struct pci_device_id cx8800_pci_tbl[] = { static const struct pci_device_id cx8800_pci_tbl[] = {
{ {
.vendor = 0x14f1, .vendor = 0x14f1,
.device = 0x8800, .device = 0x8800,
......
...@@ -108,7 +108,7 @@ static unsigned int inline norm_maxh(v4l2_std_id norm) ...@@ -108,7 +108,7 @@ static unsigned int inline norm_maxh(v4l2_std_id norm)
/* static data */ /* static data */
struct cx8800_fmt { struct cx8800_fmt {
char *name; const char *name;
u32 fourcc; /* v4l2 format id */ u32 fourcc; /* v4l2 format id */
int depth; int depth;
int flags; int flags;
...@@ -138,7 +138,7 @@ struct cx88_ctrl { ...@@ -138,7 +138,7 @@ struct cx88_ctrl {
/* more */ /* more */
struct sram_channel { struct sram_channel {
char *name; const char *name;
u32 cmds_start; u32 cmds_start;
u32 ctrl_start; u32 ctrl_start;
u32 cdt; u32 cdt;
...@@ -149,7 +149,7 @@ struct sram_channel { ...@@ -149,7 +149,7 @@ struct sram_channel {
u32 cnt1_reg; u32 cnt1_reg;
u32 cnt2_reg; u32 cnt2_reg;
}; };
extern struct sram_channel cx88_sram_channels[]; extern const struct sram_channel const cx88_sram_channels[];
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* card configuration */ /* card configuration */
...@@ -262,7 +262,7 @@ struct cx88_input { ...@@ -262,7 +262,7 @@ struct cx88_input {
}; };
struct cx88_board { struct cx88_board {
char *name; const char *name;
unsigned int tuner_type; unsigned int tuner_type;
unsigned int radio_type; unsigned int radio_type;
unsigned char tuner_addr; unsigned char tuner_addr;
...@@ -314,7 +314,7 @@ struct cx88_buffer { ...@@ -314,7 +314,7 @@ struct cx88_buffer {
/* cx88 specific */ /* cx88 specific */
unsigned int bpl; unsigned int bpl;
struct btcx_riscmem risc; struct btcx_riscmem risc;
struct cx8800_fmt *fmt; const struct cx8800_fmt *fmt;
u32 count; u32 count;
}; };
...@@ -424,7 +424,7 @@ struct cx8800_fh { ...@@ -424,7 +424,7 @@ struct cx8800_fh {
unsigned int nclips; unsigned int nclips;
/* video capture */ /* video capture */
struct cx8800_fmt *fmt; const struct cx8800_fmt *fmt;
unsigned int width,height; unsigned int width,height;
struct videobuf_queue vidq; struct videobuf_queue vidq;
...@@ -579,7 +579,7 @@ struct cx8802_dev { ...@@ -579,7 +579,7 @@ struct cx8802_dev {
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* cx88-core.c */ /* cx88-core.c */
extern void cx88_print_irqbits(char *name, char *tag, char **strings, extern void cx88_print_irqbits(const char *name, const char *tag, const char *strings[],
int len, u32 bits, u32 mask); int len, u32 bits, u32 mask);
extern int cx88_core_irq(struct cx88_core *core, u32 status); extern int cx88_core_irq(struct cx88_core *core, u32 status);
...@@ -606,10 +606,10 @@ cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf); ...@@ -606,10 +606,10 @@ cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf);
extern void cx88_risc_disasm(struct cx88_core *core, extern void cx88_risc_disasm(struct cx88_core *core,
struct btcx_riscmem *risc); struct btcx_riscmem *risc);
extern int cx88_sram_channel_setup(struct cx88_core *core, extern int cx88_sram_channel_setup(struct cx88_core *core,
struct sram_channel *ch, const struct sram_channel *ch,
unsigned int bpl, u32 risc); unsigned int bpl, u32 risc);
extern void cx88_sram_channel_dump(struct cx88_core *core, extern void cx88_sram_channel_dump(struct cx88_core *core,
struct sram_channel *ch); const struct sram_channel *ch);
extern int cx88_set_scale(struct cx88_core *core, unsigned int width, extern int cx88_set_scale(struct cx88_core *core, unsigned int width,
unsigned int height, enum v4l2_field field); unsigned int height, enum v4l2_field field);
...@@ -617,8 +617,8 @@ extern int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm); ...@@ -617,8 +617,8 @@ extern int cx88_set_tvnorm(struct cx88_core *core, v4l2_std_id norm);
extern struct video_device *cx88_vdev_init(struct cx88_core *core, extern struct video_device *cx88_vdev_init(struct cx88_core *core,
struct pci_dev *pci, struct pci_dev *pci,
struct video_device *template, const struct video_device *template_,
char *type); const char *type);
extern struct cx88_core* cx88_core_get(struct pci_dev *pci); extern struct cx88_core* cx88_core_get(struct pci_dev *pci);
extern void cx88_core_put(struct cx88_core *core, extern void cx88_core_put(struct cx88_core *core,
struct pci_dev *pci); struct pci_dev *pci);
...@@ -644,7 +644,7 @@ int cx8800_restart_vbi_queue(struct cx8800_dev *dev, ...@@ -644,7 +644,7 @@ int cx8800_restart_vbi_queue(struct cx8800_dev *dev,
struct cx88_dmaqueue *q); struct cx88_dmaqueue *q);
void cx8800_vbi_timeout(unsigned long data); void cx8800_vbi_timeout(unsigned long data);
extern struct videobuf_queue_ops cx8800_vbi_qops; extern const struct videobuf_queue_ops cx8800_vbi_qops;
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
/* cx88-i2c.c */ /* cx88-i2c.c */
......
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