mfd: intel_quark_i2c_gpio: revert "Constify static struct resources"
PATCH 1/5 mfd: intel_quark_i2c_gpio: revert "Constify static struct resources"
The structures are used as place holders, so they are modified at run-time. Obviously they may not be constants.
BUG: unable to handle page fault for address: d0643220 ... CPU: 0 PID: 110 Comm: modprobe Not tainted 5.11.0+ #1 Hardware name: Intel Corp. QUARK/GalileoGen2, BIOS 0x01000200 01/01/2014 EIP: intel_quark_mfd_probe+0x93/0x1c0 [intel_quark_i2c_gpio]
This partially reverts the commit c4a164f41554d2899bed94bdcc499263f41787b4.
While at it, add a comment to avoid similar changes in the future.
--- drivers/mfd/intel_quark_i2c_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mfd/intel_quark_i2c_gpio.c +4 -2
@@ -72,7 +72,8 @@ static const struct dmi_system_id dmi_platform_info[] = { {} }; -static const struct resource intel_quark_i2c_res[] = { +/* This is used as a place holder and will be modified at run-time */ +static struct resource intel_quark_i2c_res[] = { [INTEL_QUARK_IORES_MEM ] = { .flags =IORESOURCE_MEM , },
@@ -85,7 +86,8 @@ static struct mfd_cell_acpi_match intel_quark_acpi_match_i2c = { .adr = MFD_ACPI_MATCH_I2C, }; -static const struct resource intel_quark_gpio_res[] = { +/* This is used as a place holder and will be modified at run-time */ +static struct resource intel_quark_gpio_res[] = { [INTEL_QUARK_IORES_MEM ] = { .flags =IORESOURCE_MEM , },
Signature · 1 line
2.30.1
PATCH 2/5 mfd: intel_quark_i2c_gpio: Unregister resources in reversed order
In ->remove() unregister resources in reversed order, i.e. MFD devices first followed by I²C clock.
--- drivers/mfd/intel_quark_i2c_gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/intel_quark_i2c_gpio.c +1 -1
@@ -269,8 +269,8 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,static void intel_quark_mfd_remove (struct pci_dev *pdev) { -intel_quark_unregister_i2c_clk (&pdev->dev);mfd_remove_devices (&pdev->dev); +intel_quark_unregister_i2c_clk (&pdev->dev); }static struct pci_driver intel_quark_mfd_driver = {
Signature · 1 line
2.30.1
Lee Jones
AppliedRe: [PATCH v1 2/5] mfd: intel_quark_i2c_gpio: Unregister resources in reversed order
Quoted 7 lines · Andy Shevchenko
In ->remove() unregister resources in reversed order, i.e. MFD devices first followed by I²C clock.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH 3/5 mfd: intel_quark_i2c_gpio: Remove unused struct device member
In reply to Andy ShevchenkoThe device pointer in the custom structure is not used anywhere, remove it for good.
--- drivers/mfd/intel_quark_i2c_gpio.c | 2 -- 1 file changed, 2 deletions(-)
drivers/mfd/intel_quark_i2c_gpio.c +0 -2
@@ -45,7 +45,6 @@#define INTEL_QUARK_I2C_CLK_HZ 33000000struct intel_quark_mfd { -struct device *dev;struct clk *i2c_clk;struct clk_lookup *i2c_clk_lookup; };
@@ -239,7 +238,6 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,if (!quark_mfd)return -ENOMEM ; - quark_mfd->dev = &pdev->dev;dev_set_drvdata (&pdev->dev, quark_mfd); ret =intel_quark_register_i2c_clk (&pdev->dev);
Signature · 1 line
2.30.1
Lee Jones
AppliedRe: [PATCH v1 3/5] mfd: intel_quark_i2c_gpio: Remove unused struct device member
Quoted 7 lines · Andy Shevchenko
The device pointer in the custom structure is not used anywhere, remove it for good.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 2 -- 1 file changed, 2 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH 4/5 mfd: intel_quark_i2c_gpio: Replace I²C speeds with descriptive definitions
In reply to Andy ShevchenkoI²C header provides a descriptive definitions for standard bus speeds. Use them instead of plain numbers.
--- drivers/mfd/intel_quark_i2c_gpio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mfd/intel_quark_i2c_gpio.c +5 -4
@@ -16,6 +16,7 @@#include <linux/clkdev.h> #include <linux/clk-provider.h> #include <linux/dmi.h> +#include <linux/i2c.h> #include <linux/platform_data/gpio-dwapb.h> #include <linux/platform_data/i2c-designware.h>
@@ -54,19 +55,19 @@ static const struct dmi_system_id dmi_platform_info[] = { .matches = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "Galileo"), }, - .driver_data = (void *)100000, + .driver_data = (void *)I2C_MAX_STANDARD_MODE_FREQ, }, { .matches = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "GalileoGen2"), }, - .driver_data = (void *)400000, + .driver_data = (void *)I2C_MAX_FAST_MODE_FREQ, }, { .matches = { DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), }, - .driver_data = (void *)400000, + .driver_data = (void *)I2C_MAX_FAST_MODE_FREQ, }, {} };
@@ -176,7 +177,7 @@ static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell)return -ENOMEM ;/* Normal mode by default */ - pdata->i2c_scl_freq =100000 ; + pdata->i2c_scl_freq =I2C_MAX_STANDARD_MODE_FREQ ; dmi_id =dmi_first_match (dmi_platform_info);if (dmi_id)
Signature · 1 line
2.30.1
Lee Jones
AppliedRe: [PATCH v1 4/5] mfd: intel_quark_i2c_gpio: Replace I²C speeds with descriptive definitions
Quoted 7 lines · Andy Shevchenko
I²C header provides a descriptive definitions for standard bus speeds. Use them instead of plain numbers.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH 5/5 mfd: intel_quark_i2c_gpio: Reuse BAR definitions for MFD cell indexing
In reply to Andy ShevchenkoIt's convenient and less error prone to use definitions to address different cells in an array. For this purpose we may reuse existing BAR definitions.
--- drivers/mfd/intel_quark_i2c_gpio.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/mfd/intel_quark_i2c_gpio.c +10 -10
@@ -98,14 +98,6 @@ static struct mfd_cell_acpi_match intel_quark_acpi_match_gpio = { };static struct mfd_cell intel_quark_mfd_cells[] = { - { - .id =MFD_GPIO_BAR , - .name ="gpio-dwapb" , - .acpi_match = &intel_quark_acpi_match_gpio, - .num_resources =ARRAY_SIZE (intel_quark_gpio_res), - .resources = intel_quark_gpio_res, - .ignore_resource_conflicts = true, - }, { .id =MFD_I2C_BAR , .name ="i2c_designware" ,
@@ -114,6 +106,14 @@ static struct mfd_cell intel_quark_mfd_cells[] = { .resources = intel_quark_i2c_res, .ignore_resource_conflicts = true, }, + { + .id = MFD_GPIO_BAR, + .name = "gpio-dwapb", + .acpi_match = &intel_quark_acpi_match_gpio, + .num_resources = ARRAY_SIZE(intel_quark_gpio_res), + .resources = intel_quark_gpio_res, + .ignore_resource_conflicts = true, + }, };static const struct pci_device_id intel_quark_mfd_ids[] = {
@@ -245,11 +245,11 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,if (ret)return ret; - ret =intel_quark_i2c_setup (pdev, &intel_quark_mfd_cells[1 ]); + ret =intel_quark_i2c_setup (pdev, &intel_quark_mfd_cells[MFD_I2C_BAR ]);if (ret) goto err_unregister_i2c_clk; - ret =intel_quark_gpio_setup (pdev, &intel_quark_mfd_cells[0 ]); + ret =intel_quark_gpio_setup (pdev, &intel_quark_mfd_cells[MFD_GPIO_BAR ]);if (ret) goto err_unregister_i2c_clk;
Signature · 1 line
2.30.1
Re: [PATCH v1 5/5] mfd: intel_quark_i2c_gpio: Reuse BAR definitions for MFD cell indexing
Quoted 31 lines · Andy Shevchenko
It's convenient and less error prone to use definitions to address different cells in an array. For this purpose we may reuse existing BAR definitions.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)drivers/mfd/intel_quark_i2c_gpio.c +0
-8@@ -98,14 +98,6 @@ static struct mfd_cell_acpi_match intel_quark_acpi_match_gpio = { };static struct mfd_cell intel_quark_mfd_cells[] = { - { - .id =MFD_GPIO_BAR , - .name ="gpio-dwapb" , - .acpi_match = &intel_quark_acpi_match_gpio, - .num_resources =ARRAY_SIZE (intel_quark_gpio_res), - .resources = intel_quark_gpio_res, - .ignore_resource_conflicts = true, - }, { .id =MFD_I2C_BAR , .name ="i2c_designware" ,@@ -114,6 +106,14 @@ static struct mfd_cell intel_quark_mfd_cells[] = { .resources = intel_quark_i2c_res, .ignore_resource_conflicts = true,
drivers/mfd/intel_quark_i2c_gpio.c static struct mfd_cell intel_quark_mfd_cells[] = { · line 117
Quoted 10 lines
drivers/mfd/intel_quark_i2c_gpio.c +8
-0}, + { + .id = MFD_GPIO_BAR, + .name = "gpio-dwapb", + .acpi_match = &intel_quark_acpi_match_gpio, + .num_resources = ARRAY_SIZE(intel_quark_gpio_res), + .resources = intel_quark_gpio_res, + .ignore_resource_conflicts = true, + }, };
I would make this more explicit.
[MFD_I2C_BAR] = { }
If someone comes along and re-reorders these, it will break.
Quoted 15 lines
drivers/mfd/intel_quark_i2c_gpio.c +2
-2static const struct pci_device_id intel_quark_mfd_ids[] = {@@ -245,11 +245,11 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,if (ret)return ret; - ret =intel_quark_i2c_setup (pdev, &intel_quark_mfd_cells[1 ]); + ret =intel_quark_i2c_setup (pdev, &intel_quark_mfd_cells[MFD_I2C_BAR ]);if (ret) goto err_unregister_i2c_clk; - ret =intel_quark_gpio_setup (pdev, &intel_quark_mfd_cells[0 ]); + ret =intel_quark_gpio_setup (pdev, &intel_quark_mfd_cells[MFD_GPIO_BAR ]);if (ret) goto err_unregister_i2c_clk;
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v1 5/5] mfd: intel_quark_i2c_gpio: Reuse BAR definitions for MFD cell indexing
Quoted 5 lines · Lee Jones
Quoted 3 lines · Andy Shevchenko
It's convenient and less error prone to use definitions to address different cells in an array. For this purpose we may reuse existing BAR definitions.
...
Quoted 12 lines
drivers/mfd/intel_quark_i2c_gpio.c static struct mfd_cell intel_quark_mfd_cells[] = { · line 117
Quoted 9 lines
drivers/mfd/intel_quark_i2c_gpio.c +8
-0+ { + .id = MFD_GPIO_BAR, + .name = "gpio-dwapb", + .acpi_match = &intel_quark_acpi_match_gpio, + .num_resources = ARRAY_SIZE(intel_quark_gpio_res), + .resources = intel_quark_gpio_res, + .ignore_resource_conflicts = true, + }, };I would make this more explicit.
Quoted 3 lines
[
MFD_I2C_BAR] = { }If someone comes along and re-reorders these, it will break.
Agree.
Will do for v2.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 47 lines · Andy Shevchenko
The structures are used as place holders, so they are modified at run-time. Obviously they may not be constants.
BUG: unable to handle page fault for address: d0643220 ... CPU: 0 PID: 110 Comm: modprobe Not tainted 5.11.0+ #1 Hardware name: Intel Corp. QUARK/GalileoGen2, BIOS 0x01000200 01/01/2014 EIP: intel_quark_mfd_probe+0x93/0x1c0 [intel_quark_i2c_gpio]This partially reverts the commit
c4a164f41554d2899bed94bdcc499263f41787b4.While at it, add a comment to avoid similar changes in the future.
Fixes c4a164f41554 ("mfd: Constify static struct resources")Cc Rikard Falkeborn <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mfd/intel_quark_i2c_gpio.c +4
-2@@ -72,7 +72,8 @@ static const struct dmi_system_id dmi_platform_info[] = { {} }; -static const struct resource intel_quark_i2c_res[] = { +/* This is used as a place holder and will be modified at run-time */ +static struct resource intel_quark_i2c_res[] = { [INTEL_QUARK_IORES_MEM ] = { .flags =IORESOURCE_MEM , },@@ -85,7 +86,8 @@ static struct mfd_cell_acpi_match intel_quark_acpi_match_i2c = { .adr = MFD_ACPI_MATCH_I2C, }; -static const struct resource intel_quark_gpio_res[] = { +/* This is used as a place holder and will be modified at run-time */ +static struct resource intel_quark_gpio_res[] = { [INTEL_QUARK_IORES_MEM ] = { .flags =IORESOURCE_MEM , },Signature · 1 line
2.30.1
Sorry about that :(
Quoted 51 lines · Rikard Falkeborn
Quoted 47 lines · Andy Shevchenko
The structures are used as place holders, so they are modified at run-time. Obviously they may not be constants.
BUG: unable to handle page fault for address: d0643220 ... CPU: 0 PID: 110 Comm: modprobe Not tainted 5.11.0+ #1 Hardware name: Intel Corp. QUARK/GalileoGen2, BIOS 0x01000200 01/01/2014 EIP: intel_quark_mfd_probe+0x93/0x1c0 [intel_quark_i2c_gpio]This partially reverts the commit
c4a164f41554d2899bed94bdcc499263f41787b4.While at it, add a comment to avoid similar changes in the future.
Fixes c4a164f41554 ("mfd: Constify static struct resources")Cc Rikard Falkeborn <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mfd/intel_quark_i2c_gpio.c +4
-2@@ -72,7 +72,8 @@ static const struct dmi_system_id dmi_platform_info[] = { {} }; -static const struct resource intel_quark_i2c_res[] = { +/* This is used as a place holder and will be modified at run-time */ +static struct resource intel_quark_i2c_res[] = { [INTEL_QUARK_IORES_MEM ] = { .flags =IORESOURCE_MEM , },@@ -85,7 +86,8 @@ static struct mfd_cell_acpi_match intel_quark_acpi_match_i2c = { .adr = MFD_ACPI_MATCH_I2C, }; -static const struct resource intel_quark_gpio_res[] = { +/* This is used as a place holder and will be modified at run-time */ +static struct resource intel_quark_gpio_res[] = { [INTEL_QUARK_IORES_MEM ] = { .flags =IORESOURCE_MEM , },Signature · 1 line
2.30.1Sorry about that :(
Quoted 1 line
Reviewed-by Rikard Falkeborn <[email protected]>
Thanks for review!
Lee, this series has a critical bug fix, should I do something or you is going to apply this soon?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 49 lines · Andy Shevchenko
Quoted 48 lines · Rikard Falkeborn
Quoted 35 lines · Andy Shevchenko
The structures are used as place holders, so they are modified at run-time. Obviously they may not be constants.
BUG: unable to handle page fault for address: d0643220 ... CPU: 0 PID: 110 Comm: modprobe Not tainted 5.11.0+ #1 Hardware name: Intel Corp. QUARK/GalileoGen2, BIOS 0x01000200 01/01/2014 EIP: intel_quark_mfd_probe+0x93/0x1c0 [intel_quark_i2c_gpio]This partially reverts the commit
c4a164f41554d2899bed94bdcc499263f41787b4.While at it, add a comment to avoid similar changes in the future.
Fixes c4a164f41554 ("mfd: Constify static struct resources")Cc Rikard Falkeborn <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/mfd/intel_quark_i2c_gpio.c +2
-1@@ -72,7 +72,8 @@ static const struct dmi_system_id dmi_platform_info[] = { {} }; -static const struct resource intel_quark_i2c_res[] = { +/* This is used as a place holder and will be modified at run-time */ +static struct resource intel_quark_i2c_res[] = { [INTEL_QUARK_IORES_MEM ] = { .flags =IORESOURCE_MEM , },drivers/mfd/intel_quark_i2c_gpio.c static struct mfd_cell_acpi_match intel_quark_acpi_match_i2c = { · line 93
Quoted 9 lines
drivers/mfd/intel_quark_i2c_gpio.c +2
-1@@ -85,7 +86,8 @@ static struct mfd_cell_acpi_match intel_quark_acpi_match_i2c = { .adr = MFD_ACPI_MATCH_I2C, }; -static const struct resource intel_quark_gpio_res[] = { +/* This is used as a place holder and will be modified at run-time */ +static struct resource intel_quark_gpio_res[] = { [INTEL_QUARK_IORES_MEM ] = { .flags =IORESOURCE_MEM , },Sorry about that :(
Quoted 6 lines
Quoted 1 line
Reviewed-by Rikard Falkeborn <[email protected]>Thanks for review!
Lee, this series has a critical bug fix, should I do something or you is going to apply this soon?
It's on my to-review list.
I can prioritise bug fixes though - can it be applied by itself?
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 3 lines · Lee Jones
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Rikard Falkeborn
On Tue, Mar 02, 2021 at 03:56:16PM +0200, Andy Shevchenko wrote:
...
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Sorry about that :(
Reviewed-by Rikard Falkeborn <[email protected]>
Quoted 8 lines
Quoted 4 lines
Thanks for review!
Lee, this series has a critical bug fix, should I do something or you is going to apply this soon?
It's on my to-review list.
I can prioritise bug fixes though - can it be applied by itself?
Sire, that's why it's at the beginning of the series.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 11 lines · Andy Shevchenko
The structures are used as place holders, so they are modified at run-time. Obviously they may not be constants.
BUG: unable to handle page fault for address: d0643220 ... CPU: 0 PID: 110 Comm: modprobe Not tainted 5.11.0+ #1 Hardware name: Intel Corp. QUARK/GalileoGen2, BIOS 0x01000200 01/01/2014 EIP: intel_quark_mfd_probe+0x93/0x1c0 [intel_quark_i2c_gpio]This partially reverts the commit
c4a164f41554d2899bed94bdcc499263f41787b4.
Quoted 8 lines
While at it, add a comment to avoid similar changes in the future.
Fixes c4a164f41554 ("mfd: Constify static struct resources")Cc Rikard Falkeborn <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Applied to -fixes for testing, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 15 lines · Lee Jones
Quoted 13 lines · Andy Shevchenko
The structures are used as place holders, so they are modified at run-time. Obviously they may not be constants.
BUG: unable to handle page fault for address: d0643220 ... CPU: 0 PID: 110 Comm: modprobe Not tainted 5.11.0+ #1 Hardware name: Intel Corp. QUARK/GalileoGen2, BIOS 0x01000200 01/01/2014 EIP: intel_quark_mfd_probe+0x93/0x1c0 [intel_quark_i2c_gpio]This partially reverts the commit
c4a164f41554d2899bed94bdcc499263f41787b4.While at it, add a comment to avoid similar changes in the future.
Quoted 8 lines
Quoted 6 lines
Fixes c4a164f41554 ("mfd: Constify static struct resources")Cc Rikard Falkeborn <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/mfd/intel_quark_i2c_gpio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)Applied to -fixes for testing, thanks.
Thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko