From 0a6ecbb40ebe372028088b3e6b71a3adf9b1b674 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 17 Mar 2013 10:56:20 -0300 Subject: [PATCH] [media] go7007: drop firmware name in board config, make configs const The firmware is always the same, so drop it from the board configs. Also make the board configs const. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/go7007/go7007-driver.c | 5 +-- drivers/staging/media/go7007/go7007-fw.c | 10 ++++-- drivers/staging/media/go7007/go7007-priv.h | 5 ++- drivers/staging/media/go7007/go7007-usb.c | 36 +++++++------------ drivers/staging/media/go7007/saa7134-go7007.c | 3 +- 5 files changed, 25 insertions(+), 34 deletions(-) diff --git a/drivers/staging/media/go7007/go7007-driver.c b/drivers/staging/media/go7007/go7007-driver.c index 3c0b2585ad73..3d7705eff1c5 100644 --- a/drivers/staging/media/go7007/go7007-driver.c +++ b/drivers/staging/media/go7007/go7007-driver.c @@ -624,7 +624,8 @@ EXPORT_SYMBOL(go7007_parse_video_stream); /* * Allocate a new go7007 struct. Used by the hardware-specific probe. */ -struct go7007 *go7007_alloc(struct go7007_board_info *board, struct device *dev) +struct go7007 *go7007_alloc(const struct go7007_board_info *board, + struct device *dev) { struct go7007 *go; int i; @@ -677,7 +678,7 @@ EXPORT_SYMBOL(go7007_alloc); void go7007_update_board(struct go7007 *go) { - struct go7007_board_info *board = go->board_info; + const struct go7007_board_info *board = go->board_info; if (board->sensor_flags & GO7007_SENSOR_TV) { go->standard = GO7007_STD_NTSC; diff --git a/drivers/staging/media/go7007/go7007-fw.c b/drivers/staging/media/go7007/go7007-fw.c index 524ba4877ec3..c2d0e58afc34 100644 --- a/drivers/staging/media/go7007/go7007-fw.c +++ b/drivers/staging/media/go7007/go7007-fw.c @@ -36,6 +36,8 @@ #include "go7007-priv.h" +#define GO7007_FW_NAME "go7007/go7007tv.bin" + /* Constants used in the source firmware image to describe code segments */ #define FLAG_MODE_MJPEG (1) @@ -1568,10 +1570,10 @@ int go7007_construct_fw_image(struct go7007 *go, u8 **fw, int *fwlen) default: return -1; } - if (request_firmware(&fw_entry, go->board_info->firmware, go->dev)) { + if (request_firmware(&fw_entry, GO7007_FW_NAME, go->dev)) { dev_err(go->dev, "unable to load firmware from file \"%s\"\n", - go->board_info->firmware); + GO7007_FW_NAME); return -1; } code = kzalloc(codespace * 2, GFP_KERNEL); @@ -1586,7 +1588,7 @@ int go7007_construct_fw_image(struct go7007 *go, u8 **fw, int *fwlen) if (chunk_len + 2 > srclen) { dev_err(go->dev, "firmware file \"%s\" appears to be corrupted\n", - go->board_info->firmware); + GO7007_FW_NAME); goto fw_failed; } if (chunk_flags & mode_flag) { @@ -1622,3 +1624,5 @@ fw_failed: release_firmware(fw_entry); return -1; } + +MODULE_FIRMWARE(GO7007_FW_NAME); diff --git a/drivers/staging/media/go7007/go7007-priv.h b/drivers/staging/media/go7007/go7007-priv.h index cfa4c8474744..31adc7074441 100644 --- a/drivers/staging/media/go7007/go7007-priv.h +++ b/drivers/staging/media/go7007/go7007-priv.h @@ -75,7 +75,6 @@ struct go7007; #define GO7007_AUDIO_OKI_MODE (1<<17) struct go7007_board_info { - char *firmware; unsigned int flags; int hpi_buffer_cap; unsigned int sensor_flags; @@ -151,7 +150,7 @@ enum go7007_parser_state { struct go7007 { struct device *dev; u8 bus_info[32]; - struct go7007_board_info *board_info; + const struct go7007_board_info *board_info; unsigned int board_id; int tuner_type; int channel_number; /* for multi-channel boards like Adlink PCI-MPG24 */ @@ -273,7 +272,7 @@ int go7007_reset_encoder(struct go7007 *go); int go7007_register_encoder(struct go7007 *go, unsigned num_i2c_devs); int go7007_start_encoder(struct go7007 *go); void go7007_parse_video_stream(struct go7007 *go, u8 *buf, int length); -struct go7007 *go7007_alloc(struct go7007_board_info *board, +struct go7007 *go7007_alloc(const struct go7007_board_info *board, struct device *dev); void go7007_update_board(struct go7007 *go); diff --git a/drivers/staging/media/go7007/go7007-usb.c b/drivers/staging/media/go7007/go7007-usb.c index bd23d7d3e067..31c18f5bbae7 100644 --- a/drivers/staging/media/go7007/go7007-usb.c +++ b/drivers/staging/media/go7007/go7007-usb.c @@ -63,7 +63,7 @@ struct go7007_usb_board { }; struct go7007_usb { - struct go7007_usb_board *board; + const struct go7007_usb_board *board; struct mutex i2c_lock; struct usb_device *usbdev; struct urb *video_urbs[8]; @@ -73,10 +73,9 @@ struct go7007_usb { /*********************** Product specification data ***********************/ -static struct go7007_usb_board board_matrix_ii = { +static const struct go7007_usb_board board_matrix_ii = { .flags = GO7007_USB_EZUSB, .main_info = { - .firmware = "go7007/go7007tv.bin", .flags = GO7007_BOARD_HAS_AUDIO | GO7007_BOARD_USE_ONBOARD_I2C, .audio_flags = GO7007_AUDIO_I2S_MODE_1 | @@ -114,10 +113,9 @@ static struct go7007_usb_board board_matrix_ii = { }, }; -static struct go7007_usb_board board_matrix_reload = { +static const struct go7007_usb_board board_matrix_reload = { .flags = GO7007_USB_EZUSB, .main_info = { - .firmware = "go7007/go7007tv.bin", .flags = GO7007_BOARD_HAS_AUDIO | GO7007_BOARD_USE_ONBOARD_I2C, .audio_flags = GO7007_AUDIO_I2S_MODE_1 | @@ -152,10 +150,9 @@ static struct go7007_usb_board board_matrix_reload = { }, }; -static struct go7007_usb_board board_star_trek = { +static const struct go7007_usb_board board_star_trek = { .flags = GO7007_USB_EZUSB | GO7007_USB_EZUSB_I2C, .main_info = { - .firmware = "go7007/go7007tv.bin", .flags = GO7007_BOARD_HAS_AUDIO, /* | GO7007_BOARD_HAS_TUNER, */ .sensor_flags = GO7007_SENSOR_656 | @@ -200,10 +197,9 @@ static struct go7007_usb_board board_star_trek = { }, }; -static struct go7007_usb_board board_px_tv402u = { +static const struct go7007_usb_board board_px_tv402u = { .flags = GO7007_USB_EZUSB | GO7007_USB_EZUSB_I2C, .main_info = { - .firmware = "go7007/go7007tv.bin", .flags = GO7007_BOARD_HAS_AUDIO | GO7007_BOARD_HAS_TUNER, .sensor_flags = GO7007_SENSOR_656 | @@ -275,10 +271,9 @@ static struct go7007_usb_board board_px_tv402u = { }, }; -static struct go7007_usb_board board_xmen = { +static const struct go7007_usb_board board_xmen = { .flags = 0, .main_info = { - .firmware = "go7007/go7007tv.bin", .flags = GO7007_BOARD_USE_ONBOARD_I2C, .hpi_buffer_cap = 0, .sensor_flags = GO7007_SENSOR_VREF_POLAR, @@ -310,10 +305,9 @@ static struct go7007_usb_board board_xmen = { }, }; -static struct go7007_usb_board board_matrix_revolution = { +static const struct go7007_usb_board board_matrix_revolution = { .flags = GO7007_USB_EZUSB, .main_info = { - .firmware = "go7007/go7007tv.bin", .flags = GO7007_BOARD_HAS_AUDIO | GO7007_BOARD_USE_ONBOARD_I2C, .audio_flags = GO7007_AUDIO_I2S_MODE_1 | @@ -348,10 +342,9 @@ static struct go7007_usb_board board_matrix_revolution = { }, }; -static struct go7007_usb_board board_lifeview_lr192 = { +static const struct go7007_usb_board board_lifeview_lr192 = { .flags = GO7007_USB_EZUSB, .main_info = { - .firmware = "go7007/go7007tv.bin", .flags = GO7007_BOARD_HAS_AUDIO | GO7007_BOARD_USE_ONBOARD_I2C, .audio_flags = GO7007_AUDIO_I2S_MODE_1 | @@ -376,10 +369,9 @@ static struct go7007_usb_board board_lifeview_lr192 = { }, }; -static struct go7007_usb_board board_endura = { +static const struct go7007_usb_board board_endura = { .flags = 0, .main_info = { - .firmware = "go7007/go7007tv.bin", .flags = 0, .audio_flags = GO7007_AUDIO_I2S_MODE_1 | GO7007_AUDIO_I2S_MASTER | @@ -401,10 +393,9 @@ static struct go7007_usb_board board_endura = { }, }; -static struct go7007_usb_board board_adlink_mpg24 = { +static const struct go7007_usb_board board_adlink_mpg24 = { .flags = 0, .main_info = { - .firmware = "go7007/go7007tv.bin", .flags = GO7007_BOARD_USE_ONBOARD_I2C, .audio_flags = GO7007_AUDIO_I2S_MODE_1 | GO7007_AUDIO_I2S_MASTER | @@ -434,10 +425,9 @@ static struct go7007_usb_board board_adlink_mpg24 = { }, }; -static struct go7007_usb_board board_sensoray_2250 = { +static const struct go7007_usb_board board_sensoray_2250 = { .flags = GO7007_USB_EZUSB | GO7007_USB_EZUSB_I2C, .main_info = { - .firmware = "go7007/go7007tv.bin", .audio_flags = GO7007_AUDIO_I2S_MODE_1 | GO7007_AUDIO_I2S_MASTER | GO7007_AUDIO_WORD_16, @@ -486,8 +476,6 @@ static struct go7007_usb_board board_sensoray_2250 = { }, }; -MODULE_FIRMWARE("go7007/go7007tv.bin"); - static const struct usb_device_id go7007_usb_id_table[] = { { .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION | @@ -1041,7 +1029,7 @@ static int go7007_usb_probe(struct usb_interface *intf, { struct go7007 *go; struct go7007_usb *usb; - struct go7007_usb_board *board; + const struct go7007_usb_board *board; struct usb_device *usbdev = interface_to_usbdev(intf); unsigned num_i2c_devs; char *name; diff --git a/drivers/staging/media/go7007/saa7134-go7007.c b/drivers/staging/media/go7007/saa7134-go7007.c index d56f4fc44a93..aee9acee366a 100644 --- a/drivers/staging/media/go7007/saa7134-go7007.c +++ b/drivers/staging/media/go7007/saa7134-go7007.c @@ -64,8 +64,7 @@ struct saa7134_go7007 { dma_addr_t bottom_dma; }; -static struct go7007_board_info board_voyager = { - .firmware = "go7007/go7007tv.bin", +static const struct go7007_board_info board_voyager = { .flags = 0, .sensor_flags = GO7007_SENSOR_656 | GO7007_SENSOR_VALID_ENABLE | -- 2.20.1