info.c (067e4a5d23422c9e9a0787b7e18fa2457226d999) | info.c (d97e1b78239c7e7e441088e0b644bd3b076002e6) |
---|---|
1/* 2 * Information interface for ALSA driver 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 * 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 218 unchanged lines hidden (view full) --- 227 if (pos >= buf->size) 228 return 0; 229 size = buf->size - pos; 230 size = min(count, size); 231 if (copy_to_user(buffer, buf->buffer + pos, size)) 232 return -EFAULT; 233 break; 234 case SNDRV_INFO_CONTENT_DATA: | 1/* 2 * Information interface for ALSA driver 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 * 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 218 unchanged lines hidden (view full) --- 227 if (pos >= buf->size) 228 return 0; 229 size = buf->size - pos; 230 size = min(count, size); 231 if (copy_to_user(buffer, buf->buffer + pos, size)) 232 return -EFAULT; 233 break; 234 case SNDRV_INFO_CONTENT_DATA: |
235 if (entry->c.ops->read) | 235 if (pos >= entry->size) 236 return 0; 237 if (entry->c.ops->read) { 238 size = entry->size - pos; 239 size = min(count, size); |
236 size = entry->c.ops->read(entry, 237 data->file_private_data, | 240 size = entry->c.ops->read(entry, 241 data->file_private_data, |
238 file, buffer, count, pos); | 242 file, buffer, size, pos); 243 } |
239 break; 240 } 241 if ((ssize_t) size > 0) 242 *offset = pos + size; 243 return size; 244} 245 246static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer, --- 30 unchanged lines hidden (view full) --- 277 mutex_unlock(&entry->access); 278 return -EFAULT; 279 } 280 buf->size = pos + count; 281 mutex_unlock(&entry->access); 282 size = count; 283 break; 284 case SNDRV_INFO_CONTENT_DATA: | 244 break; 245 } 246 if ((ssize_t) size > 0) 247 *offset = pos + size; 248 return size; 249} 250 251static ssize_t snd_info_entry_write(struct file *file, const char __user *buffer, --- 30 unchanged lines hidden (view full) --- 282 mutex_unlock(&entry->access); 283 return -EFAULT; 284 } 285 buf->size = pos + count; 286 mutex_unlock(&entry->access); 287 size = count; 288 break; 289 case SNDRV_INFO_CONTENT_DATA: |
285 if (entry->c.ops->write) | 290 if (entry->c.ops->write && count > 0) { 291 size_t maxsize = entry->size - pos; 292 count = min(count, maxsize); |
286 size = entry->c.ops->write(entry, 287 data->file_private_data, 288 file, buffer, count, pos); | 293 size = entry->c.ops->write(entry, 294 data->file_private_data, 295 file, buffer, count, pos); |
296 } |
|
289 break; 290 } 291 if ((ssize_t) size > 0) 292 *offset = pos + size; 293 return size; 294} 295 296static int snd_info_entry_open(struct inode *inode, struct file *file) --- 708 unchanged lines hidden --- | 297 break; 298 } 299 if ((ssize_t) size > 0) 300 *offset = pos + size; 301 return size; 302} 303 304static int snd_info_entry_open(struct inode *inode, struct file *file) --- 708 unchanged lines hidden --- |