1. 07 8月, 2017 2 次提交
    • B
      ALSA: ice1712: add const to snd_akm4xxx structures · 3135432e
      Bhumika Goyal 提交于
      Declare snd_akm4xxx structures  as const as they are only passed
      to the function snd_ice1712_akm4xxx_init. This argument is of type
      const, so make the structures const.
      Done using Coccinelle:
      
      @match disable optional_qualifier@
      identifier s;
      position p;
      @@
      static struct snd_akm4xxx s@p={...};
      
      @good1@
      identifier match.s;
      position p;
      @@
      snd_ice1712_akm4xxx_init(...,&s@p,...)
      
      @bad@
      identifier match.s;
      position p!={match.p,good1.p};
      @@
      s@p
      
      @depends on !bad disable optional_qualifier@
      identifier match.s;
      @@
      static
      +const
      struct snd_akm4xxx s={...};
      Signed-off-by: NBhumika Goyal <bhumirks@gmail.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3135432e
    • B
      ALSA: ice1712: add const to snd_ak4xxx_private structures · 4647e8d5
      Bhumika Goyal 提交于
      Declare snd_ak4xxx_private structures  as const as they are only passed
      to the function snd_ice1712_akm4xxx_init. This argument is of type const,
      so make the structures const.
      Done using Coccinelle:
      
      @match disable optional_qualifier@
      identifier s;
      position p;
      @@
      static struct snd_ak4xxx_private s@p={...};
      
      @good1@
      identifier match.s;
      position p;
      @@
      snd_ice1712_akm4xxx_init(...,&s@p,...)
      
      @bad@
      identifier match.s;
      position p!={match.p,good1.p};
      @@
      s@p
      
      @depends on !bad disable optional_qualifier@
      identifier match.s;
      @@
      static
      +const
      struct snd_ak4xxx_private s={...};
      Signed-off-by: NBhumika Goyal <bhumirks@gmail.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      4647e8d5
  2. 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
  3. 02 8月, 2017 1 次提交
  4. 01 8月, 2017 2 次提交
  5. 28 7月, 2017 2 次提交
  6. 27 7月, 2017 1 次提交
  7. 26 7月, 2017 2 次提交
  8. 24 7月, 2017 1 次提交
    • K
      ASoC: sh: hac: add missing "int ret" · 295c5ba4
      Kuninori Morimoto 提交于
      commit b047e1cc ("ASoC: ac97: Support multi-platform AC'97")
      modified hac_soc_platform_probe(), but "int ret" was missed.
      This patch adds missing "int ret", otherwise, we will get
      
      linux/sound/soc/sh/hac.c: In function 'hac_soc_platform_probe':
      linux/sound/soc/sh/hac.c:318: error: 'ret' undeclared (first use in this function)
      linux/sound/soc/sh/hac.c:318: error: (Each undeclared identifier is reported only once
      linux/sound/soc/sh/hac.c:318: error: for each function it appears in.)
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: NMark Brown <broonie@kernel.org>
      295c5ba4
  9. 22 7月, 2017 1 次提交
  10. 21 7月, 2017 3 次提交
  11. 20 7月, 2017 1 次提交
  12. 19 7月, 2017 1 次提交
    • A
      ALSA: hda: constify pci_device_id. · 6c5a2660
      Arvind Yadav 提交于
      pci_device_id are not supposed to change at runtime. All functions
      working with pci_device_id provided by <linux/pci.h> work with
      const pci_device_id. So mark the non-const structs as const.
      
      File size before:
         text	   data	    bss	    dec	    hex	filename
         2610	    304	      8	   2922	    b6a	sound/hda/hdac_i915.o
      
      File size After adding 'const':
         text	   data	    bss	    dec	    hex	filename
         2674	    240	      8	   2922	    b6a	sound/hda/hdac_i915.o
      Signed-off-by: NArvind Yadav <arvind.yadav.cs@gmail.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      6c5a2660
  13. 18 7月, 2017 8 次提交
    • A
      ALSA: pcxhr: fix string overflow warnings · 50517352
      Arnd Bergmann 提交于
      With gcc-7, we get a warning about a possible string overflow:
      
      sound/pci/pcxhr/pcxhr.c: In function 'pcxhr_probe':
      sound/pci/pcxhr/pcxhr.c:1647:28: error: ' [PCM #' directive writing 7 bytes into a region of size between 1 and 32 [-Werror=format-overflow=]
      
      The shortname can simply be removed, and the longname can
      be changed into a shorter "name" string that is used in three
      places. Making it a little shorter (40 bytes) avoids the risk of
      overflowing completely, but I also use snprintf() here for
      extra clarity.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      50517352
    • A
      ALSA: rme9652: fix format overflow warnings · 7ad210ac
      Arnd Bergmann 提交于
      gcc-7 warns about a possible sprintf format string overflow with a
      temporary buffer that is used to print from another buffer of the same
      size:
      
      sound/pci/rme9652/hdspm.c: In function 'snd_hdspm_create_alsa_devices':
      sound/pci/rme9652/hdspm.c:2123:17: error: ' MIDIoverMADI' directive writing 13 bytes into a region of size between 1 and 32 [-Werror=format-overflow=]
      
      This extends the temporary buffer to twice the size, and changes
      the code to use the safer snprintf() across the entire file.
      The longer buffer is still necessary to avoid a format-truncation
      warning.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7ad210ac
    • A
      ALSA: mixart: fix string overflow warning · c6e486ff
      Arnd Bergmann 提交于
      Using a temporary string produces warnings about a possible overflow
      in sprintf:
      
      sound/pci/mixart/mixart.c: In function 'snd_mixart_probe':
      sound/pci/mixart/mixart.c:1353:28: error: ' [PCM #' directive writing 7 bytes into a region of size between 1 and 32 [-Werror=format-overflow=]
         sprintf(card->shortname, "%s [PCM #%d]", mgr->shortname, i);
                                  ^~~~~~~~~~~~~~
      sound/pci/mixart/mixart.c:1353:28: note: using the range [-2147483648, 2147483647] for directive argument
      sound/pci/mixart/mixart.c:1353:3: note: 'sprintf' output between 10 and 51 bytes into a destination of size 32
         sprintf(card->shortname, "%s [PCM #%d]", mgr->shortname, i);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      sound/pci/mixart/mixart.c:1354:27: error: ' [PCM #' directive writing 7 bytes into a region of size between 1 and 80 [-Werror=format-overflow=]
         sprintf(card->longname, "%s [PCM #%d]", mgr->longname, i);
                                 ^~~~~~~~~~~~~~
      sound/pci/mixart/mixart.c:1354:27: note: using the range [-2147483648, 2147483647] for directive argument
      sound/pci/mixart/mixart.c:1354:3: note: 'sprintf' output between 10 and 99 bytes into a destination of size 80
      
      Skipping the intermediate, we can get gcc to see that it is in fact
      safe here.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      c6e486ff
    • A
      ALSA: opti9xx: fix format string overflow warning · 24d22077
      Arnd Bergmann 提交于
      We pass a long name from "codec->pcm->name" into the longname
      string of the same length:
      
      sound/isa/opti9xx/miro.c: In function 'snd_miro_probe':
      sound/isa/opti9xx/miro.c:1356:39: error: '%s' directive writing up to 79 bytes into a region of size between 35 and 72 [-Werror=format-overflow=]
        sprintf(card->longname, "%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
                                             ^~
      sound/isa/opti9xx/miro.c:1356:26: note: using the range [0, 4294967295] for directive argument
        sprintf(card->longname, "%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      sound/isa/opti9xx/miro.c:1356:2: note: 'sprintf' output between 32 and 185 bytes into a destination of size 80
        sprintf(card->longname, "%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
      
      There is no easy way to avoid the theoretical overflow in this case,
      but using snprintf() will turn it into a harmless truncation.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      24d22077
    • A
      ALSA: ad1848: fix format string overflow warning · 003d3e70
      Arnd Bergmann 提交于
      The snd_pcm name is too long to fit into the card shortname
      or a part of the longname:
      
      sound/isa/ad1848/ad1848.c: In function 'snd_ad1848_probe':
      sound/isa/ad1848/ad1848.c:116:26: error: ' at 0x' directive writing 6 bytes into a region of size between 1 and 80 [-Werror=format-overflow=]
        sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      sound/isa/ad1848/ad1848.c:116:2: note: 'sprintf' output between 22 and 128 bytes into a destination of size 80
        sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         chip->pcm->name, chip->port, irq[n], dma1[n]);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      This changes the code to use length-checking functions that truncate
      if necessary. The "[Thinkpad]" substring is now also part of the
      snprintf(), as that could also overflow the buffer.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      003d3e70
    • A
      ALSA: cs423x: fix format string overflow warning · 6d8b04de
      Arnd Bergmann 提交于
      The snd_pcm name may overflow the card->longname total size:
      
      sound/isa/cs423x/cs4231.c: In function 'snd_cs4231_probe':
      sound/isa/cs423x/cs4231.c:115:26: error: ' at 0x' directive writing 6 bytes into a region of size between 1 and 80 [-Werror=format-overflow=] 0x%lx, irq %d, dma %d",
        sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      This changes the driver to use snprintf() so we truncate the string
      instead of overflowing into the next field if that happens.
      
      I decided to split out the second format string for the extra
      DMA channel to keep the code simpler.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      6d8b04de
    • A
      ALSA: als100: fix format string overflow warning · 8a463639
      Arnd Bergmann 提交于
      The compiler sees that the format string might overflow for the longname:
      
      sound/isa/als100.c: In function 'snd_als100_pnp_detect':
      sound/isa/als100.c:225:27: error: ', dma ' directive writing 6 bytes into a region of size between 0 and 64 [-Werror=format-overflow=]
         sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d",
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      sound/isa/als100.c:225:3: note: 'sprintf' output between 24 and 113 bytes into a destination of size 80
         sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d",
      
      Open-coding "shortname" here gets us below the limit, and using
      snprintf() is a good idea too.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      8a463639
    • A
      ALSA: fm801: Initialize chip after IRQ handler is registered · 610e1ae9
      Andy Shevchenko 提交于
      The commit b56fa687 ("ALSA: fm801: detect FM-only card earlier")
      rearranged initialization calls, i.e. it makes snd_fm801_chip_init() to
      be called before we register interrupt handler and set PCI bus
      mastering.
      
      Somehow it prevents FM801-AU to work properly. Thus, partially revert
      initialization order changed by commit mentioned above.
      
      Fixes: b56fa687 ("ALSA: fm801: detect FM-only card earlier")
      Reported-by: NÉmeric MASCHINO <emeric.maschino@gmail.com>
      Tested-by: NÉmeric MASCHINO <emeric.maschino@gmail.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: <stable@vger.kernel.org> # v4.5+
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      610e1ae9
  14. 17 7月, 2017 4 次提交
  15. 15 7月, 2017 1 次提交
  16. 13 7月, 2017 1 次提交
  17. 11 7月, 2017 4 次提交