From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Rander Wang <rander.wang@intel.com>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>,
oder_chiou@realtek.com, lgirdwood@gmail.com, perex@perex.cz,
tiwai@suse.com, alsa-devel@alsa-project.org
Subject: [PATCH AUTOSEL 5.18 08/41] ASoC: codecs: rt700/rt711/rt711-sdca: initialize workqueues in probe
Date: Thu, 14 Jul 2022 00:21:48 -0400 [thread overview]
Message-ID: <20220714042221.281187-8-sashal@kernel.org> (raw)
In-Reply-To: <20220714042221.281187-1-sashal@kernel.org>
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
[ Upstream commit ba98d7d8b60ba410aa03834f6aa48fd3b2e68478 ]
The workqueues are initialized in the io_init functions, which isn't
quite right. In some tests, this leads to warnings throw from
__queue_delayed_work()
WARN_ON_FUNCTION_MISMATCH(timer->function, delayed_work_timer_fn);
Move all the initializations to the probe functions.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220606203752.144159-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/soc/codecs/rt700.c | 12 +++++-------
sound/soc/codecs/rt711-sdca.c | 10 +++-------
sound/soc/codecs/rt711.c | 12 +++++-------
3 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/sound/soc/codecs/rt700.c b/sound/soc/codecs/rt700.c
index 1f4da32639d4..d24064e77edc 100644
--- a/sound/soc/codecs/rt700.c
+++ b/sound/soc/codecs/rt700.c
@@ -1114,6 +1114,11 @@ int rt700_init(struct device *dev, struct regmap *sdw_regmap,
mutex_init(&rt700->disable_irq_lock);
+ INIT_DELAYED_WORK(&rt700->jack_detect_work,
+ rt700_jack_detect_handler);
+ INIT_DELAYED_WORK(&rt700->jack_btn_check_work,
+ rt700_btn_check_handler);
+
/*
* Mark hw_init to false
* HW init will be performed when device reports present
@@ -1208,13 +1213,6 @@ int rt700_io_init(struct device *dev, struct sdw_slave *slave)
/* Finish Initial Settings, set power to D3 */
regmap_write(rt700->regmap, RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3);
- if (!rt700->first_hw_init) {
- INIT_DELAYED_WORK(&rt700->jack_detect_work,
- rt700_jack_detect_handler);
- INIT_DELAYED_WORK(&rt700->jack_btn_check_work,
- rt700_btn_check_handler);
- }
-
/*
* if set_jack callback occurred early than io_init,
* we set up the jack detection function now
diff --git a/sound/soc/codecs/rt711-sdca.c b/sound/soc/codecs/rt711-sdca.c
index 9c88c92c0abc..d8821d535a24 100644
--- a/sound/soc/codecs/rt711-sdca.c
+++ b/sound/soc/codecs/rt711-sdca.c
@@ -1414,6 +1414,9 @@ int rt711_sdca_init(struct device *dev, struct regmap *regmap,
mutex_init(&rt711->calibrate_mutex);
mutex_init(&rt711->disable_irq_lock);
+ INIT_DELAYED_WORK(&rt711->jack_detect_work, rt711_sdca_jack_detect_handler);
+ INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_sdca_btn_check_handler);
+
/*
* Mark hw_init to false
* HW init will be performed when device reports present
@@ -1545,13 +1548,6 @@ int rt711_sdca_io_init(struct device *dev, struct sdw_slave *slave)
rt711_sdca_index_update_bits(rt711, RT711_VENDOR_HDA_CTL,
RT711_PUSH_BTN_INT_CTL0, 0x20, 0x00);
- if (!rt711->first_hw_init) {
- INIT_DELAYED_WORK(&rt711->jack_detect_work,
- rt711_sdca_jack_detect_handler);
- INIT_DELAYED_WORK(&rt711->jack_btn_check_work,
- rt711_sdca_btn_check_handler);
- }
-
/* calibration */
ret = rt711_sdca_calibration(rt711);
if (ret < 0)
diff --git a/sound/soc/codecs/rt711.c b/sound/soc/codecs/rt711.c
index 3cb4bf76c021..608deb7c2ea2 100644
--- a/sound/soc/codecs/rt711.c
+++ b/sound/soc/codecs/rt711.c
@@ -1206,6 +1206,10 @@ int rt711_init(struct device *dev, struct regmap *sdw_regmap,
mutex_init(&rt711->calibrate_mutex);
mutex_init(&rt711->disable_irq_lock);
+ INIT_DELAYED_WORK(&rt711->jack_detect_work, rt711_jack_detect_handler);
+ INIT_DELAYED_WORK(&rt711->jack_btn_check_work, rt711_btn_check_handler);
+ INIT_WORK(&rt711->calibration_work, rt711_calibration_work);
+
/*
* Mark hw_init to false
* HW init will be performed when device reports present
@@ -1313,14 +1317,8 @@ int rt711_io_init(struct device *dev, struct sdw_slave *slave)
if (rt711->first_hw_init)
rt711_calibration(rt711);
- else {
- INIT_DELAYED_WORK(&rt711->jack_detect_work,
- rt711_jack_detect_handler);
- INIT_DELAYED_WORK(&rt711->jack_btn_check_work,
- rt711_btn_check_handler);
- INIT_WORK(&rt711->calibration_work, rt711_calibration_work);
+ else
schedule_work(&rt711->calibration_work);
- }
/*
* if set_jack callback occurred early than io_init,
--
2.35.1
next prev parent reply other threads:[~2022-07-14 4:23 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 4:21 [PATCH AUTOSEL 5.18 01/41] ASoC: ops: Fix off by one in range control validation Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 02/41] pinctrl: aspeed: Fix potential NULL dereference in aspeed_pinmux_set_mux() Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 03/41] ASoC: Realtek/Maxim SoundWire codecs: disable pm_runtime on remove Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 04/41] ASoC: rt711-sdca-sdw: fix calibrate mutex initialization Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 05/41] ASoC: Intel: sof_sdw: handle errors on card registration Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 06/41] ASoC: rt711: fix calibrate mutex initialization Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 07/41] ASoC: rt7*-sdw: harden jack_detect_handler Sasha Levin
2022-07-14 4:21 ` Sasha Levin [this message]
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 09/41] ASoC: SOF: Intel: hda-dsp: Expose hda_dsp_core_power_up() Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 10/41] ASoC: SOF: Intel: hda-loader: Make sure that the fw load sequence is followed Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 11/41] ASoC: SOF: Intel: hda-loader: Clarify the cl_dsp_init() flow Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 12/41] ASoC: wcd9335: Remove RX channel from old list before adding it to a new one Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 13/41] ASoC: wcd9335: Fix spurious event generation Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 14/41] ASoC: wcd938x: Fix event generation for some controls Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 15/41] ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 16/41] ASoC: rockchip: i2s: switch BCLK to GPIO Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 17/41] ASoC: wm_adsp: Fix event for preloader Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 18/41] ASoC: wm5110: Fix DRE control Sasha Levin
2022-07-14 4:21 ` [PATCH AUTOSEL 5.18 19/41] ASoC: cs35l41: Correct some control names Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 20/41] ASoC: rt711-sdca: fix kernel NULL pointer dereference when IO error Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 21/41] ASoC: dapm: Initialise kcontrol data for mux/demux controls Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 22/41] ASoC: cs35l41: Add ASP TX3/4 source to register patch Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 23/41] ASoC: cs47l15: Fix event generation for low power mux control Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 24/41] ASoC: madera: Fix event generation for OUT1 demux Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 25/41] ASoC: madera: Fix event generation for rate controls Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 26/41] irqchip: or1k-pic: Undefine mask_ack for level triggered hardware Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 27/41] pinctrl: imx: Add the zero base flag for imx93 Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 28/41] x86/xen: Use clear_bss() for Xen PV guests Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 29/41] x86: Clear .brk area at early boot Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 30/41] soc: ixp4xx/npe: Fix unused match warning Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 31/41] ARM: dts: stm32: use the correct clock source for CEC on stm32mp151 Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 32/41] Revert "can: xilinx_can: Limit CANFD brp to 2" Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 33/41] ALSA: usb-audio: Add quirks for MacroSilicon MS2100/MS2106 devices Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 34/41] ALSA: usb-audio: Add quirk for Fiero SC-01 Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 35/41] ALSA: usb-audio: Add quirk for Fiero SC-01 (fw v1.0.0) Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 36/41] nvme-pci: phison e16 has bogus namespace ids Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 37/41] nvme: use struct group for generic command dwords Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 38/41] wireguard: selftests: set fake real time in init Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 39/41] wireguard: selftests: use virt machine on m68k Sasha Levin
2022-07-14 7:08 ` Geert Uytterhoeven
2022-07-17 23:01 ` Sasha Levin
2022-07-18 1:34 ` Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 40/41] wireguard: selftests: always call kernel makefile Sasha Levin
2022-07-14 4:22 ` [PATCH AUTOSEL 5.18 41/41] signal handling: don't use BUG_ON() for debugging Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220714042221.281187-8-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=rander.wang@intel.com \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).