aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/mixart
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-04-13 05:39:47 -0400
committerTakashi Iwai <tiwai@suse.de>2010-04-13 06:01:20 -0400
commit73029e0ff18dfac8a1aab1dc188e1e150bbe3adc (patch)
tree680d00a2e5bc124b5b1b642508a47a90e3c47b3f /sound/pci/mixart
parentd97e1b78239c7e7e441088e0b644bd3b076002e6 (diff)
ALSA: info - Implement common llseek for binary mode
The llseek implementation is identical for existing driver implementations, so let's merge to the common layer. The same code for the text proc file can be used even for the binary proc file. The driver can provide its own llseek method if needed. Then the common code will be skipped. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/mixart')
-rw-r--r--sound/pci/mixart/mixart.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index be95e005c81d..6c3fd4d1c49d 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1102,55 +1102,6 @@ static int snd_mixart_free(struct mixart_mgr *mgr)
1102/* 1102/*
1103 * proc interface 1103 * proc interface
1104 */ 1104 */
1105static loff_t snd_mixart_BA0_llseek(struct snd_info_entry *entry,
1106 void *private_file_data,
1107 struct file *file,
1108 loff_t offset, int orig)
1109{
1110 offset = offset & ~3; /* 4 bytes aligned */
1111
1112 switch(orig) {
1113 case SEEK_SET:
1114 file->f_pos = offset;
1115 break;
1116 case SEEK_CUR:
1117 file->f_pos += offset;
1118 break;
1119 case SEEK_END: /* offset is negative */
1120 file->f_pos = MIXART_BA0_SIZE + offset;
1121 break;
1122 default:
1123 return -EINVAL;
1124 }
1125 if(file->f_pos > MIXART_BA0_SIZE)
1126 file->f_pos = MIXART_BA0_SIZE;
1127 return file->f_pos;
1128}
1129
1130static loff_t snd_mixart_BA1_llseek(struct snd_info_entry *entry,
1131 void *private_file_data,
1132 struct file *file,
1133 loff_t offset, int orig)
1134{
1135 offset = offset & ~3; /* 4 bytes aligned */
1136
1137 switch(orig) {
1138 case SEEK_SET:
1139 file->f_pos = offset;
1140 break;
1141 case SEEK_CUR:
1142 file->f_pos += offset;
1143 break;
1144 case SEEK_END: /* offset is negative */
1145 file->f_pos = MIXART_BA1_SIZE + offset;
1146 break;
1147 default:
1148 return -EINVAL;
1149 }
1150 if(file->f_pos > MIXART_BA1_SIZE)
1151 file->f_pos = MIXART_BA1_SIZE;
1152 return file->f_pos;
1153}
1154 1105
1155/* 1106/*
1156 mixart_BA0 proc interface for BAR 0 - read callback 1107 mixart_BA0 proc interface for BAR 0 - read callback
@@ -1186,12 +1137,10 @@ static ssize_t snd_mixart_BA1_read(struct snd_info_entry *entry,
1186 1137
1187static struct snd_info_entry_ops snd_mixart_proc_ops_BA0 = { 1138static struct snd_info_entry_ops snd_mixart_proc_ops_BA0 = {
1188 .read = snd_mixart_BA0_read, 1139 .read = snd_mixart_BA0_read,
1189 .llseek = snd_mixart_BA0_llseek
1190}; 1140};
1191 1141
1192static struct snd_info_entry_ops snd_mixart_proc_ops_BA1 = { 1142static struct snd_info_entry_ops snd_mixart_proc_ops_BA1 = {
1193 .read = snd_mixart_BA1_read, 1143 .read = snd_mixart_BA1_read,
1194 .llseek = snd_mixart_BA1_llseek
1195}; 1144};
1196 1145
1197 1146