10 Dec, 2011

6 commits

  • The PCM subsystem in the Line6 driver is mainly used for PCM playback and
    capture by ALSA, but also has other tasks, most notably providing a
    low-latency software monitor for devices which don't support hardware
    monitoring (e.g., the TonePort series). This patch makes ALSA "play nicely"
    with the other components, i.e., prevents it from resetting the isochronous
    USB transfer while other PCM tasks (software monitoring) are running.

    Signed-off-by: Markus Grabner
    Signed-off-by: Greg Kroah-Hartman

    Markus Grabner
     
  • The .trigger() pcm callbacks are not allowed to block and cannot wait
    until urbs have completed. We need to ensure that stopping, preparing,
    and then restarting a stream always works.

    Currently the driver will sometimes return -EBUSY when restarting the
    stream because urbs have not completed yet. This can be triggered by
    jackd from userspace.

    The solution is to wait on urbs in the .prepare() pcm callback since
    blocking is allowed in that callback. This guarantees that all urbs are
    quiesced and ready to be submitted when the start trigger callback is
    invoked.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: Markus Grabner
    Signed-off-by: Greg Kroah-Hartman

    Stefan Hajnoczi
     
  • The line6 driver checks struct field addresses for NULL where it does
    not make sense to do so. The struct has already been checked for NULL
    and there is no value in checking the first field's address too.

    Suggested-by: Dan Carpenter
    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: Markus Grabner
    Signed-off-by: Greg Kroah-Hartman

    Stefan Hajnoczi
     
  • Playback urbs use the index_out counter to decide which part of the
    playback buffer to use. Since the urb already has a unique index in
    range [0, LINE6_ISO_BUFFERS) there is no need to keep a separate
    counter.

    Use the urb index instead. This also eliminates the possibility of two
    urbs using the same playback buffer space if they ever complete
    out-of-order for some reason.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: Markus Grabner
    Signed-off-by: Greg Kroah-Hartman

    Stefan Hajnoczi
     
  • The playback urb transfer buffer calculation does not factor in
    LINE6_ISO_PACKETS. Buffer memory is organized like this in the driver:

    Buffer 0 Buffer 1 ...
    [Packet 0, Packet 1, ...][Packet 0, Packet 1, ...][Packet 0, ...]

    However, we're lucky that LINE6_ISO_PACKETS is currently defined as 1 so
    this patch does not change any behavior. It's still worth including
    this fix in case the LINE6_ISO_PACKETS value is changed in the future.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: Markus Grabner
    Signed-off-by: Greg Kroah-Hartman

    Stefan Hajnoczi
     
  • The .hw_params() pcm callback can be invoked multiple times in a row.
    Ensure that the URB data buffer is only allocated once.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: Markus Grabner
    Signed-off-by: Greg Kroah-Hartman

    Stefan Hajnoczi
     

09 Dec, 2011

4 commits


02 Dec, 2011

1 commit

  • "line6" hasn't been set at this point and we should be using
    &interface->dev instead.

    Gcc would have complained about this if it weren't for the fact that we
    initialized line6 to NULL. I removed the initialization.

    Signed-off-by: Dan Carpenter
    Reviewed-by: Stefan Hajnoczi
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     

27 Nov, 2011

6 commits

  • Use kmemdup rather than duplicating its implementation

    The semantic patch that makes this change is available
    in scripts/coccinelle/api/memdup.cocci.

    More information about semantic patching is available at
    http://coccinelle.lip6.fr/

    Signed-off-by: Thomas Meyer
    Signed-off-by: Greg Kroah-Hartman

    Thomas Meyer
     
  • It is unsafe to free buffers in line6_pcm_stop(), which is not allowed
    to sleep, since urbs cannot be killed completely there and only
    unlinked. This means I/O may still be in progress and the URB
    completion function still gets invoked. This may result in memory
    corruption when buffer_in is freed but I/O is still pending.

    Additionally, line6_pcm_start() is not supposed to sleep so it should
    not use kmalloc(GFP_KERNEL).

    These issues can be resolved by performing buffer allocation/freeing in
    the .hw_params/.hw_free callbacks instead. The ALSA documentation also
    recommends doing buffer allocation/freeing in these callbacks.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: Greg Kroah-Hartman

    Stefan Hajnoczi
     
  • The POD HD300 isochronous endpoints have different max packet sizes for
    read and write. Using the read endpoint max packet size may be too
    large for the write endpoint. Instead we should use the minimum of both
    endpoints to be sure the size is acceptable.

    In theory we could decouple read and write packet sizes but the driver
    currently uses a single size which I chose not to mess with since other
    features like software monitoring may depend on a single packet size for
    both endpoints.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: Greg Kroah-Hartman

    Stefan Hajnoczi
     
  • The driver leaves MIDI processing up to userspace for the POD HD300
    device. Add a missing case statement to skip MIDI postprocessing in the
    driver. This change has no effect other than silencing a printk:

    line6usb driver bug: missing case in linux/drivers/staging/line6/midi.c:179

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: Greg Kroah-Hartman

    Stefan Hajnoczi
     
  • The Pod HD device family uses new MIDI SysEx messages and therefore
    cannot reuse the existing Pod code. Instead of hardcoding Pod HD MIDI
    messages into the driver, leave MIDI up to userspace. This driver
    simply presents MIDI and pcm ALSA devices.

    This device is similar to the Pod except that it has 48 kHz audio and
    does not respond to Pod SysEx messages.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: Greg Kroah-Hartman

    Stefan Hajnoczi
     
  • If the first call to line6_midibuf_init() fails we'll leak a little
    bit of memory. If the second call fails we'll leak a bit more. This
    happens when we return from the function and the local variable
    'line6midi' goes out of scope.

    Signed-off-by: Jesper Juhl
    Signed-off-by: Greg Kroah-Hartman

    Jesper Juhl
     

01 Nov, 2011

1 commit


18 May, 2011

1 commit

  • This seems to be the result of patches ab366c1a and 1027f476 crossing each
    other. Patch ab366c1a adds calls to usb_put_intf and usb_put_dev at the
    end of the function line6_probe, in the error handling code, while patch
    1027f476 moves the calls to the corresponding get function from the
    beginning to the end of line6_probe, making the calls to put in the error
    handling code unnecessary.

    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Greg Kroah-Hartman

    Julia Lawall
     

15 Mar, 2011

1 commit

  • This patch was generated by the following semantic patch:
    //
    @@ expression E; @@
    - if (E != NULL) { kfree(E); }
    + kfree(E);

    @@ expression E; @@
    - if (E != NULL) { kfree(E); E = NULL; }
    + kfree(E);
    + E = NULL;
    //

    Signed-off-by: Ilia Mirkin
    Signed-off-by: Greg Kroah-Hartman

    Ilia Mirkin
     

09 Dec, 2010

1 commit


19 Nov, 2010

1 commit


17 Nov, 2010

1 commit


08 Oct, 2010

1 commit


22 Sep, 2010

2 commits


21 Sep, 2010

1 commit


01 Sep, 2010

2 commits


28 Jul, 2010

1 commit

  • line6 uses snd_pcm*() functions, so it should select SND_PCM.

    ERROR: "snd_pcm_period_elapsed" [drivers/staging/line6/line6usb.ko] undefined!
    ERROR: "snd_pcm_set_ops" [drivers/staging/line6/line6usb.ko] undefined!
    ERROR: "snd_pcm_lib_free_pages" [drivers/staging/line6/line6usb.ko] undefined!
    ERROR: "snd_pcm_lib_ioctl" [drivers/staging/line6/line6usb.ko] undefined!
    ERROR: "snd_pcm_lib_malloc_pages" [drivers/staging/line6/line6usb.ko] undefined!
    ERROR: "snd_pcm_hw_constraint_ratdens" [drivers/staging/line6/line6usb.ko] undefined!
    ERROR: "snd_pcm_format_physical_width" [drivers/staging/line6/line6usb.ko] undefined!
    ERROR: "snd_pcm_lib_preallocate_pages_for_all" [drivers/staging/line6/line6usb.ko] undefined!
    ERROR: "snd_pcm_new" [drivers/staging/line6/line6usb.ko] undefined!

    Signed-off-by: Randy Dunlap
    Cc: Markus Grabner
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     

23 Jul, 2010

1 commit


18 May, 2010

1 commit

  • Use kmemdup when some other buffer is immediately copied into the
    allocated region.

    A simplified version of the semantic patch that makes this change is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @@
    expression from,to,size,flag;
    statement S;
    @@

    - to = \(kmalloc\|kzalloc\)(size,flag);
    + to = kmemdup(from,size,flag);
    if (to==NULL || ...) S
    - memcpy(to, from, size);
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Greg Kroah-Hartman

    Julia Lawall
     

12 May, 2010

2 commits


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

04 Mar, 2010

2 commits

  • Fixed a coding style issue.

    Signed-off-by: Sylvain Trias
    Signed-off-by: Greg Kroah-Hartman

    Sylvain Trias
     
  • The id_table field of the struct usb_device_id is constant in
    so it is worth to make the initialization data also constant.

    The semantic match that finds this kind of pattern is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @r@
    disable decl_init,const_decl_init;
    identifier I1, I2, x;
    @@
    struct I1 {
    ...
    const struct I2 *x;
    ...
    };
    @s@
    identifier r.I1, y;
    identifier r.x, E;
    @@
    struct I1 y = {
    .x = E,
    };
    @c@
    identifier r.I2;
    identifier s.E;
    @@
    const struct I2 E[] = ... ;
    @depends on !c@
    identifier r.I2;
    identifier s.E;
    @@
    + const
    struct I2 E[] = ...;
    //

    Signed-off-by: Németh Márton
    Cc: Julia Lawall
    Cc: cocci@diku.dk
    Signed-off-by: Greg Kroah-Hartman

    Németh Márton
     

12 Dec, 2009

3 commits