All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Harker <george@george-graphics.co.uk>
To: Takashi Iwai <tiwai@suse.de>
Cc: George Harker <george@george-graphics.co.uk>,
	Clemens Ladisch <clemens@ladisch.de>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] use usb headers rather than define structs locally
Date: Fri, 26 Feb 2021 21:24:56 +0000	[thread overview]
Message-ID: <20210226212457.24538-1-george@george-graphics.co.uk> (raw)
In-Reply-To: <s5hczwpucd3.wl-tiwai@suse.de>

Use struct definitions from linux/usb/midi.h rather than locally define
the structs in sound/usb/midi.c .

Signed-off-by: George Harker <george@george-graphics.co.uk>
---
 sound/usb/midi.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 0c23fa6d8..610cf54ee 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -47,6 +47,7 @@
 #include <linux/usb.h>
 #include <linux/wait.h>
 #include <linux/usb/audio.h>
+#include <linux/usb/midi.h>
 #include <linux/module.h>
 
 #include <sound/core.h>
@@ -77,23 +78,6 @@ MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
 MODULE_DESCRIPTION("USB Audio/MIDI helper module");
 MODULE_LICENSE("Dual BSD/GPL");
 
-
-struct usb_ms_header_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-	__u8  bDescriptorSubtype;
-	__u8  bcdMSC[2];
-	__le16 wTotalLength;
-} __attribute__ ((packed));
-
-struct usb_ms_endpoint_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-	__u8  bDescriptorSubtype;
-	__u8  bNumEmbMIDIJack;
-	__u8  baAssocJackID[];
-} __attribute__ ((packed));
-
 struct snd_usb_midi_in_endpoint;
 struct snd_usb_midi_out_endpoint;
 struct snd_usb_midi_endpoint;
@@ -1875,7 +1859,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi *umidi,
 	    ms_header->bDescriptorType == USB_DT_CS_INTERFACE &&
 	    ms_header->bDescriptorSubtype == UAC_HEADER)
 		dev_dbg(&umidi->dev->dev, "MIDIStreaming version %02x.%02x\n",
-			    ms_header->bcdMSC[1], ms_header->bcdMSC[0]);
+			    ((uint8_t *)&ms_header->bcdMSC)[1], ((uint8_t *)&ms_header->bcdMSC)[0]);
 	else
 		dev_warn(&umidi->dev->dev,
 			 "MIDIStreaming interface descriptor not found\n");
-- 
2.20.1


WARNING: multiple messages have this Message-ID (diff)
From: George Harker <george@george-graphics.co.uk>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org,
	George Harker <george@george-graphics.co.uk>,
	Clemens Ladisch <clemens@ladisch.de>,
	linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.com>
Subject: [PATCH 1/2] use usb headers rather than define structs locally
Date: Fri, 26 Feb 2021 21:24:56 +0000	[thread overview]
Message-ID: <20210226212457.24538-1-george@george-graphics.co.uk> (raw)
In-Reply-To: <s5hczwpucd3.wl-tiwai@suse.de>

Use struct definitions from linux/usb/midi.h rather than locally define
the structs in sound/usb/midi.c .

Signed-off-by: George Harker <george@george-graphics.co.uk>
---
 sound/usb/midi.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index 0c23fa6d8..610cf54ee 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -47,6 +47,7 @@
 #include <linux/usb.h>
 #include <linux/wait.h>
 #include <linux/usb/audio.h>
+#include <linux/usb/midi.h>
 #include <linux/module.h>
 
 #include <sound/core.h>
@@ -77,23 +78,6 @@ MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
 MODULE_DESCRIPTION("USB Audio/MIDI helper module");
 MODULE_LICENSE("Dual BSD/GPL");
 
-
-struct usb_ms_header_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-	__u8  bDescriptorSubtype;
-	__u8  bcdMSC[2];
-	__le16 wTotalLength;
-} __attribute__ ((packed));
-
-struct usb_ms_endpoint_descriptor {
-	__u8  bLength;
-	__u8  bDescriptorType;
-	__u8  bDescriptorSubtype;
-	__u8  bNumEmbMIDIJack;
-	__u8  baAssocJackID[];
-} __attribute__ ((packed));
-
 struct snd_usb_midi_in_endpoint;
 struct snd_usb_midi_out_endpoint;
 struct snd_usb_midi_endpoint;
@@ -1875,7 +1859,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi *umidi,
 	    ms_header->bDescriptorType == USB_DT_CS_INTERFACE &&
 	    ms_header->bDescriptorSubtype == UAC_HEADER)
 		dev_dbg(&umidi->dev->dev, "MIDIStreaming version %02x.%02x\n",
-			    ms_header->bcdMSC[1], ms_header->bcdMSC[0]);
+			    ((uint8_t *)&ms_header->bcdMSC)[1], ((uint8_t *)&ms_header->bcdMSC)[0]);
 	else
 		dev_warn(&umidi->dev->dev,
 			 "MIDIStreaming interface descriptor not found\n");
-- 
2.20.1


  reply	other threads:[~2021-02-26 21:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210221094148.30447-1-george@george-graphics.co.uk>
2021-02-21  9:43 ` [PATCH] sound/usb generate midi streaming substream names from jack names George Harker
2021-02-21  9:43   ` George Harker
2021-02-24  7:57   ` Takashi Iwai
2021-02-24  7:57     ` Takashi Iwai
2021-02-26 21:24     ` George Harker [this message]
2021-02-26 21:24       ` [PATCH 1/2] use usb headers rather than define structs locally George Harker
2021-02-26 21:26     ` [PATCH 2/2] midi streaming substream names from jack names A number of devices have named substreams which are hard to remember / decypher from <device> MIDI n names. Eg. Korg puts a pass through on one substream and iConnectivity devices name the connections George Harker
2021-02-26 21:26       ` George Harker
2021-02-26 21:36       ` George Harker
2021-02-26 21:36         ` George Harker
2021-03-01  8:27         ` Takashi Iwai
2021-03-01  8:27           ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210226212457.24538-1-george@george-graphics.co.uk \
    --to=george@george-graphics.co.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.