From a76d19e6acb1ef16561b0682cd1a566463fa3d98 Mon Sep 17 00:00:00 2001 From: Benjamin Gray Date: Tue, 28 Feb 2023 10:33:17 +1100 Subject: i2c: Disable I2C_APPLE when I2C_PASEMI is a builtin The ppc64le_allmodconfig sets I2C_PASEMI=y and leaves COMPILE_TEST to default to y and I2C_APPLE to default to m, running into a known incompatible configuration that breaks the build [1]. Specifically, a common dependency (i2c-pasemi-core.o in this case) cannot be used by both builtin and module consumers. Disable I2C_APPLE when I2C_PASEMI is a builtin to prevent this. [1]: https://lore.kernel.org/all/202112061809.XT99aPrf-lkp@intel.com Suggested-by: Arnd Bergmann Signed-off-by: Benjamin Gray Acked-by: Arnd Bergmann Acked-by: Sven Peter Signed-off-by: Wolfram Sang --- drivers/i2c/busses/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 9b8e84f20604..25eb4e8fd22f 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -914,6 +914,7 @@ config I2C_PASEMI config I2C_APPLE tristate "Apple SMBus platform driver" + depends on !I2C_PASEMI depends on ARCH_APPLE || COMPILE_TEST default ARCH_APPLE help -- cgit v1.2.3 From 1d092308ce223bb1403475737b8fb847e9e8704c Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Fri, 17 Feb 2023 23:13:30 +0100 Subject: i2c: gxp: remove "empty" switch statement There used to be error messages which had to go. Now, it only consists of 'break's, so it can go. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-gxp.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/i2c/busses/i2c-gxp.c b/drivers/i2c/busses/i2c-gxp.c index da4c8e5a8039..352dedf6292f 100644 --- a/drivers/i2c/busses/i2c-gxp.c +++ b/drivers/i2c/busses/i2c-gxp.c @@ -126,19 +126,8 @@ static int gxp_i2c_master_xfer(struct i2c_adapter *adapter, time_left = wait_for_completion_timeout(&drvdata->completion, adapter->timeout); ret = num - drvdata->msgs_remaining; - if (time_left == 0) { - switch (drvdata->state) { - case GXP_I2C_WDATA_PHASE: - break; - case GXP_I2C_RDATA_PHASE: - break; - case GXP_I2C_ADDR_PHASE: - break; - default: - break; - } + if (time_left == 0) return -ETIMEDOUT; - } if (drvdata->state == GXP_I2C_ADDR_NACK || drvdata->state == GXP_I2C_DATA_NACK) -- cgit v1.2.3 From 4b3dfb0ed6336dea4a763ce9fa30a42763eb3800 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Mon, 20 Feb 2023 15:40:59 +0100 Subject: i2c: gxp: return proper error on address NACK According to Documentation/i2c/fault-codes.rst, NACK after sending an address should be -ENXIO. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-gxp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/i2c/busses/i2c-gxp.c b/drivers/i2c/busses/i2c-gxp.c index 352dedf6292f..fda7809e72ba 100644 --- a/drivers/i2c/busses/i2c-gxp.c +++ b/drivers/i2c/busses/i2c-gxp.c @@ -129,8 +129,10 @@ static int gxp_i2c_master_xfer(struct i2c_adapter *adapter, if (time_left == 0) return -ETIMEDOUT; - if (drvdata->state == GXP_I2C_ADDR_NACK || - drvdata->state == GXP_I2C_DATA_NACK) + if (drvdata->state == GXP_I2C_ADDR_NACK) + return -ENXIO; + + if (drvdata->state == GXP_I2C_DATA_NACK) return -EIO; return ret; -- cgit v1.2.3 From 65609d3206f784489eb1ebd6fce64b84a42cc63c Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 27 Feb 2023 13:06:33 +0300 Subject: i2c: gxp: fix an error code in probe This is passing IS_ERR() instead of PTR_ERR() so instead of an error code it prints and returns the number 1. Fixes: 4a55ed6f89f5 ("i2c: Add GXP SoC I2C Controller") Signed-off-by: Dan Carpenter Reviewed-by: Nick Hawkins Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-gxp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/i2c/busses/i2c-gxp.c b/drivers/i2c/busses/i2c-gxp.c index fda7809e72ba..d4b55d989a26 100644 --- a/drivers/i2c/busses/i2c-gxp.c +++ b/drivers/i2c/busses/i2c-gxp.c @@ -516,7 +516,7 @@ static int gxp_i2c_probe(struct platform_device *pdev) i2cg_map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "hpe,sysreg"); if (IS_ERR(i2cg_map)) { - return dev_err_probe(&pdev->dev, IS_ERR(i2cg_map), + return dev_err_probe(&pdev->dev, PTR_ERR(i2cg_map), "failed to map i2cg_handle\n"); } -- cgit v1.2.3