Skip to content

Commit

Permalink
ALSA: rawmidi: Add ioctl callback to snd_rawmidi_global_ops
Browse files Browse the repository at this point in the history
A new callback, ioctl, is added to snd_rawmidi_global_ops for allowing
the driver to deal with the own ioctls.  This is another preparation
patch for the upcoming UMP support.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230523075358.9672-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed May 23, 2023
1 parent 09b6289 commit fb3bd12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/sound/rawmidi.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ struct snd_rawmidi_global_ops {
int (*dev_unregister) (struct snd_rawmidi * rmidi);
void (*get_port_info)(struct snd_rawmidi *rmidi, int number,
struct snd_seq_port_info *info);
long (*ioctl)(struct snd_rawmidi *rmidi, unsigned int cmd,
void __user *argp);
};

struct snd_rawmidi_runtime {
Expand Down
7 changes: 5 additions & 2 deletions sound/core/rawmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ static int snd_rawmidi_ioctl_status64(struct snd_rawmidi_file *rfile,
static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct snd_rawmidi_file *rfile;
struct snd_rawmidi *rmidi;
void __user *argp = (void __user *)arg;

rfile = file->private_data;
Expand Down Expand Up @@ -984,8 +985,10 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
}
}
default:
rmidi_dbg(rfile->rmidi,
"rawmidi: unknown command = 0x%x\n", cmd);
rmidi = rfile->rmidi;
if (rmidi->ops && rmidi->ops->ioctl)
return rmidi->ops->ioctl(rmidi, cmd, argp);
rmidi_dbg(rmidi, "rawmidi: unknown command = 0x%x\n", cmd);
}
return -ENOTTY;
}
Expand Down

0 comments on commit fb3bd12

Please sign in to comment.