diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-02-07 03:49:14 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-02-07 03:49:14 -0500 |
commit | 3593cab5d62c4c7abced1076710f9bc2d8847433 (patch) | |
tree | dd5dc21961f6b4aef6900b0c2eb63ce7c70aecd5 /drivers/media/dvb/ttusb-budget | |
parent | 538f9630afbbe429ecbcdcf92536200293a8e4b3 (diff) |
V4L/DVB (3318b): sem2mutex: drivers/media/, #2
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttusb-budget')
-rw-r--r-- | drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 5a13c4744f6..ecb15d4ecf8 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/time.h> | 19 | #include <linux/time.h> |
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/jiffies.h> | 21 | #include <linux/jiffies.h> |
22 | #include <asm/semaphore.h> | 22 | #include <linux/mutex.h> |
23 | 23 | ||
24 | #include "dvb_frontend.h" | 24 | #include "dvb_frontend.h" |
25 | #include "dmxdev.h" | 25 | #include "dmxdev.h" |
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/dvb/dmx.h> | 35 | #include <linux/dvb/dmx.h> |
36 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
37 | 37 | ||
38 | |||
39 | /* | 38 | /* |
40 | TTUSB_HWSECTIONS: | 39 | TTUSB_HWSECTIONS: |
41 | the DSP supports filtering in hardware, however, since the "muxstream" | 40 | the DSP supports filtering in hardware, however, since the "muxstream" |
@@ -83,8 +82,8 @@ struct ttusb { | |||
83 | struct dvb_net dvbnet; | 82 | struct dvb_net dvbnet; |
84 | 83 | ||
85 | /* and one for USB access. */ | 84 | /* and one for USB access. */ |
86 | struct semaphore semi2c; | 85 | struct mutex semi2c; |
87 | struct semaphore semusb; | 86 | struct mutex semusb; |
88 | 87 | ||
89 | struct dvb_adapter adapter; | 88 | struct dvb_adapter adapter; |
90 | struct usb_device *dev; | 89 | struct usb_device *dev; |
@@ -150,7 +149,7 @@ static int ttusb_cmd(struct ttusb *ttusb, | |||
150 | printk("\n"); | 149 | printk("\n"); |
151 | #endif | 150 | #endif |
152 | 151 | ||
153 | if (down_interruptible(&ttusb->semusb) < 0) | 152 | if (mutex_lock_interruptible(&ttusb->semusb) < 0) |
154 | return -EAGAIN; | 153 | return -EAGAIN; |
155 | 154 | ||
156 | err = usb_bulk_msg(ttusb->dev, ttusb->bulk_out_pipe, | 155 | err = usb_bulk_msg(ttusb->dev, ttusb->bulk_out_pipe, |
@@ -158,13 +157,13 @@ static int ttusb_cmd(struct ttusb *ttusb, | |||
158 | if (err != 0) { | 157 | if (err != 0) { |
159 | dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n", | 158 | dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n", |
160 | __FUNCTION__, err); | 159 | __FUNCTION__, err); |
161 | up(&ttusb->semusb); | 160 | mutex_unlock(&ttusb->semusb); |
162 | return err; | 161 | return err; |
163 | } | 162 | } |
164 | if (actual_len != len) { | 163 | if (actual_len != len) { |
165 | dprintk("%s: only wrote %d of %d bytes\n", __FUNCTION__, | 164 | dprintk("%s: only wrote %d of %d bytes\n", __FUNCTION__, |
166 | actual_len, len); | 165 | actual_len, len); |
167 | up(&ttusb->semusb); | 166 | mutex_unlock(&ttusb->semusb); |
168 | return -1; | 167 | return -1; |
169 | } | 168 | } |
170 | 169 | ||
@@ -174,7 +173,7 @@ static int ttusb_cmd(struct ttusb *ttusb, | |||
174 | if (err != 0) { | 173 | if (err != 0) { |
175 | printk("%s: failed, receive error %d\n", __FUNCTION__, | 174 | printk("%s: failed, receive error %d\n", __FUNCTION__, |
176 | err); | 175 | err); |
177 | up(&ttusb->semusb); | 176 | mutex_unlock(&ttusb->semusb); |
178 | return err; | 177 | return err; |
179 | } | 178 | } |
180 | #if DEBUG >= 3 | 179 | #if DEBUG >= 3 |
@@ -185,14 +184,14 @@ static int ttusb_cmd(struct ttusb *ttusb, | |||
185 | printk("\n"); | 184 | printk("\n"); |
186 | #endif | 185 | #endif |
187 | if (!needresult) | 186 | if (!needresult) |
188 | up(&ttusb->semusb); | 187 | mutex_unlock(&ttusb->semusb); |
189 | return 0; | 188 | return 0; |
190 | } | 189 | } |
191 | 190 | ||
192 | static int ttusb_result(struct ttusb *ttusb, u8 * data, int len) | 191 | static int ttusb_result(struct ttusb *ttusb, u8 * data, int len) |
193 | { | 192 | { |
194 | memcpy(data, ttusb->last_result, len); | 193 | memcpy(data, ttusb->last_result, len); |
195 | up(&ttusb->semusb); | 194 | mutex_unlock(&ttusb->semusb); |
196 | return 0; | 195 | return 0; |
197 | } | 196 | } |
198 | 197 | ||
@@ -250,7 +249,7 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num | |||
250 | int i = 0; | 249 | int i = 0; |
251 | int inc; | 250 | int inc; |
252 | 251 | ||
253 | if (down_interruptible(&ttusb->semi2c) < 0) | 252 | if (mutex_lock_interruptible(&ttusb->semi2c) < 0) |
254 | return -EAGAIN; | 253 | return -EAGAIN; |
255 | 254 | ||
256 | while (i < num) { | 255 | while (i < num) { |
@@ -284,7 +283,7 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num | |||
284 | i += inc; | 283 | i += inc; |
285 | } | 284 | } |
286 | 285 | ||
287 | up(&ttusb->semi2c); | 286 | mutex_unlock(&ttusb->semi2c); |
288 | return i; | 287 | return i; |
289 | } | 288 | } |
290 | 289 | ||
@@ -1495,8 +1494,11 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1495 | ttusb->dev = udev; | 1494 | ttusb->dev = udev; |
1496 | ttusb->c = 0; | 1495 | ttusb->c = 0; |
1497 | ttusb->mux_state = 0; | 1496 | ttusb->mux_state = 0; |
1498 | sema_init(&ttusb->semi2c, 0); | 1497 | mutex_init(&ttusb->semi2c); |
1499 | sema_init(&ttusb->semusb, 1); | 1498 | |
1499 | mutex_lock(&ttusb->semi2c); | ||
1500 | |||
1501 | mutex_init(&ttusb->semusb); | ||
1500 | 1502 | ||
1501 | ttusb_setup_interfaces(ttusb); | 1503 | ttusb_setup_interfaces(ttusb); |
1502 | 1504 | ||
@@ -1504,7 +1506,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1504 | if (ttusb_init_controller(ttusb)) | 1506 | if (ttusb_init_controller(ttusb)) |
1505 | printk("ttusb_init_controller: error\n"); | 1507 | printk("ttusb_init_controller: error\n"); |
1506 | 1508 | ||
1507 | up(&ttusb->semi2c); | 1509 | mutex_unlock(&ttusb->semi2c); |
1508 | 1510 | ||
1509 | dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE); | 1511 | dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE); |
1510 | ttusb->adapter.priv = ttusb; | 1512 | ttusb->adapter.priv = ttusb; |