All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Krzysztof Kozlowski <krzk@kernel.org>,
	Sangbeom Kim <sbkim73@samsung.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH 2/6] ASoC: samsung: smdk_wm8580: Remove old platforms and drop mach-types usage
Date: Sat, 19 Nov 2016 16:48:26 +0100	[thread overview]
Message-ID: <9ef6c39c-e7a2-4591-380f-07f92317313b@metafoo.de> (raw)
In-Reply-To: <90e0f455-fa24-f643-fa07-67efe217188a@metafoo.de>

On 11/19/2016 04:45 PM, Lars-Peter Clausen wrote:
> On 11/19/2016 04:42 PM, Lars-Peter Clausen wrote:
>> On 11/19/2016 03:48 PM, Krzysztof Kozlowski wrote:
>> [...]
>>> @@ -206,15 +204,10 @@ static int __init smdk_audio_init(void)
>>>  	int ret;
>>>  	char *str;
>>>  
>>> -	if (machine_is_smdkc100()
>>> -			|| machine_is_smdkv210() || machine_is_smdkc110()) {
>>> -		smdk.num_links = 3;
>>> -	} else if (machine_is_smdk6410()) {
>>> -		str = (char *)smdk_dai[PRI_PLAYBACK].cpu_dai_name;
>>> -		str[strlen(str) - 1] = '2';
>>> -		str = (char *)smdk_dai[PRI_CAPTURE].cpu_dai_name;
>>> -		str[strlen(str) - 1] = '2';
>>> -	}
>>> +	str = (char *)smdk_dai[PRI_PLAYBACK].cpu_dai_name;
>>> +	str[strlen(str) - 1] = '2';
>>> +	str = (char *)smdk_dai[PRI_CAPTURE].cpu_dai_name;
>>> +	str[strlen(str) - 1] = '2';
>>
>> This could be further simplified by just updating the initial cpu_dai_name
>> string in the dai_link struct.
>>
>> Especially considering that the cpu_dai_name is a string literal and the ARM
>> kernel now has rodata write protection enabled by default, so modifying it
>> will crash the kernel.
> 
> Spoke too soon, you fix this up in the next patch. But I'd just squash that
> change into this patch. I think it is pretty safe to assume that it is correct.
> 

And another thing. Since num_links is always 2 now the last entry from the
smdk_dai array can be removed and num_links can be initialized using
ARRAY_SIZE().

WARNING: multiple messages have this Message-ID (diff)
From: lars@metafoo.de (Lars-Peter Clausen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] ASoC: samsung: smdk_wm8580: Remove old platforms and drop mach-types usage
Date: Sat, 19 Nov 2016 16:48:26 +0100	[thread overview]
Message-ID: <9ef6c39c-e7a2-4591-380f-07f92317313b@metafoo.de> (raw)
In-Reply-To: <90e0f455-fa24-f643-fa07-67efe217188a@metafoo.de>

On 11/19/2016 04:45 PM, Lars-Peter Clausen wrote:
> On 11/19/2016 04:42 PM, Lars-Peter Clausen wrote:
>> On 11/19/2016 03:48 PM, Krzysztof Kozlowski wrote:
>> [...]
>>> @@ -206,15 +204,10 @@ static int __init smdk_audio_init(void)
>>>  	int ret;
>>>  	char *str;
>>>  
>>> -	if (machine_is_smdkc100()
>>> -			|| machine_is_smdkv210() || machine_is_smdkc110()) {
>>> -		smdk.num_links = 3;
>>> -	} else if (machine_is_smdk6410()) {
>>> -		str = (char *)smdk_dai[PRI_PLAYBACK].cpu_dai_name;
>>> -		str[strlen(str) - 1] = '2';
>>> -		str = (char *)smdk_dai[PRI_CAPTURE].cpu_dai_name;
>>> -		str[strlen(str) - 1] = '2';
>>> -	}
>>> +	str = (char *)smdk_dai[PRI_PLAYBACK].cpu_dai_name;
>>> +	str[strlen(str) - 1] = '2';
>>> +	str = (char *)smdk_dai[PRI_CAPTURE].cpu_dai_name;
>>> +	str[strlen(str) - 1] = '2';
>>
>> This could be further simplified by just updating the initial cpu_dai_name
>> string in the dai_link struct.
>>
>> Especially considering that the cpu_dai_name is a string literal and the ARM
>> kernel now has rodata write protection enabled by default, so modifying it
>> will crash the kernel.
> 
> Spoke too soon, you fix this up in the next patch. But I'd just squash that
> change into this patch. I think it is pretty safe to assume that it is correct.
> 

And another thing. Since num_links is always 2 now the last entry from the
smdk_dai array can be removed and num_links can be initialized using
ARRAY_SIZE().

  reply	other threads:[~2016-11-19 15:49 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-19 14:48 [PATCH 0/6] ASoC: samsung: Minor cleanup for old machines Krzysztof Kozlowski
2016-11-19 14:48 ` Krzysztof Kozlowski
2016-11-19 14:48 ` [PATCH 1/6] ASoC: samsung: Remove non-existing MACH dependencies Krzysztof Kozlowski
2016-11-19 14:48   ` Krzysztof Kozlowski
2016-11-21 10:17   ` Sylwester Nawrocki
2016-11-21 10:17     ` Sylwester Nawrocki
2016-11-22 17:26   ` Applied "ASoC: samsung: Remove non-existing MACH dependencies" to the asoc tree Mark Brown
2016-11-22 17:26     ` Mark Brown
2016-11-22 17:26     ` Mark Brown
2016-11-19 14:48 ` [PATCH 2/6] ASoC: samsung: smdk_wm8580: Remove old platforms and drop mach-types usage Krzysztof Kozlowski
2016-11-19 14:48   ` Krzysztof Kozlowski
2016-11-19 15:42   ` Lars-Peter Clausen
2016-11-19 15:42     ` Lars-Peter Clausen
2016-11-19 15:45     ` Lars-Peter Clausen
2016-11-19 15:45       ` Lars-Peter Clausen
2016-11-19 15:48       ` Lars-Peter Clausen [this message]
2016-11-19 15:48         ` Lars-Peter Clausen
2016-11-19 18:01         ` Krzysztof Kozlowski
2016-11-19 18:01           ` Krzysztof Kozlowski
2016-11-19 14:48 ` [RFT 3/6] ASoC: samsung: smdk_wm8580: Remove machine specific quirks Krzysztof Kozlowski
2016-11-19 14:48   ` Krzysztof Kozlowski
2016-11-19 14:48 ` [PATCH 4/6] ASoC: samsung: Enable COMPILE_TEST for SmartQ and WM8580 Krzysztof Kozlowski
2016-11-19 14:48   ` Krzysztof Kozlowski
2016-11-22 17:26   ` Applied "ASoC: samsung: Enable COMPILE_TEST for SmartQ and WM8580" to the asoc tree Mark Brown
2016-11-22 17:26     ` Mark Brown
2016-11-22 17:26     ` Mark Brown
2016-11-19 14:48 ` [PATCH 5/6] ASoC: samsung: Enable COMPILE_TEST for entire Samsung ASoc Krzysztof Kozlowski
2016-11-19 14:48   ` Krzysztof Kozlowski
2016-11-22 17:26   ` Applied "ASoC: samsung: Enable COMPILE_TEST for entire Samsung ASoc" to the asoc tree Mark Brown
2016-11-22 17:26     ` Mark Brown
2016-11-22 17:26     ` Mark Brown
2016-11-19 14:48 ` [PATCH 6/6] ARM: s5pv210_defconfig: Remove old MACHs Krzysztof Kozlowski
2016-11-19 14:48   ` Krzysztof Kozlowski

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=9ef6c39c-e7a2-4591-380f-07f92317313b@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=krzk@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=s.nawrocki@samsung.com \
    --cc=sbkim73@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.