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/saa7164-encoder.c | |
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/saa7164-encoder.c')
-rw-r--r-- | drivers/media/video/saa7164/saa7164-encoder.c | 48 |
1 files changed, 9 insertions, 39 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) { |