cascardo/linux.git
9 years agoASoC: Intel: byt-rt5640: Add quirk for Dell Venue 8 Pro tablet
Jarkko Nikula [Thu, 2 Oct 2014 10:29:08 +0000 (13:29 +0300)]
ASoC: Intel: byt-rt5640: Add quirk for Dell Venue 8 Pro tablet

It was found with help of Jan-Michael Brummer <jan.brummer@tabos.org> that
Dell Venue 8 Pro tablet has a digital microphone connected to DMIC2
interface of the RT564x.

This patch adds a DAPM route to DMIC2 and a quirk using it for that tablet.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reported-by: Jan-Michael Brummer <jan.brummer@tabos.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: Intel: byt-rt5640: Enable DMIC interface for default DAPM route
Jarkko Nikula [Wed, 1 Oct 2014 12:08:15 +0000 (15:08 +0300)]
ASoC: Intel: byt-rt5640: Enable DMIC interface for default DAPM route

It turned out DMIC interface wasn't enabled/disabled runtime for active
DMIC route in the rt5640 codec driver anymore after commit
71d97a794301 ("ASoC: rt5640: Use the platform data for DMIC settings").

Since DMIC interface must be enabled explicitly either by passing platform
data to rt5640 codec driver or by calling new rt5640_dmic_enable() this
patch adds a DMI quirk flag that is used to conditionally enable DMIC
interface during sound card init time.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoMerge branch 'topic/rt5640' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Mark Brown [Wed, 1 Oct 2014 16:04:24 +0000 (17:04 +0100)]
Merge branch 'topic/rt5640' of git://git./linux/kernel/git/broonie/sound into asoc-intel

9 years agoASoC: rt5640: Add function for enabling DMIC from ACPI probed machine
Jarkko Nikula [Wed, 1 Oct 2014 12:08:14 +0000 (15:08 +0300)]
ASoC: rt5640: Add function for enabling DMIC from ACPI probed machine

There is no code enabling DMIC clock in systems that don't provide platform
data for rt5640 after commit 71d97a794301 ("ASoC: rt5640: Use the platform
data for DMIC settings").

I think it's worth to keep this static DMIC clock and alternative data pin
setting during probe time. For making possible to use DMIC from ACPI probed
machine (prior ACPI 5.1 with _DSD) this patch moves DMIC configuration to
new exported rt5640_dmic_enable() that machine drivers can call.

Please note, this patch moves DMIC configuration from i2c probe to codec
probe in case platform data for rt5640 is set.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: Intel: byt-rt5640: Add quirk for Asus T100
Jarkko Nikula [Mon, 29 Sep 2014 13:58:16 +0000 (16:58 +0300)]
ASoC: Intel: byt-rt5640: Add quirk for Asus T100

Asus T100 internal microphone is not digital but analogue connected to IN1P
pin of the RT564x codec with shared bias between internal and headset
microphones. Because of this there is need to have machine specific DAPM
routes in byt-rt5640.

Add handling for them with the help of DMI quirk that is used to add custom
routes in addition to common. Because "Internal Mic" connected to DMIC1 is
not common to all move it as a default custom route when there is no match
in quirk table.

Custom "Internal Mic" -> "IN1P" with MICBIAS1 route is added for Asus T100.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: Intel: byt-rt5640: Remove IN2N pin from DAPM route table
Jarkko Nikula [Mon, 29 Sep 2014 13:58:15 +0000 (16:58 +0300)]
ASoC: Intel: byt-rt5640: Remove IN2N pin from DAPM route table

I tested couple byt-rt5640 based platforms and they have single-ended
headset microphone connection to IN2P only. I guess IN2N was either defined
by accident or some early platform had floating ground for headset. It's
better to remove IN2N and add a custom route for such a platform if needed.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: Intel: byt-max98090: Set card as fully routed
Jarkko Nikula [Fri, 26 Sep 2014 13:25:38 +0000 (16:25 +0300)]
ASoC: Intel: byt-max98090: Set card as fully routed

All byt-max98090 audio connections are known and described in DAPM routing
table. Set the fully_routed flag in order to disable unused codec pins.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoMerge branch 'fix/max98090' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Mark Brown [Sun, 28 Sep 2014 11:22:30 +0000 (12:22 +0100)]
Merge branch 'fix/max98090' of git://git./linux/kernel/git/broonie/sound into asoc-intel

9 years agoASoC: max98090: Enable both DMIC channels also when using mono configuration
Jarkko Nikula [Fri, 26 Sep 2014 13:25:37 +0000 (16:25 +0300)]
ASoC: max98090: Enable both DMIC channels also when using mono configuration

According to MAX98090 specification "Digital microphone clock (DMC) is
enabled once both data channels are enabled.". Therefore both digital
microphone data channels must be enabled also when using mono microphone
configuration.

Fix this by moving "DMICL_ENA" and "DMICR_ENA" supply widgets from "DMICL"
and "DMICR" inputs to "DMIC Mux" in order to enable both data channels
whenever there is active mono or stereo digital microphone input path.

Use of "DMICL" and "DMICR" inputs are retained for informative source and in
case the driver would find use for exact digital microphone configuration in
the future.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: Intel: mfld-pcm: add control for powering up/down dsp
Vinod Koul [Fri, 19 Sep 2014 11:16:03 +0000 (16:46 +0530)]
ASoC: Intel: mfld-pcm: add control for powering up/down dsp

When we have PCM (FE/BE) opened or DAPM widgets triggered we need power
up/down DSP accordingly. The DSP will do ref count of these requests
i.e. link these runtime_get/put calls of DSP

Also fix some preexisting spacing error.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: Intel: mrfld: Use snd_soc_dai_get_drvdata to derive drv data
Subhransu S. Prusty [Tue, 9 Sep 2014 09:41:32 +0000 (15:11 +0530)]
ASoC: Intel: mrfld: Use snd_soc_dai_get_drvdata to derive drv data

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: Intel: mrfld: add bytes control for modules
Vinod Koul [Tue, 9 Sep 2014 09:41:25 +0000 (15:11 +0530)]
ASoC: Intel: mrfld: add bytes control for modules

This patch add support for various modules like eq etc for mrfld DSP.
All these modules will be exposed to usermode as bytes controls.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: Intel: mfld-pcm: don't call trigger ops to DSP for internal streams
Vinod Koul [Tue, 9 Sep 2014 09:41:24 +0000 (15:11 +0530)]
ASoC: Intel: mfld-pcm: don't call trigger ops to DSP for internal streams

For internal stream i.e. BE we have don't need trigger ops as that
would be handled by DAPM for us in subsequent patches

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: mfld: pcm: Replace pr_ with dev_
Subhransu S. Prusty [Tue, 2 Sep 2014 12:35:56 +0000 (18:05 +0530)]
ASoC: mfld: pcm: Replace pr_ with dev_

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: sst-haswell-pcm: Move controls and DAPM elements to component
Lars-Peter Clausen [Wed, 20 Aug 2014 11:08:48 +0000 (13:08 +0200)]
ASoC: sst-haswell-pcm: Move controls and DAPM elements to component

The sst-haswell-pcm driver registers both a snd_soc_component and a
snd_soc_platform and expects that the DAPM widgets for the DAIs registered by
component are added to the DAPM context of the platform. This requires us to
have a hack in the ASoC core which does so. Moving the DAPM elements over to
the component allows us to remove this hack.

While we are at it also move the controls over to the component. The controls
don't need the platform for anything other than snd_soc_platform_get_drvdata(),
this can easily be replaced by snd_soc_component_get_drvdata(). As the long
term goal is to register only a single component this is a step in the right
direction.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: sst-haswell-pcm: Alloc state struct in driver probe()
Lars-Peter Clausen [Wed, 20 Aug 2014 11:08:47 +0000 (13:08 +0200)]
ASoC: sst-haswell-pcm: Alloc state struct in driver probe()

Resource allocations should happen in driver probe callback rather than in
snd_soc_platform probe functions. Especially if the resource is device
managed. The snd_soc_* probe/remove functions are mainly intended to be used
for things that require the component to be already bound to a card.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoMerge branch 'topic/component' of git://git.kernel.org/pub/scm/linux/kernel/git/broon...
Mark Brown [Sat, 6 Sep 2014 13:44:11 +0000 (14:44 +0100)]
Merge branch 'topic/component' of git://git./linux/kernel/git/broonie/sound into asoc-intel

9 years agoASoC: Add snd_soc_component_{get,set}_drvdata()
Lars-Peter Clausen [Wed, 20 Aug 2014 11:08:46 +0000 (13:08 +0200)]
ASoC: Add snd_soc_component_{get,set}_drvdata()

Add Add snd_soc_component_{get,set}_drvdata() similar to
snd_soc_codec_{get,set}_drvdata() and snd_soc_platform_{get,set}_drvdata().
Also update them to use the new functions internally.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: max98090: Add recovery for PLL lock failure
Jarkko Nikula [Wed, 3 Sep 2014 12:42:48 +0000 (15:42 +0300)]
ASoC: max98090: Add recovery for PLL lock failure

All MAX98090 input clocks MCLK, LRCLK and BCLK must be running and stable
before powering on the codec in slave mode. Otherwise the PLL may not lock
to LRCLK causing silence in playback and capture. How often that happens is
somewhat hardware and clock configuration specific.

Now if wanting to follow strictly this clocks must be active before
powering the codec on requirement we should have a notification from DAI
driver to codec driver when clocks are activated and take codec out of
shutdown only after that. Plus take care of possible active bypass paths.

However, when PLL unlock occurs, MAX98090 asserts the PLL Unlock Flag which
can be configured as an IRQ source. This allows to workaround around the
issue by toggling the codec power shortly in case of PLL lock failure.

In order to prevent needlessly toggling codec power in case of short PLL
unlocks at the beginning of stream this patch implements delayed activation
for PLL unlock interrupt. Then workaround is run only when the PLL doesn't
lock at all.

Power toggling workaround for PLL unlock comes originally from
Liam Girdwood <liam.r.girdwood@linux.intel.com> and delayed activation from
me.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
9 years agoASoC: Remove unused cache_only from struct snd_soc_codec
Jarkko Nikula [Thu, 28 Aug 2014 11:07:11 +0000 (14:07 +0300)]
ASoC: Remove unused cache_only from struct snd_soc_codec

There are no real users for cache_only in "struct snd_soc_codec" so remove
it and needless debugfs node.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: mfld-compress: Use dedicated function instead of ioctl
Subhransu S. Prusty [Thu, 21 Aug 2014 12:50:49 +0000 (18:20 +0530)]
ASoC: mfld-compress: Use dedicated function instead of ioctl

Also pass sst device as an argument to function pointer prototypes of
compr_ops. This will be used to derive sst driver context.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Restore idle_bias_off initialization
Lars-Peter Clausen [Sun, 24 Aug 2014 13:36:55 +0000 (15:36 +0200)]
ASoC: Restore idle_bias_off initialization

This was accidentally lost in commit f1d45cc3ae96 ("ASoC: Consolidate
platform and CODEC probe/remove").

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Replace list_empty(&card->codec_dev_list) with !card->instantiated
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:30 +0000 (15:51 +0200)]
ASoC: Replace list_empty(&card->codec_dev_list) with !card->instantiated

With componentization we no longer necessarily need a snd_soc_codec struct for a
card. Instead of checking if the card's CODEC list is empty just use
card->instantiated to check if the card has been instantiated yet.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Remove support for legacy snd_soc_platform IO
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:29 +0000 (15:51 +0200)]
ASoC: Remove support for legacy snd_soc_platform IO

There were never any actual users of this in upstream and by we have with
regmap a replacement in place, which should be used by new drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Automatically initialize regmap for all components
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:28 +0000 (15:51 +0200)]
ASoC: Automatically initialize regmap for all components

So far regmap is only automatically initialized for CODECs. Now that we have the
infrastructure in place to let components have DAPM widgets and controls that
want to use the generic regmap based IO also make sure to automatically
initialize regmap for all components.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Consolidate CPU and CODEC DAI lookup
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:27 +0000 (15:51 +0200)]
ASoC: Consolidate CPU and CODEC DAI lookup

The lookup of CPU and CODEC DAIs is fairly similar and can easily be
consolidated into a single helper function.

There are two main differences in the current implementation of the CPU and
CODEC DAI lookup:
 1) CPU DAIs can be looked up by the DAI name alone and do not necessarily
   require a component name/of_node.
 2) The CODEC DAI search only considers DAIs from CODEC components.

For 1) the new helper function will allow to lookup DAIs without providing a
component name or of_node, but since snd_soc_register_card() already rejects
CODEC DAI link components without neither a of_node or a name we'll never get
into the situation where we try to lookup a CODEC DAI without a name/of_node.
For 2) the new helper function just always considers all components.
Componentization is now at a point where it is possible to register a CODEC as a
snd_soc_component rather than a snd_soc_codec, by considering DAIs from all
components it is possible to use such a CODEC in a DAI link.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Consolidate CPU and CODEC DAI removal
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:26 +0000 (15:51 +0200)]
ASoC: Consolidate CPU and CODEC DAI removal

CPU and CODEC DAI works exactly the same way. There is already a helper function
for CODEC DAI removal, use that one as well for CPU DAI removal.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Cleanup DAI module reference counting
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:25 +0000 (15:51 +0200)]
ASoC: Cleanup DAI module reference counting

Currently when a DAI has no CODEC associated to it the reference on the module
containing the DAI driver is increased when the DAI is probed and decrease when
the DAI is removed. For DAIs with CODECs the module reference count was already
incremented when the CODEC is probed. Now that all components have their module
reference count incremented when they are probed and all DAIs do have a
component it is possible to remove the module reference counting on DAI probe
and removal.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Move component->probed check into soc_{remove,probe}_component()
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:24 +0000 (15:51 +0200)]
ASoC: Move component->probed check into soc_{remove,probe}_component()

Having the check in a centralized place makes the code a bit cleaner and
shorter.

Note: There is a slight semantic change in this patch. soc_probe_aux_dev() will
no longer return -EBUSY if the AUX dev has already been probed before. This is
fine though since it will simply do nothing in that case and return success.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Pass component instead of DAPM context to AUX dev init callback
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:23 +0000 (15:51 +0200)]
ASoC: Pass component instead of DAPM context to AUX dev init callback

Given that the component is the containing structure it makes more sense to pass
the component rather than the DAPM context to the AUX dev init callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Move AUX dev support to the component level
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:22 +0000 (15:51 +0200)]
ASoC: Move AUX dev support to the component level

This patch makes it possible to register arbitrary components as a AUX dev
for a card. This was previously only possible for CODEC components. With
componentization having made it possible for components to have DAPM contexts
and controls there is no reason why AUX devs should be artificially limited to
snd_soc_codec devices.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Add component level probe/remove support
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:21 +0000 (15:51 +0200)]
ASoC: Add component level probe/remove support

Now that we have a unified probe and remove path make sure to call them for all
components. soc_{probe,remove}_component are responsible for setting up the DAPM
context for the component, initialize the component prefix, manage the debugfs
entries as well as do the registration of table based controls and DAPM
elements. They also call the component drivers probe and remove callbacks. This
patch makes these things available for generic snd_soc_component drivers rather
than only having them for snd_soc_codec and snd_soc_platform drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Make rtd->codec optional
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:20 +0000 (15:51 +0200)]
ASoC: Make rtd->codec optional

There are some place in the ASoC core that expect rtd->codec to be non NULL
(mainly CODEC specific sysfs files). With componentization going forward
rtd->codec might be NULL in some cases. This patch prepares the core for this by
not registering CODEC specific sysfs files if rtd->codec is NULL. sysfs file
removal does not need to be conditionalized as it handles the removal of
non-existing files just fine.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Consolidate platform and CODEC probe/remove
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:19 +0000 (15:51 +0200)]
ASoC: Consolidate platform and CODEC probe/remove

The platform and CODEC probe and remove code is now largely identical. This
patch consolidates it at the component level.

The resulting code is slightly larger due to all the boiler plate code setting
up the indirection for the table based control and DAPM registration.  Once all
drivers have been update to no longer use the snd_soc_codec_driver and
snd_soc_platform_driver specific fields for this the indirection can be removed
again.

This patch contains two noteworthy hacks that are only meant to be temporary to
be able to update drivers and the core in separate incremental patches.

The first hack is related to that some DPCM platforms expect that the DAPM
widgets for the DAIs of a snd_soc_component are created in the DAPM context of
the snd_soc_platform that has the same parent device. For handling this the
steal_sibling_dai_widgets attribute is introduced. It gets set for
snd_soc_platforms that register DAPM elements. When creating the DAI widgets for
a component this flag is checked and if it is found on one of the siblings the
component will not create any DAI widgets in its own DAPM context. If the
attribute is set on a platform it will look for siblings components and create
DAI widgets for them in its own context. The fix for this will be to update
the offending drivers to only register a single component rather than two.

The second hack deals with the fact that the ASoC card suspend and resume code
still needs a list of CODECs that have been registered for the card. To handle
this the generic probe and remove path have a check to see if the component is
CODEC and if yes add/remove it to the card's CODEC list. While it is possible to
clean up the suspend/resume code to not need the CODEC list anymore this is a
bit of a chicken and egg problem since it will become easier to clean up the
suspend/resume code once there is a unified component layer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Move debugfs registration to the component level
Lars-Peter Clausen [Tue, 19 Aug 2014 13:51:18 +0000 (15:51 +0200)]
ASoC: Move debugfs registration to the component level

The debugfs registration is mostly identical between platforms and CODECs. This
patches consolidates the two implementations at the component level.

Unfortunately there are still a couple of CODEC specific debugfs files that are
related to legacy ASoC IO that need to be registered. For this a new callback is
added to the component struct that will be initialized when a CODEC is
registered and will be used to register the CODEC specific files. Once there are
no drivers left using legacy IO this can be removed again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Intel: add mrfld DSP defines
Vinod Koul [Mon, 4 Aug 2014 09:45:55 +0000 (15:15 +0530)]
ASoC: Intel: add mrfld DSP defines

We define the DSP commands,structures here which will be used to send the IPCs

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Intel: mfld-pcm: Change sst_ops prototypes to take dev parameter
Subhransu S. Prusty [Mon, 4 Aug 2014 09:34:21 +0000 (15:04 +0530)]
ASoC: Intel: mfld-pcm: Change sst_ops prototypes to take dev parameter

sst_ops need to use the sst driver context. So pass sst device as argument,
which can be used to retrieve sst context.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Intel: mfld-pcm: Use function instead of ioctl
Subhransu S. Prusty [Mon, 4 Aug 2014 09:34:20 +0000 (15:04 +0530)]
ASoC: Intel: mfld-pcm: Use function instead of ioctl

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoASoC: Intel: Fix to use byte control interface
Vinod Koul [Mon, 4 Aug 2014 09:34:19 +0000 (15:04 +0530)]
ASoC: Intel: Fix to use byte control interface

Using a byte control interface instead of generic_params ioctl.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
9 years agoLinux 3.17-rc1 v3.17-rc1
Linus Torvalds [Sat, 16 Aug 2014 16:40:26 +0000 (10:40 -0600)]
Linux 3.17-rc1

9 years agoMerge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86
Linus Torvalds [Sat, 16 Aug 2014 15:32:27 +0000 (09:32 -0600)]
Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86

Pull x86 platform driver updates from Matthew Garrett:
 "A moderate number of changes, but nothing awfully significant.

  A lot of const cleanups, some reworking and additions to the rfkill
  quirks in the asus driver, a new driver for generating falling laptop
  events on Toshibas and some misc fixes.

  Maybe vendors have stopped inventing things"

* 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86: (41 commits)
  platform/x86: Enable build support for toshiba_haps
  Documentation: Add file about toshiba_haps module
  platform/x86: Toshiba HDD Active Protection Sensor
  asus-nb-wmi: Add wapf4 quirk for the U32U
  alienware-wmi: make hdmi_mux enabled on case-by-case basis
  ideapad-laptop: Constify DMI table and other r/o variables
  asus-nb-wmi.c: Rename x401u quirk to wapf4
  compal-laptop: correct invalid hwmon name
  toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list
  toshiba_acpi: Add extra check to backlight code
  Fix log message about future removal of interface
  ideapad-laptop: Disable touchpad interface on Yoga models
  asus-nb-wmi: Add wapf4 quirk for the X550CC
  intel_ips: Make ips_mcp_limits variables static
  thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata
  fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst
  hp-wmi: Add missing __init annotations to initialization code
  hp_accel: Constify ACPI and DMI tables
  fujitsu-tablet: Mark DMI callbacks as __init code
  dell-laptop: Mark dell_quirks[] DMI table as __initconst
  ...

9 years agoMerge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
Linus Torvalds [Sat, 16 Aug 2014 15:25:34 +0000 (09:25 -0600)]
Merge branch 'release' of git://git./linux/kernel/git/lenb/linux

Pull idle update from Len Brown:
 "Two Intel-platform-specific updates to intel_idle, and a cosmetic
  tweak to the turbostat utility"

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
  tools/power turbostat: tweak whitespace in output format
  intel_idle: Broadwell support
  intel_idle: Disable Baytrail Core and Module C6 auto-demotion

9 years agoMerge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty...
Linus Torvalds [Sat, 16 Aug 2014 15:24:41 +0000 (09:24 -0600)]
Merge tag 'fixes-for-linus' of git://git./linux/kernel/git/rusty/linux

Pull module fix from Rusty Russell:
 "Nasty potential bug if someone uses a known module param with an
  invalid value (we don't fail unknown module params any more, just
  warn)"

* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  module: Clean up ro/nx after early module load failures

9 years agoMerge branch 'rng-queue' of git://git.kernel.org/pub/scm/linux/kernel/git/amit/virtio
Linus Torvalds [Sat, 16 Aug 2014 15:23:15 +0000 (09:23 -0600)]
Merge branch 'rng-queue' of git://git./linux/kernel/git/amit/virtio

Pull virtio-rng update from Amit Shah:
 "Add derating factor for use by hwrng core

  Sending directly to you with the commit log changes Ted Ts'o pointed
  out.  Not sure if Rusty's back after his travel, but this already has
  his s-o-b"

* 'rng-queue' of git://git.kernel.org/pub/scm/linux/kernel/git/amit/virtio:
  virtio: rng: add derating factor for use by hwrng core

9 years agoMerge branch 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
Linus Torvalds [Sat, 16 Aug 2014 15:06:55 +0000 (09:06 -0600)]
Merge branch 'for-linus2' of git://git./linux/kernel/git/mason/linux-btrfs

Pull btrfs updates from Chris Mason:
 "These are all fixes I'd like to get out to a broader audience.

  The biggest of the bunch is Mark's quota fix, which is also in the
  SUSE kernel, and makes our subvolume quotas dramatically more
  accurate.

  I've been running xfstests with these against your current git
  overnight, but I'm queueing up longer tests as well"

* 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: disable strict file flushes for renames and truncates
  Btrfs: fix csum tree corruption, duplicate and outdated checksums
  Btrfs: Fix memory corruption by ulist_add_merge() on 32bit arch
  Btrfs: fix compressed write corruption on enospc
  btrfs: correctly handle return from ulist_add
  btrfs: qgroup: account shared subtrees during snapshot delete
  Btrfs: read lock extent buffer while walking backrefs
  Btrfs: __btrfs_mod_ref should always use no_quota
  btrfs: adjust statfs calculations according to raid profiles

9 years agoMerge tag 'locks-v3.17-2' of git://git.samba.org/jlayton/linux
Linus Torvalds [Sat, 16 Aug 2014 14:58:47 +0000 (08:58 -0600)]
Merge tag 'locks-v3.17-2' of git://git.samba.org/jlayton/linux

Pull file locking bugfixes from Jeff Layton:
 "Most of these patches are to fix a long-standing regression that crept
  in when the BKL was removed from the file-locking code.  The code was
  converted to use a conventional spinlock, but some fl_release_private
  ops can block and you can end up sleeping inside the lock.

  There's also a patch to make /proc/locks show delegations as 'DELEG'"

* tag 'locks-v3.17-2' of git://git.samba.org/jlayton/linux:
  locks: update Locking documentation to clarify fl_release_private behavior
  locks: move locks_free_lock calls in do_fcntl_add_lease outside spinlock
  locks: defer freeing locks in locks_delete_lock until after i_lock has been dropped
  locks: don't reuse file_lock in __posix_lock_file
  locks: don't call locks_release_private from locks_copy_lock
  locks: show delegations as "DELEG" in /proc/locks

9 years agoMerge git://git.kvack.org/~bcrl/aio-next
Linus Torvalds [Sat, 16 Aug 2014 14:56:27 +0000 (08:56 -0600)]
Merge git://git.kvack.org/~bcrl/aio-next

Pull aio updates from Ben LaHaise.

* git://git.kvack.org/~bcrl/aio-next:
  aio: use iovec array rather than the single one
  aio: fix some comments
  aio: use the macro rather than the inline magic number
  aio: remove the needless registration of ring file's private_data
  aio: remove no longer needed preempt_disable()
  aio: kill the misleading rcu read locks in ioctx_add_table() and kill_ioctx()
  aio: change exit_aio() to load mm->ioctx_table once and avoid rcu_read_lock()

9 years agoplatform/x86: Enable build support for toshiba_haps
Azael Avalos [Thu, 14 Aug 2014 15:55:40 +0000 (09:55 -0600)]
platform/x86: Enable build support for toshiba_haps

Makefile and Kconfig build support patch for the newly introduced
kernel module toshiba_haps.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoDocumentation: Add file about toshiba_haps module
Azael Avalos [Thu, 14 Aug 2014 15:55:39 +0000 (09:55 -0600)]
Documentation: Add file about toshiba_haps module

This patch provides information about the Toshiba HDD
Active Protection Sensor driver module toshiba_haps.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoplatform/x86: Toshiba HDD Active Protection Sensor
Azael Avalos [Thu, 14 Aug 2014 15:55:38 +0000 (09:55 -0600)]
platform/x86: Toshiba HDD Active Protection Sensor

This driver adds support for the built-in accelereometer found
on recent Toshiba laptops with HID TOS620A.

This driver receives ACPI notify events 0x80 when the sensor
detects a sudden move or a harsh vibration, as well as an
ACPI notify event 0x81 whenever the movement or vibration has
been stabilized.

Also provides sysfs entries to get/set the desired protection
level and reseting the HDD protection interface.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoasus-nb-wmi: Add wapf4 quirk for the U32U
Hans de Goede [Tue, 29 Jul 2014 09:59:57 +0000 (11:59 +0200)]
asus-nb-wmi: Add wapf4 quirk for the U32U

As reported here: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1173681
the U32U needs wapf=4 too.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoalienware-wmi: make hdmi_mux enabled on case-by-case basis
Mario Limonciello [Thu, 24 Jul 2014 04:19:23 +0000 (23:19 -0500)]
alienware-wmi: make hdmi_mux enabled on case-by-case basis

Not all HW supporting WMAX method will support the HDMI mux feature.
Explicitly quirk the HW that does support it.

Signed-off-by: Mario Limonciello <mario_limonciello@dell.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoideapad-laptop: Constify DMI table and other r/o variables
Mathias Krause [Wed, 16 Jul 2014 17:43:15 +0000 (19:43 +0200)]
ideapad-laptop: Constify DMI table and other r/o variables

Constify the rfkill_blacklist[] DMI table, the ideapad_rfk_data[] table
and the ideapad_attribute_group attribute group. There's no need to have
them writeable during runtime.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Ike Panhc <ike.pan@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoasus-nb-wmi.c: Rename x401u quirk to wapf4
Hans de Goede [Mon, 14 Jul 2014 07:14:34 +0000 (09:14 +0200)]
asus-nb-wmi.c: Rename x401u quirk to wapf4

The actual x401u does not use the so named x401u quirk but the x55u quirk.
All that the x401u quirk does it setting wapf to 4, so rename it to wapf4 to
stop the confusion.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agocompal-laptop: correct invalid hwmon name
Roald Frederickx [Wed, 13 Aug 2014 20:40:14 +0000 (13:40 -0700)]
compal-laptop: correct invalid hwmon name

Change the name of the hwmon interface from "compal-laptop" to "compal".
A dash is an invalid character for a hwmon name and caused the call to
hwmon_device_register_with_groups() to fail.

Signed-off-by: Roald Frederickx <roald.frederickx@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agotoshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list
Azael Avalos [Mon, 4 Aug 2014 15:21:02 +0000 (09:21 -0600)]
toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list

The Toshiba Qosmio X75-A series models also come with
the new keymap layout.

This patch adds this model to the alt_keymap_dmi list,
along with an extra key found on these models.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agotoshiba_acpi: Add extra check to backlight code
Azael Avalos [Mon, 4 Aug 2014 15:21:01 +0000 (09:21 -0600)]
toshiba_acpi: Add extra check to backlight code

Some Toshiba models (most notably Qosmios) come with an
incomplete backlight method where the AML code doesn't
check for write or read commands and always returns
HCI_SUCCESS and the actual brightness (and in some
cases the max brightness), thus allowing the backlight
interface to be registered without write support.

This patch changes the set_lcd_brightness function,
checking the returned values for values greater than
zero to avoid registering a broken backlight interface.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoFix log message about future removal of interface
Martin Kepplinger [Sat, 26 Jul 2014 15:46:06 +0000 (17:46 +0200)]
Fix log message about future removal of interface

If this is going away, it won't be in 2012.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoideapad-laptop: Disable touchpad interface on Yoga models
Hans de Goede [Fri, 18 Jul 2014 10:21:47 +0000 (12:21 +0200)]
ideapad-laptop: Disable touchpad interface on Yoga models

Yoga models don't offer touchpad ctrl through the ideapad interface, causing
ideapad_sync_touchpad_state to send wrong touchpad enable/disable events.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoasus-nb-wmi: Add wapf4 quirk for the X550CC
Hans de Goede [Fri, 18 Jul 2014 10:15:09 +0000 (12:15 +0200)]
asus-nb-wmi: Add wapf4 quirk for the X550CC

As reported here: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1173681
the X550CC needs wapf=4 too.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agointel_ips: Make ips_mcp_limits variables static
Mathias Krause [Wed, 16 Jul 2014 17:43:16 +0000 (19:43 +0200)]
intel_ips: Make ips_mcp_limits variables static

These variables don't need to be visible outside of this compilation
unit, make them static.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agothinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata
Mathias Krause [Wed, 16 Jul 2014 17:43:17 +0000 (19:43 +0200)]
thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata

Mark volume_alsa_control_vol and volume_alsa_control_mute as __initdata,
as snd_ctl_new1() will copy the relevant parts, so there is no need to
keep the master copies around after initialization.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agofujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst
Mathias Krause [Wed, 16 Jul 2014 17:43:11 +0000 (19:43 +0200)]
fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst

The DMI table is only ever used during initialization. Mark it as
__initconst so its memory can be released afterwards -- roughly 1.5 kB.
In turn, the callback functions can be marked with __init, too.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Jonathan Woithe <jwoithe@just42.net>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agohp-wmi: Add missing __init annotations to initialization code
Mathias Krause [Wed, 16 Jul 2014 17:43:13 +0000 (19:43 +0200)]
hp-wmi: Add missing __init annotations to initialization code

These functions are only called from other initialization routines, so
can be marked __init, too.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agohp_accel: Constify ACPI and DMI tables
Mathias Krause [Wed, 16 Jul 2014 17:43:14 +0000 (19:43 +0200)]
hp_accel: Constify ACPI and DMI tables

Constify the lis3lv02d_device_ids[] ACPI and the lis3lv02d_dmi_ids[] DMI
tables. There's no need to have them writeable during runtime.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Eric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agofujitsu-tablet: Mark DMI callbacks as __init code
Mathias Krause [Wed, 16 Jul 2014 17:43:12 +0000 (19:43 +0200)]
fujitsu-tablet: Mark DMI callbacks as __init code

The DMI table is already marked as __initconst, so can be the callback
functions as they're only used in that context.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Robert Gerlach <khnz@gmx.de>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agodell-laptop: Mark dell_quirks[] DMI table as __initconst
Mathias Krause [Wed, 16 Jul 2014 17:43:09 +0000 (19:43 +0200)]
dell-laptop: Mark dell_quirks[] DMI table as __initconst

The dell_quirks[] DMI table is only ever used during initialization.
Mark it as __initconst so its memory can be released afterwards --
roughly 5.7 kB. In turn, the callback function can be marked with
__init, too.

Also the touchpad_led_init() function can be marked __init as it's only
referenced from dell_init() -- an __init function.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoeeepc-wmi: Constify asus_quirks[] DMI table
Mathias Krause [Wed, 16 Jul 2014 17:43:10 +0000 (19:43 +0200)]
eeepc-wmi: Constify asus_quirks[] DMI table

Constify the asus_quirks[] DMI table. There's no need to have it
writeable during runtime.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoacer-wmi: Mark init data and code as such
Mathias Krause [Wed, 16 Jul 2014 17:43:04 +0000 (19:43 +0200)]
acer-wmi: Mark init data and code as such

Quite a lot of code and data of acer-wmi.c is only ever used during
initialization. Mark those accordingly -- and constify, where
appropriate -- so the memory can be released afterwards.

All in all those changes move ~10 kB of code and data to the .init
sections, marking them for release after initialization has finished.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoasus-nb-wmi: Constify asus_quirks[] DMI table
Mathias Krause [Wed, 16 Jul 2014 17:43:08 +0000 (19:43 +0200)]
asus-nb-wmi: Constify asus_quirks[] DMI table

Constify the asus_quirks[] DMI table. There's no need to have it
writeable during runtime.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoalienware-wmi: Mark DMI table as __initconst
Mathias Krause [Wed, 16 Jul 2014 17:43:07 +0000 (19:43 +0200)]
alienware-wmi: Mark DMI table as __initconst

The DMI table is only ever used during initialization. Mark it as
__initconst so its memory can be released appropriately. In turn, the
callback function can be marked with __init, too.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoacer-wmi: Hide acer_{suspend,resume} for !CONFIG_PM_SLEEP
Mathias Krause [Wed, 16 Jul 2014 17:43:06 +0000 (19:43 +0200)]
acer-wmi: Hide acer_{suspend,resume} for !CONFIG_PM_SLEEP

Encapsulate acer_suspend() and acer_resume with #ifdef CONFIG_PM_SLEEP
to get rid of the following warnings:

  ../acer-wmi.c:2046:12: warning: â€˜acer_suspend’ defined but not used [-Wunused-function]
  ../acer-wmi.c:2068:12: warning: â€˜acer_resume’ defined but not used [-Wunused-function]

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoacer-wmi: Mark acer_wmi_keymap[] as __initconst
Mathias Krause [Wed, 16 Jul 2014 17:43:05 +0000 (19:43 +0200)]
acer-wmi: Mark acer_wmi_keymap[] as __initconst

sparse_keymap_setup() will make a copy of the keymap, so we can release
the master copy after initialization.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoMAINTAINERS: Update git URL for x86 platform drivers
Mathias Krause [Wed, 16 Jul 2014 17:43:03 +0000 (19:43 +0200)]
MAINTAINERS: Update git URL for x86 platform drivers

The repo on kernel.org is no longer available but has a replacement at
cavan.codon.org.uk.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoWMI: Remove unnecessary null test
Himangi Saraogi [Tue, 15 Jul 2014 17:19:11 +0000 (22:49 +0530)]
WMI: Remove unnecessary null test

This patch removes the null test on block. block is initialized at the
beginning of the function to &wblock->gblock. Since wblock is
dereferenced prior to the null test, wblock must be a valid pointer,
and &wblock->gblock cannot be null.

The following Coccinelle script is used for detecting the change:

@r@
expression e,f;
identifier g,y;
statement S1,S2;
@@

*e = &f->g
<+...
 f->y
 ...+>
*if (e != NULL || ...)
 S1 else S2

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agodrivers/platform/x86/thinkpad_acpi.c: don't test unsigned int for negativity
Andrey Utkin [Mon, 14 Jul 2014 22:56:21 +0000 (01:56 +0300)]
drivers/platform/x86/thinkpad_acpi.c: don't test unsigned int for negativity

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80231
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoasus-nb-wmi: Add wapf4 quirk for the X550CL
Hans de Goede [Mon, 14 Jul 2014 07:14:35 +0000 (09:14 +0200)]
asus-nb-wmi: Add wapf4 quirk for the X550CL

As reported here: https://bugs.launchpad.net/bugs/1277959
the X550CL needs wapf=4 too.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoasus-nb-wmi: Add ASUSTeK COMPUTER INC. X200CA
AceLan Kao [Wed, 9 Jul 2014 08:18:19 +0000 (16:18 +0800)]
asus-nb-wmi: Add ASUSTeK COMPUTER INC. X200CA

BIOS won't light on the wifi-led after S3, so asus-wmi driver needs to
control the wifi and wifi-led status.
But, it'll lead to bt status error if asus-wmi driver controls bt as well.
So, for X200CA, asus-wmi driver controls wifi status only and have to set
wapf to 1.

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoasus-wmi: control wlan-led if wapf > 0
AceLan Kao [Wed, 9 Jul 2014 08:18:18 +0000 (16:18 +0800)]
asus-wmi: control wlan-led if wapf > 0

Wifi will be controlled by asus-wmi driver when wapf > 0
So, controls the wifi-led when wapf > 0

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoasus-wmi: backlight_init: Stop treating -ENODEV as if its not an error
Hans de Goede [Tue, 8 Jul 2014 08:47:22 +0000 (10:47 +0200)]
asus-wmi: backlight_init: Stop treating -ENODEV as if its not an error

When bl_power support got added to asus-wmi, the error handling for it was
written to ignore -ENODEV, to avoid not registering a backlight interface for
models which have no bl_power control, but do have brightness control.

At the same time the error handling for brightness_max was modified to do the
same, this is wrong, when there is no brightness_max asus-wmi should not
register a backlight interface.

Note the caller of asus_wmi_backlight_init already special cases -ENODEV,
and will not cause the wmi driver regristration to fail because of a
-ENODEV return from asus_wmi_backlight_init.

https://bugzilla.redhat.com/show_bug.cgi?id=1097436

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoasus-wmi: Disable acpi-video backlight on desktop machines
Hans de Goede [Tue, 8 Jul 2014 08:47:21 +0000 (10:47 +0200)]
asus-wmi: Disable acpi-video backlight on desktop machines

Some Asus motherboards for desktop PC-s export an acpi-video interface
advertising backlight support. Test the dmi chassis-type and tell acpi-video
to not register a backlight interface on desktops.

https://bugzilla.redhat.com/show_bug.cgi?id=1097436

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoideapad-laptop: Change Lenovo Yoga 2 series rfkill handling
Hans de Goede [Mon, 23 Jun 2014 14:45:51 +0000 (16:45 +0200)]
ideapad-laptop: Change Lenovo Yoga 2 series rfkill handling

It seems that the same problems which lead to adding an rfkill blacklist and
putting the Lenovo Yoga 2 11 on it are also present on the Lenovo Yoga 2 13
and Lenovo Yoga 2 Pro too:
https://bugzilla.redhat.com/show_bug.cgi?id=1021036
https://forums.lenovo.com/t5/Linux-Discussion/Yoga-2-13-not-Pro-Linux-Warning/m-p/1517612

Testing has shown that the firmware rfkill settings are persistent over
reboots. So blacklisting the driver is not good enough, if the wifi is blocked
at the firmware level the wifi needs to be explictly unblocked through the
ideapad-laptop interface.

And at least on the Lenovo Yoga 2 13 the VPCCMD_RF register which on devices
with hardware kill switch reports the hardware switch state, needs to be
explictly set to 1 (radio enabled / not blocked).

So this patch does 3 things to get proper rfkill handling on these models:

1) Instead of blacklisting the rfkill functionality, which means that people
with a firmware blocked wifi get stuck in that situation, ignore the value
reported by the not present hardware rfkill switch, as this is what is causing
ideapad-laptop to wrongly report all radios as hardware blocks. But do register
the rfkill interfaces so that the user can soft [un]block them.

2) On models without a hardware rfkill switch, explictly set VPCCMD_RF to 1

3) Drop the " 11" postfix from the dmi match string, as the entire Yoga 2
series is affected.

Yoga 2 11:
Reported-and-tested-by: Vincent Gerris <vgerris@gmail.com>
Yoga 2 13:
Tested-by: madls05 <http://ubuntuforums.org/showthread.php?t=2215044>
Yoga 2 Pro:
Reported-and-tested-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agothinkpad_acpi: Update mapping for F12 hotkey on *40 models to KEY_FILE
Hans de Goede [Mon, 23 Jun 2014 11:38:23 +0000 (13:38 +0200)]
thinkpad_acpi: Update mapping for F12 hotkey on *40 models to KEY_FILE

The new keyboard found on the *40 models is also being sold as a standalone
keyboard (with trackpoint):
http://shop.lenovo.com/us/en/itemdetails/0B47189/460/60AC6A0372B14F5BA7B12F1FF88E33C7

This uses a standard HUT code for the F12 key with the 6 square boxes on it,
which gets mapped to KEY_FILE by the kernel. Change the mapping done of
identical laptop key done by thinkpad_acpi to also send KEY_FILE for
consistency.

Cc: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoeeepc-laptop: rename _set and _get arguments in macro
Paul Bolle [Tue, 17 Jun 2014 12:06:30 +0000 (14:06 +0200)]
eeepc-laptop: rename _set and _get arguments in macro

The _set and _get arguments to the EEEPC_CREATE_SENSOR_ATTR() macro
are confusingly named: _set should be _get and vice versa. Rename these
arguments.

Drop the trailing semicolon from that macro, while we're at it.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agofujitsu-laptop: Clear build warnings
Jean Delvare [Mon, 16 Jun 2014 09:55:13 +0000 (11:55 +0200)]
fujitsu-laptop: Clear build warnings

When CONFIG_FUJITSU_LAPTOP_DEBUG is disabled and W=1, the
fujitsu-laptop driver builds with the following warnings:

drivers/platform/x86/fujitsu-laptop.c: In function "bl_update_status":
drivers/platform/x86/fujitsu-laptop.c:409:8: warning: suggest braces around empty body in an "if" statement [-Wempty-body]
    ret);
        ^
drivers/platform/x86/fujitsu-laptop.c:418:8: warning: suggest braces around empty body in an "if" statement [-Wempty-body]
    ret);
        ^

Rework the debug printk helper macro to get rid of these. I verified
that this change has no effect on the generated binary, both in the
debug and non-debug case.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Jonathan Woithe <jwoithe@just42.net>
Cc: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoplatform/x86/toshiba-apci.c possible bad if test?
Nick [Fri, 13 Jun 2014 03:04:15 +0000 (23:04 -0400)]
platform/x86/toshiba-apci.c possible bad if test?

Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agosony-laptop: fix doesn't work lid resume settings on Vaio Pro
mog422 [Thu, 12 Jun 2014 06:34:09 +0000 (15:34 +0900)]
sony-laptop: fix doesn't work lid resume settings on Vaio Pro

Signed-off-by: mog422 <admin@mog422.net>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoWAPF 4 for ASUSTeK COMPUTER INC. X75VBP WLAN ON.
poma [Tue, 6 May 2014 20:03:38 +0000 (22:03 +0200)]
WAPF 4 for ASUSTeK COMPUTER INC. X75VBP WLAN ON.

The 'asus-nb-wmi' WAPF parameter must be set to 4, so the internal Wireless LAN device is operational.

Signed-off-by: poma <pomidorabelisima@gmail.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
9 years agoMerge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sat, 16 Aug 2014 00:28:58 +0000 (18:28 -0600)]
Merge tag 'scsi-misc' of git://git./linux/kernel/git/jejb/scsi

Pull more SCSI changes from James Bottomley:
 "This is a small set of updates which missed the first pull.  It's more
  msix updates, some iscsi and qla4xxx fixes, we also have some string
  null termination fixes a return value fix and a couple of pm8001
  firmware fixes.

  Just a note, we do have a couple of bug fixes coming under separate
  cover, but they don't have to be part of the merge window"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  iscsi class: Fix freeing of skb in get host error path
  scsi: fix u14-34f printk format warnings
  pm8001: fix pm8001_store_update_fw
  pm8001: Fix erratic calculation in update_flash
  pm8001: Update MAINTAINERS list
  libiscsi: return new error code when nop times out
  iscsi class: fix get_host_stats return code when not supported
  iscsi class: fix get_host_stats error handling
  qla4xxx: fix get_host_stats error propagation
  qla4xxx: check the return value of dma_alloc_coherent()
  scsi: qla4xxx: ql4_mbx.c: Cleaning up missing null-terminate in conjunction with strncpy
  scsi: qla4xxx: ql4_os.c: Cleaning up missing null-terminate in conjunction with strncpy
  qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()
  pm8001: Use pci_enable_msix_exact() instead of pci_enable_msix()

9 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Linus Torvalds [Sat, 16 Aug 2014 00:16:28 +0000 (18:16 -0600)]
Merge branch 'for-linus' of git://git./linux/kernel/git/dtor/input

Pull input layer fixes from Dmitry Torokhov:
 "Second round of updates for the input subsystem.  Mostly small fixups
  to the code merged in the first round (atmel_mxt_ts, wacom) but also a
  smallish patch to xbox driver to support Xbox One controllers and a
  patch to better handle Synaptics profile sensors found in Cr-48
  Chromebooks that should not affect any other devices"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: edt-ft5x06 - remove superfluous assignment
  Input: xpad - add support for Xbox One controllers
  Input: atmel_mxt_ts - fix a few issues reported by Coverity
  Input: atmel_mxt_ts - split config update a bit
  Input: atmel_mxt_ts - simplify mxt_initialize a bit
  Input: joystick - use get_cycles on ARMv8
  Input: wacom - fix compiler warning if !CONFIG_PM
  Input: cap1106 - allow changing key mapping from userspace
  Input: synaptics - use firmware data for Cr-48
  Input: synaptics - properly initialize slots for semi-MT
  Input: MT - make slot cleanup callable outside mt_sync_frame()
  Input: atmel_mxt_ts - mXT224 DMA quirk was fixed in firmware v2.0.AA

9 years agoMerge tag 'sound-fix-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
Linus Torvalds [Sat, 16 Aug 2014 00:06:56 +0000 (18:06 -0600)]
Merge tag 'sound-fix-3.17-rc1' of git://git./linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Here is the additional fix patches that have been queued up since the
  previous pull request.  A few HD-audio fixes, a USB-audio quirk
  addition, and a couple of trivial cleanup for the legacy OSS codes"

* tag 'sound-fix-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda - Set TLV_DB_SCALE_MUTE bit for cx5051 vmaster
  ALSA: hda/ca0132 - Don't try loading firmware at resume when already failed
  ALSA: hda - Fix pop noises on reboot for Dell XPS 13 9333
  ALSA: hda - Set internal mic as default input source on Dell XPS 13 9333
  ALSA: usb-audio: fix BOSS ME-25 MIDI regression
  ALSA: hda - Fix parsing of CMI8888 codec
  ALSA: hda - Fix probing and stuttering on CMI8888 HD-audio controller
  ALSA: hda/realtek - Fixed ALC286/ALC288 recording delay for Headset Mic
  sound: oss: Remove typedefs wanc_info and wavnc_port_info
  sound: oss: uart401: Remove typedef uart401_devc

9 years agoMerge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Linus Torvalds [Fri, 15 Aug 2014 23:57:49 +0000 (17:57 -0600)]
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm fixes (mostly nouveau) from Dave Airlie:
 "One doc buidling fixes for a file that moved, along with a bunch of
  nouveau fixes, one a build problem on ARM"

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
  drm/doc: Refer to proper source file
  drm/nouveau/platform: fix compilation error
  drm/nouveau/gk20a: add LTC device
  drm/nouveau: warn if we fail to re-pin fb on resume
  drm/nouveau/nvif: fix dac load detect method definition
  drm/gf100-/gr: fix -ENOSPC detection when allocating zbc table entries
  drm/nouveau/nvif: return null pointers on failure, in addition to ret != 0
  drm/nouveau/ltc: fix tag base address getting truncated if above 4GiB
  drm/nvc0-/fb/ram: fix use of non-existant ram if partitions aren't uniform
  drm/nouveau/bar: behave better if ioremap failed
  drm/nouveau/kms: nouveau_fbcon_accel_fini can be static
  drm/nouveau: kill unused variable warning if !__OS_HAS_AGP
  drm/nouveau/nvif: fix a number of notify thinkos

9 years agoMerge branch 'linux_next' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
Linus Torvalds [Fri, 15 Aug 2014 23:56:45 +0000 (17:56 -0600)]
Merge branch 'linux_next' of git://git./linux/kernel/git/mchehab/linux-edac

Pull EDAC updates from Mauro Carvalho Chehab.

* 'linux_next' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac:
  sb_edac: add support for Haswell based systems
  sb_edac: Fix mix tab/spaces alignments
  edac: add DDR4 and RDDR4
  sb_edac: remove bogus assumption on mc ordering
  sb_edac: make minimal use of channel_mask
  sb_edac: fix socket detection on Ivy Bridge controllers
  sb_edac: update Kconfig description
  sb_edac: search devices using product id
  sb_edac: make RIR limit retrieval per model
  sb_edac: make node id retrieval per model
  sb_edac: make memory type detection per memory controller

9 years agotools/power turbostat: tweak whitespace in output format
Len Brown [Fri, 15 Aug 2014 01:22:13 +0000 (21:22 -0400)]
tools/power turbostat: tweak whitespace in output format

turbostat -S
output was off by 1 space before this patch.

Signed-off-by: Len Brown <len.brown@intel.com>
9 years agointel_idle: Broadwell support
Len Brown [Wed, 5 Feb 2014 04:56:40 +0000 (23:56 -0500)]
intel_idle: Broadwell support

Broadwell (BDW) is similar to Haswell (HSW), the preceding processor generation.

Currently, the only difference in their C-state tables is that PC3 max exit latency
is 33usec on HSW and 40usec on BDW.

Signed-off-by: Len Brown <len.brown@intel.com>
9 years agointel_idle: Disable Baytrail Core and Module C6 auto-demotion
Len Brown [Thu, 31 Jul 2014 19:21:24 +0000 (15:21 -0400)]
intel_idle: Disable Baytrail Core and Module C6 auto-demotion

Power efficiency improves on Baytrail (Intel Atom Processor E3000)
when Linux disables C6 auto-demotion.

Based on work by Srinidhi Kasagar <srinidhi.kasagar@intel.com>.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: x86@kernel.org
9 years agomodule: Clean up ro/nx after early module load failures
Andy Lutomirski [Fri, 15 Aug 2014 18:43:37 +0000 (04:13 +0930)]
module: Clean up ro/nx after early module load failures

The commit

    4982223e51e8 module: set nx before marking module MODULE_STATE_COMING.

introduced a regression: if a module fails to parse its arguments or
if mod_sysfs_setup fails, then the module's memory will be freed
while still read-only.  Anything that reuses that memory will crash
as soon as it tries to write to it.

Cc: stable@vger.kernel.org # v3.16
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
9 years agobtrfs: disable strict file flushes for renames and truncates
Chris Mason [Tue, 12 Aug 2014 17:47:42 +0000 (10:47 -0700)]
btrfs: disable strict file flushes for renames and truncates

Truncates and renames are often used to replace old versions of a file
with new versions.  Applications often expect this to be an atomic
replacement, even if they haven't done anything to make sure the new
version is fully on disk.

Btrfs has strict flushing in place to make sure that renaming over an
old file with a new file will fully flush out the new file before
allowing the transaction commit with the rename to complete.

This ordering means the commit code needs to be able to lock file pages,
and there are a few paths in the filesystem where we will try to end a
transaction with the page lock held.  It's rare, but these things can
deadlock.

This patch removes the ordered flushes and switches to a best effort
filemap_flush like ext4 uses. It's not perfect, but it should fix the
deadlocks.

Signed-off-by: Chris Mason <clm@fb.com>
9 years agoBtrfs: fix csum tree corruption, duplicate and outdated checksums
Filipe Manana [Sat, 9 Aug 2014 20:22:27 +0000 (21:22 +0100)]
Btrfs: fix csum tree corruption, duplicate and outdated checksums

Under rare circumstances we can end up leaving 2 versions of a checksum
for the same file extent range.

The reason for this is that after calling btrfs_next_leaf we process
slot 0 of the leaf it returns, instead of processing the slot set in
path->slots[0]. Most of the time (by far) path->slots[0] is 0, but after
btrfs_next_leaf() releases the path and before it searches for the next
leaf, another task might cause a split of the next leaf, which migrates
some of its keys to the leaf we were processing before calling
btrfs_next_leaf(). In this case btrfs_next_leaf() returns again the
same leaf but with path->slots[0] having a slot number corresponding
to the first new key it got, that is, a slot number that didn't exist
before calling btrfs_next_leaf(), as the leaf now has more keys than
it had before. So we must really process the returned leaf starting at
path->slots[0] always, as it isn't always 0, and the key at slot 0 can
have an offset much lower than our search offset/bytenr.

For example, consider the following scenario, where we have:

sums->bytenr: 40157184, sums->len: 16384, sums end: 40173568
four 4kb file data blocks with offsets 40157184401612804016537640169472

  Leaf N:

    slot = 0                           slot = btrfs_header_nritems() - 1
  |-------------------------------------------------------------------|
  | [(CSUM CSUM 39239680), size 8] ... [(CSUM CSUM 40116224), size 4] |
  |-------------------------------------------------------------------|

  Leaf N + 1:

      slot = 0                          slot = btrfs_header_nritems() - 1
  |--------------------------------------------------------------------|
  | [(CSUM CSUM 40161280), size 32] ... [((CSUM CSUM 40615936), size 8 |
  |--------------------------------------------------------------------|

Because we are at the last slot of leaf N, we call btrfs_next_leaf() to
find the next highest key, which releases the current path and then searches
for that next key. However after releasing the path and before finding that
next key, the item at slot 0 of leaf N + 1 gets moved to leaf N, due to a call
to ctree.c:push_leaf_left() (via ctree.c:split_leaf()), and therefore
btrfs_next_leaf() will returns us a path again with leaf N but with the slot
pointing to its new last key (CSUM CSUM 40161280). This new version of leaf N
is then:

    slot = 0                        slot = btrfs_header_nritems() - 2  slot = btrfs_header_nritems() - 1
  |----------------------------------------------------------------------------------------------------|
  | [(CSUM CSUM 39239680), size 8] ... [(CSUM CSUM 40116224), size 4]  [(CSUM CSUM 40161280), size 32] |
  |----------------------------------------------------------------------------------------------------|

And incorrecly using slot 0, makes us set next_offset to 39239680 and we jump
into the "insert:" label, which will set tmp to:

    tmp = min((sums->len - total_bytes) >> blocksize_bits,
        (next_offset - file_key.offset) >> blocksize_bits) =
    min((16384 - 0) >> 12, (39239680 - 40157184) >> 12) =
    min(4, (u64)-917504 = 18446744073708634112 >> 12) = 4

and

   ins_size = csum_size * tmp = 4 * 4 = 16 bytes.

In other words, we insert a new csum item in the tree with key
(CSUM_OBJECTID CSUM_KEY 40157184 = sums->bytenr) that contains the checksums
for all the data (4 blocks of 4096 bytes each = sums->len). Which is wrong,
because the item with key (CSUM CSUM 40161280) (the one that was moved from
leaf N + 1 to the end of leaf N) contains the old checksums of the last 12288
bytes of our data and won't get those old checksums removed.

So this leaves us 2 different checksums for 3 4kb blocks of data in the tree,
and breaks the logical rule:

   Key_N+1.offset >= Key_N.offset + length_of_data_its_checksums_cover

An obvious bad effect of this is that a subsequent csum tree lookup to get
the checksum of any of the blocks with logical offset of 4016128040165376
or 40169472 (the last 3 4kb blocks of file data), will get the old checksums.

Cc: stable@vger.kernel.org
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
9 years agoBtrfs: Fix memory corruption by ulist_add_merge() on 32bit arch
Takashi Iwai [Mon, 28 Jul 2014 08:57:04 +0000 (10:57 +0200)]
Btrfs: Fix memory corruption by ulist_add_merge() on 32bit arch

We've got bug reports that btrfs crashes when quota is enabled on
32bit kernel, typically with the Oops like below:
 BUG: unable to handle kernel NULL pointer dereference at 00000004
 IP: [<f9234590>] find_parent_nodes+0x360/0x1380 [btrfs]
 *pde = 00000000
 Oops: 0000 [#1] SMP
 CPU: 0 PID: 151 Comm: kworker/u8:2 Tainted: G S      W 3.15.2-1.gd43d97e-default #1
 Workqueue: btrfs-qgroup-rescan normal_work_helper [btrfs]
 task: f1478130 ti: f147c000 task.ti: f147c000
 EIP: 0060:[<f9234590>] EFLAGS: 00010213 CPU: 0
 EIP is at find_parent_nodes+0x360/0x1380 [btrfs]
 EAX: f147dda8 EBX: f147ddb0 ECX: 00000011 EDX: 00000000
 ESI: 00000000 EDI: f147dda4 EBP: f147ddf8 ESP: f147dd38
  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
 CR0: 8005003b CR2: 00000004 CR3: 00bf3000 CR4: 00000690
 Stack:
  00000000 00000000 f147dda4 00000050 00000001 00000000 00000001 00000050
  00000001 00000000 d3059000 00000001 00000022 000000a8 00000000 00000000
  00000000 000000a1 00000000 00000000 00000001 00000000 00000000 11800000
 Call Trace:
  [<f923564d>] __btrfs_find_all_roots+0x9d/0xf0 [btrfs]
  [<f9237bb1>] btrfs_qgroup_rescan_worker+0x401/0x760 [btrfs]
  [<f9206148>] normal_work_helper+0xc8/0x270 [btrfs]
  [<c025e38b>] process_one_work+0x11b/0x390
  [<c025eea1>] worker_thread+0x101/0x340
  [<c026432b>] kthread+0x9b/0xb0
  [<c0712a71>] ret_from_kernel_thread+0x21/0x30
  [<c0264290>] kthread_create_on_node+0x110/0x110

This indicates a NULL corruption in prefs_delayed list.  The further
investigation and bisection pointed that the call of ulist_add_merge()
results in the corruption.

ulist_add_merge() takes u64 as aux and writes a 64bit value into
old_aux.  The callers of this function in backref.c, however, pass a
pointer of a pointer to old_aux.  That is, the function overwrites
64bit value on 32bit pointer.  This caused a NULL in the adjacent
variable, in this case, prefs_delayed.

Here is a quick attempt to band-aid over this: a new function,
ulist_add_merge_ptr() is introduced to pass/store properly a pointer
value instead of u64.  There are still ugly void ** cast remaining
in the callers because void ** cannot be taken implicitly.  But, it's
safer than explicit cast to u64, anyway.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=887046
Cc: <stable@vger.kernel.org> [v3.11+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Chris Mason <clm@fb.com>