2 * 32bit -> 64bit ioctl wrapper for hwdep API
3 * Copyright (c) by Takashi Iwai <tiwai@suse.de>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include <sound/driver.h>
22 #include <linux/time.h>
24 #include <sound/core.h>
25 #include <sound/hwdep.h>
26 #include <asm/uaccess.h>
29 struct sndrv_hwdep_dsp_image32 {
31 unsigned char name[64];
32 u32 image; /* pointer */
35 } /* don't set packed attribute here */;
37 static int _snd_ioctl32_hwdep_dsp_image(unsigned int fd, unsigned int cmd, unsigned long arg, struct file *file, unsigned int native_ctl)
39 struct sndrv_hwdep_dsp_image data;
40 struct sndrv_hwdep_dsp_image32 data32;
44 if (copy_from_user(&data32, (void __user *)arg, sizeof(data32)))
46 memset(&data, 0, sizeof(data));
47 data.index = data32.index;
48 memcpy(data.name, data32.name, sizeof(data.name));
49 data.image = compat_ptr(data32.image);
50 data.length = data32.length;
51 data.driver_data = data32.driver_data;
54 err = file->f_op->ioctl(file->f_dentry->d_inode, file, native_ctl, (unsigned long)&data);
59 DEFINE_ALSA_IOCTL_ENTRY(hwdep_dsp_image, hwdep_dsp_image, SNDRV_HWDEP_IOCTL_DSP_LOAD);
61 #define AP(x) snd_ioctl32_##x
64 SNDRV_HWDEP_IOCTL_DSP_LOAD32 = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image32)
67 struct ioctl32_mapper hwdep_mappers[] = {
68 MAP_COMPAT(SNDRV_HWDEP_IOCTL_PVERSION),
69 MAP_COMPAT(SNDRV_HWDEP_IOCTL_INFO),
70 MAP_COMPAT(SNDRV_HWDEP_IOCTL_DSP_STATUS),
71 { SNDRV_HWDEP_IOCTL_DSP_LOAD32, AP(hwdep_dsp_image) },