From: Andy Shevchenko <[email protected]>
Subsystems (3)
Andy Shevchenko
reviewerThis is the subset of the patches [1] that should not affect any functionality. Here is the unification of ID tables, a couple of function prototypes, and other small cleanups.
In any case this is Cc'ed to AMD who reported a problem in [1] presumably in the patch that is *not* included here.
v3:
- fixed one more rebase issue in patch 5 (LKP)
v2:
- fixed rebase issue in patch 5 (LKP)
Andy Shevchenko (7):
i2c: designware: Replace a while-loop by for-loop
i2c: designware: Let PCI core to take care about interrupt vectors
i2c: designware: Add missing 'c' into PCI IDs variable name
i2c: designware: Unify terminator in device ID tables
i2c: designware: Always provide device ID tables
i2c: designware: Drop return value from i2c_dw_acpi_configure()
i2c: designware: Drop return value from dw_i2c_of_configure()
drivers/i2c/busses/i2c-designware-common.c | 4 +- drivers/i2c/busses/i2c-designware-core.h | 4 +- drivers/i2c/busses/i2c-designware-pcidrv.c | 22 ++---- drivers/i2c/busses/i2c-designware-platdrv.c | 76 +++++++++------------ 4 files changed, 44 insertions(+), 62 deletions(-)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Andy Shevchenko
reviewerPATCH v3 1/7 i2c: designware: Replace a while-loop by for-loop
Replace a while-loop by for-loop in i2c_dw_probe_lock_support() to save a few lines of code.
--- drivers/i2c/busses/i2c-designware-platdrv.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/i2c/busses/i2c-designware-platdrv.c +1 -4
@@ -238,11 +238,9 @@ static int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)int i =0 ;int ret; - ptr = i2c_dw_semaphore_cb_table; - dev->semaphore_idx =-1 ; -while (ptr->probe) { +for (ptr = i2c_dw_semaphore_cb_table; ptr->probe; ptr++) { ret = ptr->probe (dev);if (ret) {/*
@@ -254,7 +252,6 @@ static int i2c_dw_probe_lock_support(struct dw_i2c_dev *dev)return ret; i++; - ptr++;continue ; }
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Andy Shevchenko
reviewerPATCH v3 2/7 i2c: designware: Let PCI core to take care about interrupt vectors
In reply to Andy ShevchenkoPCI core, after pcim_enable_device(), takes care about the allocated IRQ vectors, no need to do it explicitly and break the cleaning up order.
--- drivers/i2c/busses/i2c-designware-pcidrv.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/i2c/busses/i2c-designware-pcidrv.c +3 -11
@@ -295,10 +295,8 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,if (controller->setup) { r = controller->setup (pdev, controller); -if (r) { -pci_free_irq_vectors (pdev); +if (r)return r; - } }i2c_dw_adjust_bus_speed (dev);
@@ -307,10 +305,8 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,i2c_dw_acpi_configure (&pdev->dev); r =i2c_dw_validate_speed (dev); -if (r) { -pci_free_irq_vectors (pdev); +if (r)return r; - }i2c_dw_configure (dev);
@@ -330,10 +326,8 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, adap->nr = controller->bus_num; r =i2c_dw_probe (dev); -if (r) { -pci_free_irq_vectors (pdev); +if (r)return r; - }if ((dev->flags &MODEL_MASK ) ==MODEL_AMD_NAVI_GPU ) { dev->slave =i2c_new_ccgx_ucsi (&dev->adapter, dev->irq, &dgpu_node);
@@ -359,8 +353,6 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)pm_runtime_get_noresume (&pdev->dev);i2c_del_adapter (&dev->adapter); -devm_free_irq (&pdev->dev, dev->irq, dev); -pci_free_irq_vectors (pdev); }static const struct pci_device_id i2_designware_pci_ids[] = {
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Re: [PATCH v3 2/7] i2c: designware: Let PCI core to take care about interrupt vectors
Quoted 10 lines · Andy Shevchenko
PCI core, after
pcim_enable_device(), takes care about the allocated IRQ vectors, no need to do it explicitly and break the cleaning up order.Reviewed-by Andi Shyti <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/i2c/busses/i2c-designware-pcidrv.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
I wanted to test this due to earlier 9be8bc4dd617 ("i2c: designware-pci: Fix BUG_ON during device removal").
Andy Shevchenko
reviewerPATCH v3 3/7 i2c: designware: Add missing 'c' into PCI IDs variable name
In reply to Andy ShevchenkoAdd missing 'c' into i2c_designware_pci_ids variable name.
--- drivers/i2c/busses/i2c-designware-pcidrv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-designware-pcidrv.c +3 -3
@@ -355,7 +355,7 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)i2c_del_adapter (&dev->adapter); } -static const struct pci_device_id i2_designware_pci_ids[] = { +static const struct pci_device_id i2c_designware_pci_ids[] = {/* Medfield */ {PCI_VDEVICE (INTEL ,0x0817 ), medfield }, {PCI_VDEVICE (INTEL ,0x0818 ), medfield },
@@ -403,16 +403,16 @@ static const struct pci_device_id i2_designware_pci_ids[] = { { PCI_VDEVICE(ATI, 0x7464), navi_amd }, { 0,} }; -MODULE_DEVICE_TABLE (pci, i2_designware_pci_ids); +MODULE_DEVICE_TABLE (pci, i2c_designware_pci_ids);static struct pci_driver dw_i2c_driver = { .name =DRIVER_NAME , - .id_table = i2_designware_pci_ids, .probe = i2c_dw_pci_probe, .remove = i2c_dw_pci_remove, .driver = { .pm = &i2c_dw_pm_ops, }, + .id_table = i2c_designware_pci_ids, };module_pci_driver (dw_i2c_driver);
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Andy Shevchenko
reviewerPATCH v3 4/7 i2c: designware: Unify terminator in device ID tables
In reply to Andy ShevchenkoMake the terminator entry look the same in all device ID tables.
--- drivers/i2c/busses/i2c-designware-pcidrv.c | 2 +- drivers/i2c/busses/i2c-designware-platdrv.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-designware-pcidrv.c +1 -1
@@ -401,7 +401,7 @@ static const struct pci_device_id i2c_designware_pci_ids[] = { { PCI_VDEVICE(ATI, 0x73c4), navi_amd }, { PCI_VDEVICE(ATI, 0x7444), navi_amd }, { PCI_VDEVICE(ATI, 0x7464), navi_amd }, - { 0,} + {} };MODULE_DEVICE_TABLE (pci, i2c_designware_pci_ids);
drivers/i2c/busses/i2c-designware-platdrv.c +2 -2
@@ -58,7 +58,7 @@ static const struct acpi_device_id dw_i2c_acpi_match[] = { { "HISI02A2", 0 }, { "HISI02A3", 0 }, { "HYGO0010", ACCESS_INTR_MASK }, - { } + {} }; MODULE_DEVICE_TABLE(acpi, dw_i2c_acpi_match); #endif
@@ -154,7 +154,7 @@ static const struct of_device_id dw_i2c_of_match[] = { { .compatible = "snps,designware-i2c", }, { .compatible = "mscc,ocelot-i2c", .data = (void *)MODEL_MSCC_OCELOT }, { .compatible = "baikal,bt1-sys-i2c", .data = (void *)MODEL_BAIKAL_BT1 }, - {}, + {} }; MODULE_DEVICE_TABLE(of, dw_i2c_of_match); #else
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Andy Shevchenko
reviewerPATCH v3 5/7 i2c: designware: Always provide device ID tables
In reply to Andy ShevchenkoThere is no need to have ugly ifdeffery and additional macros for the device ID tables. Always provide them. Since we touch the ACPI table, make it sorted by ID.
--- drivers/i2c/busses/i2c-designware-platdrv.c | 64 ++++++++++----------- 1 file changed, 31 insertions(+), 33 deletions(-)
drivers/i2c/busses/i2c-designware-platdrv.c +31 -33
@@ -40,29 +40,6 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)return clk_get_rate (dev->clk) /KILO ; } -#ifdef CONFIG_ACPI -static const struct acpi_device_id dw_i2c_acpi_match[] = { - {"INT33C2" ,0 }, - {"INT33C3" ,0 }, - {"INT3432" ,0 }, - {"INT3433" ,0 }, - {"INTC10EF" ,0 }, - {"80860F41" ,ACCESS_NO_IRQ_SUSPEND }, - {"808622C1" ,ACCESS_NO_IRQ_SUSPEND }, - {"AMD0010" ,ACCESS_INTR_MASK }, - {"AMDI0010" ,ACCESS_INTR_MASK }, - {"AMDI0019" ,ACCESS_INTR_MASK |ARBITRATION_SEMAPHORE }, - {"AMDI0510" ,0 }, - {"APMC0D0F" ,0 }, - {"HISI02A1" ,0 }, - {"HISI02A2" ,0 }, - {"HISI02A3" ,0 }, - {"HYGO0010" ,ACCESS_INTR_MASK }, - {} -}; -MODULE_DEVICE_TABLE (acpi, dw_i2c_acpi_match); -#endif -#ifdef CONFIG_OF #define BT1_I2C_CTL 0x100#define BT1_I2C_CTL_ADDR_MASK GENMASK(7, 0)
@@ -149,14 +126,6 @@ static int dw_i2c_of_configure(struct platform_device *pdev) return 0; } - -static const struct of_device_id dw_i2c_of_match[] = { - { .compatible ="snps,designware-i2c" , }, - { .compatible ="mscc,ocelot-i2c" , .data = (void *)MODEL_MSCC_OCELOT }, - { .compatible ="baikal,bt1-sys-i2c" , .data = (void *)MODEL_BAIKAL_BT1 }, - {} -}; -MODULE_DEVICE_TABLE (of, dw_i2c_of_match);#else static int bt1_i2c_request_regs (struct dw_i2c_dev *dev) {
@@ -477,6 +446,35 @@ static const struct dev_pm_ops dw_i2c_dev_pm_ops = {RUNTIME_PM_OPS (dw_i2c_plat_runtime_suspend, dw_i2c_plat_runtime_resume,NULL ) }; +static const struct of_device_id dw_i2c_of_match[] = { + { .compatible ="snps,designware-i2c" , }, + { .compatible ="mscc,ocelot-i2c" , .data = (void *)MODEL_MSCC_OCELOT }, + { .compatible ="baikal,bt1-sys-i2c" , .data = (void *)MODEL_BAIKAL_BT1 }, + {} +}; +MODULE_DEVICE_TABLE (of, dw_i2c_of_match); + +static const struct acpi_device_id dw_i2c_acpi_match[] = { + {"80860F41" ,ACCESS_NO_IRQ_SUSPEND }, + {"808622C1" ,ACCESS_NO_IRQ_SUSPEND }, + {"AMD0010" ,ACCESS_INTR_MASK }, + {"AMDI0010" ,ACCESS_INTR_MASK }, + {"AMDI0019" ,ACCESS_INTR_MASK |ARBITRATION_SEMAPHORE }, + {"AMDI0510" ,0 }, + {"APMC0D0F" ,0 }, + {"HISI02A1" ,0 }, + {"HISI02A2" ,0 }, + {"HISI02A3" ,0 }, + {"HYGO0010" ,ACCESS_INTR_MASK }, + {"INT33C2" ,0 }, + {"INT33C3" ,0 }, + {"INT3432" ,0 }, + {"INT3433" ,0 }, + {"INTC10EF" ,0 }, + {} +}; +MODULE_DEVICE_TABLE (acpi, dw_i2c_acpi_match); +static const struct platform_device_id dw_i2c_platform_ids[] = { {"i2c_designware" }, {}
@@ -488,8 +486,8 @@ static struct platform_driver dw_i2c_driver = { .remove_new = dw_i2c_plat_remove, .driver = { .name = "i2c_designware", - .of_match_table = of_match_ptr(dw_i2c_of_match), - .acpi_match_table = ACPI_PTR(dw_i2c_acpi_match), + .of_match_table = dw_i2c_of_match, + .acpi_match_table = dw_i2c_acpi_match, .pm = pm_ptr(&dw_i2c_dev_pm_ops), }, .id_table = dw_i2c_platform_ids,
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Andy Shevchenko
reviewerPATCH v3 6/7 i2c: designware: Drop return value from i2c_dw_acpi_configure()
In reply to Andy Shevchenkoi2c_dw_acpi_configure() is called without checking of the returned value, hence just drop it by converting to void.
--- drivers/i2c/busses/i2c-designware-common.c | 4 +--- drivers/i2c/busses/i2c-designware-core.h | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-designware-common.c +1 -3
@@ -255,7 +255,7 @@ static void i2c_dw_acpi_params(struct device *device, char method[],kfree (buf.pointer); } -int i2c_dw_acpi_configure (struct device *device) +void i2c_dw_acpi_configure (struct device *device) {struct dw_i2c_dev *dev =dev_get_drvdata (device);struct i2c_timings *t = &dev->timings;
@@ -285,8 +285,6 @@ int i2c_dw_acpi_configure(struct device *device) dev->sda_hold_time = fs_ht;break ; } - -return 0 ; }EXPORT_SYMBOL_GPL (i2c_dw_acpi_configure);
drivers/i2c/busses/i2c-designware-core.h +2 -2
@@ -420,7 +420,7 @@ int i2c_dw_validate_speed(struct dw_i2c_dev *dev);void i2c_dw_adjust_bus_speed (struct dw_i2c_dev *dev);#if IS_ENABLED (CONFIG_ACPI ) -int i2c_dw_acpi_configure (struct device *device); +void i2c_dw_acpi_configure (struct device *device);#else -static inline int i2c_dw_acpi_configure (struct device *device) {return -ENODEV ; } +static inline void i2c_dw_acpi_configure (struct device *device) { }#endif
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Andy Shevchenko
reviewerPATCH v3 7/7 i2c: designware: Drop return value from dw_i2c_of_configure()
In reply to Andy Shevchenkodw_i2c_of_configure() is called without checking of the returned value, hence just drop it by converting to void.
--- drivers/i2c/busses/i2c-designware-platdrv.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-designware-platdrv.c +2 -5
@@ -110,7 +110,7 @@ static int mscc_twi_set_sda_hold_time(struct dw_i2c_dev *dev)return 0 ; } -static int dw_i2c_of_configure (struct platform_device *pdev) +static void dw_i2c_of_configure (struct platform_device *pdev) {struct dw_i2c_dev *dev =platform_get_drvdata (pdev);
@@ -123,8 +123,6 @@ static int dw_i2c_of_configure(struct platform_device *pdev)default : break; } - -return 0 ; }#else static int bt1_i2c_request_regs (struct dw_i2c_dev *dev)
@@ -132,9 +130,8 @@ static int bt1_i2c_request_regs(struct dw_i2c_dev *dev) return -ENODEV; } -static inline int dw_i2c_of_configure (struct platform_device *pdev) +static inline void dw_i2c_of_configure (struct platform_device *pdev) { -return -ENODEV ; }#endif
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Andi Shyti
maintainerHi Andy,
Quoted 15 lines · Andy Shevchenko
This is the subset of the patches [1] that should not affect any functionality. Here is the unification of ID tables, a couple of function prototypes, and other small cleanups.
In any case this is Cc'ed to AMD who reported a problem in [1] presumably in the patch that is *not* included here.
v3:
- fixed one more rebase issue in patch 5 (LKP)v2:
- fixed rebase issue in patch 5 (LKP)
Quoted 8 lines
Andy Shevchenko (7):
i2c: designware: Replace a while-loop by for-loop
i2c: designware: Let PCI core to take care about interrupt vectors
i2c: designware: Add missing 'c' into PCI IDs variable name
i2c: designware: Unify terminator in device ID tables
i2c: designware: Always provide device ID tables
i2c: designware: Drop return value fromi2c_dw_acpi_configure()
i2c: designware: Drop return value fromdw_i2c_of_configure()
It all applies neatly on my branch and it's all reviewed by me. I will keep it for a few more days so that others have a chance to review this series as well.
Thanks,
Andi
Andi Shyti
maintainerHi Andy,
All merged to i2c/i2c-host.
Thanks,
Andi
Quoted 33 lines · Andy Shevchenko
This is the subset of the patches [1] that should not affect any functionality. Here is the unification of ID tables, a couple of function prototypes, and other small cleanups.
In any case this is Cc'ed to AMD who reported a problem in [1] presumably in the patch that is *not* included here.
v3:
- fixed one more rebase issue in patch 5 (LKP)v2:
- fixed rebase issue in patch 5 (LKP)Andy Shevchenko (7):
i2c: designware: Replace a while-loop by for-loop
i2c: designware: Let PCI core to take care about interrupt vectors
i2c: designware: Add missing 'c' into PCI IDs variable name
i2c: designware: Unify terminator in device ID tables
i2c: designware: Always provide device ID tables
i2c: designware: Drop return value fromi2c_dw_acpi_configure()
i2c: designware: Drop return value fromdw_i2c_of_configure()drivers/i2c/busses/i2c-designware-common.c | 4 +- drivers/i2c/busses/i2c-designware-core.h | 4 +- drivers/i2c/busses/i2c-designware-pcidrv.c | 22 ++---- drivers/i2c/busses/i2c-designware-platdrv.c | 76 +++++++++------------ 4 files changed, 44 insertions(+), 62 deletions(-)Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Andy Shevchenko
reviewerQuoted 3 lines · Andi Shyti
Hi Andy,
All merged to i2c/i2c-host.
Thank you!
Signature · 2 lines
With Best Regards, Andy Shevchenko