From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Herve Codina <herve.codina@bootlin.com>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
Mark Brown <broonie@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>
Subject: Re: [PATCH v2 2/3] ASoC: codecs: Add support for the Renesas IDT821034 codec
Date: Mon, 23 Jan 2023 12:30:32 +0000 [thread overview]
Message-ID: <79b35117-98aa-dc7c-2a27-805cd4ac2c71@csgroup.eu> (raw)
In-Reply-To: <20230123131755.1f5702be@bootlin.com>
Le 23/01/2023 à 13:17, Herve Codina a écrit :
> 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;
> }
>
I guess you mean :
if (IS_ENABLED(CONFIG_GPIOLIB))
> Is that ok for you ?
What about:
if (IS_ENABLED(CONFIG_GPIOLIB))
return idt821034_gpio_init(idt821034);
else
return 0;
Christophe
next prev parent reply other threads:[~2023-01-23 12:31 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
2023-01-23 12:30 ` Christophe Leroy [this message]
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=79b35117-98aa-dc7c-2a27-805cd4ac2c71@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=alsa-devel@alsa-project.org \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=herve.codina@bootlin.com \
--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=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