aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-12-24 10:14:20 -0500
committerTejun Heo <tj@kernel.org>2010-12-24 10:14:20 -0500
commit707bcf326bd50c875d82bd2e7c31dcfb92b7e813 (patch)
tree6359ba94e571ca15ef6fa0ff44f5872c8210e157 /drivers/media/video/saa7134
parent883624a08cb4144343e7362d9fff0e2c69613ebf (diff)
media/video: explicitly flush request_module work
Video drivers request submodules using a work during probe and calls flush_scheduled_work() on exit to make sure the work is complete before being unloaded. This patch makes these drivers flush the work directly instead of using flush_scheduled_work(). While at it, relocate request_submodules() call in saa7134_initdev() right right before successful return as in other drivers to avoid failing after the work is scheduled and returning failure without the work still active. This is in preparation for the deprecation of flush_scheduled_work(). Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 764d7d219fe..2ceeac7ae34 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -166,8 +166,14 @@ static void request_submodules(struct saa7134_dev *dev)
166 schedule_work(&dev->request_module_wk); 166 schedule_work(&dev->request_module_wk);
167} 167}
168 168
169static void flush_request_submodules(struct saa7134_dev *dev)
170{
171 flush_work_sync(&dev->request_module_wk);
172}
173
169#else 174#else
170#define request_submodules(dev) 175#define request_submodules(dev)
176#define flush_request_submodules(dev)
171#endif /* CONFIG_MODULES */ 177#endif /* CONFIG_MODULES */
172 178
173/* ------------------------------------------------------------------ */ 179/* ------------------------------------------------------------------ */
@@ -1010,8 +1016,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
1010 } 1016 }
1011 } 1017 }
1012 1018
1013 request_submodules(dev);
1014
1015 v4l2_prio_init(&dev->prio); 1019 v4l2_prio_init(&dev->prio);
1016 1020
1017 mutex_lock(&saa7134_devlist_lock); 1021 mutex_lock(&saa7134_devlist_lock);
@@ -1066,6 +1070,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
1066 if (saa7134_dmasound_init && !dev->dmasound.priv_data) 1070 if (saa7134_dmasound_init && !dev->dmasound.priv_data)
1067 saa7134_dmasound_init(dev); 1071 saa7134_dmasound_init(dev);
1068 1072
1073 request_submodules(dev);
1069 return 0; 1074 return 0;
1070 1075
1071 fail4: 1076 fail4:
@@ -1091,6 +1096,8 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
1091 struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev); 1096 struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev);
1092 struct saa7134_mpeg_ops *mops; 1097 struct saa7134_mpeg_ops *mops;
1093 1098
1099 flush_request_submodules(dev);
1100
1094 /* Release DMA sound modules if present */ 1101 /* Release DMA sound modules if present */
1095 if (saa7134_dmasound_exit && dev->dmasound.priv_data) { 1102 if (saa7134_dmasound_exit && dev->dmasound.priv_data) {
1096 saa7134_dmasound_exit(dev); 1103 saa7134_dmasound_exit(dev);