1. 20 1月, 2018 2 次提交
  2. 31 8月, 2017 1 次提交
    • T
      ALSA: Get rid of card power_lock · 7d8e8292
      Takashi Iwai 提交于
      Currently we're taking power_lock at each card component for assuring
      the power-up sequence, but it doesn't help anything in the
      implementation at the moment: it just serializes unnecessarily the
      callers, but it doesn't protect about the power state change itself.
      It used to have some usefulness in the early days where we managed the
      PM manually.  But now the suspend/resume core procedure is beyond our
      hands, and power_lock lost its meaning.
      
      This patch drops the power_lock from allover the places.
      There shouldn't be any issues by this change, as it's no helper
      regarding the power state change.  Rather we'll get better performance
      by removing the serialization; which is the only slight concern of any
      behavior change, but it can't be a showstopper, after all.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7d8e8292
  3. 24 8月, 2017 3 次提交
    • T
      ALSA: control: TLV data is unavailable at initial state of user-defined element set · b8e2204b
      Takashi Sakamoto 提交于
      For user-defined element set, in its initial state, TLV data is not
      registered. It's firstly available when any application register it by
      an additional operation. However, in current implementation, it's available
      in its initial state. As a result, applications get -ENXIO to read it.
      
      This commit controls its readability to manage info flags properly. In an
      initial state, elements don't have SND_CTL_ELEM_ACCESS_TLV_READ flag. Once
      TLV write operation is executed, they get the flag.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      b8e2204b
    • T
      ALSA: control: queue TLV event for a set of user-defined element · da428828
      Takashi Sakamoto 提交于
      In a design of user-defined element set, applications allow to change TLV
      data on the set. This operation doesn't only affects to a target element,
      but also to elements in the set.
      
      This commit generates TLV event for all of elements in the set when the TLV
      data is changed.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      da428828
    • T
      ALSA: control: delegate TLV eventing to each driver · fb8027eb
      Takashi Sakamoto 提交于
      In a design of ALSA control core, a set of elements is represented by
      'struct snd_kcontrol' to share common attributes. The set of elements
      shares TLV (Type-Length-Value) data, too.
      
      On the other hand, in ALSA control interface/protocol for applications,
      a TLV operation is committed to an element. Totally, the operation can
      have sub-effect to the other elements in the set. For example, TLV_WRITE
      operation is expected to change TLV data, which returns to applications.
      Applications attempt to change the TLV data per element, but in the above
      design, they can effect to elements in the same set.
      
      As a default, ALSA control core has no implementation except for TLV_READ
      operation. Thus, the above design looks to have no issue. However, in
      kernel APIs of ALSA control component, developers can program a handler
      for any request of the TLV operation. Therefore, for elements in a set
      which has the handler, applications can commit TLV_WRITE and TLV_COMMAND
      requests.
      
      For the above scenario, ALSA control core assist notification. When the
      handler returns positive value, the core queueing an event for a requested
      element. However, this includes design defects that the event is not
      queued for the other element in a set. Actually, developers can program
      the handlers to keep per-element TLV data, but it depends on each driver.
      
      As of v4.13-rc6, there's no driver in tree to utilize the notification,
      except for user-defined element set. This commit delegates the notification
      into each driver to prevent developers from the design defects.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      fb8027eb
  4. 22 8月, 2017 1 次提交
    • T
      ALSA: core: Fix unexpected error at replacing user TLV · 88c54cdf
      Takashi Iwai 提交于
      When user tries to replace the user-defined control TLV, the kernel
      checks the change of its content via memcmp().  The problem is that
      the kernel passes the return value from memcmp() as is.  memcmp()
      gives a non-zero negative value depending on the comparison result,
      and this shall be recognized as an error code.
      
      The patch covers that corner-case, return 1 properly for the changed
      TLV.
      
      Fixes: 8aa9b586 ("[ALSA] Control API - more robust TLV implementation")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      88c54cdf
  5. 20 8月, 2017 3 次提交
    • T
      ALSA: control: use counting semaphore as write lock for ELEM_WRITE operation · 5bbb1ab5
      Takashi Sakamoto 提交于
      In ALSA control interface, applications can execute two types of request
      for value of members on each element; ELEM_READ and ELEM_WRITE. In ALSA
      control core, these two requests are handled within read lock of a
      counting semaphore, therefore several processes can run to execute these
      two requests at the same time. This has an issue because ELEM_WRITE
      requests have an effect to change state of the target element. Concurrent
      access should be controlled for each of ELEM_READ/ELEM_WRITE case.
      
      This commit uses the counting semaphore as write lock for ELEM_WRITE
      requests, while use it as read lock for ELEM_READ requests. The state of
      a target element is maintained exclusively between ELEM_WRITE/ELEM_READ
      operations.
      
      There's a concern. If the counting semaphore is acquired for read lock
      in implementations of 'struct snd_kcontrol.put()' in each driver, this
      commit shall cause dead lock. As of v4.13-rc5, 'snd-mixer-oss.ko',
      'snd-emu10k1.ko' and 'snd-soc-sst-atom-hifi2-platform.ko' includes codes
      for read locks, but these are not in a call graph from
      'struct snd_kcontrol.put(). Therefore, this commit is safe.
      
      In current implementation, the same solution is applied for the other
      operations to element; e.g. ELEM_LOCK and ELEM_UNLOCK. There's another
      discussion about an overhead to maintain concurrent access to an element
      during operating the other elements on the same card instance, because the
      lock primitive is originally implemented to maintain a list of elements on
      the card instance. There's a substantial difference between
      per-element-list lock and per-element lock.
      
      Here, let me investigate another idea to add per-element lock to maintain
      the concurrent accesses with inquiry/change requests to an element. It's
      not so frequent for applications to operate members on elements, while
      adding a new lock primitive to structure increases memory footprint for
      all of element sets somehow. Experimentally, inquiry operation is more
      frequent than change operation and usage of counting semaphore for the
      inquiry operation brings no blocking to the other inquiry operations. Thus
      the overhead is not so critical for usual applications. For the above
      reasons, in this commit, the per-element lock is not introduced.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      5bbb1ab5
    • T
      ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE operations · becf9e5d
      Takashi Sakamoto 提交于
      ALSA control core handles ELEM_READ/ELEM_WRITE requests within lock
      acquisition of a counting semaphore. The lock is acquired in helper
      functions in the end of call path before calling implementations of each
      driver.
      
      ioctl(2) with SNDRV_CTL_ELEM_READ
      ...
      ->snd_ctl_ioctl()
        ->snd_ctl_elem_read_user()
          ->snd_ctl_elem_read()
            ->down_read(controls_rwsem)
            ->snd_ctl_find_id()
            ->struct snd_kcontrol.get()
            ->up_read(controls_rwsem)
      
      ioctl(2) with SNDRV_CTL_ELEM_WRITE
      ...
      ->snd_ctl_ioctl()
        ->snd_ctl_elem_write_user()
          ->snd_ctl_elem_write()
            ->down_read(controls_rwsem)
            ->snd_ctl_find_id()
            ->struct snd_kcontrol.put()
            ->up_read(controls_rwsem)
      
      This commit moves the lock acquisition to middle of the call graph to
      simplify the helper functions. As a result:
      
      ioctl(2) with SNDRV_CTL_ELEM_READ
      ...
      ->snd_ctl_ioctl()
        ->snd_ctl_elem_read_user()
          ->down_read(controls_rwsem)
          ->snd_ctl_elem_read()
            ->snd_ctl_find_id()
            ->struct snd_kcontrol.get()
          ->up_read(controls_rwsem)
      
      ioctl(2) with SNDRV_CTL_ELEM_WRITE
      ...
      ->snd_ctl_ioctl()
        ->snd_ctl_elem_write_user()
          ->down_read(controls_rwsem)
          ->snd_ctl_elem_write()
            ->snd_ctl_find_id()
            ->struct snd_kcontrol.put()
          ->up_read(controls_rwsem)
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      becf9e5d
    • T
      ALSA: control: queue events within locking of controls_rwsem for ELEM_WRITE operation · 7b42cfaf
      Takashi Sakamoto 提交于
      Any control event is queued by a call of snd_ctl_notify(). This function
      adds the event to each queue of opened file data corresponding to ALSA
      control character devices. This function acquired two types of lock; a
      counting semaphore for a list of the opened file data and a spinlock for
      card data opened by the file. Typically, this function is called after
      acquiring a counting semaphore for a list of elements in the card data.
      
      In current implementation of a handler for ELEM_WRITE request, the
      function is called after releasing the semaphore for a list of elements
      in the card data. This release is not necessarily needed.
      
      This commit removes the release to call the function within the critical
      section so that later commits are simple.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7b42cfaf
  6. 04 8月, 2017 5 次提交
    • T
      ALSA: control: code refactoring for TLV request handler to user element set · 6d4d41f0
      Takashi Sakamoto 提交于
      User-defined element set registers own handler to get callbacks from TLV
      ioctl handler. In the handler, execution path bifurcates depending on
      requests from user space. At write request, container in given buffer is
      registered to the element set, or replaced old TLV data. At the read
      request, the registered data is copied to user space. The command request
      is not allowed.  In current implementation, function of the handler
      includes codes for the two cases.
      
      This commit adds two helper functions for these cases so that readers can
      easily get the above design.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      6d4d41f0
    • T
      ALSA: control: code refactoring TLV ioctl handler · 450296f3
      Takashi Sakamoto 提交于
      In a design of ALSA control core, execution path bifurcates depending on
      target element. When a set with the target element has a handler, it's
      called. Else, registered buffer is copied to user space. These two
      operations are apparently different.  In current implementation, they're
      on the same function with a condition statement. This makes it a bit hard
      to understand conditions of each case.
      
      This commit splits codes for these two cases.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      450296f3
    • T
      ALSA: control: obsolete user_ctl_lock · 30d8340b
      Takashi Sakamoto 提交于
      At a previous commit, concurrent requests for TLV data are maintained
      exclusively between read requests and write/command requests. TLV
      callback handlers in each driver has no risk from concurrent access for
      reference/change.
      
      In current implementation, 'struct snd_card' has a mutex to control
      concurrent accesses to user-defined element sets. This commit obsoletes it.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      30d8340b
    • T
      ALSA: control: use counting semaphore as write lock for TLV write/command operations · 4c8099e9
      Takashi Sakamoto 提交于
      In ALSA control interface, applications can execute three types of request
      for Type-Length-Value (TLV) data to a set of elements; read, write and
      command. In ALSA control core, all of the requests are handled within read
      lock to a counting semaphore, therefore several processes can run to access
      to the data at the same time for any purposes. This has an issue because
      write and command requests have side effect to change state of a set of
      elements for the TLV data. Concurrent access should be controlled for each
      of reference/change case.
      
      This commit uses the counting semaphore as read lock for TLV read requests,
      while use it as write lock for TLV write/command requests. The state of a
      set of elements for the TLV data is maintained exclusively between read
      requests and write/command requests, or between write and command requests.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      4c8099e9
    • T
      ALSA: control: queue events within locking of controls_rwsem for TLV operation · 28a0989c
      Takashi Sakamoto 提交于
      Any control event is queued by a call of snd_ctl_notify(). This function
      adds the event to each queue of opened file data corresponding to ALSA
      control character devices. This function acquired two types of lock; a
      counting semaphore for a list of the opened file data and a spinlock for
      card data opened by the file. Typically, this function is called after
      acquiring a counting semaphore for a list of elements in the card data.
      
      In current implementation of TLV request handler, the function is called
      after releasing the semaphore for a list of elements in the card data.
      This release is not necessarily needed.
      
      This commit removes the release to call the function within the critical
      section so that later commits are simple.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      28a0989c
  7. 20 6月, 2017 1 次提交
    • I
      sched/wait: Rename wait_queue_t => wait_queue_entry_t · ac6424b9
      Ingo Molnar 提交于
      Rename:
      
      	wait_queue_t		=>	wait_queue_entry_t
      
      'wait_queue_t' was always a slight misnomer: its name implies that it's a "queue",
      but in reality it's a queue *entry*. The 'real' queue is the wait queue head,
      which had to carry the name.
      
      Start sorting this out by renaming it to 'wait_queue_entry_t'.
      
      This also allows the real structure name 'struct __wait_queue' to
      lose its double underscore and become 'struct wait_queue_entry',
      which is the more canonical nomenclature for such data types.
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      ac6424b9
  8. 24 5月, 2017 1 次提交
  9. 23 5月, 2017 1 次提交
  10. 02 3月, 2017 1 次提交
  11. 08 7月, 2016 1 次提交
    • T
      ALSA: ctl: Stop notification after disconnection · f388cdcd
      Takashi Iwai 提交于
      snd_ctl_remove() has a notification for the removal event.  It's
      superfluous when done during the device got disconnected.  Although
      the notification itself is mostly harmless, it may potentially be
      harmful, and should be suppressed.  Actually some components PCM may
      free ctl elements during the disconnect or free callbacks, thus it's
      no theoretical issue.
      
      This patch adds the check of card->shutdown flag for avoiding
      unnecessary notifications after (or during) the disconnect.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      f388cdcd
  12. 07 7月, 2016 1 次提交
    • T
      ALSA: control: add dimension validator for userspace elements · 860c1994
      Takashi Sakamoto 提交于
      The 'dimen' field in struct snd_ctl_elem_info is used to compose all of
      members in the element as multi-dimensional matrix. The field has four
      members. Each member represents the width in each dimension level by
      element member unit. For example, if the members consist of typical
      two dimensional matrix, the dimen[0] represents the number of rows
      and dimen[1] represents the number of columns (or vise-versa).
      
      The total members in the matrix should be exactly the same as the number
      of members in the element, while current implementation has no validator
      of this information. In a view of userspace applications, the information
      must be valid so that it cannot cause any bugs such as buffer-over-run.
      
      This commit adds a validator of dimension information for userspace
      applications which add new element sets. When they add the element sets
      with wrong dimension information, they receive -EINVAL.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      860c1994
  13. 18 1月, 2016 1 次提交
  14. 13 4月, 2015 1 次提交
  15. 12 4月, 2015 1 次提交
  16. 11 4月, 2015 3 次提交
  17. 10 4月, 2015 1 次提交
  18. 13 3月, 2015 1 次提交
  19. 12 3月, 2015 1 次提交
  20. 10 3月, 2015 3 次提交
  21. 09 2月, 2015 1 次提交
  22. 08 2月, 2015 1 次提交
  23. 03 2月, 2015 1 次提交
    • T
      ALSA: Simplify snd_device_register() variants · 40a4b263
      Takashi Iwai 提交于
      Now that all callers have been replaced with
      snd_device_register_for_dev(), let's drop the obsolete device
      registration code and concentrate only on the code handling struct
      device directly.  That said,
      
      - remove the old snd_device_register(),
      - rename snd_device_register_for_dev() with snd_device_register(),
      - drop superfluous arguments from snd_device_register(),
      - change snd_unregister_device() to pass the device pointer directly
      Reviewed-by: NJaroslav Kysela <perex@perex.cz>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      40a4b263
  24. 02 2月, 2015 2 次提交
  25. 07 11月, 2014 1 次提交
  26. 30 10月, 2014 1 次提交