/* * HWDEP Interface for HD-audio codec * * Copyright (c) 2007 Takashi Iwai * * This driver is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This driver is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include "hda_codec.h" #include "hda_local.h" #include #include /* * write/read an out-of-bound verb */ static int verb_write_ioctl(struct hda_codec *codec, struct hda_verb_ioctl __user *arg) { u32 verb, res; if (get_user(verb, &arg->verb)) return -EFAULT; res = snd_hda_codec_read(codec, verb >> 24, 0, (verb >> 8) & 0xffff, verb & 0xff); if (put_user(res, &arg->res)) return -EFAULT; return 0; } static int get_wcap_ioctl(struct hda_codec *codec, struct hda_verb_ioctl __user *arg) { u32 verb, res; if (get_user(verb, &arg->verb)) return -EFAULT; res = get_wcaps(codec, verb >> 24); if (put_user(res, &arg->res)) return -EFAULT; return 0; } /* */ static int hda_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigned int cmd, unsigned long arg) { struct hda_codec *codec = hw->private_data; void __user *argp = (void __user *)arg; switch (cmd) { case HDA_IOCTL_PVERSION: return put_user(HDA_HWDEP_VERSION, (int __user *)argp); case HDA_IOCTL_VERB_WRITE: return verb_write_ioctl(codec, argp); case HDA_IOCTL_GET_WCAP: return get_wcap_ioctl(codec, argp); } return -ENOIOCTLCMD; } #ifdef CONFIG_COMPAT static int hda_hwdep_ioctl_compat(struct snd_hwdep *hw, struct file *file, unsigned int cmd, unsigned long arg) { return hda_hwdep_ioctl(hw, file, cmd, (unsigned long)compat_ptr(arg)); } #endif static int hda_hwdep_open(struct snd_hwdep *hw, struct file *file) { #ifndef CONFIG_SND_DEBUG_VERBOSE if (!capable(CAP_SYS_RAWIO)) return -EACCES; #endif return 0; } int snd_hda_create_hwdep(struct hda_codec *codec) { char hwname[16]; struct snd_hwdep *hwdep; int err; sprintf(hwname, "HDA Codec %d", codec->addr); err = snd_hwdep_new(codec->card, hwname, codec->addr, &hwdep); if (err < 0) return err; codec->hwdep = hwdep; sprintf(hwdep->name, "HDA Codec %d", codec->addr); hwdep->iface = SNDRV_HWDEP_IFACE_HDA; hwdep->private_data = codec; hwdep->exclusive = 1; hwdep->ops.open = hda_hwdep_open; hwdep->ops.ioctl = hda_hwdep_ioctl; #ifdef CONFIG_COMPAT hwdep->ops.ioctl_compat = hda_hwdep_ioctl_compat; #endif /* for sysfs */ hwdep->dev.groups = snd_hda_dev_attr_groups; dev_set_drvdata(&hwdep->dev, codec); return 0; } ns
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-01 12:27:05 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-01 12:27:05 -0800
commit4759d386d55fef452d692bf101167914437e848e (patch)
treee7109c192ec589fcea2a98f9702aa3c0e4009581 /fs/xfs/xfs_iomap.c
parent238d1d0f79f619d75c2cc741d6770fb0986aef24 (diff)
parent1db175428ee374489448361213e9c3b749d14900 (diff)
Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull DAX updates from Dan Williams: "The completion of Jan's DAX work for 4.10. As I mentioned in the libnvdimm-for-4.10 pull request, these are some final fixes for the DAX dirty-cacheline-tracking invalidation work that was merged through the -mm, ext4, and xfs trees in -rc1. These patches were prepared prior to the merge window, but we waited for 4.10-rc1 to have a stable merge base after all the prerequisites were merged. Quoting Jan on the overall changes in these patches: "So I'd like all these 6 patches to go for rc2. The first three patches fix invalidation of exceptional DAX entries (a bug which is there for a long time) - without these patches data loss can occur on power failure even though user called fsync(2). The other three patches change locking of DAX faults so that ->iomap_begin() is called in a more relaxed locking context and we are safe to start a transaction there for ext4" These have received a build success notification from the kbuild robot, and pass the latest libnvdimm unit tests. There have not been any -next releases since -rc1, so they have not appeared there" * 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: ext4: Simplify DAX fault path dax: Call ->iomap_begin without entry lock during dax fault dax: Finish fault completely when loading holes dax: Avoid page invalidation races and unnecessary radix tree traversals mm: Invalidate DAX radix tree entries only if appropriate ext2: Return BH_New buffers for zeroed blocks
Diffstat (limited to 'fs/xfs/xfs_iomap.c')