aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers
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/drivers
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/drivers')
-rw-r--r--sound/drivers/opl4/opl4_proc.c24
1 files changed, 0 insertions, 24 deletions
diff --git a/sound/drivers/opl4/opl4_proc.c b/sound/drivers/opl4/opl4_proc.c
index 210b89de06d7..c5c13c4c260e 100644
--- a/sound/drivers/opl4/opl4_proc.c
+++ b/sound/drivers/opl4/opl4_proc.c
@@ -90,35 +90,11 @@ static ssize_t snd_opl4_mem_proc_write(struct snd_info_entry *entry,
90 return count; 90 return count;
91} 91}
92 92
93static loff_t snd_opl4_mem_proc_llseek(struct snd_info_entry *entry,
94 void *file_private_data,
95 struct file *file,
96 loff_t offset, int orig)
97{
98 switch (orig) {
99 case SEEK_SET:
100 file->f_pos = offset;
101 break;
102 case SEEK_CUR:
103 file->f_pos += offset;
104 break;
105 case SEEK_END: /* offset is negative */
106 file->f_pos = entry->size + offset;
107 break;
108 default:
109 return -EINVAL;
110 }
111 if (file->f_pos > entry->size)
112 file->f_pos = entry->size;
113 return file->f_pos;
114}
115
116static struct snd_info_entry_ops snd_opl4_mem_proc_ops = { 93static struct snd_info_entry_ops snd_opl4_mem_proc_ops = {
117 .open = snd_opl4_mem_proc_open, 94 .open = snd_opl4_mem_proc_open,
118 .release = snd_opl4_mem_proc_release, 95 .release = snd_opl4_mem_proc_release,
119 .read = snd_opl4_mem_proc_read, 96 .read = snd_opl4_mem_proc_read,
120 .write = snd_opl4_mem_proc_write, 97 .write = snd_opl4_mem_proc_write,
121 .llseek = snd_opl4_mem_proc_llseek,
122}; 98};
123 99
124int snd_opl4_create_proc(struct snd_opl4 *opl4) 100int snd_opl4_create_proc(struct snd_opl4 *opl4)