aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-20 12:41:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-20 12:41:44 -0400
commit7f06a8b26aba1dc03b42272dc0089a800372c575 (patch)
tree7c67198f83d069eb13fd417e022d111b7e4c82a1 /sound/drivers
parentc3ad33c9bcb6616999953af76f16318120fe3691 (diff)
parentd71f4cece4bd97d05592836202fc04ff2e7817e3 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (250 commits) ALSA: hda: Storage class should be before const qualifier ASoC: tpa6130a2: Remove CPVSS and HPVdd supplies ASoC: tpa6130a2: Define output pins with SND_SOC_DAPM_OUTPUT ASoC: sdp4430 - add sdp4430 pcm ops to DAI. ASoC: TWL6040: Enable earphone path in codec ASoC: SDP4430: Add support for Earphone speaker ASoC: SDP4430: Add sdp4430 machine driver ASoC: tlv320dac33: Avoid powering off while in BIAS_OFF ASoC: tlv320dac33: Use dev_dbg in dac33_hard_power function ALSA: sound/pci/asihpi: Use kzalloc ALSA: hdmi - dont fail on extra nodes ALSA: intelhdmi - add id for the CougarPoint chipset ALSA: intelhdmi - user friendly codec name ALSA: intelhdmi - add dependency on SND_DYNAMIC_MINORS ALSA: asihpi: incorrect range check ALSA: asihpi: testing the wrong variable ALSA: es1688: add pedantic range checks ARM: McBSP: Add support for omap4 in McBSP driver ARM: McBSP: Fix request for irq in OMAP4 OMAP: McBSP: Add 32-bit mode support ...
Diffstat (limited to 'sound/drivers')
-rw-r--r--sound/drivers/opl4/opl4_proc.c83
1 files changed, 25 insertions, 58 deletions
diff --git a/sound/drivers/opl4/opl4_proc.c b/sound/drivers/opl4/opl4_proc.c
index 1679300b7583..df850b8830a5 100644
--- a/sound/drivers/opl4/opl4_proc.c
+++ b/sound/drivers/opl4/opl4_proc.c
@@ -49,77 +49,45 @@ static int snd_opl4_mem_proc_release(struct snd_info_entry *entry,
49 return 0; 49 return 0;
50} 50}
51 51
52static long snd_opl4_mem_proc_read(struct snd_info_entry *entry, void *file_private_data, 52static ssize_t snd_opl4_mem_proc_read(struct snd_info_entry *entry,
53 struct file *file, char __user *_buf, 53 void *file_private_data,
54 unsigned long count, unsigned long pos) 54 struct file *file, char __user *_buf,
55 size_t count, loff_t pos)
55{ 56{
56 struct snd_opl4 *opl4 = entry->private_data; 57 struct snd_opl4 *opl4 = entry->private_data;
57 long size;
58 char* buf; 58 char* buf;
59 59
60 size = count; 60 buf = vmalloc(count);
61 if (pos + size > entry->size) 61 if (!buf)
62 size = entry->size - pos; 62 return -ENOMEM;
63 if (size > 0) { 63 snd_opl4_read_memory(opl4, buf, pos, count);
64 buf = vmalloc(size); 64 if (copy_to_user(_buf, buf, count)) {
65 if (!buf)
66 return -ENOMEM;
67 snd_opl4_read_memory(opl4, buf, pos, size);
68 if (copy_to_user(_buf, buf, size)) {
69 vfree(buf);
70 return -EFAULT;
71 }
72 vfree(buf); 65 vfree(buf);
73 return size; 66 return -EFAULT;
74 } 67 }
75 return 0; 68 vfree(buf);
69 return count;
76} 70}
77 71
78static long snd_opl4_mem_proc_write(struct snd_info_entry *entry, void *file_private_data, 72static ssize_t snd_opl4_mem_proc_write(struct snd_info_entry *entry,
79 struct file *file, const char __user *_buf, 73 void *file_private_data,
80 unsigned long count, unsigned long pos) 74 struct file *file,
75 const char __user *_buf,
76 size_t count, loff_t pos)
81{ 77{
82 struct snd_opl4 *opl4 = entry->private_data; 78 struct snd_opl4 *opl4 = entry->private_data;
83 long size;
84 char *buf; 79 char *buf;
85 80
86 size = count; 81 buf = vmalloc(count);
87 if (pos + size > entry->size) 82 if (!buf)
88 size = entry->size - pos; 83 return -ENOMEM;
89 if (size > 0) { 84 if (copy_from_user(buf, _buf, count)) {
90 buf = vmalloc(size);
91 if (!buf)
92 return -ENOMEM;
93 if (copy_from_user(buf, _buf, size)) {
94 vfree(buf);
95 return -EFAULT;
96 }
97 snd_opl4_write_memory(opl4, buf, pos, size);
98 vfree(buf); 85 vfree(buf);
99 return size; 86 return -EFAULT;
100 }
101 return 0;
102}
103
104static long long snd_opl4_mem_proc_llseek(struct snd_info_entry *entry, void *file_private_data,
105 struct file *file, long long offset, int orig)
106{
107 switch (orig) {
108 case SEEK_SET:
109 file->f_pos = offset;
110 break;
111 case SEEK_CUR:
112 file->f_pos += offset;
113 break;
114 case SEEK_END: /* offset is negative */
115 file->f_pos = entry->size + offset;
116 break;
117 default:
118 return -EINVAL;
119 } 87 }
120 if (file->f_pos > entry->size) 88 snd_opl4_write_memory(opl4, buf, pos, count);
121 file->f_pos = entry->size; 89 vfree(buf);
122 return file->f_pos; 90 return count;
123} 91}
124 92
125static struct snd_info_entry_ops snd_opl4_mem_proc_ops = { 93static struct snd_info_entry_ops snd_opl4_mem_proc_ops = {
@@ -127,7 +95,6 @@ static struct snd_info_entry_ops snd_opl4_mem_proc_ops = {
127 .release = snd_opl4_mem_proc_release, 95 .release = snd_opl4_mem_proc_release,
128 .read = snd_opl4_mem_proc_read, 96 .read = snd_opl4_mem_proc_read,
129 .write = snd_opl4_mem_proc_write, 97 .write = snd_opl4_mem_proc_write,
130 .llseek = snd_opl4_mem_proc_llseek,
131}; 98};
132 99
133int snd_opl4_create_proc(struct snd_opl4 *opl4) 100int snd_opl4_create_proc(struct snd_opl4 *opl4)