From d678f2eed5e7c30fc3976ef3e8293221ff2c0bea Mon Sep 17 00:00:00 2001 From: Mike Isely Date: Thu, 20 Apr 2006 00:20:40 -0500 Subject: Change pvrusb2 module request behavior to be more conservative From: Mike Isely Previously when the pvrusb2 driver loaded, it immediately did a request_module() on all possible I2C support modules it might need. But that is overkill, since the actual modules needed is a subset depending on the model type. This change delays module request until the hardware shows up, and then it only requests the modules that make sense for the specific hardware. Signed-off-by: Mike Isely --- linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c | 43 +++++++++++++++++++++--- linux/drivers/media/video/pvrusb2/pvrusb2-main.c | 10 ------ 2 files changed, 39 insertions(+), 14 deletions(-) (limited to 'linux') diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 350db8dcb..8da06d216 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -53,6 +53,40 @@ static const char *pvr2_device_names[] = { #endif }; +struct pvr2_string_table { + const char **lst; + unsigned int cnt; +}; + +// Names of other client modules to request for 24xxx model hardware +static const char *pvr2_client_24xxx[] = { + "cx25840", + "tuner", + "tda9887", + "wm8775", +}; + +// Names of other client modules to request for 29xxx model hardware +static const char *pvr2_client_29xxx[] = { + "msp3400", + "saa7115", + "tuner", + "tda9887", +}; + +static struct pvr2_string_table pvr2_client_lists[] = { + [PVR2_HDW_TYPE_29XXX] = { + pvr2_client_29xxx, + sizeof(pvr2_client_29xxx)/sizeof(pvr2_client_29xxx[0]), + }, +#ifdef CONFIG_VIDEO_PVRUSB2_24XXX + [PVR2_HDW_TYPE_24XXX] = { + pvr2_client_24xxx, + sizeof(pvr2_client_24xxx)/sizeof(pvr2_client_24xxx[0]), + }, +#endif +}; + static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = 0}; DECLARE_MUTEX(pvr2_unit_sem); @@ -817,10 +851,7 @@ int pvr2_upload_firmware1(struct pvr2_hdw *hdw) "v4l-pvrusb2-24xxx-01.fw", }; #endif - static const struct { - const char **lst; - unsigned int cnt; - } fw_file_defs[] = { + static const struct pvr2_string_table fw_file_defs[] = { [PVR2_HDW_TYPE_29XXX] = { fw_files_29xxx, sizeof(fw_files_29xxx)/sizeof(fw_files_29xxx[0]), @@ -1465,6 +1496,10 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw) } if (!pvr2_hdw_dev_ok(hdw)) return; + for (idx = 0; idx < pvr2_client_lists[hdw->hdw_type].cnt; idx++) { + request_module(pvr2_client_lists[hdw->hdw_type].lst[idx]); + } + pvr2_hdw_cmd_powerup(hdw); if (!pvr2_hdw_dev_ok(hdw)) return; diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-main.c b/linux/drivers/media/video/pvrusb2/pvrusb2-main.c index 988f32ad4..245f7a36d 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-main.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-main.c @@ -134,16 +134,6 @@ static int __init pvr_init(void) pvr2_trace(PVR2_TRACE_INIT,"pvr_init"); - /* Auto-load various support modules (with which we may - indirectly interact) */ - request_module("msp3400"); - request_module("cx25840"); - request_module("saa7115"); - request_module("tuner"); - request_module("tveeprom"); - request_module("tda9887"); - request_module("wm8775"); - #ifdef CONFIG_VIDEO_PVRUSB2_SYSFS class_ptr = pvr2_sysfs_class_create(); #endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */ -- cgit v1.2.3