From: Herve Codina <herve.codina@bootlin.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v2 2/3] ASoC: codecs: Add support for the Renesas IDT821034 codec
Date: Mon, 23 Jan 2023 13:17:55 +0100 [thread overview]
Message-ID: <20230123131755.1f5702be@bootlin.com> (raw)
In-Reply-To: <eb20dc66-f564-ed7e-8873-65621e5970de@csgroup.eu>
Hi Christophe,
On Mon, 23 Jan 2023 11:13:23 +0000
Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
> Hi Hervé,
>
> Le 23/01/2023 à 09:56, Herve Codina a écrit :
> >
> > gpiochip_get_data() is defined only when CONFIG_GPIOLIB is set.
> > That's why the #if section is used.
>
> gpiochip_get_data() is still declared when CONFIG_GPIOLIB is not set, so
> it is not a problem, the call to it will be eliminated at buildtime.
>
> By the way, at the time being I get the following warnings:
>
> CC sound/soc/codecs/idt821034.o
> sound/soc/codecs/idt821034.c:310:12: warning: 'idt821034_read_slic_raw'
> defined but not used [-Wunused-function]
> 310 | static int idt821034_read_slic_raw(struct idt821034 *idt821034,
> u8 ch, u8 *slic_raw)
> | ^~~~~~~~~~~~~~~~~~~~~~~
> sound/soc/codecs/idt821034.c:305:11: warning:
> 'idt821034_get_written_slic_raw' defined but not used [-Wunused-function]
> 305 | static u8 idt821034_get_written_slic_raw(struct idt821034
> *idt821034, u8 ch)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> sound/soc/codecs/idt821034.c:276:12: warning: 'idt821034_write_slic_raw'
> defined but not used [-Wunused-function]
> 276 | static int idt821034_write_slic_raw(struct idt821034
> *idt821034, u8 ch, u8 slic_raw)
> | ^~~~~~~~~~~~~~~~~~~~~~~~
> sound/soc/codecs/idt821034.c:271:11: warning: 'idt821034_get_slic_conf'
> defined but not used [-Wunused-function]
> 271 | static u8 idt821034_get_slic_conf(struct idt821034 *idt821034,
> u8 ch)
> | ^~~~~~~~~~~~~~~~~~~~~~~
> sound/soc/codecs/idt821034.c:250:12: warning: 'idt821034_set_slic_conf'
> defined but not used [-Wunused-function]
> 250 | static int idt821034_set_slic_conf(struct idt821034 *idt821034,
> u8 ch, u8 slic_dir)
> | ^~~~~~~~~~~~~~~~~~~~~~~
>
>
> With the following changes I have no warning and an objdump -x on
> idt821034.o shows no reference to gpiochip_get_data()
>
> 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
> idt821034_component_driver = {
> .endianness = 1,
> };
>
> -#if IS_ENABLED(CONFIG_GPIOLIB)
> #define IDT821034_GPIO_OFFSET_TO_SLIC_CHANNEL(_offset) (((_offset) /
> 5) % 4)
> #define IDT821034_GPIO_OFFSET_TO_SLIC_MASK(_offset) BIT((_offset) % 5)
>
> @@ -1133,12 +1132,6 @@ static int idt821034_gpio_init(struct idt821034
> *idt821034)
> return devm_gpiochip_add_data(&idt821034->spi->dev,
> &idt821034->gpio_chip,
> idt821034);
> }
> -#else /* IS_ENABLED(CONFIG_GPIOLIB) */
> -static int idt821034_gpio_init(struct idt821034 *idt821034)
> -{
> - return 0;
> -}
> -#endif
>
> static int idt821034_spi_probe(struct spi_device *spi)
> {
> @@ -1165,6 +1158,9 @@ static int idt821034_spi_probe(struct spi_device *spi)
> if (ret)
> return ret;
>
> + if (!IS_ENABLED(CONFIG_GPIOLIB))
> + return 0;
> +
> ret = idt821034_gpio_init(idt821034);
> if (ret)
> return ret;
>
>
> 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 = idt821034_gpio_init(idt821034);
if (ret)
return ret;
}
Is that ok for you ?
Thanks,
Hervé
--
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2023-01-23 12:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 9:50 [PATCH v2 0/3] Add the Renesas IDT821034 codec support Herve Codina
2023-01-20 9:50 ` [PATCH v2 1/3] dt-bindings: sound: Add Renesas IDT821034 codec Herve Codina
2023-01-22 13:46 ` Krzysztof Kozlowski
2023-01-20 9:50 ` [PATCH v2 2/3] ASoC: codecs: Add support for the " Herve Codina
2023-01-20 12:12 ` Mark Brown
2023-01-20 13:13 ` Herve Codina
2023-01-23 7:53 ` Christophe Leroy
2023-01-23 8:56 ` Herve Codina
2023-01-23 10:47 ` Christophe Leroy
2023-01-23 11:13 ` Christophe Leroy
2023-01-23 12:17 ` Herve Codina [this message]
2023-01-23 12:30 ` Christophe Leroy
2023-01-23 12:59 ` Herve Codina
2023-01-23 13:53 ` Christophe Leroy
2023-01-20 9:50 ` [PATCH v2 3/3] MAINTAINERS: add the Renesas IDT821034 codec entry Herve Codina
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=20230123131755.1f5702be@bootlin.com \
--to=herve.codina@bootlin.com \
--cc=alsa-devel@alsa-project.org \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=tiwai@suse.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