diff options
| author | Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> | 2007-05-02 08:48:35 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-04 20:59:08 -0400 |
| commit | fffe52e86b4ad5f8bdcb284c4ea6c87402967f3d (patch) | |
| tree | 614d018e9458bfce1d5d4aae3c2487e4f0ec8cda | |
| parent | bd685ac8e78b9bfd4a0145be22a7ff11ab11adef (diff) | |
ps3av: misc updates
ps3av:
- Move the definition of struct ps3av to ps3av.c, as it's locally used only.
- Kill ps3av.sem, use the existing ps3av.mutex instead.
- Make the 512-byte buffer in ps3av_do_pkt() static to reduce stack usage.
Its use is protected by a semaphore anyway.
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | drivers/ps3/ps3av.c | 29 | ||||
| -rw-r--r-- | include/asm-powerpc/ps3av.h | 22 |
2 files changed, 23 insertions, 28 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 @@ | |||
| 38 | static int timeout = 5000; /* in msec ( 5 sec ) */ | 38 | static int timeout = 5000; /* in msec ( 5 sec ) */ |
| 39 | module_param(timeout, int, 0644); | 39 | module_param(timeout, int, 0644); |
| 40 | 40 | ||
| 41 | static struct ps3av ps3av; | 41 | static 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 | ||
| 43 | static struct ps3_vuart_port_device ps3av_dev = { | 60 | static 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; |
diff --git a/include/asm-powerpc/ps3av.h b/include/asm-powerpc/ps3av.h index 5c1b989406e4..1366fc5b452d 100644 --- a/include/asm-powerpc/ps3av.h +++ b/include/asm-powerpc/ps3av.h | |||
| @@ -18,8 +18,6 @@ | |||
| 18 | #ifndef _ASM_POWERPC_PS3AV_H_ | 18 | #ifndef _ASM_POWERPC_PS3AV_H_ |
| 19 | #define _ASM_POWERPC_PS3AV_H_ | 19 | #define _ASM_POWERPC_PS3AV_H_ |
| 20 | 20 | ||
| 21 | #include <linux/mutex.h> | ||
| 22 | |||
| 23 | /** command for ioctl() **/ | 21 | /** command for ioctl() **/ |
| 24 | #define PS3AV_VERSION 0x205 /* version of ps3av command */ | 22 | #define PS3AV_VERSION 0x205 /* version of ps3av command */ |
| 25 | 23 | ||
| @@ -643,25 +641,6 @@ struct ps3av_pkt_avb_param { | |||
| 643 | u8 buf[PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE]; | 641 | u8 buf[PS3AV_PKT_AVB_PARAM_MAX_BUF_SIZE]; |
| 644 | }; | 642 | }; |
| 645 | 643 | ||
| 646 | struct ps3av { | ||
| 647 | int available; | ||
| 648 | struct semaphore sem; | ||
| 649 | struct work_struct work; | ||
| 650 | struct completion done; | ||
| 651 | struct workqueue_struct *wq; | ||
| 652 | struct mutex mutex; | ||
| 653 | int open_count; | ||
| 654 | struct ps3_vuart_port_device *dev; | ||
| 655 | |||
| 656 | int region; | ||
| 657 | struct ps3av_pkt_av_get_hw_conf av_hw_conf; | ||
| 658 | u32 av_port[PS3AV_AV_PORT_MAX + PS3AV_OPT_PORT_MAX]; | ||
| 659 | u32 opt_port[PS3AV_OPT_PORT_MAX]; | ||
| 660 | u32 head[PS3AV_HEAD_MAX]; | ||
| 661 | u32 audio_port; | ||
| 662 | int ps3av_mode; | ||
| 663 | int ps3av_mode_old; | ||
| 664 | }; | ||
| 665 | 644 | ||
| 666 | /** command status **/ | 645 | /** command status **/ |
| 667 | #define PS3AV_STATUS_SUCCESS 0x0000 /* success */ | 646 | #define PS3AV_STATUS_SUCCESS 0x0000 /* success */ |
| @@ -719,6 +698,7 @@ static inline void ps3av_cmd_av_monitor_info_dump(const struct ps3av_pkt_av_get_ | |||
| 719 | extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *, | 698 | extern int ps3av_cmd_video_get_monitor_info(struct ps3av_pkt_av_get_monitor_info *, |
| 720 | u32); | 699 | u32); |
| 721 | 700 | ||
| 701 | struct ps3_vuart_port_device; | ||
| 722 | extern int ps3av_vuart_write(struct ps3_vuart_port_device *dev, | 702 | extern int ps3av_vuart_write(struct ps3_vuart_port_device *dev, |
| 723 | const void *buf, unsigned long size); | 703 | const void *buf, unsigned long size); |
| 724 | extern int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf, | 704 | extern int ps3av_vuart_read(struct ps3_vuart_port_device *dev, void *buf, |
