diff mbox series

[02/36] ALSA: rawmidi: Add ioctl callback to snd_rawmidi_global_ops

Message ID 20230519093114.28813-3-tiwai@suse.de (mailing list archive)
State Superseded
Headers show
Series ALSA: Add MIDI 2.0 support | expand

Commit Message

Takashi Iwai May 19, 2023, 9:30 a.m. UTC
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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 include/sound/rawmidi.h | 3 +++
 sound/core/rawmidi.c    | 2 ++
 2 files changed, 5 insertions(+)

Comments

Jaroslav Kysela May 22, 2023, 5:41 a.m. UTC | #1
On 19. 05. 23 11:30, Takashi Iwai wrote:
> 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.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
diff mbox series

Patch

diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 52b1cbfb2526..a53cd063412c 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -32,6 +32,7 @@ 
 
 struct snd_rawmidi;
 struct snd_rawmidi_substream;
+struct snd_rawmidi_file;
 struct snd_seq_port_info;
 struct pid;
 
@@ -47,6 +48,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_file *rfile, unsigned int cmd,
+		      void __user *argp);
 };
 
 struct snd_rawmidi_runtime {
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 589b75087d27..1415f559b5d0 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -984,6 +984,8 @@  static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
 		}
 	}
 	default:
+		if (rfile->rmidi->ops && rfile->rmidi->ops->ioctl)
+			return rfile->rmidi->ops->ioctl(rfile, cmd, argp);
 		rmidi_dbg(rfile->rmidi,
 			  "rawmidi: unknown command = 0x%x\n", cmd);
 	}