From patchwork Wed Mar 27 08:05:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 13605859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 940ADC47DD9 for ; Wed, 27 Mar 2024 08:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=feTZl+FCr/JRCrjVhGq0LuAAD/CRv++UIGgu0wDf2Gs=; b=H20nAC32K6PF4E bsPfNHpYJV6Z88CIB24bsuDtkByofENBfrL09otsSXurBcdV1DY2jBSLCRHV9MCmB5GU30bq7hvf8 bPFQAO+FjDgeGWnZHTE+5OBtKkmDa6WfyEiKgYeQMvf5BsHXIA8Z0a1Svmn+8QvP71rll0MXCKj8Q /p6s2lJ/18Js8yM1Yd2NlkZmHzj4PSo6ZJT6tYIuem10/GvqxNcRsh2myMDCgw6xXd2DjJefqzdLY BY7KYibbSewfIrHVDU/oaRrHfLU8H7LlMAxC8/Vt9qtJOKVkOu3Vnf2mgdrWDWYayyYH3HIjXcuHp kCntMtmO1MvrE+uNIWQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpOIG-00000007xNU-0Goc; Wed, 27 Mar 2024 08:05:56 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpOI9-00000007xMQ-47rn for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 08:05:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1711526745; bh=r4JXMW58E7i8lNoJ31XYYNnSGQR/YuEX7KZrH5t3UyE=; h=From:To:Cc:Subject:Date:From; b=FNs720YzlUVg+LJFcaUHuBsJLiF6gKZLE6FYoYAy+4PcQed1GZnX12dX5Ot6qHu6G hdcEfh1WJ0ZNPzzeDBZwkRSz24z4wz6wDvWgcIFpTKyzGRuhrgvph+d7GcZAhVRN8y /jNXuG0LdO6JsQlDpFHHPbmhnInQNrR/JVIC1yVs= From: =?utf-8?q?Ond=C5=99ej_Jirman?= To: linux-kernel@vger.kernel.org Cc: Ondrej Jirman , kernel test robot , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Rob Herring , AngeloGioacchino Del Regno , Claudiu Beznea , Arnaud Ferraris , linux-sound@vger.kernel.org (open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support) Subject: [PATCH] ASoC: sun8i-codec: Fix build with CONFIG_SND_JACK_INPUT_DEV disabled Date: Wed, 27 Mar 2024 09:05:34 +0100 Message-ID: <20240327080542.3649840-1-megi@xff.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240327_010550_504653_1521AEE9 X-CRM114-Status: GOOD ( 14.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ondrej Jirman When CONFIG_SND_JACK_INPUT_DEV is disabled, struct snd_jack doesn't have 'type' field. We can't rely on this field being always present, so store the jack_type in the codec driver itself. Signed-off-by: Ondrej Jirman Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202403261243.kcXCPAYs-lkp@intel.com/ --- This is a followup for https://lore.kernel.org/lkml/2vhd45kylttgonosdcfn7ugwyy2vx56gijwf3ealz4tel65iqr@cs3kxrl6d2hh/ sound/soc/sunxi/sun8i-codec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c index 43795362fed0..b5dafb749c3f 100644 --- a/sound/soc/sunxi/sun8i-codec.c +++ b/sound/soc/sunxi/sun8i-codec.c @@ -232,6 +232,7 @@ struct sun8i_codec { struct delayed_work jack_work; int jack_irq; int jack_status; + int jack_type; int jack_last_sample; ktime_t jack_hbias_ready; struct mutex jack_mutex; @@ -1352,7 +1353,6 @@ static void sun8i_codec_jack_work(struct work_struct *work) struct sun8i_codec *scodec = container_of(work, struct sun8i_codec, jack_work.work); unsigned int mdata; - int type_mask = scodec->jack->jack->type; int type; guard(mutex)(&scodec->jack_mutex); @@ -1363,7 +1363,7 @@ static void sun8i_codec_jack_work(struct work_struct *work) scodec->jack_last_sample = -1; - if (type_mask & SND_JACK_MICROPHONE) { + if (scodec->jack_type & SND_JACK_MICROPHONE) { /* * If we were in disconnected state, we enable HBIAS and * wait 600ms before reading initial HDATA value. @@ -1376,7 +1376,7 @@ static void sun8i_codec_jack_work(struct work_struct *work) scodec->jack_status = SUN8I_JACK_STATUS_WAITING_HBIAS; } else { snd_soc_jack_report(scodec->jack, SND_JACK_HEADPHONE, - type_mask); + scodec->jack_type); scodec->jack_status = SUN8I_JACK_STATUS_CONNECTED; } } else if (scodec->jack_status == SUN8I_JACK_STATUS_WAITING_HBIAS) { @@ -1417,17 +1417,17 @@ static void sun8i_codec_jack_work(struct work_struct *work) if (type == SND_JACK_HEADPHONE) sun8i_codec_set_hmic_bias(scodec, false); - snd_soc_jack_report(scodec->jack, type, type_mask); + snd_soc_jack_report(scodec->jack, type, scodec->jack_type); scodec->jack_status = SUN8I_JACK_STATUS_CONNECTED; } else if (scodec->jack_status == SUN8I_JACK_STATUS_CONNECTED) { if (scodec->last_hmic_irq != SUN8I_HMIC_STS_JACK_OUT_IRQ_ST) return; scodec->jack_status = SUN8I_JACK_STATUS_DISCONNECTED; - if (type_mask & SND_JACK_MICROPHONE) + if (scodec->jack_type & SND_JACK_MICROPHONE) sun8i_codec_set_hmic_bias(scodec, false); - snd_soc_jack_report(scodec->jack, 0, type_mask); + snd_soc_jack_report(scodec->jack, 0, scodec->jack_type); } } @@ -1491,7 +1491,7 @@ static irqreturn_t sun8i_codec_jack_irq(int irq, void *dev_id) if (scodec->jack_last_sample >= 0 && scodec->jack_last_sample == value) snd_soc_jack_report(scodec->jack, type, - scodec->jack->jack->type); + scodec->jack_type); scodec->jack_last_sample = value; }