Message ID | 20170322195752.33291-5-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Samuel Ortiz |
Headers | show |
Hi Andy, [auto build test ERROR on linus/master] [also build test ERROR on v4.11-rc3 next-20170324] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/NFC-pn544-Get-rid-of-platform-data/20170324-232445 config: i386-randconfig-x078-201712 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/nfc/pn544/i2c.c: In function 'pn544_hci_i2c_probe': >> drivers/nfc/pn544/i2c.c:910:3: error: implicit declaration of function 'nfc_dbg' [-Werror=implicit-function-declaration] nfc_dbg(dev, "Unable to add GPIO mapping table\n"); ^~~~~~~ Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size Cyclomatic Complexity 1 include/uapi/linux/swab.h:__swab16p Cyclomatic Complexity 1 include/uapi/linux/swab.h:__swab32p Cyclomatic Complexity 1 include/uapi/linux/byteorder/little_endian.h:__be32_to_cpup Cyclomatic Complexity 1 include/uapi/linux/byteorder/little_endian.h:__be16_to_cpup Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR Cyclomatic Complexity 1 include/linux/workqueue.h:__init_work Cyclomatic Complexity 1 include/linux/device.h:dev_get_drvdata Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata Cyclomatic Complexity 1 include/linux/i2c.h:i2c_get_clientdata Cyclomatic Complexity 1 include/linux/i2c.h:i2c_set_clientdata Cyclomatic Complexity 1 include/linux/i2c.h:i2c_get_functionality Cyclomatic Complexity 1 include/linux/i2c.h:i2c_check_functionality Cyclomatic Complexity 2 include/linux/acpi.h:acpi_dev_remove_driver_gpios Cyclomatic Complexity 1 include/linux/unaligned/access_ok.h:get_unaligned_be16 Cyclomatic Complexity 1 include/linux/unaligned/access_ok.h:get_unaligned_be32 Cyclomatic Complexity 1 include/linux/unaligned/access_ok.h:put_unaligned_be16 Cyclomatic Complexity 3 include/linux/err.h:IS_ERR_OR_NULL Cyclomatic Complexity 3 include/acpi/acpi_bus.h:is_acpi_device_node Cyclomatic Complexity 2 include/acpi/acpi_bus.h:to_acpi_device_node Cyclomatic Complexity 1 include/linux/err.h:IS_ERR Cyclomatic Complexity 1 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_disable Cyclomatic Complexity 2 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_work_complete Cyclomatic Complexity 4 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_remove Cyclomatic Complexity 1 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_enable_mode Cyclomatic Complexity 1 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_enable Cyclomatic Complexity 1 include/linux/workqueue.h:queue_work Cyclomatic Complexity 1 include/linux/workqueue.h:schedule_work Cyclomatic Complexity 1 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_download Cyclomatic Complexity 3 drivers/nfc/pn544/i2c.c:check_crc Cyclomatic Complexity 3 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_check_cmd Cyclomatic Complexity 1 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_add_len_crc Cyclomatic Complexity 1 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_remove_len_crc Cyclomatic Complexity 6 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_write Cyclomatic Complexity 16 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_read_status Cyclomatic Complexity 1 include/linux/skbuff.h:alloc_skb Cyclomatic Complexity 8 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_read Cyclomatic Complexity 11 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_irq_thread_fn Cyclomatic Complexity 4 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_write_cmd Cyclomatic Complexity 2 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_write_chunk Cyclomatic Complexity 4 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_secure_write_frame_cmd Cyclomatic Complexity 9 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_secure_write_frame Cyclomatic Complexity 23 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_work Cyclomatic Complexity 1 include/linux/device.h:devm_kzalloc Cyclomatic Complexity 6 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_platform_init Cyclomatic Complexity 10 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_probe Cyclomatic Complexity 1 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_driver_init Cyclomatic Complexity 1 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_driver_exit Cyclomatic Complexity 1 drivers/nfc/pn544/i2c.c:_GLOBAL__sub_I_65535_0_i2c.c cc1: some warnings being treated as errors vim +/nfc_dbg +910 drivers/nfc/pn544/i2c.c 904 905 phy->i2c_dev = client; 906 i2c_set_clientdata(client, phy); 907 908 r = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_pn544_gpios); 909 if (r) > 910 nfc_dbg(dev, "Unable to add GPIO mapping table\n"); 911 912 /* Get EN GPIO */ 913 phy->gpiod_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
On Fri, 2017-03-24 at 23:50 +0800, kbuild test robot wrote: > Hi Andy, > > [auto build test ERROR on linus/master] > [also build test ERROR on v4.11-rc3 next-20170324] > [if your patch is applied to the wrong git tree, please drop us a note > to help improve the system] > > url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/NFC-p > n544-Get-rid-of-platform-data/20170324-232445 > config: i386-randconfig-x078-201712 (attached as .config) > compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 > reproduce: > # save the attached .config to linux build tree > make ARCH=i386 > > All errors (new ones prefixed by >>): > > drivers/nfc/pn544/i2c.c: In function 'pn544_hci_i2c_probe': > > > drivers/nfc/pn544/i2c.c:910:3: error: implicit declaration of > > > function 'nfc_dbg' [-Werror=implicit-function-declaration] > > nfc_dbg(dev, "Unable to add GPIO mapping table\n"); > ^~~~~~~ Yes, there is a dependency patch. Since I have heard nothing from NFC maintainers (subsystem seems abandoned) and taking into consideration removal of such macro back in 2011 I'll probably replace nfc_* by dev_* in the driver. > Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size > Cyclomatic Complexity 1 include/uapi/linux/swab.h:__swab16p > Cyclomatic Complexity 1 include/uapi/linux/swab.h:__swab32p > Cyclomatic Complexity 1 > include/uapi/linux/byteorder/little_endian.h:__be32_to_cpup > Cyclomatic Complexity 1 > include/uapi/linux/byteorder/little_endian.h:__be16_to_cpup > Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD > Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR > Cyclomatic Complexity 1 include/linux/workqueue.h:__init_work > Cyclomatic Complexity 1 include/linux/device.h:dev_get_drvdata > Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata > Cyclomatic Complexity 1 include/linux/i2c.h:i2c_get_clientdata > Cyclomatic Complexity 1 include/linux/i2c.h:i2c_set_clientdata > Cyclomatic Complexity 1 include/linux/i2c.h:i2c_get_functionality > Cyclomatic Complexity 1 include/linux/i2c.h:i2c_check_functionality > Cyclomatic Complexity 2 > include/linux/acpi.h:acpi_dev_remove_driver_gpios > Cyclomatic Complexity 1 > include/linux/unaligned/access_ok.h:get_unaligned_be16 > Cyclomatic Complexity 1 > include/linux/unaligned/access_ok.h:get_unaligned_be32 > Cyclomatic Complexity 1 > include/linux/unaligned/access_ok.h:put_unaligned_be16 > Cyclomatic Complexity 3 include/linux/err.h:IS_ERR_OR_NULL > Cyclomatic Complexity 3 include/acpi/acpi_bus.h:is_acpi_device_node > Cyclomatic Complexity 2 include/acpi/acpi_bus.h:to_acpi_device_node > Cyclomatic Complexity 1 include/linux/err.h:IS_ERR > Cyclomatic Complexity 1 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_disable > Cyclomatic Complexity 2 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_work_complete > Cyclomatic Complexity 4 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_remove > Cyclomatic Complexity 1 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_enable_mode > Cyclomatic Complexity 1 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_enable > Cyclomatic Complexity 1 include/linux/workqueue.h:queue_work > Cyclomatic Complexity 1 include/linux/workqueue.h:schedule_work > Cyclomatic Complexity 1 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_download > Cyclomatic Complexity 3 drivers/nfc/pn544/i2c.c:check_crc > Cyclomatic Complexity 3 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_check_cmd > Cyclomatic Complexity 1 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_add_len_crc > Cyclomatic Complexity 1 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_remove_len_crc > Cyclomatic Complexity 6 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_write > Cyclomatic Complexity 16 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_read_status > Cyclomatic Complexity 1 include/linux/skbuff.h:alloc_skb > Cyclomatic Complexity 8 drivers/nfc/pn544/i2c.c:pn544_hci_i2c_read > Cyclomatic Complexity 11 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_irq_thread_fn > Cyclomatic Complexity 4 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_write_cmd > Cyclomatic Complexity 2 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_write_chunk > Cyclomatic Complexity 4 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_secure_write_frame_cmd > Cyclomatic Complexity 9 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_secure_write_frame > Cyclomatic Complexity 23 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_fw_work > Cyclomatic Complexity 1 include/linux/device.h:devm_kzalloc > Cyclomatic Complexity 6 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_platform_init > Cyclomatic Complexity 10 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_probe > Cyclomatic Complexity 1 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_driver_init > Cyclomatic Complexity 1 > drivers/nfc/pn544/i2c.c:pn544_hci_i2c_driver_exit > Cyclomatic Complexity 1 > drivers/nfc/pn544/i2c.c:_GLOBAL__sub_I_65535_0_i2c.c > cc1: some warnings being treated as errors > > vim +/nfc_dbg +910 drivers/nfc/pn544/i2c.c > > 904 > 905 phy->i2c_dev = client; > 906 i2c_set_clientdata(client, phy); > 907 > 908 r = > acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_pn544_gpios); > 909 if (r) > > 910 nfc_dbg(dev, "Unable to add GPIO mapping > table\n"); > 911 > 912 /* Get EN GPIO */ > 913 phy->gpiod_en = devm_gpiod_get(dev, "enable", > GPIOD_OUT_LOW); > > --- > 0-DAY kernel test infrastructure Open Source Technology > Center > https://lists.01.org/pipermail/kbuild-all Intel > Corporation
diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c index 6226d220f1d0..daa48531b7ae 100644 --- a/drivers/nfc/pn544/i2c.c +++ b/drivers/nfc/pn544/i2c.c @@ -879,58 +879,10 @@ static const struct acpi_gpio_mapping acpi_pn544_gpios[] = { { }, }; -static int pn544_hci_i2c_acpi_request_resources(struct i2c_client *client) -{ - struct pn544_i2c_phy *phy = i2c_get_clientdata(client); - struct device *dev = &client->dev; - int ret; - - ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_pn544_gpios); - if (ret) - return ret; - - /* Get EN GPIO from ACPI */ - phy->gpiod_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR(phy->gpiod_en)) { - nfc_err(dev, "Unable to get EN GPIO\n"); - return PTR_ERR(phy->gpiod_en); - } - - /* Get FW GPIO from ACPI */ - phy->gpiod_fw = devm_gpiod_get(dev, "firmware", GPIOD_OUT_LOW); - if (IS_ERR(phy->gpiod_fw)) { - nfc_err(dev, "Unable to get FW GPIO\n"); - return PTR_ERR(phy->gpiod_fw); - } - - return 0; -} - -static int pn544_hci_i2c_of_request_resources(struct i2c_client *client) -{ - struct pn544_i2c_phy *phy = i2c_get_clientdata(client); - struct device *dev = &client->dev; - - /* Obtaining EN GPIO from device tree */ - phy->gpiod_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR(phy->gpiod_en)) { - nfc_err(dev, "Failed to get EN gpio\n"); - return PTR_ERR(phy->gpiod_en); - } - - /* Obtaining FW GPIO from device tree */ - phy->gpiod_fw = devm_gpiod_get(dev, "firmware", GPIOD_OUT_LOW); - if (IS_ERR(phy->gpiod_fw)) { - nfc_err(dev, "Failed to get FW gpio\n"); - return PTR_ERR(phy->gpiod_fw); - } - - return 0; -} - static int pn544_hci_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { + struct device *dev = &client->dev; struct pn544_i2c_phy *phy; int r = 0; @@ -953,24 +905,22 @@ static int pn544_hci_i2c_probe(struct i2c_client *client, phy->i2c_dev = client; i2c_set_clientdata(client, phy); - /* No platform data, using device tree. */ - if (client->dev.of_node) { - r = pn544_hci_i2c_of_request_resources(client); - if (r) { - nfc_err(&client->dev, "No DT data\n"); - return r; - } - /* Using ACPI */ - } else if (ACPI_HANDLE(&client->dev)) { - r = pn544_hci_i2c_acpi_request_resources(client); - if (r) { - nfc_err(&client->dev, - "Cannot get ACPI data\n"); - return r; - } - } else { - nfc_err(&client->dev, "No platform data\n"); - return -EINVAL; + r = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_pn544_gpios); + if (r) + nfc_dbg(dev, "Unable to add GPIO mapping table\n"); + + /* Get EN GPIO */ + phy->gpiod_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); + if (IS_ERR(phy->gpiod_en)) { + nfc_err(dev, "Unable to get EN GPIO\n"); + return PTR_ERR(phy->gpiod_en); + } + + /* Get FW GPIO */ + phy->gpiod_fw = devm_gpiod_get(dev, "firmware", GPIOD_OUT_LOW); + if (IS_ERR(phy->gpiod_fw)) { + nfc_err(dev, "Unable to get FW GPIO\n"); + return PTR_ERR(phy->gpiod_fw); } pn544_hci_i2c_platform_init(phy);
Since OF and ACPI case almost the same get rid of code duplication by moving gpiod_get() calls directly to ->probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- The patch depends on early sent http://marc.info/?l=linux-wireless&m=149021085530803&w=2 drivers/nfc/pn544/i2c.c | 84 ++++++++++--------------------------------------- 1 file changed, 17 insertions(+), 67 deletions(-)