Changeset 598 for GPL/trunk/alsa-kernel/pci/emu10k1/emuproc.c
- Timestamp:
- Apr 3, 2017, 4:51:56 PM (8 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
-
Property svn:mergeinfo
set to
/GPL/branches/uniaud32-2.1.x merged eligible
-
Property svn:mergeinfo
set to
-
GPL/trunk/alsa-kernel/pci/emu10k1/emuproc.c
r399 r598 342 342 #define A_TOTAL_SIZE_CODE (0x400*8) 343 343 344 static long snd_emu10k1_fx8010_read(struct snd_info_entry *entry, 345 void *file_private_data, 346 struct file *file, char __user *buf, 347 unsigned long count, unsigned long pos) 348 { 349 long size; 344 static ssize_t snd_emu10k1_fx8010_read(struct snd_info_entry *entry, 345 void *file_private_data, 346 struct file *file, char __user *buf, 347 size_t count, loff_t pos) 348 { 350 349 struct snd_emu10k1 *emu = entry->private_data; 351 350 unsigned int offset; 352 351 int tram_addr = 0; 352 unsigned int *tmp; 353 long res; 354 unsigned int idx; 353 355 354 356 if (!strcmp(entry->name, "fx8010_tram_addr")) { … … 362 364 offset = emu->audigy ? A_FXGPREGBASE : FXGPREGBASE; 363 365 } 364 size = count; 365 if (pos + size > entry->size) 366 size = (long)entry->size - pos; 367 if (size > 0) { 368 unsigned int *tmp; 369 long res; 370 unsigned int idx; 371 if ((tmp = kmalloc(size + 8, GFP_KERNEL)) == NULL) 372 return -ENOMEM; 373 for (idx = 0; idx < ((pos & 3) + size + 3) >> 2; idx++) 374 if (tram_addr && emu->audigy) { 375 tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0) >> 11; 376 tmp[idx] |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20; 377 } else 378 tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0); 379 if (copy_to_user(buf, ((char *)tmp) + (pos & 3), size)) 380 res = -EFAULT; 381 else { 382 res = size; 366 367 tmp = kmalloc(count + 8, GFP_KERNEL); 368 if (!tmp) 369 return -ENOMEM; 370 for (idx = 0; idx < ((pos & 3) + count + 3) >> 2; idx++) { 371 unsigned int val; 372 val = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0); 373 if (tram_addr && emu->audigy) { 374 val >>= 11; 375 val |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20; 383 376 } 384 kfree(tmp); 385 return res; 386 } 387 return 0; 377 tmp[idx] = val; 378 } 379 if (copy_to_user(buf, ((char *)tmp) + (pos & 3), count)) 380 res = -EFAULT; 381 else 382 res = count; 383 kfree(tmp); 384 return res; 388 385 } 389 386 … … 452 449 if (sscanf(line, "%x %x", ®, &val) != 2) 453 450 continue; 454 if ( (reg < 0x40) && (reg >= 0) && (val <= 0xffffffff)) {451 if (reg < 0x40 && val <= 0xffffffff) { 455 452 spin_lock_irqsave(&emu->emu_lock, flags); 456 453 outl(val, emu->port + (reg & 0xfffffffc)); … … 528 525 if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) 529 526 continue; 530 if ( (reg < 0xa0) && (reg >= 0) && (val <= 0xffffffff) && (channel_id >= 0) && (channel_id <= 3))527 if (reg < 0xa0 && val <= 0xffffffff && channel_id <= 3) 531 528 snd_ptr_write(emu, iobase, reg, channel_id, val); 532 529 }
Note:
See TracChangeset
for help on using the changeset viewer.