Skip to contentSkip to conversation

gpio, bcm-kona, LLVMLinux: Remove use of __initconst

PATCH Superseded [email protected] 5 participants 12 messages Sep 23, 2014 – Oct 3, 2014

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio, bcm-kona, LLVMLinux: Remove use of __initconst

From: Behan Webster <[email protected]>

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.

---
 drivers/gpio/gpio-bcm-kona.c      | 2 +-
 drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-bcm-kona.c +1 -1
index 3f6b33c..de0801e 100644
@@ -496,7 +496,7 @@ static struct irq_chip bcm_gpio_irq_chip = {
 	.irq_release_resources = bcm_kona_gpio_irq_relres,
 };
 
-static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {
+static struct of_device_id const bcm_kona_gpio_of_match[] = {
 	{ .compatible = "brcm,kona-gpio" },
 	{}
 };
drivers/mmc/host/sdhci-bcm-kona.c +1 -1
index dd780c3..4bb06c8 100644
@@ -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 */
 	{}
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 33 lines · On Tue, Sep 23, 2014 at 12:30:16PM -0700, [email protected] wrote:

From: Behan Webster <[email protected]>

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.

---
 drivers/gpio/gpio-bcm-kona.c      | 2 +-
 drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-bcm-kona.c +1 -1
index 3f6b33c..de0801e 100644
@@ -496,7 +496,7 @@ static struct irq_chip bcm_gpio_irq_chip = {
 	.irq_release_resources = bcm_kona_gpio_irq_relres,
 };
 
-static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {
+static struct of_device_id const bcm_kona_gpio_of_match[] = {
 	{ .compatible = "brcm,kona-gpio" },
 	{}
 };
drivers/mmc/host/sdhci-bcm-kona.c +0 -0
index dd780c3..4bb06c8 100644

drivers/mmc/host/sdhci-bcm-kona.c static struct sdhci_pltfm_data sdhci_pltfm_data_kona = { · line 231

Quoted 8 lines
drivers/mmc/host/sdhci-bcm-kona.c +1 -1
@@ -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 */
 	{}

-Matt

#2 lore raw
In reply to [email protected]
Quoted 7 lines · On Tue, Sep 23, 2014 at 12:30:16PM -0700, [email protected] wrote:

From: Behan Webster <[email protected]>

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.

Quoted 7 lines
---
 drivers/gpio/gpio-bcm-kona.c      | 2 +-
 drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

As mentioned on IRC, Linus, Chris, and Ulf probably would like this split to go into each respective tree.

-Matt

Quoted 30 lines
drivers/gpio/gpio-bcm-kona.c +1 -1
index 3f6b33c..de0801e 100644
@@ -496,7 +496,7 @@ static struct irq_chip bcm_gpio_irq_chip = {
 	.irq_release_resources = bcm_kona_gpio_irq_relres,
 };
 
-static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {
+static struct of_device_id const bcm_kona_gpio_of_match[] = {
 	{ .compatible = "brcm,kona-gpio" },
 	{}
 };
drivers/mmc/host/sdhci-bcm-kona.c +1 -1
index dd780c3..4bb06c8 100644
@@ -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 */
 	{}
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 1/2 gpio, bcm-kona, LLVMLinux: Remove use of __initconst

From: Behan Webster <[email protected]>

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.

---
 drivers/gpio/gpio-bcm-kona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-bcm-kona.c +1 -1
index 3f6b33c..de0801e 100644
@@ -496,7 +496,7 @@ static struct irq_chip bcm_gpio_irq_chip = {
 	.irq_release_resources = bcm_kona_gpio_irq_relres,
 };
 
-static struct __initconst of_device_id bcm_kona_gpio_of_match[] = {
+static struct of_device_id const bcm_kona_gpio_of_match[] = {
 	{ .compatible = "brcm,kona-gpio" },
 	{}
 };
Signature · 1 line
1.9.1
#4 lore raw

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

From: Behan Webster <[email protected]>

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.

---
 drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-bcm-kona.c +1 -1
index dd780c3..4bb06c8 100644
@@ -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 */
 	{}
Signature · 1 line
1.9.1
#11 lore raw
In reply to Matt Porter
Quoted 15 lines · Matt Porter
Quoted 7 lines · On Tue, Sep 23, 2014 at 12:30:16PM -0700, [email protected] wrote:

From: Behan Webster <[email protected]>

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.

Quoted 7 lines
---
  drivers/gpio/gpio-bcm-kona.c      | 2 +-
  drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 2 lines

As mentioned on IRC, Linus, Chris, and Ulf probably would like this split to go into each respective tree.

Thanks Matt.

I reposted as a 2 patch series. Strictly speaking one patch is for each tree.

Behan

Signature · 2 lines
Behan Webster
[email protected]
#5 lore raw

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

In reply to [email protected]

drivers/mmc/host/sdhci-bcm-kona.c static struct sdhci_pltfm_data sdhci_pltfm_data_kona = { · line 231

Quoted 12 lines · On Tuesday 23 September 2014 15:55:08 [email protected] wrote:
drivers/mmc/host/sdhci-bcm-kona.c +1 -1
@@ -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

#10 lore raw
In reply to [email protected]
Quoted 11 lines · On Wed, Sep 24, 2014 at 12:55 AM, <[email protected]> wrote:

From: Behan Webster <[email protected]>

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.

Patch applied.

Yours,
Linus Walleij

#6 lore raw

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

In reply to Arnd Bergmann
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · On Tuesday 23 September 2014 15:55:08 [email protected] wrote:
drivers/mmc/host/sdhci-bcm-kona.c +0 -0
@@ -225,7 +225,7 @@ static struct sdhci_pltfm_data sdhci_pltfm_data_kona = {
                 SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
  };
 
Quoted 9 lines

drivers/mmc/host/sdhci-bcm-kona.c static struct sdhci_pltfm_data sdhci_pltfm_data_kona = { · line 231

Quoted 6 lines
drivers/mmc/host/sdhci-bcm-kona.c +1 -1
-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! :)

Quoted 7 lines

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.

Quoted 1 line

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.

Quoted 2 lines

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

Signature · 2 lines
Behan Webster
[email protected]
#7 lore raw

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

Quoted 8 lines · Behan Webster
Quoted 2 lines · Arnd Bergmann

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

#8 lore raw

PATCH v3 1/1 mmc, sdhci, bcm-kona, LLVMLinux: Remove use of __initconst

In reply to Arnd Bergmann

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.

---
 drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-bcm-kona.c +1 -1
index dd780c3..d085dfe 100644
@@ -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 const struct of_device_id sdhci_bcm_kona_of_match[] = {
 	{ .compatible = "brcm,kona-sdhci"},
 	{ .compatible = "bcm,kona-sdhci"}, /* deprecated name */
 	{}
Signature · 1 line
1.9.1
Applied
#9 lore raw

Re: [PATCH v3] mmc, sdhci, bcm-kona, LLVMLinux: Remove use of __initconst

Quoted 9 lines · Behan Webster

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.

Thanks! Applied for next.

Kind regards
Uffe

Quoted 20 lines
---
 drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-bcm-kona.c +1 -2
index dd780c3..d085dfe 100644
@@ -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 const struct of_device_id sdhci_bcm_kona_of_match[] = {
        { .compatible = "brcm,kona-sdhci"},
        { .compatible = "bcm,kona-sdhci"}, /* deprecated name */
        {}
--

1.9.1