From: Olivier MOYSAN <olivier.moysan@foss.st.com>
To: tangbin <tangbin@cmss.chinamobile.com>, Mark Brown <broonie@kernel.org>
Cc: <arnaud.pouliquen@foss.st.com>, <lgirdwood@gmail.com>,
<perex@perex.cz>, <tiwai@suse.com>, <mcoquelin.stm32@gmail.com>,
<alexandre.torgue@foss.st.com>, <alsa-devel@alsa-project.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ASoC: stm32: sai: Use of_device_get_match_data()tosimplify code
Date: Wed, 25 May 2022 14:30:13 +0200 [thread overview]
Message-ID: <b346eb00-fde1-2dc0-e6e3-09dbf1359c20@foss.st.com> (raw)
In-Reply-To: <cd375914-a3e6-37c7-4a16-551937006f92@cmss.chinamobile.com>
Hi Tang,
On 5/25/22 09:36, tangbin wrote:
> Hi Olivier:
>
> On 2022/5/24 22:30, Olivier MOYSAN wrote:
>> Hi Tang,
>>
>> On 5/24/22 03:44, tangbin wrote:
>>> Hi Mark & Olivier:
>>>
>>> On 2022/5/24 2:57, Mark Brown wrote:
>>>> On Mon, May 23, 2022 at 03:28:48PM +0200, Olivier MOYSAN wrote:
>>>>
>>>>> The current patch requires a change in the driver.
>>>>> Either changing STM_SAI_x_ID enums, or replacing data by a struct.
>>>>> For instance:
>>>>> struct stm32_sai_comp_data {
>>>>> unsigned int id;
>>>>> }
>>>>> struct stm32_sai_comp_data stm32_sai_comp_data_a = {
>>>>> .id = STM_SAI_A_ID;
>>>>> }
>>>>> struct of_device_id stm32_sai_sub_ids[] = {
>>>>> .data = &stm32_sai_comp_data_a},
>>>>> }
>>>> Either approach works for me (or a revert for that matter).
>>>
>>> Thanks for your advice, I was thoughtless.
>>>
>>> I think change the date of STM_SAI_x_ID maybe simple. But if we
>>> don't change the id,
>>>
>>> what about add a "#define" like the line 47:
>>>
>>> #define STM_SAI_IS_SUB(x) ((x)->id == STM_SAI_A_ID || (x)->id ==
>>> STM_SAI_B_ID)
>>>
>>> then in the judgement, wu use:
>>>
>>> sai->id = (uintptr_t)of_device_get_match_data(&pdev->dev);
>>>
>>> if (!STM_SAI_IS_SUB(sai))
>>>
>>> return -EINVAL;
>>>
>>>
>>> if you think that's ok, I will send patch v2 for you .
>>>
>>
>> If we allow null value in STM_SAI_IS_SUB(sai) check, we can miss real
>> NULL pointer error from of_device_get_match_data().
>>
>> The simplest way is to change STM_SAI_x_ID enums I think.
>> But honnestly, I feel more comfortable to let the driver unchanged.
>>
> Oh,you are right, I am sorry.
>
> Please forget this patch, I'm sorry to have wasted your time.
>
> But I saw some codes is useless in the line 48 & line 49, I think we can
> remove it.
>
Yes, these two defines are no more useful.
Feel free to send a cleanup patch.
BRs
Olivier
> If you think so, I will send this patch for you.
>
>
> Thanks
>
> Tang Bin
>
>
>> BRs
>> Olivier
>>
>>> Thanks
>>>
>>> Tang Bin
>>>
>>>
>
>
prev parent reply other threads:[~2022-05-25 12:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 12:42 [PATCH] ASoC: stm32: sai: Use of_device_get_match_data() to simplify code Tang Bin
2022-05-23 13:28 ` Olivier MOYSAN
2022-05-23 18:57 ` Mark Brown
[not found] ` <3fb8d7f8-4506-3b28-22cb-863bda1f21c8@cmss.chinamobile.com>
2022-05-24 14:30 ` [PATCH] ASoC: stm32: sai: Use of_device_get_match_data() tosimplify code Olivier MOYSAN
2022-05-25 7:36 ` [PATCH] ASoC: stm32: sai: Use of_device_get_match_data()tosimplify code tangbin
2022-05-25 12:30 ` Olivier MOYSAN [this message]
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=b346eb00-fde1-2dc0-e6e3-09dbf1359c20@foss.st.com \
--to=olivier.moysan@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=alsa-devel@alsa-project.org \
--cc=arnaud.pouliquen@foss.st.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=perex@perex.cz \
--cc=tangbin@cmss.chinamobile.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
all inboxes | Powered by JetHome®