aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-05-20 05:58:57 -0400
committerTakashi Iwai <tiwai@suse.de>2010-05-20 05:58:57 -0400
commit3374cd1abd478f767aaedf2c21d109596ff0fe72 (patch)
tree46b00a571ba5d86373bd9054fdccc5dc6e28e42f /sound/isa
parente40152ee1e1c7a63f4777791863215e3faa37a86 (diff)
parent670ff6abd6caff406b217f8a828d6c03656535d8 (diff)
Merge branch 'topic/core-cleanup' into for-linus
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/gus/gus_mem_proc.c48
1 files changed, 8 insertions, 40 deletions
diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c
index 2803e227aec9..2ccb3fadd7be 100644
--- a/sound/isa/gus/gus_mem_proc.c
+++ b/sound/isa/gus/gus_mem_proc.c
@@ -31,52 +31,21 @@ struct gus_proc_private {
31 struct snd_gus_card * gus; 31 struct snd_gus_card * gus;
32}; 32};
33 33
34static long snd_gf1_mem_proc_dump(struct snd_info_entry *entry, void *file_private_data, 34static ssize_t snd_gf1_mem_proc_dump(struct snd_info_entry *entry,
35 struct file *file, char __user *buf, 35 void *file_private_data,
36 unsigned long count, unsigned long pos) 36 struct file *file, char __user *buf,
37 size_t count, loff_t pos)
37{ 38{
38 long size;
39 struct gus_proc_private *priv = entry->private_data; 39 struct gus_proc_private *priv = entry->private_data;
40 struct snd_gus_card *gus = priv->gus; 40 struct snd_gus_card *gus = priv->gus;
41 int err; 41 int err;
42 42
43 size = count; 43 err = snd_gus_dram_read(gus, buf, pos, count, priv->rom);
44 if (pos + size > priv->size) 44 if (err < 0)
45 size = (long)priv->size - pos; 45 return err;
46 if (size > 0) { 46 return count;
47 if ((err = snd_gus_dram_read(gus, buf, pos, size, priv->rom)) < 0)
48 return err;
49 return size;
50 }
51 return 0;
52} 47}
53 48
54static long long snd_gf1_mem_proc_llseek(struct snd_info_entry *entry,
55 void *private_file_data,
56 struct file *file,
57 long long offset,
58 int orig)
59{
60 struct gus_proc_private *priv = entry->private_data;
61
62 switch (orig) {
63 case SEEK_SET:
64 file->f_pos = offset;
65 break;
66 case SEEK_CUR:
67 file->f_pos += offset;
68 break;
69 case SEEK_END: /* offset is negative */
70 file->f_pos = priv->size + offset;
71 break;
72 default:
73 return -EINVAL;
74 }
75 if (file->f_pos > priv->size)
76 file->f_pos = priv->size;
77 return file->f_pos;
78}
79
80static void snd_gf1_mem_proc_free(struct snd_info_entry *entry) 49static void snd_gf1_mem_proc_free(struct snd_info_entry *entry)
81{ 50{
82 struct gus_proc_private *priv = entry->private_data; 51 struct gus_proc_private *priv = entry->private_data;
@@ -85,7 +54,6 @@ static void snd_gf1_mem_proc_free(struct snd_info_entry *entry)
85 54
86static struct snd_info_entry_ops snd_gf1_mem_proc_ops = { 55static struct snd_info_entry_ops snd_gf1_mem_proc_ops = {
87 .read = snd_gf1_mem_proc_dump, 56 .read = snd_gf1_mem_proc_dump,
88 .llseek = snd_gf1_mem_proc_llseek,
89}; 57};
90 58
91int snd_gf1_mem_proc_init(struct snd_gus_card * gus) 59int snd_gf1_mem_proc_init(struct snd_gus_card * gus)