int snd_yrw801_detect(struct snd_opl4 *opl4) { char buf[15]; snd_opl4_read_memory(opl4, buf, 0x001200, 15); if (memcmp(buf, "CopyrightYAMAHA", 15)) return -ENODEV; snd_opl4_read_memory(opl4, buf, 0x1ffffe, 2); if (buf[0] != 0x01) return -ENODEV; snd_printdd("YRW801 ROM version %02x.%02x\n", buf[0], buf[1]); return 0; }
static ssize_t snd_opl4_mem_proc_read(struct snd_info_entry *entry, void *file_private_data, struct file *file, char __user *_buf, size_t count, loff_t pos) { struct snd_opl4 *opl4 = entry->private_data; char* buf; buf = vmalloc(count); if (!buf) return -ENOMEM; snd_opl4_read_memory(opl4, buf, pos, count); if (copy_to_user(_buf, buf, count)) { vfree(buf); return -EFAULT; } vfree(buf); return count; }