diff options
author | Steven Toth <stoth@kernellabs.com> | 2010-10-06 20:52:22 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-21 05:55:32 -0400 |
commit | 214ce3faacafa3cca2fdd340d18ff35cfe463c2b (patch) | |
tree | f0cf942a8f78626d1a4ee29a361c360e65b96088 /drivers/media/video/saa7164 | |
parent | 18024ee2df675ad921a8c65e7a9e22180d32da84 (diff) |
[media] saa7164: Removed use of the BKL
Remove usage of the BKL and instead used video_set_drvdata() during
open fops.
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7164')
-rw-r--r-- | drivers/media/video/saa7164/saa7164-encoder.c | 48 | ||||
-rw-r--r-- | drivers/media/video/saa7164/saa7164-vbi.c | 48 |
2 files changed, 18 insertions, 78 deletions
diff --git a/drivers/media/video/saa7164/saa7164-encoder.c b/drivers/media/video/saa7164/saa7164-encoder.c index d02682e24c20..cbb53d0ee979 100644 --- a/drivers/media/video/saa7164/saa7164-encoder.c +++ b/drivers/media/video/saa7164/saa7164-encoder.c | |||
@@ -1054,57 +1054,26 @@ out: | |||
1054 | 1054 | ||
1055 | static int fops_open(struct file *file) | 1055 | static int fops_open(struct file *file) |
1056 | { | 1056 | { |
1057 | struct saa7164_dev *h, *dev = NULL; | 1057 | struct saa7164_dev *dev; |
1058 | struct saa7164_port *port = NULL; | 1058 | struct saa7164_port *port; |
1059 | struct saa7164_port *portc = NULL; | ||
1060 | struct saa7164_port *portd = NULL; | ||
1061 | struct saa7164_encoder_fh *fh; | 1059 | struct saa7164_encoder_fh *fh; |
1062 | struct list_head *list; | ||
1063 | int minor = video_devdata(file)->minor; | ||
1064 | 1060 | ||
1065 | dprintk(DBGLVL_ENC, "%s()\n", __func__); | 1061 | port = (struct saa7164_port *)video_get_drvdata(video_devdata(file)); |
1066 | 1062 | if (!port) | |
1067 | /* TODO: Really, the BKL? - remove this */ | 1063 | return -ENODEV; |
1068 | lock_kernel(); | ||
1069 | list_for_each(list, &saa7164_devlist) { | ||
1070 | h = list_entry(list, struct saa7164_dev, devlist); | ||
1071 | |||
1072 | portc = &h->ports[SAA7164_PORT_ENC1]; | ||
1073 | portd = &h->ports[SAA7164_PORT_ENC2]; | ||
1074 | |||
1075 | if (portc->v4l_device && | ||
1076 | portc->v4l_device->minor == minor) { | ||
1077 | dev = h; | ||
1078 | port = portc; | ||
1079 | break; | ||
1080 | } | ||
1081 | |||
1082 | if (portd->v4l_device && | ||
1083 | portd->v4l_device->minor == minor) { | ||
1084 | dev = h; | ||
1085 | port = portd; | ||
1086 | break; | ||
1087 | } | ||
1088 | 1064 | ||
1089 | } | 1065 | dev = port->dev; |
1090 | 1066 | ||
1091 | if (port == NULL) { | 1067 | dprintk(DBGLVL_ENC, "%s()\n", __func__); |
1092 | unlock_kernel(); | ||
1093 | return -ENODEV; | ||
1094 | } | ||
1095 | 1068 | ||
1096 | /* allocate + initialize per filehandle data */ | 1069 | /* allocate + initialize per filehandle data */ |
1097 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 1070 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
1098 | if (NULL == fh) { | 1071 | if (NULL == fh) |
1099 | unlock_kernel(); | ||
1100 | return -ENOMEM; | 1072 | return -ENOMEM; |
1101 | } | ||
1102 | 1073 | ||
1103 | file->private_data = fh; | 1074 | file->private_data = fh; |
1104 | fh->port = port; | 1075 | fh->port = port; |
1105 | 1076 | ||
1106 | unlock_kernel(); | ||
1107 | |||
1108 | return 0; | 1077 | return 0; |
1109 | } | 1078 | } |
1110 | 1079 | ||
@@ -1474,6 +1443,7 @@ int saa7164_encoder_register(struct saa7164_port *port) | |||
1474 | goto failed; | 1443 | goto failed; |
1475 | } | 1444 | } |
1476 | 1445 | ||
1446 | video_set_drvdata(port->v4l_device, port); | ||
1477 | result = video_register_device(port->v4l_device, | 1447 | result = video_register_device(port->v4l_device, |
1478 | VFL_TYPE_GRABBER, -1); | 1448 | VFL_TYPE_GRABBER, -1); |
1479 | if (result < 0) { | 1449 | if (result < 0) { |
diff --git a/drivers/media/video/saa7164/saa7164-vbi.c b/drivers/media/video/saa7164/saa7164-vbi.c index a4bcf989a194..323c7cdca37b 100644 --- a/drivers/media/video/saa7164/saa7164-vbi.c +++ b/drivers/media/video/saa7164/saa7164-vbi.c | |||
@@ -1001,57 +1001,26 @@ int saa7164_vbi_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
1001 | 1001 | ||
1002 | static int fops_open(struct file *file) | 1002 | static int fops_open(struct file *file) |
1003 | { | 1003 | { |
1004 | struct saa7164_dev *h, *dev = NULL; | 1004 | struct saa7164_dev *dev; |
1005 | struct saa7164_port *port = NULL; | 1005 | struct saa7164_port *port; |
1006 | struct saa7164_port *porte = NULL; | ||
1007 | struct saa7164_port *portf = NULL; | ||
1008 | struct saa7164_vbi_fh *fh; | 1006 | struct saa7164_vbi_fh *fh; |
1009 | struct list_head *list; | ||
1010 | int minor = video_devdata(file)->minor; | ||
1011 | 1007 | ||
1012 | dprintk(DBGLVL_VBI, "%s()\n", __func__); | 1008 | port = (struct saa7164_port *)video_get_drvdata(video_devdata(file)); |
1013 | 1009 | if (!port) | |
1014 | /* TODO: Really, the BKL? - remove this */ | 1010 | return -ENODEV; |
1015 | lock_kernel(); | ||
1016 | list_for_each(list, &saa7164_devlist) { | ||
1017 | h = list_entry(list, struct saa7164_dev, devlist); | ||
1018 | |||
1019 | porte = &h->ports[SAA7164_PORT_VBI1]; | ||
1020 | portf = &h->ports[SAA7164_PORT_VBI2]; | ||
1021 | |||
1022 | if (porte->v4l_device && | ||
1023 | porte->v4l_device->minor == minor) { | ||
1024 | dev = h; | ||
1025 | port = porte; | ||
1026 | break; | ||
1027 | } | ||
1028 | |||
1029 | if (portf->v4l_device && | ||
1030 | portf->v4l_device->minor == minor) { | ||
1031 | dev = h; | ||
1032 | port = portf; | ||
1033 | break; | ||
1034 | } | ||
1035 | 1011 | ||
1036 | } | 1012 | dev = port->dev; |
1037 | 1013 | ||
1038 | if (port == NULL) { | 1014 | dprintk(DBGLVL_VBI, "%s()\n", __func__); |
1039 | unlock_kernel(); | ||
1040 | return -ENODEV; | ||
1041 | } | ||
1042 | 1015 | ||
1043 | /* allocate + initialize per filehandle data */ | 1016 | /* allocate + initialize per filehandle data */ |
1044 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 1017 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
1045 | if (NULL == fh) { | 1018 | if (NULL == fh) |
1046 | unlock_kernel(); | ||
1047 | return -ENOMEM; | 1019 | return -ENOMEM; |
1048 | } | ||
1049 | 1020 | ||
1050 | file->private_data = fh; | 1021 | file->private_data = fh; |
1051 | fh->port = port; | 1022 | fh->port = port; |
1052 | 1023 | ||
1053 | unlock_kernel(); | ||
1054 | |||
1055 | return 0; | 1024 | return 0; |
1056 | } | 1025 | } |
1057 | 1026 | ||
@@ -1363,6 +1332,7 @@ int saa7164_vbi_register(struct saa7164_port *port) | |||
1363 | goto failed; | 1332 | goto failed; |
1364 | } | 1333 | } |
1365 | 1334 | ||
1335 | video_set_drvdata(port->v4l_device, port); | ||
1366 | result = video_register_device(port->v4l_device, | 1336 | result = video_register_device(port->v4l_device, |
1367 | VFL_TYPE_VBI, -1); | 1337 | VFL_TYPE_VBI, -1); |
1368 | if (result < 0) { | 1338 | if (result < 0) { |