cascardo/linux.git
9 years agoALSA: line6: Handle error from line6_pcm_acquire()
Takashi Iwai [Tue, 27 Jan 2015 15:42:14 +0000 (16:42 +0100)]
ALSA: line6: Handle error from line6_pcm_acquire()

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Make common PCM pointer callback
Takashi Iwai [Tue, 27 Jan 2015 14:41:27 +0000 (15:41 +0100)]
ALSA: line6: Make common PCM pointer callback

Both playback and capture callbacks are identical, so let's merge
them.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Reorganize PCM stream handling
Takashi Iwai [Tue, 27 Jan 2015 14:24:09 +0000 (15:24 +0100)]
ALSA: line6: Reorganize PCM stream handling

The current code deals with the stream start / stop solely via
line6_pcm_acquire() and line6_pcm_release().  This was (supposedly)
intended to avoid the races, but it doesn't work as expected.  The
concurrent acquire and release calls can be performed without proper
protections, thus this might result in memory corruption.
Furthermore, we can't take a mutex to protect the whole function
because it can be called from the PCM trigger callback that is an
atomic context.  Also spinlock isn't appropriate because the function
allocates with kmalloc with GFP_KERNEL.  That is, these function just
lead to singular problems.

This is an attempt to reduce the existing races.  First off, separate
both the stream buffer management and the stream URB management.  The
former is protected via a newly introduced state_mutex while the
latter is protected via each line6_pcm_stream lock.

Secondly, the stream state are now managed in opened and running bit
flags of each line6_pcm_stream.  Not only this a bit clearer than
previous combined bit flags, this also gives a better abstraction.
These rewrites allows us to make common hw_params and hw_free
callbacks for both playback and capture directions.

For the monitor and impulse operations, still line6_pcm_acquire() and
line6_pcm_release() are used.  They call internally the corresponding
functions for both playback and capture streams with proper lock or
mutex.  Unlike the previous versions, these function don't take the
bit masks but the only single type value.  Also they are supposed to
be applied only as duplex operations.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Clear prev_fbuf and prev_fsize properly
Takashi Iwai [Tue, 27 Jan 2015 15:17:26 +0000 (16:17 +0100)]
ALSA: line6: Clear prev_fbuf and prev_fsize properly

Clearing prev_fsize in line6_pcm_acquire() is pretty racy.
This can be called at any time while the stream is being played.
Rather better to clear prev_fbuf and prev_fsize at the proper place
like the stream stop for capture, and just after copying the monitor /
impulse data inside the spinlock.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Fix racy loopback handling
Takashi Iwai [Tue, 27 Jan 2015 11:50:44 +0000 (12:50 +0100)]
ALSA: line6: Fix racy loopback handling

The impulse and monitor handling in submit_audio_out_urb() isn't
protected thus this can be racy with the capture stream handling.
This patch extends the range to protect via each stream's spinlock
(now the whole submit_audio_*_urb() are covered), and take the capture
stream lock additionally for the impulse and monitor handling part.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Minor tidy up in line6_probe()
Takashi Iwai [Sun, 25 Jan 2015 17:41:26 +0000 (18:41 +0100)]
ALSA: line6: Minor tidy up in line6_probe()

Move the check of multi configurations before snd_card_new() as a
short path, and reduce superfluous pointer references.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Let snd_card_new() allocate private data
Takashi Iwai [Sun, 25 Jan 2015 17:36:29 +0000 (18:36 +0100)]
ALSA: line6: Let snd_card_new() allocate private data

Instead of allocating the private data individually in each driver's
probe at first, let snd_card_new() allocate the data that is called in
line6_probe().  This simplifies the primary probe functions.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Drop interface argument from private_init and disconnect callbacks
Takashi Iwai [Sun, 25 Jan 2015 17:22:58 +0000 (18:22 +0100)]
ALSA: line6: Drop interface argument from private_init and disconnect callbacks

The interface argument is used just for retrieving the assigned
device, which can be already found in line6->ifcdev.  Drop them from
the callbacks.  Also, pass the usb id to private_init so that the
driver can deal with it there.  This is a preliminary work for the
further cleanup to move the whole allocation into driver.c.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Skip volume manipulation during silence copying
Takashi Iwai [Fri, 23 Jan 2015 15:58:30 +0000 (16:58 +0100)]
ALSA: line6: Skip volume manipulation during silence copying

A minor optimization; while pausing, the driver just copies the zero
that doesn't need any volume changes.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Do clipping in volume / monitor manipulations
Takashi Iwai [Fri, 23 Jan 2015 15:54:36 +0000 (16:54 +0100)]
ALSA: line6: Do clipping in volume / monitor manipulations

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Consolidate PCM stream buffer allocation and free
Takashi Iwai [Fri, 23 Jan 2015 15:25:03 +0000 (16:25 +0100)]
ALSA: line6: Consolidate PCM stream buffer allocation and free

The PCM stream buffer allocation and free are identical for both
playback and capture streams.  Provide single helper functions.
These are used only in pcm.c, thus they can be even static.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Use dev_err()
Takashi Iwai [Fri, 23 Jan 2015 15:20:50 +0000 (16:20 +0100)]
ALSA: line6: Use dev_err()

This is the last remaining snd_printk() usage in this driver.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Consolidate URB unlink and sync helpers
Takashi Iwai [Fri, 23 Jan 2015 15:18:42 +0000 (16:18 +0100)]
ALSA: line6: Consolidate URB unlink and sync helpers

The codes to unlink and sync URBs are identical for both playback and
capture streams.  Consolidate to single helper functions.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Rearrange PCM structure
Takashi Iwai [Fri, 23 Jan 2015 15:10:57 +0000 (16:10 +0100)]
ALSA: line6: Rearrange PCM structure

Introduce a new line6_pcm_stream structure and group individual
fields of snd_line6_pcm struct to playback and capture groups.

This patch itself just does rename and nothing else.  More
meaningful cleanups based on these fields shuffling will follow.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Drop voodoo workarounds
Takashi Iwai [Fri, 23 Jan 2015 14:12:13 +0000 (15:12 +0100)]
ALSA: line6: Drop voodoo workarounds

If the problem still really remains, we should fix it instead of
papering over it like this...

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Use incremental loop
Takashi Iwai [Fri, 23 Jan 2015 14:08:40 +0000 (15:08 +0100)]
ALSA: line6: Use incremental loop

Using a decremental loop without particular reasons worsens the
readability a lot.  Use incremental loops instead.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Drop superfluous spinlock for trigger
Takashi Iwai [Fri, 23 Jan 2015 13:49:22 +0000 (14:49 +0100)]
ALSA: line6: Drop superfluous spinlock for trigger

The trigger callback is already spinlocked, so we need no more lock
here (even for the linked substreams).  Let's drop it.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Fix the error recovery in line6_pcm_acquire()
Takashi Iwai [Fri, 23 Jan 2015 13:34:42 +0000 (14:34 +0100)]
ALSA: line6: Fix the error recovery in line6_pcm_acquire()

line6_pcm_acquire() tries to restore the newly obtained resources at
the error path.  But some flags aren't recorded and released properly
when the corresponding buffer is already present.  These bits have to
be cleared in the error recovery, too.

Also, "flags_final" can be initialized to zero since we pass only the
subset of "channels" bits.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Use logical OR
Takashi Iwai [Fri, 23 Jan 2015 13:31:03 +0000 (14:31 +0100)]
ALSA: line6: Use logical OR

Fixed a few places using bits OR wrongly for condition checks.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Fix missing error handling in line6_pcm_acquire()
Takashi Iwai [Fri, 23 Jan 2015 12:00:03 +0000 (13:00 +0100)]
ALSA: line6: Fix missing error handling in line6_pcm_acquire()

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Reduce superfluous spinlock in midi.c
Takashi Iwai [Fri, 23 Jan 2015 11:39:11 +0000 (12:39 +0100)]
ALSA: line6: Reduce superfluous spinlock in midi.c

The midi_transmit_lock is used always inside the send_urb_lock, thus
it doesn't play any role.  Let's kill it.  Also, rename
"send_urb_lock" as a more simple name "lock" since this is the only
lock for midi.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Remove unused line6_nop_read()
Takashi Iwai [Fri, 23 Jan 2015 11:30:48 +0000 (12:30 +0100)]
ALSA: line6: Remove unused line6_nop_read()

The function isn't used any longer after rewriting from sysfs to leds
class in toneport.c.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Fix memory leak at probe error path
Takashi Iwai [Fri, 23 Jan 2015 11:27:39 +0000 (12:27 +0100)]
ALSA: line6: Fix memory leak at probe error path

Fix memory leak at probe error path by rearranging the call order in
line6_destruct() so that the common destructor is always called.
Also this simplifies the error path to a single goto label.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Minor refactoring
Takashi Iwai [Fri, 23 Jan 2015 11:24:03 +0000 (12:24 +0100)]
ALSA: line6: Minor refactoring

Split some codes in the lengthy line6_probe().

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6/toneport: Implement LED controls via LED class
Takashi Iwai [Tue, 20 Jan 2015 08:36:31 +0000 (09:36 +0100)]
ALSA: line6/toneport: Implement LED controls via LED class

Instead of non-standard sysfs, reimplement the LED controls on
TonePort as LED class devices.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6/toneport: Fix wrong argument for toneport_has_led()
Takashi Iwai [Tue, 20 Jan 2015 07:55:06 +0000 (08:55 +0100)]
ALSA: line6/toneport: Fix wrong argument for toneport_has_led()

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Don't forget to call driver's destructor at error path
Takashi Iwai [Tue, 20 Jan 2015 08:09:27 +0000 (09:09 +0100)]
ALSA: line6: Don't forget to call driver's destructor at error path

Currently disconnect callback is used as a driver's destructor, and
this has to be called not only at the disconnection time but also at
the error paths during probe.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6/toneport: Move setup_timer() at the beginning
Takashi Iwai [Tue, 20 Jan 2015 08:40:20 +0000 (09:40 +0100)]
ALSA: line6/toneport: Move setup_timer() at the beginning

... so that timer_del_sync() in the destructor can be called safely at
any time.  Also move the mod_timer() call in toneport_setup(), which
is a bit clearer place.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Remove superfluous NULL checks in each driver
Takashi Iwai [Tue, 20 Jan 2015 07:42:42 +0000 (08:42 +0100)]
ALSA: line6: Remove superfluous NULL checks in each driver

The interface and driver objects are always set when callbacks are
called.  Drop such superfluous NULL checks in init and disconnect
calls of each driver.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Abort if inconsistent usbdev is found at disconnect
Takashi Iwai [Tue, 20 Jan 2015 08:58:54 +0000 (09:58 +0100)]
ALSA: line6: Abort if inconsistent usbdev is found at disconnect

It's utterly unsafe to proceed further the disconnect procedure if the
assigned usbdev is inconsistent with the expected object.  Better to
put a WARN_ON() for more cautions and abort immediately.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Yet more cleanup of superfluous NULL checks
Takashi Iwai [Tue, 20 Jan 2015 07:40:51 +0000 (08:40 +0100)]
ALSA: line6: Yet more cleanup of superfluous NULL checks

... in line6_disconnect() as well.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Remove driver version from header comment
Chris Rorvick [Tue, 20 Jan 2015 08:20:50 +0000 (02:20 -0600)]
ALSA: line6: Remove driver version from header comment

The driver version string was removed in an ealier commit for being
useless.  These are equally useless.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Refer to manufacturer as "Line 6"
Chris Rorvick [Tue, 20 Jan 2015 08:20:49 +0000 (02:20 -0600)]
ALSA: line6: Refer to manufacturer as "Line 6"

The correct spelling includes the space.  Fix this in strings and
comments that refer to the manufacturer.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Remove superfluous NULL checks
Chris Rorvick [Tue, 20 Jan 2015 08:20:48 +0000 (02:20 -0600)]
ALSA: line6: Remove superfluous NULL checks

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Drop line6_send_program() and line6_transmit_parameter()
Takashi Iwai [Mon, 19 Jan 2015 15:38:23 +0000 (16:38 +0100)]
ALSA: line6: Drop line6_send_program() and line6_transmit_parameter()

Both functions are used nowhere.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Make line6_send_raw_message() static
Takashi Iwai [Mon, 19 Jan 2015 15:36:21 +0000 (16:36 +0100)]
ALSA: line6: Make line6_send_raw_message() static

It's used only locally.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Sync PCM stop at disconnect
Takashi Iwai [Mon, 19 Jan 2015 15:15:54 +0000 (16:15 +0100)]
ALSA: line6: Sync PCM stop at disconnect

Call line6_pcm_disconnect() at disconnect to make sure that all URBs
are cleared.  Also reduce the superfluous snd_pcm_stop() calls from
the function (and remove the unused function) since the streams are
guaranteed to be stopped at this point via snd_card_disconnect().

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Remove superfluous disconnect call in suspend handler
Takashi Iwai [Mon, 19 Jan 2015 15:12:19 +0000 (16:12 +0100)]
ALSA: line6: Remove superfluous disconnect call in suspend handler

Calling line6_pcm_disconnect() at suspend callback is superfluous and
rather confusing.  Let's get rid of it.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Remove CHECK_RETURN macro
Takashi Iwai [Mon, 19 Jan 2015 15:08:02 +0000 (16:08 +0100)]
ALSA: line6: Remove CHECK_RETURN macro

Such a macro doesn't improve readability.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Drop MISSING_CASE macro
Takashi Iwai [Mon, 19 Jan 2015 15:06:03 +0000 (16:06 +0100)]
ALSA: line6: Drop MISSING_CASE macro

Such a debug is needed in the core code, not in each lowlevel driver.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Remove driver version string
Takashi Iwai [Mon, 19 Jan 2015 15:02:36 +0000 (16:02 +0100)]
ALSA: line6: Remove driver version string

This is rather useless for a driver that has been already merged into
the official tree.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Reorganize card resource handling
Takashi Iwai [Mon, 19 Jan 2015 14:54:00 +0000 (15:54 +0100)]
ALSA: line6: Reorganize card resource handling

This is a fairly big rewrite regarding the card resource management in
line6 drivers:

- The card creation is moved into line6_probe().  This adds the global
  destructor to private_free, so that each driver doesn't have to call
  it any longer.

- The USB disconnect callback handles the card release, thus each
  driver needs to concentrate on only its own resources.  No need to
  snd_card_*() call in the destructor.

- Fix the potential stall in disconnection by removing
  snd_card_free().   It's replaced with snd_card_free_when_closed()
  for asynchronous release.

- The only remaining operation for the card in each driver is the call
  of snd_card_register().  All the rest are dealt in the common module
  by itself.

- These ended up with removal of audio.[ch] as a result of a reduction
  of one layer.  Each driver just needs to call line6_probe().

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Drop superfluous irqsave/irqrestore in PCM trigger callback
Takashi Iwai [Mon, 19 Jan 2015 14:15:21 +0000 (15:15 +0100)]
ALSA: line6: Drop superfluous irqsave/irqrestore in PCM trigger callback

The PCM trigger callback is guaranteed to be called already in
spinlock / irq-disabled context.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Don't handle PCM trigger for other cards
Takashi Iwai [Mon, 19 Jan 2015 14:11:17 +0000 (15:11 +0100)]
ALSA: line6: Don't handle PCM trigger for other cards

Otherwise it oopses.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Remove superfluous out-of-memory error messages
Takashi Iwai [Mon, 19 Jan 2015 14:05:10 +0000 (15:05 +0100)]
ALSA: line6: Remove superfluous out-of-memory error messages

Kernel already shows the error in the common path.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Drop usb_device sysfs symlink
Takashi Iwai [Mon, 19 Jan 2015 14:02:30 +0000 (15:02 +0100)]
ALSA: line6: Drop usb_device sysfs symlink

It's non-standard and rather superfluous.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Drop invalid SNDRV_PCM_INFO_RESUME flag
Takashi Iwai [Mon, 19 Jan 2015 13:58:29 +0000 (14:58 +0100)]
ALSA: line6: Drop invalid SNDRV_PCM_INFO_RESUME flag

The line6 drivers don't support the full resume although they set
SNDRV_PCM_INFO_RESUME.  These flags have to be dropped to inform
properly to the user-space.

Also, drop the CONFIG_PM in trigger callbacks, too, which are rather
superfluous.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Drop superfluous snd_device for rawmidi
Takashi Iwai [Mon, 19 Jan 2015 13:50:31 +0000 (14:50 +0100)]
ALSA: line6: Drop superfluous snd_device for rawmidi

Like the previous fix for PCM, attach the card-specific resource into
rawmidi->private_data instead of handling in a snd_device object.
This simplifies the code and structure.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Drop superfluous snd_device for PCM
Takashi Iwai [Mon, 19 Jan 2015 13:41:57 +0000 (14:41 +0100)]
ALSA: line6: Drop superfluous snd_device for PCM

Instead of handling the card-specific resource in snd_device, attach
it into pcm->private_data and release it directly in private_free.
This simplifies the code and structure.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Handle impulse response via control API
Takashi Iwai [Mon, 19 Jan 2015 13:28:25 +0000 (14:28 +0100)]
ALSA: line6: Handle impulse response via control API

Instead of sysfs and the conditional build with Kconfig, implement the
handling of the impulse response controls via control API, and always
enable the build.  Two new controls, "Impulse Response Volume" and
"Impulse Response Period" are added as a replacement for the former
sysfs files.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Split to each driver
Takashi Iwai [Thu, 15 Jan 2015 07:22:31 +0000 (08:22 +0100)]
ALSA: line6: Split to each driver

Split to each individual driver for POD, PODHD, TonePort and Variax
with a core LINE6 helper module.  The new modules follow the standard
ALSA naming rule with snd prefix: snd-usb-pod, snd-usb-podhd,
snd-usb-toneport and snd-usb-variax, together with the corresponding
CONFIG_SND_USB_* Kconfig items.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: line6: Use setup_timer() and mod_timer()
Takashi Iwai [Mon, 19 Jan 2015 10:44:40 +0000 (11:44 +0100)]
ALSA: line6: Use setup_timer() and mod_timer()

No functional change, refactoring with the standard helpers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoALSA: move line6 usb driver into sound/usb
Takashi Iwai [Mon, 12 Jan 2015 21:29:57 +0000 (22:29 +0100)]
ALSA: move line6 usb driver into sound/usb

Promote line6 driver from staging to sound/usb/line6 directory, and
maintain through sound subsystem tree.

This commit just moves the code and adapts Makefile / Kconfig.
The further renames and misc cleanups will follow.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Make *_disconnect() functions static
Chris Rorvick [Mon, 12 Jan 2015 20:43:00 +0000 (12:43 -0800)]
staging: line6: Make *_disconnect() functions static

Remove declarations from the header and move the definitions up in the
source so they need not be forward declared.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Call *_disconnect() via pointer
Chris Rorvick [Mon, 12 Jan 2015 20:42:59 +0000 (12:42 -0800)]
staging: line6: Call *_disconnect() via pointer

Which *_disconnect() to call on disconnect is known at initialization.
Add a function pointer to the `usb_line6' struct and use to call into
the appropriate logic instead of evaluating the conditional logic.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Call *_process_message() via pointer
Chris Rorvick [Mon, 12 Jan 2015 20:42:58 +0000 (12:42 -0800)]
staging: line6: Call *_process_message() via pointer

Which *_process_message() function (if any) to call when data is
received is known at initialization.  Add a function pointer to the
`usb_line6' struct and use to call into the appropriate logic instead
of evaluating the conditional logic for each message.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Pass *_process_message() `usb_line6' pointers
Chris Rorvick [Mon, 12 Jan 2015 20:42:57 +0000 (12:42 -0800)]
staging: line6: Pass *_process_message() `usb_line6' pointers

Casting the `struct usb_line6' pointer at the call point makes the code
difficult to read.  This is substantially cleaned up by moving the cast
into the callees.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Pass *_init() `usb_line6' pointers
Chris Rorvick [Mon, 12 Jan 2015 20:42:56 +0000 (12:42 -0800)]
staging: line6: Pass *_init() `usb_line6' pointers

Casting the `struct usb_line6' pointer at the call point makes the code
difficult to read.  This is substantially cleaned up by moving the cast
into the callees.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Move audio endpoints to properties
Chris Rorvick [Mon, 12 Jan 2015 20:42:55 +0000 (12:42 -0800)]
staging: line6: Move audio endpoints to properties

The device type can now be used to determine the addresses of the
audio endpoints for the interface.  Drop the conditional logic and make
these values properties.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Remove stale Pocket POD PCM endpoints
Chris Rorvick [Mon, 12 Jan 2015 20:42:54 +0000 (12:42 -0800)]
staging: line6: Remove stale Pocket POD PCM endpoints

Commit 1027f476f507 (staging: line6: sync with upstream) removed PCM
from the Pocket POD capabilities but left the endpoint configuration.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Move control endpoints to properties
Chris Rorvick [Mon, 12 Jan 2015 20:42:53 +0000 (12:42 -0800)]
staging: line6: Move control endpoints to properties

The device type can now be used to determine the addresses of the
control endpoints for the interface.  Drop the conditional logic and
make these values properties.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Move altsetting to properties
Chris Rorvick [Mon, 12 Jan 2015 20:42:52 +0000 (12:42 -0800)]
staging: line6: Move altsetting to properties

The device type can now be used to determine the altsetting for the
interface.  Drop the conditional logic and make this value a property.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Filter on UX2 interfaces
Chris Rorvick [Mon, 12 Jan 2015 20:42:51 +0000 (12:42 -0800)]
staging: line6: Filter on UX2 interfaces

The driver only supports interface 0 of the TonePort UX2 and POD Studio
UX2 devices.  Use the device table to filter on this.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Filter on Pocket POD interface
Chris Rorvick [Mon, 12 Jan 2015 20:42:50 +0000 (12:42 -0800)]
staging: line6: Filter on Pocket POD interface

The driver only supports interface 1 of the Pocket POD.  Use the device
table to filter on this.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Split out POD HD500 interfaces
Chris Rorvick [Mon, 12 Jan 2015 20:42:49 +0000 (12:42 -0800)]
staging: line6: Split out POD HD500 interfaces

The driver uses a different altsetting depending on the interface.  Add
device type entries for each of these.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Split out PODxt Live interfaces
Chris Rorvick [Mon, 12 Jan 2015 20:42:48 +0000 (12:42 -0800)]
staging: line6: Split out PODxt Live interfaces

The PODxt Live device has both a POD and a Variax interface.  Add device
type entries for each of these.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: List out capabilities individually
Chris Rorvick [Mon, 12 Jan 2015 20:42:47 +0000 (12:42 -0800)]
staging: line6: List out capabilities individually

The `LINE6_CAP_CTRL_PCM_HW' macro combines three capabilities to save
horizontal space when defining the properties entries.  Now that these
are no longer limited to single lines this is not such a concern.
Specify capabilities individually when defining each property for
better clarity.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Use explicit indexes when defining properties
Chris Rorvick [Mon, 12 Jan 2015 20:42:46 +0000 (12:42 -0800)]
staging: line6: Use explicit indexes when defining properties

Specify the index of the properties entry explicitly to define this
structure more robustly.  Also, drop the `L6PROP' macro in favor of
initializing each member explicitly on its own line since horizontal
space is limited and more attributes will be added later.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Rename capability macros
Chris Rorvick [Mon, 12 Jan 2015 20:42:45 +0000 (12:42 -0800)]
staging: line6: Rename capability macros

Including "BIT" in the macro name is pointless.  Replace with "CAP" to
provide some context for what its value represents.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Remove useless comments
Chris Rorvick [Mon, 12 Jan 2015 20:42:44 +0000 (12:42 -0800)]
staging: line6: Remove useless comments

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Remove idVendor and idProduct macros
Chris Rorvick [Mon, 12 Jan 2015 20:42:43 +0000 (12:42 -0800)]
staging: line6: Remove idVendor and idProduct macros

These are now only used to build the device table.  Each entry in this
table is already clearly documented as to what device it maps to so the
macros become unnecessary indirection.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Key off of device type
Chris Rorvick [Mon, 12 Jan 2015 20:42:42 +0000 (12:42 -0800)]
staging: line6: Key off of device type

The driver currently uses the device's idProduct as input to several
switch statements.  In some cases this is not sufficiently granular and
the interface number must be taken into account.

Store the device type in `usb_line6' and key off of it instead.  New
types can then be added that map to specific interfaces on the device so
that this conditional logic can be flattened out.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Index properties array with device type
Chris Rorvick [Mon, 12 Jan 2015 20:42:41 +0000 (12:42 -0800)]
staging: line6: Index properties array with device type

The current logic uses the index of the matched entry from the device
table as an offset to the corresponding properties entry.  The values
of the new `line6_device_type' enum are ordered such that they can be
used as an index into either of these arrays.  Drop the device entry
lookup logic and use the device type (via the .driver_info member)
instead.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Define a device type enum
Chris Rorvick [Mon, 12 Jan 2015 20:42:40 +0000 (12:42 -0800)]
staging: line6: Define a device type enum

Define an enum containing the supported devices and associate each entry
in the device table to the respective value.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Cleanup device table
Chris Rorvick [Mon, 12 Jan 2015 20:42:39 +0000 (12:42 -0800)]
staging: line6: Cleanup device table

Wrap USB_DEVICE to avoid repeating the Line 6 vendor ID.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Remove unsupported X3 devices
Chris Rorvick [Mon, 12 Jan 2015 20:42:38 +0000 (12:42 -0800)]
staging: line6: Remove unsupported X3 devices

Support for these devices appears to have never been completed.  Remove
them from the device table along with a minimal amount of supporting
code.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Remove line6_pod_transmit_paramter()
Chris Rorvick [Mon, 12 Jan 2015 20:42:37 +0000 (12:42 -0800)]
staging: line6: Remove line6_pod_transmit_paramter()

This function was no longer used as of commit 2807904441d4 (staging:
line6: drop MIDI parameter sysfs attrs).

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: Remove `device_bit' from properties
Chris Rorvick [Mon, 12 Jan 2015 20:42:36 +0000 (12:42 -0800)]
staging: line6: Remove `device_bit' from properties

The `device_bit' member was no longer used as of commit 2807904441d4
(staging: line6: drop MIDI parameter sysfs attrs).

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agoStaging: line6: remove spaces before commas.
Jonas Lundqvist [Mon, 12 Jan 2015 20:42:35 +0000 (12:42 -0800)]
Staging: line6: remove spaces before commas.

Fix three space prohibited errors in pcm.h found by checkpatch.pl.

Signed-off-by: Jonas Lundqvist <jonas@gannon.se>
Reviewed-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agostaging: line6: toneport.c: Fix for possible null pointer dereference
Rickard Strandqvist [Mon, 12 Jan 2015 20:42:34 +0000 (12:42 -0800)]
staging: line6: toneport.c: Fix for possible null pointer dereference

The NULL check was done to late, and there it was a risk
of a possible null pointer dereference.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
9 years agolinux 3.19-rc4 v3.19-rc4
Linus Torvalds [Sun, 11 Jan 2015 20:44:53 +0000 (12:44 -0800)]
linux 3.19-rc4

9 years agoMerge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
Linus Torvalds [Sun, 11 Jan 2015 20:44:10 +0000 (12:44 -0800)]
Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:
 "Three small fixes from over the Christmas period, and wiring up the
  new execveat syscall for ARM"

* 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
  ARM: 8275/1: mm: fix PMD_SECT_RDONLY undeclared compile error
  ARM: 8253/1: mm: use phys_addr_t type in map_lowmem() for kernel mem region
  ARM: 8249/1: mm: dump: don't skip regions
  ARM: wire up execveat syscall

9 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 11 Jan 2015 19:53:46 +0000 (11:53 -0800)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Misc fixes: two vdso fixes, two kbuild fixes and a boot failure fix
  with certain odd memory mappings"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, vdso: Use asm volatile in __getcpu
  x86/build: Clean auto-generated processor feature files
  x86: Fix mkcapflags.sh bash-ism
  x86: Fix step size adjustment during initial memory mapping
  x86_64, vdso: Fix the vdso address randomization algorithm

9 years agoMerge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 11 Jan 2015 19:51:49 +0000 (11:51 -0800)]
Merge branch 'sched-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
 "Misc fixes: group scheduling corner case fix, two deadline scheduler
  fixes, effective_load() overflow fix, nested sleep fix, 6144 CPUs
  system fix"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/fair: Fix RCU stall upon -ENOMEM in sched_create_group()
  sched/deadline: Avoid double-accounting in case of missed deadlines
  sched/deadline: Fix migration of SCHED_DEADLINE tasks
  sched: Fix odd values in effective_load() calculations
  sched, fanotify: Deal with nested sleeps
  sched: Fix KMALLOC_MAX_SIZE overflow during cpumask allocation

9 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 11 Jan 2015 19:47:45 +0000 (11:47 -0800)]
Merge branch 'perf-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "Mostly tooling fixes, but also some kernel side fixes: uncore PMU
  driver fix, user regs sampling fix and an instruction decoder fix that
  unbreaks PEBS precise sampling"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/x86/uncore/hsw-ep: Handle systems with only two SBOXes
  perf/x86_64: Improve user regs sampling
  perf: Move task_pt_regs sampling into arch code
  x86: Fix off-by-one in instruction decoder
  perf hists browser: Fix segfault when showing callchain
  perf callchain: Free callchains when hist entries are deleted
  perf hists: Fix children sort key behavior
  perf diff: Fix to sort by baseline field by default
  perf list: Fix --raw-dump option
  perf probe: Fix crash in dwarf_getcfi_elf
  perf probe: Fix to fall back to find probe point in symbols
  perf callchain: Append callchains only when requested
  perf ui/tui: Print backtrace symbols when segfault occurs
  perf report: Show progress bar for output resorting

9 years agoMerge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 11 Jan 2015 19:46:31 +0000 (11:46 -0800)]
Merge branch 'locking-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull locking fixes from Ingo Molnar:
 "A liblockdep fix and a mutex_unlock() mutex-debugging fix"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  mutex: Always clear owner field upon mutex_unlock()
  tools/liblockdep: Fix debug_check thinko in mutex destroy

9 years agomm: fix corner case in anon_vma endless growing prevention
Konstantin Khlebnikov [Sun, 11 Jan 2015 13:54:06 +0000 (16:54 +0300)]
mm: fix corner case in anon_vma endless growing prevention

Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas() ("kernel
BUG at mm/rmap.c:399!") caused by commit 7a3ef208e662 ("mm: prevent
endless growth of anon_vma hierarchy")

Anon_vma_clone() is usually called for a copy of source vma in
destination argument.  If source vma has anon_vma it should be already
in dst->anon_vma.  NULL in dst->anon_vma is used as a sign that it's
called from anon_vma_fork().  In this case anon_vma_clone() finds
anon_vma for reusing.

Vma_adjust() calls it differently and this breaks anon_vma reusing
logic: anon_vma_clone() links vma to old anon_vma and updates degree
counters but vma_adjust() overrides vma->anon_vma right after that.  As
a result final unlink_anon_vmas() decrements degree for wrong anon_vma.

This patch assigns ->anon_vma before calling anon_vma_clone().

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
Reported-and-tested-by: Chris Clayton <chris2553@googlemail.com>
Reported-and-tested-by: Oded Gabbay <oded.gabbay@amd.com>
Reported-and-tested-by: Chih-Wei Huang <cwhuang@android-x86.org>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Daniel Forrest <dan.forrest@ssec.wisc.edu>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: stable@vger.kernel.org # to match back-porting of 7a3ef208e662
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agomm: Don't count the stack guard page towards RLIMIT_STACK
Linus Torvalds [Sun, 11 Jan 2015 19:33:57 +0000 (11:33 -0800)]
mm: Don't count the stack guard page towards RLIMIT_STACK

Commit fee7e49d4514 ("mm: propagate error from stack expansion even for
guard page") made sure that we return the error properly for stack
growth conditions.  It also theorized that counting the guard page
towards the stack limit might break something, but also said "Let's see
if anybody notices".

Somebody did notice.  Apparently android-x86 sets the stack limit very
close to the limit indeed, and including the guard page in the rlimit
check causes the android 'zygote' process problems.

So this adds the (fairly trivial) code to make the stack rlimit check be
against the actual real stack size, rather than the size of the vma that
includes the guard page.

Reported-and-tested-by: Chih-Wei Huang <cwhuang@android-x86.org>
Cc: Jay Foad <jay.foad@gmail.com>
Cc: stable@kernel.org # to match back-porting of fee7e49d4514
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years agoMerge branch 'core/urgent' into locking/urgent, to collect all pending locking fixes
Ingo Molnar [Sun, 11 Jan 2015 08:18:05 +0000 (09:18 +0100)]
Merge branch 'core/urgent' into locking/urgent, to collect all pending locking fixes

Signed-off-by: Ingo Molnar <mingo@kernel.org>
9 years agoMerge tag 'vfio-v3.19-rc4' of git://github.com/awilliam/linux-vfio
Linus Torvalds [Sat, 10 Jan 2015 20:23:03 +0000 (12:23 -0800)]
Merge tag 'vfio-v3.19-rc4' of git://github.com/awilliam/linux-vfio

Pull VFIO fix from Alex Williamson:
 "Fix PCI header check in vfio_pci_probe() (Wei Yang)"

* tag 'vfio-v3.19-rc4' of git://github.com/awilliam/linux-vfio:
  vfio-pci: Fix the check on pci device type in vfio_pci_probe()

9 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sat, 10 Jan 2015 19:59:25 +0000 (11:59 -0800)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fix from James Bottomley:
 "Just one fix: a qlogic busy wait regression"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  qla2xxx: fix busy wait regression

9 years agoMerge tag 'sound-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
Linus Torvalds [Sat, 10 Jan 2015 05:23:27 +0000 (21:23 -0800)]
Merge tag 'sound-3.19-rc4' of git://git./linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "All a few small regression or stable fixes: a Nvidia HDMI ID addition,
  a regression fix for CAIAQ stream count, a typo fix for GPIO setup
  with STAC/IDT HD-audio codecs, and a Fireworks big-endian fix"

* tag 'sound-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: fireworks: fix an endianness bug for transaction length
  ALSA: hda - Add new GPU codec ID 0x10de0072 to snd-hda
  ALSA: hda - Fix wrong gpio_dir & gpio_mask hint setups for IDT/STAC codecs
  ALSA: snd-usb-caiaq: fix stream count check

9 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Linus Torvalds [Sat, 10 Jan 2015 05:18:48 +0000 (21:18 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/jikos/hid

Pull HID updates from Jiri Kosina:

 - bounds checking fixes in logitech and roccat drivers, from Peter Wu
   and Dan Carpenter

 - double-kfree fix in i2c-hid driver on bus shutdown, from Mika
   Westerberg

 - a couple of various small driver fixes

 - a few device id additions

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: roccat: potential out of bounds in pyra_sysfs_write_settings()
  HID: Add a new id 0x501a for Genius MousePen i608X
  HID: logitech-hidpp: prefix the name with "Logitech"
  HID: logitech-hidpp: avoid unintended fall-through
  HID: Allow HID_BATTERY_STRENGTH to be enabled
  HID: i2c-hid: Do not free buffers in i2c_hid_stop()
  HID: add battery quirk for USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO keyboard
  HID: logitech-hidpp: check WTP report length
  HID: logitech-dj: check report length

9 years agoMerge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Linus Torvalds [Sat, 10 Jan 2015 05:13:34 +0000 (21:13 -0800)]
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm fixes from Dave Airlie:
 "I'm briefly working between holidays and LCA, so this is close to a
  couple of weeks of fixes,

  Two sets of amdkfd fixes, this is a new feature this kernel, and this
  pull fixes a few issues since it got merged, ordering when built-in to
  kernel and also the iommu vs gpu ordering patch, it also reworks the
  ioctl before the initial release.

  Otherwise:
   - radeon: some misc fixes all over, hdmi, 4k, dpm
   - nouveau: mcp77 init fixes, oops fix, bug on fix, msi fix
   - i915: power fixes, revert VGACNTR patch

  Probably be quiteer next week since I'll be at LCA anyways"

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (33 commits)
  drm/amdkfd: rewrite kfd_ioctl() according to drm_ioctl()
  drm/amdkfd: reformat IOCTL definitions to drm-style
  drm/amdkfd: Do copy_to/from_user in general kfd_ioctl()
  drm/radeon: integer underflow in radeon_cp_dispatch_texture()
  drm/radeon: adjust default bapm settings for KV
  drm/radeon: properly filter DP1.2 4k modes on non-DP1.2 hw
  drm/radeon: fix sad_count check for dce3
  drm/radeon: KV has three PPLLs (v2)
  drm/amdkfd: unmap VMID<-->PASID when relesing VMID (non-HWS)
  drm/radeon: Init amdkfd only if it was compiled
  amdkfd: actually allocate longs for the pasid bitmask
  drm/nouveau/nouveau: Do not BUG_ON(!spin_is_locked()) on UP
  drm/nv4c/mc: disable msi
  drm/nouveau/fb/ram/mcp77: enable NISO poller
  drm/nouveau/fb/ram/mcp77: use carveout reg to determine size
  drm/nouveau/fb/ram/mcp77: subclass nouveau_ram
  drm/nouveau: wake up the card if necessary during gem callbacks
  drm/nouveau/device: Add support for GK208B, resolves bug 86935
  drm/nouveau: fix missing return statement in nouveau_ttm_tt_unpopulate
  drm/nouveau/bios: fix oops on pre-nv50 chipsets
  ...

9 years agoMerge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Linus Torvalds [Sat, 10 Jan 2015 04:57:58 +0000 (20:57 -0800)]
Merge tag 'arm64-fixes' of git://git./linux/kernel/git/arm64/linux

Pull arm64 fixes from Will Deacon:
 "Here is a handful of minor arm64 fixes discovered and fixed over the
  Christmas break.  The main part is adding some missing #includes that
  we seem to be getting transitively but have started causing problems
  in -next.

   - Fix early mapping fixmap corruption by EFI runtime services
   - Fix __NR_compat_syscalls off-by-one
   - Add missing sanity checks for some 32-bit registers
   - Add some missing #includes which we get transitively
   - Remove unused prepare_to_copy() macro"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64/efi: add missing call to early_ioremap_reset()
  arm64: fix missing asm/io.h include in kernel/smp_spin_table.c
  arm64: fix missing asm/alternative.h include in kernel/module.c
  arm64: fix missing linux/bug.h include in asm/arch_timer.h
  arm64: fix missing asm/pgtable-hwdef.h include in asm/processor.h
  arm64: sanity checks: add missing AArch32 registers
  arm64: Remove unused prepare_to_copy()
  arm64: Correct __NR_compat_syscalls for bpf

9 years agoMerge tag 'for_linus-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jwess...
Linus Torvalds [Sat, 10 Jan 2015 04:51:10 +0000 (20:51 -0800)]
Merge tag 'for_linus-3.19-rc4' of git://git./linux/kernel/git/jwessel/kgdb

Pull kgdb/kdb fixes from Jason Wessel:
 "These have been around since 3.17 and in kgdb-next for the last 9
  weeks and some will go back to -stable.

  Summary of changes:

  Cleanups
   - kdb: Remove unused command flags, repeat flags and KDB_REPEAT_NONE

  Fixes
   - kgdb/kdb: Allow access on a single core, if a CPU round up is
     deemed impossible, which will allow inspection of the now "trashed"
     kernel
   - kdb: Add enable mask for the command groups
   - kdb: access controls to restrict sensitive commands"

* tag 'for_linus-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
  kernel/debug/debug_core.c: Logging clean-up
  kgdb: timeout if secondary CPUs ignore the roundup
  kdb: Allow access to sensitive commands to be restricted by default
  kdb: Add enable mask for groups of commands
  kdb: Categorize kdb commands (similar to SysRq categorization)
  kdb: Remove KDB_REPEAT_NONE flag
  kdb: Use KDB_REPEAT_* values as flags
  kdb: Rename kdb_register_repeat() to kdb_register_flags()
  kdb: Rename kdb_repeat_t to kdb_cmdflags_t, cmd_repeat to cmd_flags
  kdb: Remove currently unused kdbtab_t->cmd_flags

9 years agoMerge branch 'for-3.19' of git://linux-nfs.org/~bfields/linux
Linus Torvalds [Sat, 10 Jan 2015 02:10:48 +0000 (18:10 -0800)]
Merge branch 'for-3.19' of git://linux-nfs.org/~bfields/linux

Pull two nfsd bugfixes from Bruce Fields.

* 'for-3.19' of git://linux-nfs.org/~bfields/linux:
  rpc: fix xdr_truncate_encode to handle buffer ending on page boundary
  nfsd: fix fi_delegees leak when fi_had_conflict returns true

9 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph...
Linus Torvalds [Sat, 10 Jan 2015 01:55:00 +0000 (17:55 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/sage/ceph-client

Pull two Ceph fixes from Sage Weil:
 "These are both pretty trivial: a sparse warning fix and size_t printk
  thing"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
  libceph: fix sparse endianness warnings
  ceph: use %zu for len in ceph_fill_inline_data()

9 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
Linus Torvalds [Sat, 10 Jan 2015 01:46:07 +0000 (17:46 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
 "None of these are huge, but my commit does fix a regression from 3.18
  that could cause lost files during log replay.

  This also adds Dave Sterba to the list of Btrfs maintainers.  It
  doesn't mean we're doing things differently, but Dave has really been
  helping with the maintainer workload for years"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: don't delay inode ref updates during log replay
  Btrfs: correctly get tree level in tree_backref_for_extent
  Btrfs: call inode_dec_link_count() on mkdir error path
  Btrfs: abort transaction if we don't find the block group
  Btrfs, scrub: uninitialized variable in scrub_extent_for_parity()
  Btrfs: add more maintainers

9 years agoMerge branch 'akpm' (patches from Andrew)
Linus Torvalds [Fri, 9 Jan 2015 23:10:59 +0000 (15:10 -0800)]
Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
 "12 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  mm, vmscan: prevent kswapd livelock due to pfmemalloc-throttled process being killed
  memcg: fix destination cgroup leak on task charges migration
  mm: memcontrol: switch soft limit default back to infinity
  mm/debug_pagealloc: remove obsolete Kconfig options
  vfs: renumber FMODE_NONOTIFY and add to uniqueness check
  arch/blackfin/mach-bf533/boards/stamp.c: add linux/delay.h
  ocfs2: fix the wrong directory passed to ocfs2_lookup_ino_from_name() when link file
  MAINTAINERS: update rydberg's addresses
  mm: protect set_page_dirty() from ongoing truncation
  mm: prevent endless growth of anon_vma hierarchy
  exit: fix race between wait_consider_task() and wait_task_zombie()
  ocfs2: remove bogus check in dlm_process_recovery_data