From mboxrd@z Thu Jan 1 00:00:00 1970 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (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 41F7CC38142 for ; Mon, 23 Jan 2023 12:18:55 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D456B41F8; Mon, 23 Jan 2023 13:18:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D456B41F8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1674476332; bh=gpKQRGZw8jDinmfqA00+ZXuNq6arpZGThUUNUl1njO4=; h=Date:From:To:Subject:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=kxd4sZwmxkogoPiG+p6PP4enK0kf+AW5Yw060FIweNH+8bs2SNewIRjPDY1d5a0YP Nk9fFVvaIM2M0HNLege1FylrmQMezTXzdTauwTTqJXINVSyD0SfHWrwmSEYWgfO4vX 3E7Bg+3ib8SVZ2JcbubwbCvFpf32Zdl13jV3qMAI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5DC01F804A9; Mon, 23 Jan 2023 13:18:02 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B6CB0F804C2; Mon, 23 Jan 2023 13:18:00 +0100 (CET) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C3645F80132 for ; Mon, 23 Jan 2023 13:17:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C3645F80132 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=ZUpvTT/3 Received: (Authenticated sender: herve.codina@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 3049E6000D; Mon, 23 Jan 2023 12:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1674476278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dSrbZZvovpWvlJHm56TjukjpU0bsgrOflMKyVZ5eOVU=; b=ZUpvTT/3DPBE39G475z/z5eC8dHh8fjFkfRsufenoyMfstAS1QlsDlP5CT7iV5uJMu7wTO BEBr7iXCJBRFNpOI4TNrN3zAzXR4gMuwa4xgg6xpf/n7z51tAQSVwHQiQW1EPZTVhqZGF6 QUAaDSOaLVwOD5iWrv7hgFQIjKYfW9xUaYWS21lhFoVQlHS14rpSVrp2nE+7DtorSijkTR QAdh4mVKt4CUAKavRYZp/dMiudCY9guBu7MgoYN5/q/1wbnm4GDlrxGFRPWF420y0kcYG+ jlIuARTLmRcX4/T8v/PehW8FfjViib6KecXH6P/yn0mmrFGrfXaUt+7avtmc/Q== Date: Mon, 23 Jan 2023 13:17:55 +0100 From: Herve Codina To: Christophe Leroy Subject: Re: [PATCH v2 2/3] ASoC: codecs: Add support for the Renesas IDT821034 codec Message-ID: <20230123131755.1f5702be@bootlin.com> In-Reply-To: References: <20230120095036.514639-1-herve.codina@bootlin.com> <20230120095036.514639-3-herve.codina@bootlin.com> <20230123095631.4aba35d6@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.36; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "devicetree@vger.kernel.org" , "alsa-devel@alsa-project.org" , Thomas Petazzoni , "linux-kernel@vger.kernel.org" , Linus Walleij , Takashi Iwai , Liam Girdwood , Rob Herring , "linux-gpio@vger.kernel.org" , Mark Brown , Krzysztof Kozlowski , Bartosz Golaszewski Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Hi Christophe, On Mon, 23 Jan 2023 11:13:23 +0000 Christophe Leroy wrote: > Hi Herv=C3=A9, >=20 > Le 23/01/2023 =C3=A0 09:56, Herve Codina a =C3=A9crit=C2=A0: > >=20 > > gpiochip_get_data() is defined only when CONFIG_GPIOLIB is set. > > That's why the #if section is used. =20 >=20 > gpiochip_get_data() is still declared when CONFIG_GPIOLIB is not set, so= =20 > it is not a problem, the call to it will be eliminated at buildtime. >=20 > By the way, at the time being I get the following warnings: >=20 > CC sound/soc/codecs/idt821034.o > sound/soc/codecs/idt821034.c:310:12: warning: 'idt821034_read_slic_raw'=20 > defined but not used [-Wunused-function] > 310 | static int idt821034_read_slic_raw(struct idt821034 *idt821034,= =20 > u8 ch, u8 *slic_raw) > | ^~~~~~~~~~~~~~~~~~~~~~~ > sound/soc/codecs/idt821034.c:305:11: warning:=20 > 'idt821034_get_written_slic_raw' defined but not used [-Wunused-function] > 305 | static u8 idt821034_get_written_slic_raw(struct idt821034=20 > *idt821034, u8 ch) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > sound/soc/codecs/idt821034.c:276:12: warning: 'idt821034_write_slic_raw'= =20 > defined but not used [-Wunused-function] > 276 | static int idt821034_write_slic_raw(struct idt821034=20 > *idt821034, u8 ch, u8 slic_raw) > | ^~~~~~~~~~~~~~~~~~~~~~~~ > sound/soc/codecs/idt821034.c:271:11: warning: 'idt821034_get_slic_conf'=20 > defined but not used [-Wunused-function] > 271 | static u8 idt821034_get_slic_conf(struct idt821034 *idt821034,=20 > u8 ch) > | ^~~~~~~~~~~~~~~~~~~~~~~ > sound/soc/codecs/idt821034.c:250:12: warning: 'idt821034_set_slic_conf'=20 > defined but not used [-Wunused-function] > 250 | static int idt821034_set_slic_conf(struct idt821034 *idt821034,= =20 > u8 ch, u8 slic_dir) > | ^~~~~~~~~~~~~~~~~~~~~~~ >=20 >=20 > With the following changes I have no warning and an objdump -x on=20 > idt821034.o shows no reference to gpiochip_get_data() >=20 > diff --git a/sound/soc/codecs/idt821034.c b/sound/soc/codecs/idt821034.c > index 5eb93fec6042..8b75388e22ce 100644 > --- a/sound/soc/codecs/idt821034.c > +++ b/sound/soc/codecs/idt821034.c > @@ -968,7 +968,6 @@ static const struct snd_soc_component_driver=20 > idt821034_component_driver =3D { > .endianness =3D 1, > }; >=20 > -#if IS_ENABLED(CONFIG_GPIOLIB) > #define IDT821034_GPIO_OFFSET_TO_SLIC_CHANNEL(_offset) (((_offset) /=20 > 5) % 4) > #define IDT821034_GPIO_OFFSET_TO_SLIC_MASK(_offset) BIT((_offset) % = 5) >=20 > @@ -1133,12 +1132,6 @@ static int idt821034_gpio_init(struct idt821034=20 > *idt821034) > return devm_gpiochip_add_data(&idt821034->spi->dev,=20 > &idt821034->gpio_chip, > idt821034); > } > -#else /* IS_ENABLED(CONFIG_GPIOLIB) */ > -static int idt821034_gpio_init(struct idt821034 *idt821034) > -{ > - return 0; > -} > -#endif >=20 > static int idt821034_spi_probe(struct spi_device *spi) > { > @@ -1165,6 +1158,9 @@ static int idt821034_spi_probe(struct spi_device *s= pi) > if (ret) > return ret; >=20 > + if (!IS_ENABLED(CONFIG_GPIOLIB)) > + return 0; > + > ret =3D idt821034_gpio_init(idt821034); > if (ret) > return ret; >=20 >=20 > Christophe Right, I did the test too and indeed, I can remove the #if section. I will use (I think is clearer) at idt821034_spi_probe(): if (!IS_ENABLED(CONFIG_GPIOLIB)) { ret =3D idt821034_gpio_init(idt821034); if (ret) return ret; } Is that ok for you ? Thanks, Herv=C3=A9 --=20 Herv=C3=A9 Codina, Bootlin Embedded Linux and Kernel engineering https://bootlin.com