1. 29 7月, 2020 1 次提交
  2. 23 4月, 2020 1 次提交
    • T
      ALSA: hda: Always use jackpoll helper for jack update after resume · 8d6762af
      Takashi Iwai 提交于
      HD-audio codec driver applies a tricky procedure to forcibly perform
      the runtime resume by mimicking the usage count even if the device has
      been runtime-suspended beforehand.  This was needed to assure to
      trigger the jack detection update after the system resume.
      
      And recently we also applied the similar logic to the HD-audio
      controller side.  However this seems leading to some inconsistency,
      and eventually PCI controller gets screwed up.
      
      This patch is an attempt to fix and clean up those behavior: instead
      of the tricky runtime resume procedure, the existing jackpoll work is
      scheduled when such a forced codec resume is required.  The jackpoll
      work will power up the codec, and this alone should suffice for the
      jack status update in usual cases.  If the extra polling is requested
      (by checking codec->jackpoll_interval), the manual update is invoked
      after that, and the codec is powered down again.
      
      Also, we filter the spurious wake up of the codec from the controller
      runtime resume by checking codec->relaxed_resume flag.  If this flag
      is set, basically we don't need to wake up explicitly, but it's
      supposed to be done via the audio component notifier.
      
      Fixes: c4c8dd6e ("ALSA: hda: Skip controller resume if not needed")
      Link: https://lore.kernel.org/r/20200422203744.26299-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      8d6762af
  3. 14 4月, 2020 1 次提交
    • T
      ALSA: hda: Skip controller resume if not needed · c4c8dd6e
      Takashi Iwai 提交于
      The HD-audio controller does system-suspend and resume operations by
      directly calling its helpers __azx_runtime_suspend() and
      __azx_runtime_resume().  However, in general, we don't have to resume
      always the device fully at the system resume; typically, if a device
      has been runtime-suspended, we can leave it to runtime resume.
      
      Usually for achieving this, the driver would call
      pm_runtime_force_suspend() and pm_runtime_force_resume() pairs in the
      system suspend and resume ops.  Unfortunately, this doesn't work for
      the resume path in our case.  For handling the jack detection at the
      system resume, a child codec device may need the (literally) forcibly
      resume even if it's been runtime-suspended, and for that, the
      controller device must be also resumed even if it's been suspended.
      
      This patch is an attempt to improve the situation.  It replaces the
      direct __azx_runtime_suspend()/_resume() calls with with
      pm_runtime_force_suspend() and pm_runtime_force_resume() with a slight
      trick as we've done for the codec side.  More exactly:
      
      - azx_has_pm_runtime() check is dropped from azx_runtime_suspend() and
        azx_runtime_resume(), so that it can be properly executed from the
        system-suspend/resume path
      
      - The WAKEEN handling depends on the card's power state now; it's set
        and cleared only for the runtime-suspend
      
      - azx_resume() checks whether any codec may need the forcible resume
        beforehand.  If the forcible resume is required, it does temporary
        PM refcount up/down for actually triggering the runtime resume.
      
      - A new helper function, hda_codec_need_resume(), is introduced for
        checking whether the codec needs a forcible runtime-resume, and the
        existing code is rewritten with that.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207043
      Link: https://lore.kernel.org/r/20200413082034.25166-6-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      c4c8dd6e
  4. 18 2月, 2020 1 次提交
  5. 12 2月, 2020 1 次提交
  6. 14 1月, 2020 1 次提交
  7. 13 1月, 2020 1 次提交
    • T
      ALSA: hda: Manage concurrent reg access more properly · 1a462be5
      Takashi Iwai 提交于
      In the commit 8e85def5 ("ALSA: hda: enable regmap internal
      locking"), we re-enabled the regmap lock due to the reported
      regression that showed the possible concurrent accesses.  It was a
      temporary workaround, and there are still a few opened races even
      after the revert.  In this patch, we cover those still opened windows
      with a proper mutex lock and disable the regmap internal lock again.
      
      First off, the patch introduces a new snd_hdac_device.regmap_lock
      mutex that is applied for each snd_hdac_regmap_*() call, including
      read, write and update helpers.  The mutex is applied carefully so
      that it won't block the self-power-up procedure in the helper
      function.  Also, this assures the protection for the accesses without
      regmap, too.
      
      The snd_hdac_regmap_update_raw() is refactored to use the standard
      regmap_update_bits_check() function instead of the open-code.  The
      non-regmap case is still open-coded but it's an easy part.  The all
      read and write operations are in the single mutex protection, so it's
      now race-free.
      
      In addition, a couple of new helper functions are added:
      snd_hdac_regmap_update_raw_once() and snd_hdac_regmap_sync().  Both
      are called from HD-audio legacy driver.  The former is to initialize
      the given verb bits but only once when it's not initialized yet.  Due
      to this condition, the function invokes regcache_cache_only(), and
      it's now performed inside the regmap_lock (formerly it was racy) too.
      The latter function is for simply invoking regcache_sync() inside the
      regmap_lock, which is called from the codec resume call path.
      Along with that, the HD-audio codec driver code is slightly modified /
      simplified to adapt those new functions.
      
      And finally, snd_hdac_regmap_read_raw(), *_write_raw(), etc are
      rewritten with the helper macro.  It's just for simplification because
      the code logic is identical among all those functions.
      Tested-by: NKai Vehmanen <kai.vehmanen@linux.intel.com>
      Link: https://lore.kernel.org/r/20200109090104.26073-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
      1a462be5
  8. 05 1月, 2020 1 次提交
  9. 03 1月, 2020 2 次提交
  10. 22 7月, 2019 1 次提交
  11. 18 7月, 2019 1 次提交
  12. 17 7月, 2019 1 次提交
    • T
      ALSA: hda - Don't resume forcibly i915 HDMI/DP codec · 4914da2f
      Takashi Iwai 提交于
      We apply the codec resume forcibly at system resume callback for
      updating and syncing the jack detection state that may have changed
      during sleeping.  This is, however, superfluous for the codec like
      Intel HDMI/DP, where the jack detection is managed via the audio
      component notification; i.e. the jack state change shall be reported
      sooner or later from the graphics side at mode change.
      
      This patch changes the codec resume callback to avoid the forcible
      resume conditionally with a new flag, codec->relaxed_resume, for
      reducing the resume time.  The flag is set in the codec probe.
      
      Although this doesn't fix the entire bug mentioned in the bugzilla
      entry below, it's still a good optimization and some improvements are
      seen.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201901
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      4914da2f
  13. 05 7月, 2019 1 次提交
    • T
      ALSA: hda: Simplify snd_hdac_refresh_widgets() · 774a075a
      Takashi Iwai 提交于
      Along with the recent fix for the races of snd_hdac_refresh_widgets()
      it turned out that the instantiation of widgets sysfs at
      snd_hdac_sysfs_reinit() could cause a race.  The race itself was
      already covered later by extending the mutex protection range, the
      commit 98482377 ("ALSA: hda: Fix widget_mutex incomplete
      protection"), but this also indicated that the call of *_reinit() is
      basically superfluous, as the widgets shall be created sooner or later
      from snd_hdac_device_register().
      
      This patch removes the redundant call of snd_hdac_sysfs_reinit() at
      first.  By this removal, the sysfs argument itself in
      snd_hdac_refresh_widgets() becomes superfluous, too, because the only
      case sysfs=false is always with codec->widgets=NULL.  So, we drop this
      redundant argument as well.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      774a075a
  14. 04 6月, 2019 1 次提交
  15. 31 5月, 2019 1 次提交
  16. 24 5月, 2019 1 次提交
  17. 29 4月, 2019 1 次提交
  18. 13 4月, 2019 1 次提交
    • T
      ALSA: hda: Initialize power_state field properly · 183ab39e
      Takashi Iwai 提交于
      The recent commit 98081ca6 ("ALSA: hda - Record the current power
      state before suspend/resume calls") made the HD-audio driver to store
      the PM state in power_state field.  This forgot, however, the
      initialization at power up.  Although the codec drivers usually don't
      need to refer to this field in the normal operation, let's initialize
      it properly for consistency.
      
      Fixes: 98081ca6 ("ALSA: hda - Record the current power state before suspend/resume calls")
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      183ab39e
  19. 19 3月, 2019 1 次提交
    • H
      ALSA: hda - Enforces runtime_resume after S3 and S4 for each codec · b5a236c1
      Hui Wang 提交于
      Recently we found the audio jack detection stop working after suspend
      on many machines with Realtek codec. Sometimes the audio selection
      dialogue didn't show up after users plugged headhphone/headset into
      the headset jack, sometimes after uses plugged headphone/headset, then
      click the sound icon on the upper-right corner of gnome-desktop, it
      also showed the speaker rather than the headphone.
      
      The root cause is that before suspend, the codec already call the
      runtime_suspend since this codec is not used by any apps, then in
      resume, it will not call runtime_resume for this codec. But for some
      realtek codec (so far, alc236, alc255 and alc891) with the specific
      BIOS, if it doesn't run runtime_resume after suspend, all codec
      functions including jack detection stop working anymore.
      
      This problem existed for a long time, but it was not exposed, that is
      because when problem happens, if users play sound or open
      sound-setting to check audio device, this will trigger calling to
      runtime_resume (via snd_hda_power_up), then the codec starts working
      again before users notice this problem.
      
      Since we don't know how many codec and BIOS combinations have this
      problem, to fix it, let the driver call runtime_resume for all codecs
      in pm_resume, maybe for some codecs, this is not needed, but it is
      harmless. After a codec is runtime resumed, if it is not used by any
      apps, it will be runtime suspended soon and furthermore we don't run
      suspend frequently, this change will not add much power consumption.
      
      Fixes: cc72da7d ("ALSA: hda - Use standard runtime PM for codec power-save control")
      Signed-off-by: NHui Wang <hui.wang@canonical.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      b5a236c1
  20. 30 1月, 2019 2 次提交
    • T
      ALSA: hda - Use standard device registration for beep · 45571bb8
      Takashi Iwai 提交于
      Currently the registration and free of beep input device was done
      manually from the register and the disconnect callbacks of the
      assigned codec object.  This seems working in most cases, but this may
      be a cause of some races at probe.  Moreover, due to these manual
      calls, the total code became unnecessarily lengthy.
      
      This patch rewrites the beep registration code to follow the standard
      sound device object style.  This allows us reducing the code, in
      addition to avoiding the nested device registration calls.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      45571bb8
    • T
      ALSA: hda - Record the current power state before suspend/resume calls · 98081ca6
      Takashi Iwai 提交于
      Currently we deal with single codec and suspend codec callbacks for
      all S3, S4 and runtime PM handling.  But it turned out that we want
      distinguish the call patterns sometimes, e.g. for applying some init
      sequence only at probing and restoring from hibernate.
      
      This patch slightly modifies the common PM callbacks for HD-audio
      codec and stores the currently processed PM event in power_state of
      the codec's device.power field, which is currently unused.  The codec
      callback can take a look at this event value and judges which purpose
      it's being called.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      98081ca6
  21. 21 1月, 2019 1 次提交
  22. 16 1月, 2019 1 次提交
  23. 11 12月, 2018 1 次提交
    • T
      ALSA: hda: Refactor display power management · 029d92c2
      Takashi Iwai 提交于
      The current HD-audio code manages the DRM audio power via too complex
      redirections, and this seems even still unbalanced in a corner case as
      Intel DRM CI has been intermittently reporting.  This patch is a big
      surgery for addressing the complexity and the possible unbalance.
      
      Basically the patch changes the display PM in the following ways:
      
      - Both HD-audio controller and codec drivers call a single helper,
        snd_hdac_display_power().  (Formerly, the display power control from
        a codec was done indirectly via link_power bus ops.)
      
      - snd_hdac_display_power() receives the codec address index.  For
        turning on/off from the controller, pass HDA_CODEC_IDX_CONTROLLER.
      
      - snd_hdac_display_power() doesn't manage refcounts any longer, but
        keeps the power status in bitmap.  If any of controller or codecs is
        turned on, the function updates the DRM power state via get_power()
        or put_power().
      
      Also this refactor allows us more cleanup:
      
      - The link_power bus ops is dropped, so there is no longer indirect
        management, as mentioned in the above.
      
      - hdac_device link_power_control flag is moved to hda_codec
        display_power_control flag, as it's only for HDA legacy.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106525Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      029d92c2
  24. 30 8月, 2018 2 次提交
  25. 29 8月, 2018 1 次提交
  26. 26 7月, 2018 1 次提交
  27. 28 6月, 2018 2 次提交
  28. 27 6月, 2018 1 次提交
  29. 21 6月, 2018 1 次提交
  30. 13 6月, 2018 1 次提交
    • K
      treewide: kmalloc() -> kmalloc_array() · 6da2ec56
      Kees Cook 提交于
      The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
      patch replaces cases of:
      
              kmalloc(a * b, gfp)
      
      with:
              kmalloc_array(a * b, gfp)
      
      as well as handling cases of:
      
              kmalloc(a * b * c, gfp)
      
      with:
      
              kmalloc(array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              kmalloc_array(array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              kmalloc(4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      The tools/ directory was manually excluded, since it has its own
      implementation of kmalloc().
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      type TYPE;
      expression THING, E;
      @@
      
      (
        kmalloc(
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        kmalloc(
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        kmalloc(
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        kmalloc(
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      identifier SIZE, COUNT;
      @@
      
      - kmalloc
      + kmalloc_array
        (
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        kmalloc(
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        kmalloc(
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        kmalloc(
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        kmalloc(
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kmalloc(
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        kmalloc(
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        kmalloc(
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        kmalloc(
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        kmalloc(C1 * C2 * C3, ...)
      |
        kmalloc(
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kmalloc(
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kmalloc(
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        kmalloc(
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        kmalloc(sizeof(THING) * C2, ...)
      |
        kmalloc(sizeof(TYPE) * C2, ...)
      |
        kmalloc(C1 * C2 * C3, ...)
      |
        kmalloc(C1 * C2, ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - kmalloc
      + kmalloc_array
        (
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      6da2ec56
  31. 14 5月, 2018 1 次提交
  32. 24 4月, 2018 2 次提交
  33. 12 2月, 2018 1 次提交
  34. 22 11月, 2017 1 次提交
    • T
      ALSA: hda - Fix yet remaining issue with vmaster 0dB initialization · d6c0615f
      Takashi Iwai 提交于
      The previous fix for addressing the breakage in vmaster slave
      initialization, commit a91d6612 ("ALSA: hda - Fix incorrect TLV
      callback check introduced during set_fs() removal"), introduced a new
      helper to process over each slave kctl.  However, this helper passes
      only the original kctl, not the virtual slave kctl.  As a result,
      HD-audio driver (which is the only user so far) couldn't initialize
      the slave correctly because it's trying to update the value directly
      with the original kctl, not with the mapped kctl.
      
      This patch fixes the situation again by passing both the mapped slaved
      and original slave kctls to the function.  Luckily there is a single
      caller as of now, so changing the call signature is no big matter.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197959
      Fixes: a91d6612 ("ALSA: hda - Fix incorrect TLV callback check introduced during set_fs() removal")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      d6c0615f
  35. 19 10月, 2017 1 次提交
    • T
      ALSA: hda: Avoid racy recreation of widget kobjects · 9780ded3
      Takashi Iwai 提交于
      The refresh of HD-audio widget sysfs kobjects via
      snd_hdac_refresh_widget_sysfs() is slightly racy.
      The driver recreates the whole tree from scratch after deleting the
      whole.  When CONFIG_DEBUG_KOBJECT_RELEASE option is used, kobject
      release doesn't happen immediately but delayed, while the re-creation
      of the same named kobject happens soon after invoking kobject_put().
      This may end up with the conflicts of duplicated kobjects, as found in
      the bug report below.
      
      In this patch, we take another approach to refresh the tree: instead
      of recreating the whole tree, just add the new nodes and delete the
      non-existing nodes.  Since the refresh happens only once at
      initialization, no longer race would happen.
      
      Along with the code change, merge snd_hdac_refresh_widget_sysfs() with
      the existing snd_hdac_refresh_widgets() with an additional bool flag
      for simplifying the code.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197307Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9780ded3