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/radio | |
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/radio')
-rw-r--r-- | drivers/media/radio/miropcm20-rds-core.c | 11 | ||||
-rw-r--r-- | drivers/media/radio/radio-aimslab.c | 20 | ||||
-rw-r--r-- | drivers/media/radio/radio-aztech.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-maestro.c | 11 | ||||
-rw-r--r-- | drivers/media/radio/radio-maxiradio.c | 11 | ||||
-rw-r--r-- | drivers/media/radio/radio-sf16fmi.c | 22 | ||||
-rw-r--r-- | drivers/media/radio/radio-sf16fmr2.c | 22 | ||||
-rw-r--r-- | drivers/media/radio/radio-typhoon.c | 12 | ||||
-rw-r--r-- | drivers/media/radio/radio-zoltrix.c | 26 |
9 files changed, 75 insertions, 72 deletions
diff --git a/drivers/media/radio/miropcm20-rds-core.c b/drivers/media/radio/miropcm20-rds-core.c index a917a90cb5dc..b602c73e2309 100644 --- a/drivers/media/radio/miropcm20-rds-core.c +++ b/drivers/media/radio/miropcm20-rds-core.c | |||
@@ -18,14 +18,15 @@ | |||
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <asm/semaphore.h> | 21 | #include <linux/mutex.h> |
22 | |||
22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
23 | #include "../../../sound/oss/aci.h" | 24 | #include "../../../sound/oss/aci.h" |
24 | #include "miropcm20-rds-core.h" | 25 | #include "miropcm20-rds-core.h" |
25 | 26 | ||
26 | #define DEBUG 0 | 27 | #define DEBUG 0 |
27 | 28 | ||
28 | static struct semaphore aci_rds_sem; | 29 | static struct mutex aci_rds_mutex; |
29 | 30 | ||
30 | #define RDS_DATASHIFT 2 /* Bit 2 */ | 31 | #define RDS_DATASHIFT 2 /* Bit 2 */ |
31 | #define RDS_DATAMASK (1 << RDS_DATASHIFT) | 32 | #define RDS_DATAMASK (1 << RDS_DATASHIFT) |
@@ -181,7 +182,7 @@ int aci_rds_cmd(unsigned char cmd, unsigned char databuffer[], int datasize) | |||
181 | { | 182 | { |
182 | int ret; | 183 | int ret; |
183 | 184 | ||
184 | if (down_interruptible(&aci_rds_sem)) | 185 | if (mutex_lock_interruptible(&aci_rds_mutex)) |
185 | return -EINTR; | 186 | return -EINTR; |
186 | 187 | ||
187 | rds_write(cmd); | 188 | rds_write(cmd); |
@@ -192,7 +193,7 @@ int aci_rds_cmd(unsigned char cmd, unsigned char databuffer[], int datasize) | |||
192 | else | 193 | else |
193 | ret = 0; | 194 | ret = 0; |
194 | 195 | ||
195 | up(&aci_rds_sem); | 196 | mutex_unlock(&aci_rds_mutex); |
196 | 197 | ||
197 | return ret; | 198 | return ret; |
198 | } | 199 | } |
@@ -200,7 +201,7 @@ EXPORT_SYMBOL(aci_rds_cmd); | |||
200 | 201 | ||
201 | int __init attach_aci_rds(void) | 202 | int __init attach_aci_rds(void) |
202 | { | 203 | { |
203 | init_MUTEX(&aci_rds_sem); | 204 | mutex_init(&aci_rds_mutex); |
204 | return 0; | 205 | return 0; |
205 | } | 206 | } |
206 | 207 | ||
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 914deab4e044..557fb5c4af38 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
@@ -43,7 +43,7 @@ | |||
43 | 43 | ||
44 | static int io = CONFIG_RADIO_RTRACK_PORT; | 44 | static int io = CONFIG_RADIO_RTRACK_PORT; |
45 | static int radio_nr = -1; | 45 | static int radio_nr = -1; |
46 | static struct semaphore lock; | 46 | static struct mutex lock; |
47 | 47 | ||
48 | struct rt_device | 48 | struct rt_device |
49 | { | 49 | { |
@@ -83,23 +83,23 @@ static void rt_incvol(void) | |||
83 | static void rt_mute(struct rt_device *dev) | 83 | static void rt_mute(struct rt_device *dev) |
84 | { | 84 | { |
85 | dev->muted = 1; | 85 | dev->muted = 1; |
86 | down(&lock); | 86 | mutex_lock(&lock); |
87 | outb(0xd0, io); /* volume steady, off */ | 87 | outb(0xd0, io); /* volume steady, off */ |
88 | up(&lock); | 88 | mutex_unlock(&lock); |
89 | } | 89 | } |
90 | 90 | ||
91 | static int rt_setvol(struct rt_device *dev, int vol) | 91 | static int rt_setvol(struct rt_device *dev, int vol) |
92 | { | 92 | { |
93 | int i; | 93 | int i; |
94 | 94 | ||
95 | down(&lock); | 95 | mutex_lock(&lock); |
96 | 96 | ||
97 | if(vol == dev->curvol) { /* requested volume = current */ | 97 | if(vol == dev->curvol) { /* requested volume = current */ |
98 | if (dev->muted) { /* user is unmuting the card */ | 98 | if (dev->muted) { /* user is unmuting the card */ |
99 | dev->muted = 0; | 99 | dev->muted = 0; |
100 | outb (0xd8, io); /* enable card */ | 100 | outb (0xd8, io); /* enable card */ |
101 | } | 101 | } |
102 | up(&lock); | 102 | mutex_unlock(&lock); |
103 | return 0; | 103 | return 0; |
104 | } | 104 | } |
105 | 105 | ||
@@ -108,7 +108,7 @@ static int rt_setvol(struct rt_device *dev, int vol) | |||
108 | sleep_delay(2000000); /* make sure it's totally down */ | 108 | sleep_delay(2000000); /* make sure it's totally down */ |
109 | outb(0xd0, io); /* volume steady, off */ | 109 | outb(0xd0, io); /* volume steady, off */ |
110 | dev->curvol = 0; /* track the volume state! */ | 110 | dev->curvol = 0; /* track the volume state! */ |
111 | up(&lock); | 111 | mutex_unlock(&lock); |
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
@@ -121,7 +121,7 @@ static int rt_setvol(struct rt_device *dev, int vol) | |||
121 | rt_decvol(); | 121 | rt_decvol(); |
122 | 122 | ||
123 | dev->curvol = vol; | 123 | dev->curvol = vol; |
124 | up(&lock); | 124 | mutex_unlock(&lock); |
125 | return 0; | 125 | return 0; |
126 | } | 126 | } |
127 | 127 | ||
@@ -168,7 +168,7 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq) | |||
168 | freq += 171200; /* Add 10.7 MHz IF */ | 168 | freq += 171200; /* Add 10.7 MHz IF */ |
169 | freq /= 800; /* Convert to 50 kHz units */ | 169 | freq /= 800; /* Convert to 50 kHz units */ |
170 | 170 | ||
171 | down(&lock); /* Stop other ops interfering */ | 171 | mutex_lock(&lock); /* Stop other ops interfering */ |
172 | 172 | ||
173 | send_0_byte (io, dev); /* 0: LSB of frequency */ | 173 | send_0_byte (io, dev); /* 0: LSB of frequency */ |
174 | 174 | ||
@@ -196,7 +196,7 @@ static int rt_setfreq(struct rt_device *dev, unsigned long freq) | |||
196 | else | 196 | else |
197 | outb (0xd8, io); /* volume steady + sigstr + on */ | 197 | outb (0xd8, io); /* volume steady + sigstr + on */ |
198 | 198 | ||
199 | up(&lock); | 199 | mutex_unlock(&lock); |
200 | 200 | ||
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
@@ -337,7 +337,7 @@ static int __init rtrack_init(void) | |||
337 | 337 | ||
338 | /* Set up the I/O locking */ | 338 | /* Set up the I/O locking */ |
339 | 339 | ||
340 | init_MUTEX(&lock); | 340 | mutex_init(&lock); |
341 | 341 | ||
342 | /* mute card - prevents noisy bootups */ | 342 | /* mute card - prevents noisy bootups */ |
343 | 343 | ||
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index 523be820f9c6..83bdae23417d 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c | |||
@@ -42,7 +42,7 @@ | |||
42 | static int io = CONFIG_RADIO_AZTECH_PORT; | 42 | static int io = CONFIG_RADIO_AZTECH_PORT; |
43 | static int radio_nr = -1; | 43 | static int radio_nr = -1; |
44 | static int radio_wait_time = 1000; | 44 | static int radio_wait_time = 1000; |
45 | static struct semaphore lock; | 45 | static struct mutex lock; |
46 | 46 | ||
47 | struct az_device | 47 | struct az_device |
48 | { | 48 | { |
@@ -87,9 +87,9 @@ static void send_1_byte (struct az_device *dev) | |||
87 | 87 | ||
88 | static int az_setvol(struct az_device *dev, int vol) | 88 | static int az_setvol(struct az_device *dev, int vol) |
89 | { | 89 | { |
90 | down(&lock); | 90 | mutex_lock(&lock); |
91 | outb (volconvert(vol), io); | 91 | outb (volconvert(vol), io); |
92 | up(&lock); | 92 | mutex_unlock(&lock); |
93 | return 0; | 93 | return 0; |
94 | } | 94 | } |
95 | 95 | ||
@@ -122,7 +122,7 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency) | |||
122 | frequency += 171200; /* Add 10.7 MHz IF */ | 122 | frequency += 171200; /* Add 10.7 MHz IF */ |
123 | frequency /= 800; /* Convert to 50 kHz units */ | 123 | frequency /= 800; /* Convert to 50 kHz units */ |
124 | 124 | ||
125 | down(&lock); | 125 | mutex_lock(&lock); |
126 | 126 | ||
127 | send_0_byte (dev); /* 0: LSB of frequency */ | 127 | send_0_byte (dev); /* 0: LSB of frequency */ |
128 | 128 | ||
@@ -152,7 +152,7 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency) | |||
152 | udelay (radio_wait_time); | 152 | udelay (radio_wait_time); |
153 | outb_p(128+64+volconvert(dev->curvol), io); | 153 | outb_p(128+64+volconvert(dev->curvol), io); |
154 | 154 | ||
155 | up(&lock); | 155 | mutex_unlock(&lock); |
156 | 156 | ||
157 | return 0; | 157 | return 0; |
158 | } | 158 | } |
@@ -283,7 +283,7 @@ static int __init aztech_init(void) | |||
283 | return -EBUSY; | 283 | return -EBUSY; |
284 | } | 284 | } |
285 | 285 | ||
286 | init_MUTEX(&lock); | 286 | mutex_init(&lock); |
287 | aztech_radio.priv=&aztech_unit; | 287 | aztech_radio.priv=&aztech_unit; |
288 | 288 | ||
289 | if(video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr)==-1) | 289 | if(video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr)==-1) |
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c index 36c9f5bf8cdd..39c1d9118636 100644 --- a/drivers/media/radio/radio-maestro.c +++ b/drivers/media/radio/radio-maestro.c | |||
@@ -23,10 +23,11 @@ | |||
23 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
26 | #include <asm/semaphore.h> | 26 | #include <linux/mutex.h> |
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/videodev.h> | 28 | #include <linux/videodev.h> |
29 | 29 | ||
30 | |||
30 | #define DRIVER_VERSION "0.05" | 31 | #define DRIVER_VERSION "0.05" |
31 | 32 | ||
32 | #define GPIO_DATA 0x60 /* port offset from ESS_IO_BASE */ | 33 | #define GPIO_DATA 0x60 /* port offset from ESS_IO_BASE */ |
@@ -104,7 +105,7 @@ struct radio_device { | |||
104 | muted, /* VIDEO_AUDIO_MUTE */ | 105 | muted, /* VIDEO_AUDIO_MUTE */ |
105 | stereo, /* VIDEO_TUNER_STEREO_ON */ | 106 | stereo, /* VIDEO_TUNER_STEREO_ON */ |
106 | tuned; /* signal strength (0 or 0xffff) */ | 107 | tuned; /* signal strength (0 or 0xffff) */ |
107 | struct semaphore lock; | 108 | struct mutex lock; |
108 | }; | 109 | }; |
109 | 110 | ||
110 | static u32 radio_bits_get(struct radio_device *dev) | 111 | static u32 radio_bits_get(struct radio_device *dev) |
@@ -258,9 +259,9 @@ static int radio_ioctl(struct inode *inode, struct file *file, | |||
258 | struct radio_device *card = video_get_drvdata(dev); | 259 | struct radio_device *card = video_get_drvdata(dev); |
259 | int ret; | 260 | int ret; |
260 | 261 | ||
261 | down(&card->lock); | 262 | mutex_lock(&card->lock); |
262 | ret = video_usercopy(inode, file, cmd, arg, radio_function); | 263 | ret = video_usercopy(inode, file, cmd, arg, radio_function); |
263 | up(&card->lock); | 264 | mutex_unlock(&card->lock); |
264 | 265 | ||
265 | return ret; | 266 | return ret; |
266 | } | 267 | } |
@@ -311,7 +312,7 @@ static int __devinit maestro_probe(struct pci_dev *pdev, | |||
311 | } | 312 | } |
312 | 313 | ||
313 | radio_unit->io = pci_resource_start(pdev, 0) + GPIO_DATA; | 314 | radio_unit->io = pci_resource_start(pdev, 0) + GPIO_DATA; |
314 | init_MUTEX(&radio_unit->lock); | 315 | mutex_init(&radio_unit->lock); |
315 | 316 | ||
316 | maestro_radio_inst = video_device_alloc(); | 317 | maestro_radio_inst = video_device_alloc(); |
317 | if (maestro_radio_inst == NULL) { | 318 | if (maestro_radio_inst == NULL) { |
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index c975ddd86cd5..f0bf47bcb64c 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
@@ -37,7 +37,8 @@ | |||
37 | #include <linux/sched.h> | 37 | #include <linux/sched.h> |
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
40 | #include <asm/semaphore.h> | 40 | #include <linux/mutex.h> |
41 | |||
41 | #include <linux/pci.h> | 42 | #include <linux/pci.h> |
42 | #include <linux/videodev.h> | 43 | #include <linux/videodev.h> |
43 | 44 | ||
@@ -101,7 +102,7 @@ static struct radio_device | |||
101 | 102 | ||
102 | unsigned long freq; | 103 | unsigned long freq; |
103 | 104 | ||
104 | struct semaphore lock; | 105 | struct mutex lock; |
105 | } radio_unit = {0, 0, 0, 0, }; | 106 | } radio_unit = {0, 0, 0, 0, }; |
106 | 107 | ||
107 | 108 | ||
@@ -267,9 +268,9 @@ static int radio_ioctl(struct inode *inode, struct file *file, | |||
267 | struct radio_device *card=dev->priv; | 268 | struct radio_device *card=dev->priv; |
268 | int ret; | 269 | int ret; |
269 | 270 | ||
270 | down(&card->lock); | 271 | mutex_lock(&card->lock); |
271 | ret = video_usercopy(inode, file, cmd, arg, radio_function); | 272 | ret = video_usercopy(inode, file, cmd, arg, radio_function); |
272 | up(&card->lock); | 273 | mutex_unlock(&card->lock); |
273 | return ret; | 274 | return ret; |
274 | } | 275 | } |
275 | 276 | ||
@@ -290,7 +291,7 @@ static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_d | |||
290 | goto err_out_free_region; | 291 | goto err_out_free_region; |
291 | 292 | ||
292 | radio_unit.io = pci_resource_start(pdev, 0); | 293 | radio_unit.io = pci_resource_start(pdev, 0); |
293 | init_MUTEX(&radio_unit.lock); | 294 | mutex_init(&radio_unit.lock); |
294 | maxiradio_radio.priv = &radio_unit; | 295 | maxiradio_radio.priv = &radio_unit; |
295 | 296 | ||
296 | if(video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr)==-1) { | 297 | if(video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr)==-1) { |
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index 0229f792a059..53073b424107 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/isapnp.h> | 24 | #include <linux/isapnp.h> |
25 | #include <asm/io.h> /* outb, outb_p */ | 25 | #include <asm/io.h> /* outb, outb_p */ |
26 | #include <asm/uaccess.h> /* copy to/from user */ | 26 | #include <asm/uaccess.h> /* copy to/from user */ |
27 | #include <asm/semaphore.h> | 27 | #include <linux/mutex.h> |
28 | 28 | ||
29 | struct fmi_device | 29 | struct fmi_device |
30 | { | 30 | { |
@@ -37,7 +37,7 @@ struct fmi_device | |||
37 | static int io = -1; | 37 | static int io = -1; |
38 | static int radio_nr = -1; | 38 | static int radio_nr = -1; |
39 | static struct pnp_dev *dev = NULL; | 39 | static struct pnp_dev *dev = NULL; |
40 | static struct semaphore lock; | 40 | static struct mutex lock; |
41 | 41 | ||
42 | /* freq is in 1/16 kHz to internal number, hw precision is 50 kHz */ | 42 | /* freq is in 1/16 kHz to internal number, hw precision is 50 kHz */ |
43 | /* It is only useful to give freq in intervall of 800 (=0.05Mhz), | 43 | /* It is only useful to give freq in intervall of 800 (=0.05Mhz), |
@@ -68,16 +68,16 @@ static void outbits(int bits, unsigned int data, int port) | |||
68 | 68 | ||
69 | static inline void fmi_mute(int port) | 69 | static inline void fmi_mute(int port) |
70 | { | 70 | { |
71 | down(&lock); | 71 | mutex_lock(&lock); |
72 | outb(0x00, port); | 72 | outb(0x00, port); |
73 | up(&lock); | 73 | mutex_unlock(&lock); |
74 | } | 74 | } |
75 | 75 | ||
76 | static inline void fmi_unmute(int port) | 76 | static inline void fmi_unmute(int port) |
77 | { | 77 | { |
78 | down(&lock); | 78 | mutex_lock(&lock); |
79 | outb(0x08, port); | 79 | outb(0x08, port); |
80 | up(&lock); | 80 | mutex_unlock(&lock); |
81 | } | 81 | } |
82 | 82 | ||
83 | static inline int fmi_setfreq(struct fmi_device *dev) | 83 | static inline int fmi_setfreq(struct fmi_device *dev) |
@@ -85,12 +85,12 @@ static inline int fmi_setfreq(struct fmi_device *dev) | |||
85 | int myport = dev->port; | 85 | int myport = dev->port; |
86 | unsigned long freq = dev->curfreq; | 86 | unsigned long freq = dev->curfreq; |
87 | 87 | ||
88 | down(&lock); | 88 | mutex_lock(&lock); |
89 | 89 | ||
90 | outbits(16, RSF16_ENCODE(freq), myport); | 90 | outbits(16, RSF16_ENCODE(freq), myport); |
91 | outbits(8, 0xC0, myport); | 91 | outbits(8, 0xC0, myport); |
92 | msleep(143); /* was schedule_timeout(HZ/7) */ | 92 | msleep(143); /* was schedule_timeout(HZ/7) */ |
93 | up(&lock); | 93 | mutex_unlock(&lock); |
94 | if (dev->curvol) fmi_unmute(myport); | 94 | if (dev->curvol) fmi_unmute(myport); |
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
@@ -102,7 +102,7 @@ static inline int fmi_getsigstr(struct fmi_device *dev) | |||
102 | int myport = dev->port; | 102 | int myport = dev->port; |
103 | 103 | ||
104 | 104 | ||
105 | down(&lock); | 105 | mutex_lock(&lock); |
106 | val = dev->curvol ? 0x08 : 0x00; /* unmute/mute */ | 106 | val = dev->curvol ? 0x08 : 0x00; /* unmute/mute */ |
107 | outb(val, myport); | 107 | outb(val, myport); |
108 | outb(val | 0x10, myport); | 108 | outb(val | 0x10, myport); |
@@ -110,7 +110,7 @@ static inline int fmi_getsigstr(struct fmi_device *dev) | |||
110 | res = (int)inb(myport+1); | 110 | res = (int)inb(myport+1); |
111 | outb(val, myport); | 111 | outb(val, myport); |
112 | 112 | ||
113 | up(&lock); | 113 | mutex_unlock(&lock); |
114 | return (res & 2) ? 0 : 0xFFFF; | 114 | return (res & 2) ? 0 : 0xFFFF; |
115 | } | 115 | } |
116 | 116 | ||
@@ -296,7 +296,7 @@ static int __init fmi_init(void) | |||
296 | fmi_unit.flags = VIDEO_TUNER_LOW; | 296 | fmi_unit.flags = VIDEO_TUNER_LOW; |
297 | fmi_radio.priv = &fmi_unit; | 297 | fmi_radio.priv = &fmi_unit; |
298 | 298 | ||
299 | init_MUTEX(&lock); | 299 | mutex_init(&lock); |
300 | 300 | ||
301 | if (video_register_device(&fmi_radio, VFL_TYPE_RADIO, radio_nr) == -1) { | 301 | if (video_register_device(&fmi_radio, VFL_TYPE_RADIO, radio_nr) == -1) { |
302 | release_region(io, 2); | 302 | release_region(io, 2); |
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index 099ffb3b9c71..bcebd8cb19ad 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
@@ -19,9 +19,9 @@ | |||
19 | #include <asm/io.h> /* outb, outb_p */ | 19 | #include <asm/io.h> /* outb, outb_p */ |
20 | #include <asm/uaccess.h> /* copy to/from user */ | 20 | #include <asm/uaccess.h> /* copy to/from user */ |
21 | #include <linux/videodev.h> /* kernel radio structs */ | 21 | #include <linux/videodev.h> /* kernel radio structs */ |
22 | #include <asm/semaphore.h> | 22 | #include <linux/mutex.h> |
23 | 23 | ||
24 | static struct semaphore lock; | 24 | static struct mutex lock; |
25 | 25 | ||
26 | #undef DEBUG | 26 | #undef DEBUG |
27 | //#define DEBUG 1 | 27 | //#define DEBUG 1 |
@@ -238,9 +238,9 @@ static int fmr2_do_ioctl(struct inode *inode, struct file *file, | |||
238 | if (fmr2->mute) | 238 | if (fmr2->mute) |
239 | v->flags |= VIDEO_AUDIO_MUTE; | 239 | v->flags |= VIDEO_AUDIO_MUTE; |
240 | v->mode=VIDEO_MODE_AUTO; | 240 | v->mode=VIDEO_MODE_AUTO; |
241 | down(&lock); | 241 | mutex_lock(&lock); |
242 | v->signal = fmr2_getsigstr(fmr2); | 242 | v->signal = fmr2_getsigstr(fmr2); |
243 | up(&lock); | 243 | mutex_unlock(&lock); |
244 | return 0; | 244 | return 0; |
245 | } | 245 | } |
246 | case VIDIOCSTUNER: | 246 | case VIDIOCSTUNER: |
@@ -274,9 +274,9 @@ static int fmr2_do_ioctl(struct inode *inode, struct file *file, | |||
274 | /* set card freq (if not muted) */ | 274 | /* set card freq (if not muted) */ |
275 | if (fmr2->curvol && !fmr2->mute) | 275 | if (fmr2->curvol && !fmr2->mute) |
276 | { | 276 | { |
277 | down(&lock); | 277 | mutex_lock(&lock); |
278 | fmr2_setfreq(fmr2); | 278 | fmr2_setfreq(fmr2); |
279 | up(&lock); | 279 | mutex_unlock(&lock); |
280 | } | 280 | } |
281 | return 0; | 281 | return 0; |
282 | } | 282 | } |
@@ -318,14 +318,14 @@ static int fmr2_do_ioctl(struct inode *inode, struct file *file, | |||
318 | else | 318 | else |
319 | printk(KERN_DEBUG "mute\n"); | 319 | printk(KERN_DEBUG "mute\n"); |
320 | #endif | 320 | #endif |
321 | down(&lock); | 321 | mutex_lock(&lock); |
322 | if (fmr2->curvol && !fmr2->mute) | 322 | if (fmr2->curvol && !fmr2->mute) |
323 | { | 323 | { |
324 | fmr2_setvolume(fmr2); | 324 | fmr2_setvolume(fmr2); |
325 | fmr2_setfreq(fmr2); | 325 | fmr2_setfreq(fmr2); |
326 | } | 326 | } |
327 | else fmr2_mute(fmr2->port); | 327 | else fmr2_mute(fmr2->port); |
328 | up(&lock); | 328 | mutex_unlock(&lock); |
329 | return 0; | 329 | return 0; |
330 | } | 330 | } |
331 | case VIDIOCGUNIT: | 331 | case VIDIOCGUNIT: |
@@ -380,7 +380,7 @@ static int __init fmr2_init(void) | |||
380 | fmr2_unit.card_type = 0; | 380 | fmr2_unit.card_type = 0; |
381 | fmr2_radio.priv = &fmr2_unit; | 381 | fmr2_radio.priv = &fmr2_unit; |
382 | 382 | ||
383 | init_MUTEX(&lock); | 383 | mutex_init(&lock); |
384 | 384 | ||
385 | if (request_region(io, 2, "sf16fmr2")) | 385 | if (request_region(io, 2, "sf16fmr2")) |
386 | { | 386 | { |
@@ -397,10 +397,10 @@ static int __init fmr2_init(void) | |||
397 | printk(KERN_INFO "SF16FMR2 radio card driver at 0x%x.\n", io); | 397 | printk(KERN_INFO "SF16FMR2 radio card driver at 0x%x.\n", io); |
398 | debug_print((KERN_DEBUG "Mute %d Low %d\n",VIDEO_AUDIO_MUTE,VIDEO_TUNER_LOW)); | 398 | debug_print((KERN_DEBUG "Mute %d Low %d\n",VIDEO_AUDIO_MUTE,VIDEO_TUNER_LOW)); |
399 | /* mute card - prevents noisy bootups */ | 399 | /* mute card - prevents noisy bootups */ |
400 | down(&lock); | 400 | mutex_lock(&lock); |
401 | fmr2_mute(io); | 401 | fmr2_mute(io); |
402 | fmr2_product_info(&fmr2_unit); | 402 | fmr2_product_info(&fmr2_unit); |
403 | up(&lock); | 403 | mutex_unlock(&lock); |
404 | debug_print((KERN_DEBUG "card_type %d\n", fmr2_unit.card_type)); | 404 | debug_print((KERN_DEBUG "card_type %d\n", fmr2_unit.card_type)); |
405 | return 0; | 405 | return 0; |
406 | } | 406 | } |
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c index 8ac9a8ef9094..e50955836d6b 100644 --- a/drivers/media/radio/radio-typhoon.c +++ b/drivers/media/radio/radio-typhoon.c | |||
@@ -59,7 +59,7 @@ struct typhoon_device { | |||
59 | int muted; | 59 | int muted; |
60 | unsigned long curfreq; | 60 | unsigned long curfreq; |
61 | unsigned long mutefreq; | 61 | unsigned long mutefreq; |
62 | struct semaphore lock; | 62 | struct mutex lock; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static void typhoon_setvol_generic(struct typhoon_device *dev, int vol); | 65 | static void typhoon_setvol_generic(struct typhoon_device *dev, int vol); |
@@ -77,12 +77,12 @@ static int typhoon_get_info(char *buf, char **start, off_t offset, int len); | |||
77 | 77 | ||
78 | static void typhoon_setvol_generic(struct typhoon_device *dev, int vol) | 78 | static void typhoon_setvol_generic(struct typhoon_device *dev, int vol) |
79 | { | 79 | { |
80 | down(&dev->lock); | 80 | mutex_lock(&dev->lock); |
81 | vol >>= 14; /* Map 16 bit to 2 bit */ | 81 | vol >>= 14; /* Map 16 bit to 2 bit */ |
82 | vol &= 3; | 82 | vol &= 3; |
83 | outb_p(vol / 2, dev->iobase); /* Set the volume, high bit. */ | 83 | outb_p(vol / 2, dev->iobase); /* Set the volume, high bit. */ |
84 | outb_p(vol % 2, dev->iobase + 2); /* Set the volume, low bit. */ | 84 | outb_p(vol % 2, dev->iobase + 2); /* Set the volume, low bit. */ |
85 | up(&dev->lock); | 85 | mutex_unlock(&dev->lock); |
86 | } | 86 | } |
87 | 87 | ||
88 | static int typhoon_setfreq_generic(struct typhoon_device *dev, | 88 | static int typhoon_setfreq_generic(struct typhoon_device *dev, |
@@ -102,7 +102,7 @@ static int typhoon_setfreq_generic(struct typhoon_device *dev, | |||
102 | * | 102 | * |
103 | */ | 103 | */ |
104 | 104 | ||
105 | down(&dev->lock); | 105 | mutex_lock(&dev->lock); |
106 | x = frequency / 160; | 106 | x = frequency / 160; |
107 | outval = (x * x + 2500) / 5000; | 107 | outval = (x * x + 2500) / 5000; |
108 | outval = (outval * x + 5000) / 10000; | 108 | outval = (outval * x + 5000) / 10000; |
@@ -112,7 +112,7 @@ static int typhoon_setfreq_generic(struct typhoon_device *dev, | |||
112 | outb_p((outval >> 8) & 0x01, dev->iobase + 4); | 112 | outb_p((outval >> 8) & 0x01, dev->iobase + 4); |
113 | outb_p(outval >> 9, dev->iobase + 6); | 113 | outb_p(outval >> 9, dev->iobase + 6); |
114 | outb_p(outval & 0xff, dev->iobase + 8); | 114 | outb_p(outval & 0xff, dev->iobase + 8); |
115 | up(&dev->lock); | 115 | mutex_unlock(&dev->lock); |
116 | 116 | ||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
@@ -337,7 +337,7 @@ static int __init typhoon_init(void) | |||
337 | #endif /* MODULE */ | 337 | #endif /* MODULE */ |
338 | 338 | ||
339 | printk(KERN_INFO BANNER); | 339 | printk(KERN_INFO BANNER); |
340 | init_MUTEX(&typhoon_unit.lock); | 340 | mutex_init(&typhoon_unit.lock); |
341 | io = typhoon_unit.iobase; | 341 | io = typhoon_unit.iobase; |
342 | if (!request_region(io, 8, "typhoon")) { | 342 | if (!request_region(io, 8, "typhoon")) { |
343 | printk(KERN_ERR "radio-typhoon: port 0x%x already in use\n", | 343 | printk(KERN_ERR "radio-typhoon: port 0x%x already in use\n", |
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c index d590e80c922e..7bf1a4264891 100644 --- a/drivers/media/radio/radio-zoltrix.c +++ b/drivers/media/radio/radio-zoltrix.c | |||
@@ -48,7 +48,7 @@ struct zol_device { | |||
48 | unsigned long curfreq; | 48 | unsigned long curfreq; |
49 | int muted; | 49 | int muted; |
50 | unsigned int stereo; | 50 | unsigned int stereo; |
51 | struct semaphore lock; | 51 | struct mutex lock; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static int zol_setvol(struct zol_device *dev, int vol) | 54 | static int zol_setvol(struct zol_device *dev, int vol) |
@@ -57,30 +57,30 @@ static int zol_setvol(struct zol_device *dev, int vol) | |||
57 | if (dev->muted) | 57 | if (dev->muted) |
58 | return 0; | 58 | return 0; |
59 | 59 | ||
60 | down(&dev->lock); | 60 | mutex_lock(&dev->lock); |
61 | if (vol == 0) { | 61 | if (vol == 0) { |
62 | outb(0, io); | 62 | outb(0, io); |
63 | outb(0, io); | 63 | outb(0, io); |
64 | inb(io + 3); /* Zoltrix needs to be read to confirm */ | 64 | inb(io + 3); /* Zoltrix needs to be read to confirm */ |
65 | up(&dev->lock); | 65 | mutex_unlock(&dev->lock); |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | outb(dev->curvol-1, io); | 69 | outb(dev->curvol-1, io); |
70 | msleep(10); | 70 | msleep(10); |
71 | inb(io + 2); | 71 | inb(io + 2); |
72 | up(&dev->lock); | 72 | mutex_unlock(&dev->lock); |
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
75 | 75 | ||
76 | static void zol_mute(struct zol_device *dev) | 76 | static void zol_mute(struct zol_device *dev) |
77 | { | 77 | { |
78 | dev->muted = 1; | 78 | dev->muted = 1; |
79 | down(&dev->lock); | 79 | mutex_lock(&dev->lock); |
80 | outb(0, io); | 80 | outb(0, io); |
81 | outb(0, io); | 81 | outb(0, io); |
82 | inb(io + 3); /* Zoltrix needs to be read to confirm */ | 82 | inb(io + 3); /* Zoltrix needs to be read to confirm */ |
83 | up(&dev->lock); | 83 | mutex_unlock(&dev->lock); |
84 | } | 84 | } |
85 | 85 | ||
86 | static void zol_unmute(struct zol_device *dev) | 86 | static void zol_unmute(struct zol_device *dev) |
@@ -104,7 +104,7 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq) | |||
104 | bitmask = 0xc480402c10080000ull; | 104 | bitmask = 0xc480402c10080000ull; |
105 | i = 45; | 105 | i = 45; |
106 | 106 | ||
107 | down(&dev->lock); | 107 | mutex_lock(&dev->lock); |
108 | 108 | ||
109 | outb(0, io); | 109 | outb(0, io); |
110 | outb(0, io); | 110 | outb(0, io); |
@@ -149,7 +149,7 @@ static int zol_setfreq(struct zol_device *dev, unsigned long freq) | |||
149 | udelay(1000); | 149 | udelay(1000); |
150 | } | 150 | } |
151 | 151 | ||
152 | up(&dev->lock); | 152 | mutex_unlock(&dev->lock); |
153 | 153 | ||
154 | if(!dev->muted) | 154 | if(!dev->muted) |
155 | { | 155 | { |
@@ -164,7 +164,7 @@ static int zol_getsigstr(struct zol_device *dev) | |||
164 | { | 164 | { |
165 | int a, b; | 165 | int a, b; |
166 | 166 | ||
167 | down(&dev->lock); | 167 | mutex_lock(&dev->lock); |
168 | outb(0x00, io); /* This stuff I found to do nothing */ | 168 | outb(0x00, io); /* This stuff I found to do nothing */ |
169 | outb(dev->curvol, io); | 169 | outb(dev->curvol, io); |
170 | msleep(20); | 170 | msleep(20); |
@@ -173,7 +173,7 @@ static int zol_getsigstr(struct zol_device *dev) | |||
173 | msleep(10); | 173 | msleep(10); |
174 | b = inb(io); | 174 | b = inb(io); |
175 | 175 | ||
176 | up(&dev->lock); | 176 | mutex_unlock(&dev->lock); |
177 | 177 | ||
178 | if (a != b) | 178 | if (a != b) |
179 | return (0); | 179 | return (0); |
@@ -188,7 +188,7 @@ static int zol_is_stereo (struct zol_device *dev) | |||
188 | { | 188 | { |
189 | int x1, x2; | 189 | int x1, x2; |
190 | 190 | ||
191 | down(&dev->lock); | 191 | mutex_lock(&dev->lock); |
192 | 192 | ||
193 | outb(0x00, io); | 193 | outb(0x00, io); |
194 | outb(dev->curvol, io); | 194 | outb(dev->curvol, io); |
@@ -198,7 +198,7 @@ static int zol_is_stereo (struct zol_device *dev) | |||
198 | msleep(10); | 198 | msleep(10); |
199 | x2 = inb(io); | 199 | x2 = inb(io); |
200 | 200 | ||
201 | up(&dev->lock); | 201 | mutex_unlock(&dev->lock); |
202 | 202 | ||
203 | if ((x1 == x2) && (x1 == 0xcf)) | 203 | if ((x1 == x2) && (x1 == 0xcf)) |
204 | return 1; | 204 | return 1; |
@@ -350,7 +350,7 @@ static int __init zoltrix_init(void) | |||
350 | } | 350 | } |
351 | printk(KERN_INFO "Zoltrix Radio Plus card driver.\n"); | 351 | printk(KERN_INFO "Zoltrix Radio Plus card driver.\n"); |
352 | 352 | ||
353 | init_MUTEX(&zoltrix_unit.lock); | 353 | mutex_init(&zoltrix_unit.lock); |
354 | 354 | ||
355 | /* mute card - prevents noisy bootups */ | 355 | /* mute card - prevents noisy bootups */ |
356 | 356 | ||