Takashi Iwai c3aeda6287 ALSA: hda - Fix another race in runtime PM refcounting
Although some races in runtime PM refcount was fixed by the commit
[664c715573c2: ALSA: hda - Work around races of power up/down with
runtime PM], there is still a race in the following case:

CPU0:                   CPU1 :
runtime suspend:
  codec->in_pm = 1
                        snd_hdac_power_up_pm():
                          pm_runtime_get_sync() skipped
suspend finished:
  codec->in_pm = 0
                        snd_hdac_power_down_pm():
                          pm_runtime_put_*() is called!

For avoiding this situation, increment in_pm flag atomically when it's
non-zero, and decrement accordingly, to ensure that in_pm is set
consistently for the whole concurrent operations.

Also, since atomic_inc_not_zero() and atomic_dec_if_positive() are
lengthy inline functions, move snd_hdac_power_up_pm() and _down_pm()
to sound/hda/hdac_device.c as no inline functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-13 11:07:20 +02:00
..
2015-04-05 08:41:05 +02:00
2011-08-17 00:53:54 +09:00
2011-05-19 14:10:45 -07:00
2014-05-05 18:20:22 -07:00
2013-02-14 17:27:17 +00:00
2012-09-28 14:21:54 +01:00
2015-02-02 14:42:42 +01:00
2012-01-03 22:54:56 -05:00
2008-11-17 11:45:39 +00:00
2010-10-18 16:46:27 -07:00
2011-02-14 17:10:11 +01:00
2015-02-20 17:30:07 +01:00
2015-02-02 14:42:43 +01:00
2014-07-04 18:50:51 +01:00
2014-04-18 18:52:18 +01:00
2014-07-02 20:49:25 +01:00
2012-12-24 15:57:20 +00:00
2015-03-06 14:25:27 +01:00
2013-05-08 15:43:56 +02:00
2014-09-15 15:52:03 +02:00
2011-09-20 16:02:16 +01:00
2009-12-18 13:06:47 +00:00
2011-08-08 14:30:37 +09:00
2010-04-30 16:12:44 +01:00