aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ps3/ps3av.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c
index d318eabce3c3..1a56d390fcd9 100644
--- a/drivers/ps3/ps3av.c
+++ b/drivers/ps3/ps3av.c
@@ -38,7 +38,24 @@
38static int timeout = 5000; /* in msec ( 5 sec ) */ 38static int timeout = 5000; /* in msec ( 5 sec ) */
39module_param(timeout, int, 0644); 39module_param(timeout, int, 0644);
40 40
41static struct ps3av ps3av; 41static struct ps3av {
42 int available;
43 struct mutex mutex;
44 struct work_struct work;
45 struct completion done;
46 struct workqueue_struct *wq;
47 int open_count;
48 struct ps3_vuart_port_device *dev;
49
50 int region;
51 struct ps3av_pkt_av_get_hw_conf av_hw_conf;
52 u32 av_port[PS3AV_AV_PORT_MAX + PS3AV_OPT_PORT_MAX];
53 u32 opt_port[PS3AV_OPT_PORT_MAX];
54 u32 head[PS3AV_HEAD_MAX];
55 u32 audio_port;
56 int ps3av_mode;
57 int ps3av_mode_old;
58} ps3av;
42 59
43static struct ps3_vuart_port_device ps3av_dev = { 60static struct ps3_vuart_port_device ps3av_dev = {
44 .match_id = PS3_MATCH_ID_AV_SETTINGS 61 .match_id = PS3_MATCH_ID_AV_SETTINGS
@@ -250,7 +267,7 @@ int ps3av_do_pkt(u32 cid, u16 send_len, size_t usr_buf_size,
250 struct ps3av_send_hdr *buf) 267 struct ps3av_send_hdr *buf)
251{ 268{
252 int res = 0; 269 int res = 0;
253 union { 270 static union {
254 struct ps3av_reply_hdr reply_hdr; 271 struct ps3av_reply_hdr reply_hdr;
255 u8 raw[PS3AV_BUF_SIZE]; 272 u8 raw[PS3AV_BUF_SIZE];
256 } recv_buf; 273 } recv_buf;
@@ -259,8 +276,7 @@ int ps3av_do_pkt(u32 cid, u16 send_len, size_t usr_buf_size,
259 276
260 BUG_ON(!ps3av.available); 277 BUG_ON(!ps3av.available);
261 278
262 if (down_interruptible(&ps3av.sem)) 279 mutex_lock(&ps3av.mutex);
263 return -ERESTARTSYS;
264 280
265 table = ps3av_search_cmd_table(cid, PS3AV_CID_MASK); 281 table = ps3av_search_cmd_table(cid, PS3AV_CID_MASK);
266 BUG_ON(!table); 282 BUG_ON(!table);
@@ -290,11 +306,11 @@ int ps3av_do_pkt(u32 cid, u16 send_len, size_t usr_buf_size,
290 goto err; 306 goto err;
291 } 307 }
292 308
293 up(&ps3av.sem); 309 mutex_unlock(&ps3av.mutex);
294 return 0; 310 return 0;
295 311
296 err: 312 err:
297 up(&ps3av.sem); 313 mutex_unlock(&ps3av.mutex);
298 printk(KERN_ERR "%s: failed cid:%x res:%d\n", __FUNCTION__, cid, res); 314 printk(KERN_ERR "%s: failed cid:%x res:%d\n", __FUNCTION__, cid, res);
299 return res; 315 return res;
300} 316}
@@ -872,7 +888,6 @@ static int ps3av_probe(struct ps3_vuart_port_device *dev)
872 888
873 memset(&ps3av, 0, sizeof(ps3av)); 889 memset(&ps3av, 0, sizeof(ps3av));
874 890
875 init_MUTEX(&ps3av.sem);
876 mutex_init(&ps3av.mutex); 891 mutex_init(&ps3av.mutex);
877 ps3av.ps3av_mode = 0; 892 ps3av.ps3av_mode = 0;
878 ps3av.dev = dev; 893 ps3av.dev = dev;