diff mbox

[v2,2/2] mmc, sdhci, bcm-kona, LLVMLinux: Remove use of __initconst

Message ID 1411512908-19237-2-git-send-email-behanw@converseincode.com
State Accepted
Commit b3f635ad6648d17178c3e2ab2f0a4823fcac1e83
Headers show

Commit Message

Behan Webster Sept. 23, 2014, 10:55 p.m. UTC
From: Behan Webster <behanw@converseincode.com>

The __initconst is in the wrong place, and when moved to the correct place
it uncovers an error where the variable is used by non-init data structures.

Instead merely make them const and put the const in the right spot.

Signed-off-by: Behan Webster <behanw@converseincode.com>
Reviewed-by: Mark Charlebois <charlebm@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Matt Porter <mporter@linaro.org>
---
 drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnd Bergmann Sept. 24, 2014, 9:22 a.m. UTC | #1
On Tuesday 23 September 2014 15:55:08 behanw@converseincode.com wrote:
> --- a/drivers/mmc/host/sdhci-bcm-kona.c
> +++ b/drivers/mmc/host/sdhci-bcm-kona.c
> @@ -225,7 +225,7 @@ static struct sdhci_pltfm_data sdhci_pltfm_data_kona = {
>                 SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
>  };
>  
> -static struct __initconst of_device_id sdhci_bcm_kona_of_match[] = {
> +static struct of_device_id const sdhci_bcm_kona_of_match[] = {
>         { .compatible = "brcm,kona-sdhci"},
>         { .compatible = "bcm,kona-sdhci"}, /* deprecated name */
>         {}
> 

Sorry for giving you trouble over such a simple patch (especially
one that I have acked already), but I just noticed that this is
not following the common style we use in the kernel.

Almost everywhere in Linux, we use

static const struct of_device_id sdhci_bcm_kona_of_match[] = {

not

static struct of_device_id const sdhci_bcm_kona_of_match[] = {

AFAICT they behave in identical ways, but the first one seems
easier to read for someone familiar with kernel code.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Behan Webster Sept. 24, 2014, 6:21 p.m. UTC | #2
On 09/24/14 02:22, Arnd Bergmann wrote:
> On Tuesday 23 September 2014 15:55:08 behanw@converseincode.com wrote:
>> --- a/drivers/mmc/host/sdhci-bcm-kona.c
>> +++ b/drivers/mmc/host/sdhci-bcm-kona.c
>> @@ -225,7 +225,7 @@ static struct sdhci_pltfm_data sdhci_pltfm_data_kona = {
>>                  SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
>>   };
>>   
>> -static struct __initconst of_device_id sdhci_bcm_kona_of_match[] = {
>> +static struct of_device_id const sdhci_bcm_kona_of_match[] = {
>>          { .compatible = "brcm,kona-sdhci"},
>>          { .compatible = "bcm,kona-sdhci"}, /* deprecated name */
>>          {}
>>
> Sorry for giving you trouble over such a simple patch (especially
> one that I have acked already), but I just noticed that this is
> not following the common style we use in the kernel.
It's all good. It's not like you haven't saved me a tonne of time 
already! :)

> Almost everywhere in Linux, we use
>
> static const struct of_device_id sdhci_bcm_kona_of_match[] = {
>
> not
>
> static struct of_device_id const sdhci_bcm_kona_of_match[] = {
True enough. I put the const where I did to be in keeping with the 
intent of __initconst, making the array const instead of the contained type.

> AFAICT they behave in identical ways,
Indeed. For C in both cases the resulting array of struct of_device_id 
ends up in .rodata, so functionally equivalent.

>   but the first one seems
> easier to read for someone familiar with kernel code.
No worries. Happy to post a v3.

Linus Walleij: Would you like me to respin the "gpio, bcm-kona, 
LLVMLinux: Remove use of __initconst" patch as well?

Behan
Linus Walleij Sept. 25, 2014, 8:18 a.m. UTC | #3
On Wed, Sep 24, 2014 at 8:21 PM, Behan Webster
<behanw@converseincode.com> wrote:
> On 09/24/14 02:22, Arnd Bergmann wrote:
>>   but the first one seems
>> easier to read for someone familiar with kernel code.
>
> No worries. Happy to post a v3.
>
> Linus Walleij: Would you like me to respin the "gpio, bcm-kona, LLVMLinux:
> Remove use of __initconst" patch as well?

No it's already applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
index dd780c3..4bb06c8 100644
--- a/drivers/mmc/host/sdhci-bcm-kona.c
+++ b/drivers/mmc/host/sdhci-bcm-kona.c
@@ -225,7 +225,7 @@  static struct sdhci_pltfm_data sdhci_pltfm_data_kona = {
 		SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
 };
 
-static struct __initconst of_device_id sdhci_bcm_kona_of_match[] = {
+static struct of_device_id const sdhci_bcm_kona_of_match[] = {
 	{ .compatible = "brcm,kona-sdhci"},
 	{ .compatible = "bcm,kona-sdhci"}, /* deprecated name */
 	{}