From: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>
To: Torsten Schenk <torsten.schenk-ytc+IHgoah0@public.gmane.org>
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] 6fire: fix URB transfer buffer for midi output
Date: Wed, 07 Aug 2013 18:34:52 +0200 [thread overview]
Message-ID: <s5hli4d5uj7.wl%tiwai@suse.de> (raw)
In-Reply-To: <20130807165149.188c4b16297be52c0630a18f-ytc+IHgoah0@public.gmane.org>
[Cc'ed to linux-usb ML]
At Wed, 7 Aug 2013 16:51:49 +0200,
Torsten Schenk wrote:
>
> Patch fixes URB transfer buffer allocation for midi output to be DMA-able.
Is this really needed?
That is, can't a transfer buffer be at middle of kmalloc'ed space, but
must be always the head of the kmalloc'ed space?
Takashi
>
> Signed-off-by: Torsten Schenk <torsten.schenk-ytc+IHgoah0@public.gmane.org>
> ---
> diff -Nur a/sound/usb/6fire/midi.c b/sound/usb/6fire/midi.c
> --- a/sound/usb/6fire/midi.c 2013-08-07 16:32:10.579639391 +0200
> +++ b/sound/usb/6fire/midi.c 2013-08-07 16:32:31.363378104 +0200
> @@ -19,6 +19,10 @@
> #include "chip.h"
> #include "comm.h"
>
> +enum {
> + MIDI_BUFSIZE = 64
> +};
> +
> static void usb6fire_midi_out_handler(struct urb *urb)
> {
> struct midi_runtime *rt = urb->context;
> @@ -156,6 +160,12 @@
> if (!rt)
> return -ENOMEM;
>
> + rt->out_buffer = kzalloc(MIDI_BUFSIZE, GFP_KERNEL);
> + if (!rt->out_buffer) {
> + kfree(rt);
> + return -ENOMEM;
> + }
> +
> rt->chip = chip;
> rt->in_received = usb6fire_midi_in_received;
> rt->out_buffer[0] = 0x80; /* 'send midi' command */
> @@ -169,6 +179,7 @@
>
> ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance);
> if (ret < 0) {
> + kfree(rt->out_buffer);
> kfree(rt);
> snd_printk(KERN_ERR PREFIX "unable to create midi.\n");
> return ret;
> @@ -197,6 +208,9 @@
>
> void usb6fire_midi_destroy(struct sfire_chip *chip)
> {
> - kfree(chip->midi);
> + struct midi_runtime *rt = chip->midi;
> +
> + kfree(rt->out_buffer);
> + kfree(rt);
> chip->midi = NULL;
> }
> diff -Nur a/sound/usb/6fire/midi.h b/sound/usb/6fire/midi.h
> --- a/sound/usb/6fire/midi.h 2013-08-07 16:32:10.579639391 +0200
> +++ b/sound/usb/6fire/midi.h 2013-08-07 16:32:31.363378104 +0200
> @@ -16,10 +16,6 @@
>
> #include "common.h"
>
> -enum {
> - MIDI_BUFSIZE = 64
> -};
> -
> struct midi_runtime {
> struct sfire_chip *chip;
> struct snd_rawmidi *instance;
> @@ -32,7 +28,7 @@
> struct snd_rawmidi_substream *out;
> struct urb out_urb;
> u8 out_serial; /* serial number of out packet */
> - u8 out_buffer[MIDI_BUFSIZE];
> + u8 *out_buffer;
> int buffer_offset;
>
> void (*in_received)(struct midi_runtime *rt, u8 *data, int length);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-08-07 16:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 14:51 [PATCH] 6fire: fix URB transfer buffer for midi output Torsten Schenk
[not found] ` <20130807165149.188c4b16297be52c0630a18f-ytc+IHgoah0@public.gmane.org>
2013-08-07 16:34 ` Takashi Iwai [this message]
[not found] ` <s5hli4d5uj7.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
2013-08-07 17:38 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1308071334590.886-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-08-08 6:03 ` Takashi Iwai
2013-08-08 7:16 ` Clemens Ladisch
[not found] ` <520345CB.3030307-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
2013-08-08 7:28 ` [alsa-devel] " Takashi Iwai
2013-08-11 9:11 ` [PATCH 1/2] 6fire: make buffers DMA-able (pcm) Torsten Schenk
2013-08-12 9:37 ` 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=s5hli4d5uj7.wl%tiwai@suse.de \
--to=tiwai-l3a5bk7wagm@public.gmane.org \
--cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=torsten.schenk-ytc+IHgoah0@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox