aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-oss.c
diff options
context:
space:
mode:
authorTrent Piepho <xyzzy@speakeasy.org>2007-10-10 04:37:42 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-10 12:35:07 -0400
commit6d28e98906aa9405895f92348543d08da1837ea5 (patch)
tree3f92cb9777405d0576f36b86501820c191deab3d /drivers/media/video/saa7134/saa7134-oss.c
parent805a43924158e4eb2bffc4cac0aedcfb42a89469 (diff)
V4L/DVB (6314): saa7134: Replace list_for_each+list_entry with list_for_each_entry
A couple loops weren't changed because they expected the loop iterator to be left as NULL if the list was empty. Maybe the code should just check for that first, then loop? Adjust some of the loop logic to be simpler. Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-oss.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c42
1 files changed, 15 insertions, 27 deletions
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 1a737b647366..aedf04653e0e 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -239,17 +239,14 @@ static int dsp_rec_stop(struct saa7134_dev *dev)
239static int dsp_open(struct inode *inode, struct file *file) 239static int dsp_open(struct inode *inode, struct file *file)
240{ 240{
241 int minor = iminor(inode); 241 int minor = iminor(inode);
242 struct saa7134_dev *h,*dev = NULL; 242 struct saa7134_dev *dev;
243 struct list_head *list;
244 int err; 243 int err;
245 244
246 list_for_each(list,&saa7134_devlist) { 245 list_for_each_entry(dev, &saa7134_devlist, devlist)
247 h = list_entry(list, struct saa7134_dev, devlist); 246 if (dev->dmasound.minor_dsp == minor)
248 if (h->dmasound.minor_dsp == minor) 247 goto found;
249 dev = h; 248 return -ENODEV;
250 } 249 found:
251 if (NULL == dev)
252 return -ENODEV;
253 250
254 mutex_lock(&dev->dmasound.lock); 251 mutex_lock(&dev->dmasound.lock);
255 err = -EBUSY; 252 err = -EBUSY;
@@ -680,19 +677,14 @@ mixer_level(struct saa7134_dev *dev, enum saa7134_audio_in src, int level)
680static int mixer_open(struct inode *inode, struct file *file) 677static int mixer_open(struct inode *inode, struct file *file)
681{ 678{
682 int minor = iminor(inode); 679 int minor = iminor(inode);
683 struct saa7134_dev *h,*dev = NULL; 680 struct saa7134_dev *dev;
684 struct list_head *list;
685 681
686 list_for_each(list,&saa7134_devlist) { 682 list_for_each_entry(dev, &saa7134_devlist, devlist)
687 h = list_entry(list, struct saa7134_dev, devlist); 683 if (dev->dmasound.minor_mixer == minor) {
688 if (h->dmasound.minor_mixer == minor) 684 file->private_data = dev;
689 dev = h; 685 return 0;
690 } 686 }
691 if (NULL == dev) 687 return -ENODEV;
692 return -ENODEV;
693
694 file->private_data = dev;
695 return 0;
696} 688}
697 689
698static int mixer_release(struct inode *inode, struct file *file) 690static int mixer_release(struct inode *inode, struct file *file)
@@ -1022,18 +1014,14 @@ static int saa7134_oss_init(void)
1022 1014
1023static void saa7134_oss_exit(void) 1015static void saa7134_oss_exit(void)
1024{ 1016{
1025 struct saa7134_dev *dev = NULL; 1017 struct saa7134_dev *dev;
1026 struct list_head *list;
1027
1028 list_for_each(list,&saa7134_devlist) {
1029 dev = list_entry(list, struct saa7134_dev, devlist);
1030 1018
1019 list_for_each_entry(dev, &saa7134_devlist, devlist) {
1031 /* Device isn't registered by OSS, probably ALSA's */ 1020 /* Device isn't registered by OSS, probably ALSA's */
1032 if (!dev->dmasound.minor_dsp) 1021 if (!dev->dmasound.minor_dsp)
1033 continue; 1022 continue;
1034 1023
1035 oss_device_exit(dev); 1024 oss_device_exit(dev);
1036
1037 } 1025 }
1038 1026
1039 saa7134_dmasound_init = NULL; 1027 saa7134_dmasound_init = NULL;