mixart.c (24e4a1211f691fc671de44685430dbad757d8487) mixart.c (d97e1b78239c7e7e441088e0b644bd3b076002e6)
1/*
2 * Driver for Digigram miXart soundcards
3 *
4 * main file with alsa callbacks
5 *
6 * Copyright (c) 2003 by Digigram <alsa@digigram.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 1147 unchanged lines hidden (view full) ---

1156 mixart_BA0 proc interface for BAR 0 - read callback
1157 */
1158static ssize_t snd_mixart_BA0_read(struct snd_info_entry *entry,
1159 void *file_private_data,
1160 struct file *file, char __user *buf,
1161 size_t count, loff_t pos)
1162{
1163 struct mixart_mgr *mgr = entry->private_data;
1/*
2 * Driver for Digigram miXart soundcards
3 *
4 * main file with alsa callbacks
5 *
6 * Copyright (c) 2003 by Digigram <alsa@digigram.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 1147 unchanged lines hidden (view full) ---

1156 mixart_BA0 proc interface for BAR 0 - read callback
1157 */
1158static ssize_t snd_mixart_BA0_read(struct snd_info_entry *entry,
1159 void *file_private_data,
1160 struct file *file, char __user *buf,
1161 size_t count, loff_t pos)
1162{
1163 struct mixart_mgr *mgr = entry->private_data;
1164 unsigned long maxsize;
1165
1164
1166 if (pos >= MIXART_BA0_SIZE)
1167 return 0;
1168 maxsize = MIXART_BA0_SIZE - pos;
1169 if (count > maxsize)
1170 count = maxsize;
1171 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1172 if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count))
1173 return -EFAULT;
1174 return count;
1175}
1176
1177/*
1178 mixart_BA1 proc interface for BAR 1 - read callback
1179 */
1180static ssize_t snd_mixart_BA1_read(struct snd_info_entry *entry,
1181 void *file_private_data,
1182 struct file *file, char __user *buf,
1183 size_t count, loff_t pos)
1184{
1185 struct mixart_mgr *mgr = entry->private_data;
1165 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1166 if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count))
1167 return -EFAULT;
1168 return count;
1169}
1170
1171/*
1172 mixart_BA1 proc interface for BAR 1 - read callback
1173 */
1174static ssize_t snd_mixart_BA1_read(struct snd_info_entry *entry,
1175 void *file_private_data,
1176 struct file *file, char __user *buf,
1177 size_t count, loff_t pos)
1178{
1179 struct mixart_mgr *mgr = entry->private_data;
1186 unsigned long maxsize;
1187
1180
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 */
1194 if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count))
1195 return -EFAULT;
1196 return count;
1197}
1198
1199static struct snd_info_entry_ops snd_mixart_proc_ops_BA0 = {
1200 .read = snd_mixart_BA0_read,

--- 264 unchanged lines hidden ---
1181 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1182 if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count))
1183 return -EFAULT;
1184 return count;
1185}
1186
1187static struct snd_info_entry_ops snd_mixart_proc_ops_BA0 = {
1188 .read = snd_mixart_BA0_read,

--- 264 unchanged lines hidden ---