aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/mixart/mixart.c
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/pci/mixart/mixart.c
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/pci/mixart/mixart.c')
-rw-r--r--sound/pci/mixart/mixart.c79
1 files changed, 8 insertions, 71 deletions
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 3be8f97c8bc0..6c3fd4d1c49d 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1102,73 +1102,17 @@ static int snd_mixart_free(struct mixart_mgr *mgr)
1102/* 1102/*
1103 * proc interface 1103 * proc interface
1104 */ 1104 */
1105static long long snd_mixart_BA0_llseek(struct snd_info_entry *entry,
1106 void *private_file_data,
1107 struct file *file,
1108 long long offset,
1109 int orig)
1110{
1111 offset = offset & ~3; /* 4 bytes aligned */
1112
1113 switch(orig) {
1114 case SEEK_SET:
1115 file->f_pos = offset;
1116 break;
1117 case SEEK_CUR:
1118 file->f_pos += offset;
1119 break;
1120 case SEEK_END: /* offset is negative */
1121 file->f_pos = MIXART_BA0_SIZE + offset;
1122 break;
1123 default:
1124 return -EINVAL;
1125 }
1126 if(file->f_pos > MIXART_BA0_SIZE)
1127 file->f_pos = MIXART_BA0_SIZE;
1128 return file->f_pos;
1129}
1130
1131static long long snd_mixart_BA1_llseek(struct snd_info_entry *entry,
1132 void *private_file_data,
1133 struct file *file,
1134 long long offset,
1135 int orig)
1136{
1137 offset = offset & ~3; /* 4 bytes aligned */
1138
1139 switch(orig) {
1140 case SEEK_SET:
1141 file->f_pos = offset;
1142 break;
1143 case SEEK_CUR:
1144 file->f_pos += offset;
1145 break;
1146 case SEEK_END: /* offset is negative */
1147 file->f_pos = MIXART_BA1_SIZE + offset;
1148 break;
1149 default:
1150 return -EINVAL;
1151 }
1152 if(file->f_pos > MIXART_BA1_SIZE)
1153 file->f_pos = MIXART_BA1_SIZE;
1154 return file->f_pos;
1155}
1156 1105
1157/* 1106/*
1158 mixart_BA0 proc interface for BAR 0 - read callback 1107 mixart_BA0 proc interface for BAR 0 - read callback
1159 */ 1108 */
1160static long snd_mixart_BA0_read(struct snd_info_entry *entry, void *file_private_data, 1109static ssize_t snd_mixart_BA0_read(struct snd_info_entry *entry,
1161 struct file *file, char __user *buf, 1110 void *file_private_data,
1162 unsigned long count, unsigned long pos) 1111 struct file *file, char __user *buf,
1112 size_t count, loff_t pos)
1163{ 1113{
1164 struct mixart_mgr *mgr = entry->private_data; 1114 struct mixart_mgr *mgr = entry->private_data;
1165 unsigned long maxsize;
1166 1115
1167 if (pos >= MIXART_BA0_SIZE)
1168 return 0;
1169 maxsize = MIXART_BA0_SIZE - pos;
1170 if (count > maxsize)
1171 count = maxsize;
1172 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ 1116 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1173 if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count)) 1117 if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count))
1174 return -EFAULT; 1118 return -EFAULT;
@@ -1178,18 +1122,13 @@ static long snd_mixart_BA0_read(struct snd_info_entry *entry, void *file_private
1178/* 1122/*
1179 mixart_BA1 proc interface for BAR 1 - read callback 1123 mixart_BA1 proc interface for BAR 1 - read callback
1180 */ 1124 */
1181static long snd_mixart_BA1_read(struct snd_info_entry *entry, void *file_private_data, 1125static ssize_t snd_mixart_BA1_read(struct snd_info_entry *entry,
1182 struct file *file, char __user *buf, 1126 void *file_private_data,
1183 unsigned long count, unsigned long pos) 1127 struct file *file, char __user *buf,
1128 size_t count, loff_t pos)
1184{ 1129{
1185 struct mixart_mgr *mgr = entry->private_data; 1130 struct mixart_mgr *mgr = entry->private_data;
1186 unsigned long maxsize;
1187 1131
1188 if (pos > MIXART_BA1_SIZE)
1189 return 0;
1190 maxsize = MIXART_BA1_SIZE - pos;
1191 if (count > maxsize)
1192 count = maxsize;
1193 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ 1132 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1194 if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count)) 1133 if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count))
1195 return -EFAULT; 1134 return -EFAULT;
@@ -1198,12 +1137,10 @@ static long snd_mixart_BA1_read(struct snd_info_entry *entry, void *file_private
1198 1137
1199static struct snd_info_entry_ops snd_mixart_proc_ops_BA0 = { 1138static struct snd_info_entry_ops snd_mixart_proc_ops_BA0 = {
1200 .read = snd_mixart_BA0_read, 1139 .read = snd_mixart_BA0_read,
1201 .llseek = snd_mixart_BA0_llseek
1202}; 1140};
1203 1141
1204static struct snd_info_entry_ops snd_mixart_proc_ops_BA1 = { 1142static struct snd_info_entry_ops snd_mixart_proc_ops_BA1 = {
1205 .read = snd_mixart_BA1_read, 1143 .read = snd_mixart_BA1_read,
1206 .llseek = snd_mixart_BA1_llseek
1207}; 1144};
1208 1145
1209 1146