}
int
-snd_wavefront_fx_open (snd_hwdep_t *hw, struct file *file)
+snd_wavefront_fx_open (struct snd_hwdep *hw, struct file *file)
{
if (!try_module_get(hw->card->module))
}
int
-snd_wavefront_fx_release (snd_hwdep_t *hw, struct file *file)
+snd_wavefront_fx_release (struct snd_hwdep *hw, struct file *file)
{
module_put(hw->card->module);
}
int
-snd_wavefront_fx_ioctl (snd_hwdep_t *sdev, struct file *file,
+snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file,
unsigned int cmd, unsigned long arg)
{
- snd_card_t *card;
+ struct snd_card *card;
snd_wavefront_card_t *acard;
snd_wavefront_t *dev;
wavefront_fx_info r;
- unsigned short page_data[256];
+ unsigned short *page_data = NULL;
unsigned short *pd;
+ int err = 0;
snd_assert(sdev->card != NULL, return -ENODEV);
} else if (r.data[2] == 1) {
pd = (unsigned short *) &r.data[3];
} else {
- if (r.data[2] > (long)sizeof (page_data)) {
+ if (r.data[2] > 256) {
snd_printk ("cannot write "
- "> 255 bytes to FX\n");
+ "> 512 bytes to FX\n");
return -EIO;
}
+ page_data = kmalloc(r.data[2] * sizeof(short), GFP_KERNEL);
+ if (!page_data)
+ return -ENOMEM;
if (copy_from_user (page_data,
(unsigned char __user *) r.data[3],
- r.data[2]))
+ r.data[2] * sizeof(short))) {
+ kfree(page_data);
return -EFAULT;
+ }
pd = page_data;
}
- wavefront_fx_memset (dev,
+ err = wavefront_fx_memset (dev,
r.data[0], /* page */
r.data[1], /* addr */
r.data[2], /* cnt */
pd);
+ kfree(page_data);
break;
default:
r.request);
return -ENOTTY;
}
- return 0;
+ return err;
}
/* YSS225 initialization.