mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 01:51:39 +00:00
[ALSA] return ENODEV for disconnected devices
Modules: ALSA Core Add dummy functions that return -ENODEV for the struct file_operations of a disconnected device. Without such functions, userspace would get ENOTTY. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
This commit is contained in:
parent
0b7bed4ec2
commit
b3b0abe11d
1 changed files with 42 additions and 0 deletions
|
@ -169,11 +169,44 @@ struct snd_card *snd_card_new(int idx, const char *xid,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static loff_t snd_disconnect_llseek(struct file *file, loff_t offset, int orig)
|
||||||
|
{
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t snd_disconnect_read(struct file *file, char __user *buf,
|
||||||
|
size_t count, loff_t *offset)
|
||||||
|
{
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssize_t snd_disconnect_write(struct file *file, const char __user *buf,
|
||||||
|
size_t count, loff_t *offset)
|
||||||
|
{
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned int snd_disconnect_poll(struct file * file, poll_table * wait)
|
static unsigned int snd_disconnect_poll(struct file * file, poll_table * wait)
|
||||||
{
|
{
|
||||||
return POLLERR | POLLNVAL;
|
return POLLERR | POLLNVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static long snd_disconnect_ioctl(struct file *file,
|
||||||
|
unsigned int cmd, unsigned long arg)
|
||||||
|
{
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int snd_disconnect_mmap(struct file *file, struct vm_area_struct *vma)
|
||||||
|
{
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int snd_disconnect_fasync(int fd, struct file *file, int on)
|
||||||
|
{
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* snd_card_disconnect - disconnect all APIs from the file-operations (user space)
|
* snd_card_disconnect - disconnect all APIs from the file-operations (user space)
|
||||||
* @card: soundcard structure
|
* @card: soundcard structure
|
||||||
|
@ -224,7 +257,16 @@ int snd_card_disconnect(struct snd_card *card)
|
||||||
memset(f_ops, 0, sizeof(*f_ops));
|
memset(f_ops, 0, sizeof(*f_ops));
|
||||||
f_ops->owner = file->f_op->owner;
|
f_ops->owner = file->f_op->owner;
|
||||||
f_ops->release = file->f_op->release;
|
f_ops->release = file->f_op->release;
|
||||||
|
f_ops->llseek = snd_disconnect_llseek;
|
||||||
|
f_ops->read = snd_disconnect_read;
|
||||||
|
f_ops->write = snd_disconnect_write;
|
||||||
f_ops->poll = snd_disconnect_poll;
|
f_ops->poll = snd_disconnect_poll;
|
||||||
|
f_ops->unlocked_ioctl = snd_disconnect_ioctl;
|
||||||
|
#ifdef CONFIG_COMPAT
|
||||||
|
f_ops->compat_ioctl = snd_disconnect_ioctl;
|
||||||
|
#endif
|
||||||
|
f_ops->mmap = snd_disconnect_mmap;
|
||||||
|
f_ops->fasync = snd_disconnect_fasync;
|
||||||
|
|
||||||
s_f_ops->next = card->s_f_ops;
|
s_f_ops->next = card->s_f_ops;
|
||||||
card->s_f_ops = s_f_ops;
|
card->s_f_ops = s_f_ops;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue