i2c: Enable compile testing for some of drivers
Subsystems (2)
PATCH v2 1/2 i2c: Enable compile testing for some of drivers
Some of the I2C bus drivers can be compile tested to increase build coverage. This requires also:
1. Adding dependencies on COMMON_CLK for BCM2835 and Meson I2C controllers,
2. Adding 'if' conditional to 'default y' so they will not get enabled by default on all other architectures,
3. Limiting few compile test options to supported architectures (which provide the readsX()/writesX() primitives).
---
Changes since v1:
1. Address Geert's comments (split depends, comment on weird architecture selection).
--- drivers/i2c/busses/Kconfig | 66 +++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 30 deletions(-)
drivers/i2c/busses/Kconfig +36 -30
@@ -367,7 +367,8 @@ comment "I2C system bus drivers (mostly embedded / system-on-chip)" config I2C_ALTERA tristate "Altera Soft IP I2C" - depends on (ARCH_SOCFPGA || NIOS2) && OF + depends on ARCH_SOCFPGA || NIOS2 || COMPILE_TEST + depends on OF help If you say yes to this option, support will be included for the Altera Soft IP I2C interfaces on SoCFPGA and Nios2 architectures.
@@ -387,7 +388,7 @@ config I2C_ASPEED config I2C_AT91 tristate "Atmel AT91 I2C Two-Wire interface (TWI)" - depends on ARCH_AT91 + depends on ARCH_AT91 || COMPILE_TEST help This supports the use of the I2C interface on Atmel AT91 processors.
@@ -440,7 +441,8 @@ config I2C_AXXIA config I2C_BCM2835 tristate "Broadcom BCM2835 I2C controller" - depends on ARCH_BCM2835 || ARCH_BRCMSTB + depends on ARCH_BCM2835 || ARCH_BRCMSTB || COMPILE_TEST + depends on COMMON_CLK help If you say yes to this option, support will be included for the BCM2835 I2C controller.
@@ -463,8 +465,8 @@ config I2C_BCM_IPROC config I2C_BCM_KONA tristate "BCM Kona I2C adapter" - depends on ARCH_BCM_MOBILE - default y + depends on ARCH_BCM_MOBILE || COMPILE_TEST + default y if ARCH_BCM_MOBILE help If you say yes to this option, support will be included for the I2C interface on the Broadcom Kona family of processors.
@@ -511,7 +513,7 @@ config I2C_CPM config I2C_DAVINCI tristate "DaVinci I2C driver" - depends on ARCH_DAVINCI || ARCH_KEYSTONE + depends on ARCH_DAVINCI || ARCH_KEYSTONE || COMPILE_TEST help Support for TI DaVinci I2C controller driver.
@@ -572,7 +574,7 @@ config I2C_DESIGNWARE_BAYTRAIL config I2C_DIGICOLOR tristate "Conexant Digicolor I2C driver" - depends on ARCH_DIGICOLOR + depends on ARCH_DIGICOLOR || COMPILE_TEST help Support for Conexant Digicolor SoCs (CX92755) I2C controller driver.
@@ -611,8 +613,9 @@ config I2C_EMEV2 config I2C_EXYNOS5 tristate "Exynos5 high-speed I2C driver" - depends on ARCH_EXYNOS && OF - default y + depends on OF + depends on ARCH_EXYNOS || COMPILE_TEST + default y if ARCH_EXYNOS help High-speed I2C controller on Exynos5 based Samsung SoCs.
@@ -634,7 +637,7 @@ config I2C_GPIO_FAULT_INJECTOR config I2C_HIGHLANDER tristate "Highlander FPGA SMBus interface" - depends on SH_HIGHLANDER + depends on SH_HIGHLANDER || COMPILE_TEST help If you say yes to this option, support will be included for the SMBus interface located in the FPGA on various Highlander
@@ -686,7 +689,7 @@ config I2C_IMX_LPI2C config I2C_IOP3XX tristate "Intel IOPx3xx and IXP4xx on-chip I2C interface" - depends on ARCH_IOP32X || ARCH_IXP4XX + depends on ARCH_IOP32X || ARCH_IXP4XX || COMPILE_TEST help Say Y here if you want to use the IIC bus controller on the Intel IOPx3xx I/O Processors or IXP4xx Network Processors.
@@ -726,6 +729,7 @@ config I2C_LPC2K config I2C_MESON tristate "Amlogic Meson I2C controller" depends on ARCH_MESON || COMPILE_TEST + depends on COMMON_CLK help If you say yes to this option, support will be included for the I2C interface on the Amlogic Meson family of SoCs.
@@ -759,7 +763,7 @@ config I2C_MT7621 config I2C_MV64XXX tristate "Marvell mv64xxx I2C Controller" - depends on MV64X60 || PLAT_ORION || ARCH_SUNXI || ARCH_MVEBU + depends on MV64X60 || PLAT_ORION || ARCH_SUNXI || ARCH_MVEBU || COMPILE_TEST help If you say yes to this option, support will be included for the built-in I2C interface on the Marvell 64xxx line of host bridges.
@@ -770,7 +774,7 @@ config I2C_MV64XXX config I2C_MXS tristate "Freescale i.MX28 I2C interface" - depends on SOC_IMX28 + depends on SOC_IMX28 || COMPILE_TEST select STMP_DEVICE help Say Y here if you want to use the I2C bus controller on
@@ -799,7 +803,7 @@ config I2C_OCORES config I2C_OMAP tristate "OMAP I2C adapter" - depends on ARCH_OMAP || ARCH_K3 + depends on ARCH_OMAP || ARCH_K3 || COMPILE_TEST default y if MACH_OMAP_H3 || MACH_OMAP_OSK help If you say yes to this option, support will be included for the
@@ -833,7 +837,7 @@ config I2C_PCA_PLATFORM config I2C_PMCMSP tristate "PMC MSP I2C TWI Controller" - depends on PMC_MSP + depends on PMC_MSP || COMPILE_TEST help This driver supports the PMC TWI controller on MSP devices.
@@ -842,7 +846,7 @@ config I2C_PMCMSP config I2C_PNX tristate "I2C bus support for Philips PNX and NXP LPC targets" - depends on ARCH_LPC32XX + depends on ARCH_LPC32XX || COMPILE_TEST help This driver supports the Philips IP3204 I2C IP block master and/or slave controller
@@ -863,7 +867,7 @@ config I2C_PUV3 config I2C_PXA tristate "Intel PXA2XX I2C adapter" - depends on ARCH_PXA || ARCH_MMP || ARCH_MVEBU || (X86_32 && PCI && OF) + depends on ARCH_PXA || ARCH_MMP || ARCH_MVEBU || (X86_32 && PCI && OF) || COMPILE_TEST help If you have devices in the PXA I2C bus, say yes to this option. This driver can also be built as a module. If so, the module
@@ -933,7 +937,7 @@ config HAVE_S3C2410_I2C config I2C_S3C2410 tristate "S3C2410 I2C Driver" - depends on HAVE_S3C2410_I2C + depends on HAVE_S3C2410_I2C || COMPILE_TEST help Say Y here to include support for I2C controller in the Samsung SoCs.
@@ -971,7 +975,7 @@ config I2C_SIMTEC config I2C_SIRF tristate "CSR SiRFprimaII I2C interface" - depends on ARCH_SIRF + depends on ARCH_SIRF || COMPILE_TEST help If you say yes to this option, support will be included for the CSR SiRFprimaII I2C interface.
@@ -981,14 +985,14 @@ config I2C_SIRF config I2C_SPRD tristate "Spreadtrum I2C interface" - depends on I2C=y && ARCH_SPRD + depends on I2C=y && (ARCH_SPRD || COMPILE_TEST) help If you say yes to this option, support will be included for the Spreadtrum I2C interface. config I2C_ST tristate "STMicroelectronics SSC I2C support" - depends on ARCH_STI + depends on ARCH_STI || COMPILE_TEST help Enable this option to add support for STMicroelectronics SoCs hardware SSC (Synchronous Serial Controller) as an I2C controller.
@@ -1019,7 +1023,7 @@ config I2C_STM32F7 config I2C_STU300 tristate "ST Microelectronics DDC I2C interface" - depends on MACH_U300 + depends on MACH_U300 || COMPILE_TEST default y if MACH_U300 help If you say yes to this option, support will be included for the
@@ -1055,15 +1059,16 @@ config I2C_SYNQUACER config I2C_TEGRA tristate "NVIDIA Tegra internal I2C controller" - depends on ARCH_TEGRA + depends on ARCH_TEGRA || (COMPILE_TEST && (ARC || ARM || ARM64 || M68K || RISCV || SUPERH || SPARC)) + # COMPILE_TEST needs architectures with readsX()/writesX() primitives help If you say yes to this option, support will be included for the I2C controller embedded in NVIDIA Tegra SOCs config I2C_TEGRA_BPMP tristate "NVIDIA Tegra BPMP I2C controller" - depends on TEGRA_BPMP - default y + depends on TEGRA_BPMP || COMPILE_TEST + default y if TEGRA_BPMP help If you say yes to this option, support will be included for the I2C controller embedded in NVIDIA Tegra SoCs accessed via the BPMP.
@@ -1101,7 +1106,7 @@ config I2C_VERSATILE config I2C_WMT tristate "Wondermedia WM8xxx SoC I2C bus support" - depends on ARCH_VT8500 + depends on ARCH_VT8500 || COMPILE_TEST help Say yes if you want to support the I2C bus on Wondermedia 8xxx-series SoCs.
@@ -1142,7 +1147,7 @@ config I2C_XILINX config I2C_XLR tristate "Netlogic XLR and Sigma Designs I2C support" - depends on CPU_XLR || ARCH_TANGO + depends on CPU_XLR || ARCH_TANGO || COMPILE_TEST help This driver enables support for the on-chip I2C interface of the Netlogic XLR/XLS MIPS processors and Sigma Designs SOCs.
@@ -1328,7 +1333,7 @@ config I2C_ICY config I2C_MLXCPLD tristate "Mellanox I2C driver" - depends on X86_64 + depends on X86_64 || COMPILE_TEST help This exposes the Mellanox platform I2C busses to the linux I2C layer for X86 based systems.
@@ -1403,8 +1408,9 @@ config I2C_OPAL config I2C_ZX2967 tristate "ZTE ZX2967 I2C support" - depends on ARCH_ZX - default y + depends on ARCH_ZX || (COMPILE_TEST && (ARC || ARM || ARM64 || M68K || RISCV || SUPERH || SPARC)) + # COMPILE_TEST needs architectures with readsX()/writesX() primitives + default y if ARCH_ZX help Selecting this option will add ZX2967 I2C driver. This driver can also be built as a module. If so, the module will be
Signature · 1 line
2.7.4
PATCH v2 2/2 i2c: exynos: Update Kconfig documentation
Update the help text to reflect current support devices:
1. The Exynos high speed I2C driver supports Exynos5 (ARMv7), Exynos5433 and Exynos7 (both ARMv8) SoCs,
2. The S3C I2C driver supports S3C, S5Pv210 and Exynos{3,4,5} SoCs.
---
Changes since v1:
1. New patch
--- drivers/i2c/busses/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/i2c/busses/Kconfig +4 -4
@@ -612,12 +612,12 @@ config I2C_EMEV2 I2C interface on the Renesas Electronics EM/EV family of processors. config I2C_EXYNOS5 - tristate "Exynos5 high-speed I2C driver" + tristate "Exynos high-speed I2C driver" depends on OF depends on ARCH_EXYNOS || COMPILE_TEST default y if ARCH_EXYNOS help - High-speed I2C controller on Exynos5 based Samsung SoCs. + High-speed I2C controller on Exynos5 and newer Samsung SoCs. config I2C_GPIO tristate "GPIO-based bitbanging I2C"
@@ -936,11 +936,11 @@ config HAVE_S3C2410_I2C respective Kconfig file. config I2C_S3C2410 - tristate "S3C2410 I2C Driver" + tristate "S3C/Exynos I2C Driver" depends on HAVE_S3C2410_I2C || COMPILE_TEST help Say Y here to include support for I2C controller in the - Samsung SoCs. + Samsung SoCs (S3C, S5Pv210, Exynos). config I2C_SH7760 tristate "Renesas SH7760 I2C Controller"
Signature · 1 line
2.7.4
Re: [PATCH v2 2/2] i2c: exynos: Update Kconfig documentation
Quoted 6 lines · Krzysztof Kozlowski
Update the help text to reflect current support devices:
1. The Exynos high speed I2C driver supports Exynos5 (ARMv7), Exynos5433 and Exynos7 (both ARMv8) SoCs,
2. The S3C I2C driver supports S3C, S5Pv210 and Exynos{3,4,5} SoCs.Signed-off-by Krzysztof Kozlowski <[email protected]>
Looks good. Let's discuss this one question of patch 1 and we are good to go!
Wolfram Sang
AppliedRe: [PATCH v2 2/2] i2c: exynos: Update Kconfig documentation
In reply to Krzysztof KozlowskiQuoted 7 lines · Krzysztof Kozlowski
Update the help text to reflect current support devices:
1. The Exynos high speed I2C driver supports Exynos5 (ARMv7), Exynos5433 and Exynos7 (both ARMv8) SoCs,
2. The S3C I2C driver supports S3C, S5Pv210 and Exynos{3,4,5} SoCs.Signed-off-by Krzysztof Kozlowski <[email protected]>
Applied to for-next, thanks!
kbuild test robot
build botI love your patch! Perhaps something to improve:
Hi Krzysztof,
I love your patch! Perhaps something to improve:
[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on v5.5-rc5 next-20200106]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/i2c-Enable-compile-testing-for-some-of-drivers/20200107-164808 base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next reproduce: # apt-get install sparse # sparse version: v0.6.1-129-g341daf20-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
sparse warnings: (new ones prefixed by >>)
>> drivers/i2c/busses/i2c-stu300.c:446:17: sparse: sparse: cast removes address space '<asn:2>' of expression
vim +446 drivers/i2c/busses/i2c-stu300.c
18904c0ecdf2cf Linus Walleij 2009-06-13 421
18904c0ecdf2cf Linus Walleij 2009-06-13 422 /*
18904c0ecdf2cf Linus Walleij 2009-06-13 423 * Waits for the busy bit to go low by repeated polling.
18904c0ecdf2cf Linus Walleij 2009-06-13 424 */
18904c0ecdf2cf Linus Walleij 2009-06-13 425 #define BUSY_RELEASE_ATTEMPTS 10
18904c0ecdf2cf Linus Walleij 2009-06-13 426 static int stu300_wait_while_busy(struct stu300_dev *dev)
18904c0ecdf2cf Linus Walleij 2009-06-13 427 {
18904c0ecdf2cf Linus Walleij 2009-06-13 428 unsigned long timeout;
18904c0ecdf2cf Linus Walleij 2009-06-13 429 int i;
18904c0ecdf2cf Linus Walleij 2009-06-13 430
18904c0ecdf2cf Linus Walleij 2009-06-13 431 for (i = 0; i < BUSY_RELEASE_ATTEMPTS; i++) {
18904c0ecdf2cf Linus Walleij 2009-06-13 432 timeout = jiffies + STU300_TIMEOUT;
18904c0ecdf2cf Linus Walleij 2009-06-13 433
18904c0ecdf2cf Linus Walleij 2009-06-13 434 while (!time_after(jiffies, timeout)) {
18904c0ecdf2cf Linus Walleij 2009-06-13 435 /* Is not busy? */
18904c0ecdf2cf Linus Walleij 2009-06-13 436 if ((stu300_r8(dev->virtbase + I2C_SR1) &
18904c0ecdf2cf Linus Walleij 2009-06-13 437 I2C_SR1_BUSY_IND) == 0)
18904c0ecdf2cf Linus Walleij 2009-06-13 438 return 0;
18904c0ecdf2cf Linus Walleij 2009-06-13 439 msleep(1);
18904c0ecdf2cf Linus Walleij 2009-06-13 440 }
18904c0ecdf2cf Linus Walleij 2009-06-13 441
18904c0ecdf2cf Linus Walleij 2009-06-13 442 dev_err(&dev->pdev->dev, "transaction timed out "
18904c0ecdf2cf Linus Walleij 2009-06-13 443 "waiting for device to be free (not busy). "
18904c0ecdf2cf Linus Walleij 2009-06-13 444 "Attempt: %d\n", i+1);
18904c0ecdf2cf Linus Walleij 2009-06-13 445
18904c0ecdf2cf Linus Walleij 2009-06-13 @446 dev_err(&dev->pdev->dev, "base address = "
18904c0ecdf2cf Linus Walleij 2009-06-13 447 "0x%08x, reinit hardware\n", (u32) dev->virtbase);
18904c0ecdf2cf Linus Walleij 2009-06-13 448
18904c0ecdf2cf Linus Walleij 2009-06-13 449 (void) stu300_init_hw(dev);
18904c0ecdf2cf Linus Walleij 2009-06-13 450 }
18904c0ecdf2cf Linus Walleij 2009-06-13 451
18904c0ecdf2cf Linus Walleij 2009-06-13 452 dev_err(&dev->pdev->dev, "giving up after %d attempts "
18904c0ecdf2cf Linus Walleij 2009-06-13 453 "to reset the bus.\n", BUSY_RELEASE_ATTEMPTS);
18904c0ecdf2cf Linus Walleij 2009-06-13 454
18904c0ecdf2cf Linus Walleij 2009-06-13 455 return -ETIMEDOUT;
18904c0ecdf2cf Linus Walleij 2009-06-13 456 }
18904c0ecdf2cf Linus Walleij 2009-06-13 457 :::::: The code at line 446 was first introduced by commit
:::::: 18904c0ecdf2cf22347da2adc4b273e9570333d8 i2c: ST DDC I2C U300 bus driver v3
:::::: TO: Linus Walleij <[email protected]> :::::: CC: Ben Dooks <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
Quoted 18 lines · kbuild test robot
Hi Krzysztof,
I love your patch! Perhaps something to improve:
[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on v5.5-rc5 next-20200106]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]url: https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/i2c-Enable-compile-testing-for-some-of-drivers/20200107-164808 base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next reproduce: # apt-get install sparse # sparse version: v0.6.1-129-g341daf20-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
Quoted 7 lines
If you fix the issue, kindly add following tag
Reported-by kbuild test robot <[email protected]>sparse warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
drivers/i2c/busses/i2c-stu300.c:446:17: sparse: sparse: cast removes address space '<asn:2>' of expression
I fixed this already here:
https://lore.kernel.org/lkml/20191230172751.17985-4-krzk(a)kernel.org/
Best regards,
Krzysztof
Quoted 50 lines
vim +446
drivers/i2c/busses/i2c-stu300.c18904c0ecdf2cf Linus Walleij 2009-06-13 421 18904c0ecdf2cf Linus Walleij 2009-06-13 422 /* 18904c0ecdf2cf Linus Walleij 2009-06-13 423 * Waits for the busy bit to go low by repeated polling. 18904c0ecdf2cf Linus Walleij 2009-06-13 424 */ 18904c0ecdf2cf Linus Walleij 2009-06-13 425 #define BUSY_RELEASE_ATTEMPTS 10 18904c0ecdf2cf Linus Walleij 2009-06-13 426 static int stu300_wait_while_busy(struct stu300_dev *dev) 18904c0ecdf2cf Linus Walleij 2009-06-13 427 { 18904c0ecdf2cf Linus Walleij 2009-06-13 428 unsigned long timeout; 18904c0ecdf2cf Linus Walleij 2009-06-13 429 int i; 18904c0ecdf2cf Linus Walleij 2009-06-13 430 18904c0ecdf2cf Linus Walleij 2009-06-13 431 for (i = 0; i < BUSY_RELEASE_ATTEMPTS; i++) { 18904c0ecdf2cf Linus Walleij 2009-06-13 432 timeout = jiffies + STU300_TIMEOUT; 18904c0ecdf2cf Linus Walleij 2009-06-13 433 18904c0ecdf2cf Linus Walleij 2009-06-13 434 while (!time_after(jiffies, timeout)) { 18904c0ecdf2cf Linus Walleij 2009-06-13 435 /* Is not busy? */ 18904c0ecdf2cf Linus Walleij 2009-06-13 436 if ((stu300_r8(dev->virtbase + I2C_SR1) & 18904c0ecdf2cf Linus Walleij 2009-06-13 437 I2C_SR1_BUSY_IND) == 0) 18904c0ecdf2cf Linus Walleij 2009-06-13 438 return 0; 18904c0ecdf2cf Linus Walleij 2009-06-13 439 msleep(1); 18904c0ecdf2cf Linus Walleij 2009-06-13 440 } 18904c0ecdf2cf Linus Walleij 2009-06-13 441 18904c0ecdf2cf Linus Walleij 2009-06-13 442 dev_err(&dev->pdev->dev, "transaction timed out " 18904c0ecdf2cf Linus Walleij 2009-06-13 443 "waiting for device to be free (not busy). " 18904c0ecdf2cf Linus Walleij 2009-06-13 444 "Attempt: %d\n", i+1); 18904c0ecdf2cf Linus Walleij 2009-06-13 445 18904c0ecdf2cf Linus Walleij 2009-06-13 @446 dev_err(&dev->pdev->dev, "base address = " 18904c0ecdf2cf Linus Walleij 2009-06-13 447 "0x%08x, reinit hardware\n", (u32) dev->virtbase); 18904c0ecdf2cf Linus Walleij 2009-06-13 448 18904c0ecdf2cf Linus Walleij 2009-06-13 449 (void) stu300_init_hw(dev); 18904c0ecdf2cf Linus Walleij 2009-06-13 450 } 18904c0ecdf2cf Linus Walleij 2009-06-13 451 18904c0ecdf2cf Linus Walleij 2009-06-13 452 dev_err(&dev->pdev->dev, "giving up after %d attempts " 18904c0ecdf2cf Linus Walleij 2009-06-13 453 "to reset the bus.\n", BUSY_RELEASE_ATTEMPTS); 18904c0ecdf2cf Linus Walleij 2009-06-13 454 18904c0ecdf2cf Linus Walleij 2009-06-13 455 return -ETIMEDOUT; 18904c0ecdf2cf Linus Walleij 2009-06-13 456 } 18904c0ecdf2cf Linus Walleij 2009-06-13 457:::::: The code at line 446 was first introduced by commit
::::::18904c0ecdf2cf22347da2adc4b273e9570333d8i2c: ST DDC I2C U300 bus driver v3:::::: TO: Linus Walleij <[email protected]> :::::: CC: Ben Dooks <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
Hi Krzysztof,
url: https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/i2c-Enable-compile-testing-for-some-of-drivers/20200107-164808 base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
If you fix the issue, kindly add following tag
New smatch warnings:drivers/i2c/busses/i2c-iop3xx.c:437 iop3xx_i2c_probe() warn: possible memory leak of 'new_adapter'
Old smatch warnings:drivers/i2c/busses/i2c-iop3xx.c:442 iop3xx_i2c_probe() warn: possible memory leak of 'new_adapter'
# https://github.com/0day-ci/linux/commit/16f23a6a6c2387ec6252ffba16d110ace21c85cf
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 16f23a6a6c2387ec6252ffba16d110ace21c85cf
vim +/new_adapter +437 drivers/i2c/busses/i2c-iop3xx.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 413 static int
3ae5eaec1d2d9c Russell King 2005-11-09 414 iop3xx_i2c_probe(struct platform_device *pdev)
^1da177e4c3f41 Linus Torvalds 2005-04-16 415 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 416 struct resource *res;
489447380a2921 David Vrabel 2006-01-19 417 int ret, irq;
^1da177e4c3f41 Linus Torvalds 2005-04-16 418 struct i2c_adapter *new_adapter;
^1da177e4c3f41 Linus Torvalds 2005-04-16 419 struct i2c_algo_iop3xx_data *adapter_data;
^1da177e4c3f41 Linus Torvalds 2005-04-16 420
5263ebb51eb098 Deepak Saxena 2005-10-17 421 new_adapter = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 422 if (!new_adapter) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 423 ret = -ENOMEM;
^1da177e4c3f41 Linus Torvalds 2005-04-16 424 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 425 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 426
5263ebb51eb098 Deepak Saxena 2005-10-17 427 adapter_data = kzalloc(sizeof(struct i2c_algo_iop3xx_data), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 428 if (!adapter_data) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 429 ret = -ENOMEM;
^1da177e4c3f41 Linus Torvalds 2005-04-16 430 goto free_adapter;
^1da177e4c3f41 Linus Torvalds 2005-04-16 431 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 432
fdb7e884ad617f Linus Walleij 2019-06-01 433 adapter_data->gpio_scl = devm_gpiod_get_optional(&pdev->dev,
fdb7e884ad617f Linus Walleij 2019-06-01 434 "scl",
fdb7e884ad617f Linus Walleij 2019-06-01 435 GPIOD_ASIS);
fdb7e884ad617f Linus Walleij 2019-06-01 436 if (IS_ERR(adapter_data->gpio_scl))
fdb7e884ad617f Linus Walleij 2019-06-01 @437 return PTR_ERR(adapter_data->gpio_scl);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^leak
fdb7e884ad617f Linus Walleij 2019-06-01 438 adapter_data->gpio_sda = devm_gpiod_get_optional(&pdev->dev,
fdb7e884ad617f Linus Walleij 2019-06-01 439 "sda",
fdb7e884ad617f Linus Walleij 2019-06-01 440 GPIOD_ASIS);
fdb7e884ad617f Linus Walleij 2019-06-01 441 if (IS_ERR(adapter_data->gpio_sda))
fdb7e884ad617f Linus Walleij 2019-06-01 442 return PTR_ERR(adapter_data->gpio_sda);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^fdb7e884ad617f Linus Walleij 2019-06-01 443
^1da177e4c3f41 Linus Torvalds 2005-04-16 444 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 445 if (!res) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 446 ret = -ENODEV;
^1da177e4c3f41 Linus Torvalds 2005-04-16 447 goto free_both;
^1da177e4c3f41 Linus Torvalds 2005-04-16 448 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 449
^1da177e4c3f41 Linus Torvalds 2005-04-16 450 if (!request_mem_region(res->start, IOP3XX_I2C_IO_SIZE, pdev->name)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 451 ret = -EBUSY;
^1da177e4c3f41 Linus Torvalds 2005-04-16 452 goto free_both;
^1da177e4c3f41 Linus Torvalds 2005-04-16 453 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 454
^1da177e4c3f41 Linus Torvalds 2005-04-16 455 /* set the adapter enumeration # */
^1da177e4c3f41 Linus Torvalds 2005-04-16 456 adapter_data->id = i2c_id++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 457
747fcc91cb5bad Aaro Koskinen 2010-11-29 458 adapter_data->ioaddr = ioremap(res->start, IOP3XX_I2C_IO_SIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 459 if (!adapter_data->ioaddr) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 460 ret = -ENOMEM;
^1da177e4c3f41 Linus Torvalds 2005-04-16 461 goto release_region;
^1da177e4c3f41 Linus Torvalds 2005-04-16 462 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 463
489447380a2921 David Vrabel 2006-01-19 464 irq = platform_get_irq(pdev, 0);
489447380a2921 David Vrabel 2006-01-19 465 if (irq < 0) {
489447380a2921 David Vrabel 2006-01-19 466 ret = -ENXIO;
489447380a2921 David Vrabel 2006-01-19 467 goto unmap;
489447380a2921 David Vrabel 2006-01-19 468 }
489447380a2921 David Vrabel 2006-01-19 469 ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
^1da177e4c3f41 Linus Torvalds 2005-04-16 470 pdev->name, adapter_data);
fbd9a6d7a927b2 Dan Williams 2005-11-01 471
fbd9a6d7a927b2 Dan Williams 2005-11-01 472 if (ret) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 473 ret = -EIO;
^1da177e4c3f41 Linus Torvalds 2005-04-16 474 goto unmap;
^1da177e4c3f41 Linus Torvalds 2005-04-16 475 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 476
^1da177e4c3f41 Linus Torvalds 2005-04-16 477 memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
^1da177e4c3f41 Linus Torvalds 2005-04-16 478 new_adapter->owner = THIS_MODULE;
3401b2fff38fbb Jean Delvare 2008-07-14 479 new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
^1da177e4c3f41 Linus Torvalds 2005-04-16 480 new_adapter->dev.parent = &pdev->dev;
cac28ac2a87c38 Linus Walleij 2019-01-28 481 new_adapter->dev.of_node = pdev->dev.of_node;
757ba4c697244d Martin Michlmayr 2007-07-12 482 new_adapter->nr = pdev->id;
^1da177e4c3f41 Linus Torvalds 2005-04-16 483
^1da177e4c3f41 Linus Torvalds 2005-04-16 484 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 485 * Default values...should these come in from board code?
^1da177e4c3f41 Linus Torvalds 2005-04-16 486 */
8a52c6b4d55b29 Jean Delvare 2009-03-28 487 new_adapter->timeout = HZ;
^1da177e4c3f41 Linus Torvalds 2005-04-16 488 new_adapter->algo = &iop3xx_i2c_algo;
^1da177e4c3f41 Linus Torvalds 2005-04-16 489
^1da177e4c3f41 Linus Torvalds 2005-04-16 490 init_waitqueue_head(&adapter_data->waitq);
^1da177e4c3f41 Linus Torvalds 2005-04-16 491 spin_lock_init(&adapter_data->lock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 492
^1da177e4c3f41 Linus Torvalds 2005-04-16 493 iop3xx_i2c_reset(adapter_data);
^1da177e4c3f41 Linus Torvalds 2005-04-16 494 iop3xx_i2c_enable(adapter_data);
^1da177e4c3f41 Linus Torvalds 2005-04-16 495
3ae5eaec1d2d9c Russell King 2005-11-09 496 platform_set_drvdata(pdev, new_adapter);
^1da177e4c3f41 Linus Torvalds 2005-04-16 497 new_adapter->algo_data = adapter_data;
^1da177e4c3f41 Linus Torvalds 2005-04-16 498
757ba4c697244d Martin Michlmayr 2007-07-12 499 i2c_add_numbered_adapter(new_adapter);
^1da177e4c3f41 Linus Torvalds 2005-04-16 500
^1da177e4c3f41 Linus Torvalds 2005-04-16 501 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 502
^1da177e4c3f41 Linus Torvalds 2005-04-16 503 unmap:
747fcc91cb5bad Aaro Koskinen 2010-11-29 504 iounmap(adapter_data->ioaddr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 505
^1da177e4c3f41 Linus Torvalds 2005-04-16 506 release_region:
^1da177e4c3f41 Linus Torvalds 2005-04-16 507 release_mem_region(res->start, IOP3XX_I2C_IO_SIZE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 508
^1da177e4c3f41 Linus Torvalds 2005-04-16 509 free_both:
^1da177e4c3f41 Linus Torvalds 2005-04-16 510 kfree(adapter_data);
^1da177e4c3f41 Linus Torvalds 2005-04-16 511
^1da177e4c3f41 Linus Torvalds 2005-04-16 512 free_adapter:
^1da177e4c3f41 Linus Torvalds 2005-04-16 513 kfree(new_adapter);
^1da177e4c3f41 Linus Torvalds 2005-04-16 514
^1da177e4c3f41 Linus Torvalds 2005-04-16 515 out:
^1da177e4c3f41 Linus Torvalds 2005-04-16 516 return ret;
^1da177e4c3f41 Linus Torvalds 2005-04-16 517 }---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
drivers/i2c/busses/Kconfig config I2C_OPAL · line 1412
Quoted 7 lines
config
I2C_ZX2967drivers/i2c/busses/Kconfig +2
-2tristate "ZTE ZX2967 I2C support" - depends on ARCH_ZX - default y + depends on ARCH_ZX || (COMPILE_TEST && (ARC || ARM || ARM64 || M68K || RISCV || SUPERH || SPARC)) + # COMPILE_TEST needs architectures with readsX()/writesX() primitives
The list of archs neither looks pretty nor very maintainable. My suggestion is that we leave this out of COMPILE_TEST until we have something like ARCH_HAS_READS or something. What do you think?
Quoted 1 line
drivers/i2c/busses/Kconfig +1
-0+ default y if ARCH_ZX
Quoted 11 lines · Wolfram Sang
drivers/i2c/busses/Kconfig config I2C_OPAL · line 1412
Quoted 7 lines
config
I2C_ZX2967drivers/i2c/busses/Kconfig +2
-2tristate "ZTE ZX2967 I2C support" - depends on ARCH_ZX - default y + depends on ARCH_ZX || (COMPILE_TEST && (ARC || ARM || ARM64 || M68K || RISCV || SUPERH || SPARC)) + # COMPILE_TEST needs architectures with readsX()/writesX() primitivesThe list of archs neither looks pretty nor very maintainable. My suggestion is that we leave this out of
COMPILE_TESTuntil we have something likeARCH_HAS_READSor something. What do you think?
Indeed it does not look good. However having compile testing allows kbuild to run sparse and smatch which already started pointing minor issues in existing drivers.
Yeah... pros and cons... I don't have a strong opinion to keep it. Since patch is important, maybe let's just skip this part?
Best regards,
Krzysztof
Quoted 13 lines · Krzysztof Kozlowski
Quoted 11 lines · Wolfram Sang
drivers/i2c/busses/Kconfig config I2C_OPAL · line 1412
Quoted 7 lines
config
I2C_ZX2967drivers/i2c/busses/Kconfig +2
-2tristate "ZTE ZX2967 I2C support" - depends on ARCH_ZX - default y + depends on ARCH_ZX || (COMPILE_TEST && (ARC || ARM || ARM64 || M68K || RISCV || SUPERH || SPARC)) + # COMPILE_TEST needs architectures with readsX()/writesX() primitivesThe list of archs neither looks pretty nor very maintainable. My suggestion is that we leave this out of
COMPILE_TESTuntil we have something likeARCH_HAS_READSor something. What do you think?
Quoted 6 lines
Indeed it does not look good. However having compile testing allows kbuild to run sparse and smatch which already started pointing minor issues in existing drivers.
Yeah... pros and cons... I don't have a strong opinion to keep it. Since patch is important, maybe let's just skip this part?
Yeah, let's skip it for now. If you or someone is keen on having it, something like ARCH_HAS_READS (<- needs better name) should be introduced so we can use it here. But that can/should be handled incrementally.
Quoted 18 lines · Wolfram Sang
Quoted 17 lines · Krzysztof Kozlowski
Quoted 11 lines · Wolfram Sang
drivers/i2c/busses/Kconfig config I2C_OPAL · line 1412
Quoted 7 lines
config
I2C_ZX2967drivers/i2c/busses/Kconfig +2
-2tristate "ZTE ZX2967 I2C support" - depends on ARCH_ZX - default y + depends on ARCH_ZX || (COMPILE_TEST && (ARC || ARM || ARM64 || M68K || RISCV || SUPERH || SPARC)) + # COMPILE_TEST needs architectures with readsX()/writesX() primitivesThe list of archs neither looks pretty nor very maintainable. My suggestion is that we leave this out of
COMPILE_TESTuntil we have something likeARCH_HAS_READSor something. What do you think?Indeed it does not look good. However having compile testing allows kbuild to run sparse and smatch which already started pointing minor issues in existing drivers.
Quoted 7 lines
Quoted 2 lines
Yeah... pros and cons... I don't have a strong opinion to keep it. Since patch is important, maybe let's just skip this part?
Yeah, let's skip it for now. If you or someone is keen on having it, something like
ARCH_HAS_READS(<- needs better name) should be introduced so we can use it here. But that can/should be handled incrementally.
Shall I send v3 or mayybe can you apply without this hunk?
Best regards,
Krzysztof
Quoted 18 lines · Wolfram Sang
Quoted 17 lines · Krzysztof Kozlowski
Quoted 11 lines · Wolfram Sang
drivers/i2c/busses/Kconfig config I2C_OPAL · line 1412
Quoted 7 lines
config
I2C_ZX2967drivers/i2c/busses/Kconfig +2
-2tristate "ZTE ZX2967 I2C support" - depends on ARCH_ZX - default y + depends on ARCH_ZX || (COMPILE_TEST && (ARC || ARM || ARM64 || M68K || RISCV || SUPERH || SPARC)) + # COMPILE_TEST needs architectures with readsX()/writesX() primitivesThe list of archs neither looks pretty nor very maintainable. My suggestion is that we leave this out of
COMPILE_TESTuntil we have something likeARCH_HAS_READSor something. What do you think?Indeed it does not look good. However having compile testing allows kbuild to run sparse and smatch which already started pointing minor issues in existing drivers.
Quoted 7 lines
Quoted 2 lines
Yeah... pros and cons... I don't have a strong opinion to keep it. Since patch is important, maybe let's just skip this part?
Yeah, let's skip it for now. If you or someone is keen on having it, something like
ARCH_HAS_READS(<- needs better name) should be introduced so we can use it here. But that can/should be handled incrementally.
Isn't this "HAS_IOMEM" already today? The driver compiles for me on amd64, too, so ...
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Wolfram Sang
AppliedQuoted 11 lines · Krzysztof Kozlowski
Some of the I2C bus drivers can be compile tested to increase build coverage. This requires also:
1. Adding dependencies onCOMMON_CLKfor BCM2835 and Meson I2C controllers,
2. Adding 'if' conditional to 'default y' so they will not get enabled by default on all other architectures,
3. Limiting few compile test options to supported architectures (which provide the readsX()/writesX() primitives).Signed-off-by Krzysztof Kozlowski <[email protected]>
Applied to for-next with the zx chunk removed, thanks!
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 10 lines · Krzysztof Kozlowski
Some of the I2C bus drivers can be compile tested to increase build coverage. This requires also:
1. Adding dependencies onCOMMON_CLKfor BCM2835 and Meson I2C controllers,
2. Adding 'if' conditional to 'default y' so they will not get enabled by default on all other architectures,
3. Limiting few compile test options to supported architectures (which provide the readsX()/writesX() primitives).config
I2C_BCM_KONA
drivers/i2c/busses/Kconfig config I2C_BCM_IPROC · line 469
Quoted 5 lines
drivers/i2c/busses/Kconfig +2
-2tristate "BCM Kona I2C adapter" - depends on ARCH_BCM_MOBILE - default y + depends on ARCH_BCM_MOBILE || COMPILE_TEST + default y if ARCH_BCM_MOBILE
Why not the simpler:
default ARCH_BCM_MOBILE
Regards.