Message ID | 20210202125032.64982-5-heikki.krogerus@linux.intel.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | usb: Handle device properties with software node API | expand |
Hi Heikki, I love your patch! Yet something to improve: [auto build test ERROR on usb/usb-testing] [also build test ERROR on next-20210125] [cannot apply to balbi-usb/testing/next char-misc/char-misc-testing v5.11-rc6] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Heikki-Krogerus/usb-Handle-device-properties-with-software-node-API/20210202-205900 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: arm-defconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/ca804315a8e0060b2be65411c7d32cbf4396a030 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Heikki-Krogerus/usb-Handle-device-properties-with-software-node-API/20210202-205900 git checkout ca804315a8e0060b2be65411c7d32cbf4396a030 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/usb/dwc3/dwc3-qcom.c: In function 'dwc3_qcom_acpi_register_core': >> drivers/usb/dwc3/dwc3-qcom.c:620:51: error: incompatible type for argument 2 of 'device_add_software_node' 620 | ret = device_add_software_node(&qcom->dwc3->dev, dwc3_qcom_swnode); | ^~~~~~~~~~~~~~~~ | | | const struct software_node In file included from include/linux/of.h:22, from include/linux/irqdomain.h:35, from include/linux/acpi.h:13, from drivers/usb/dwc3/dwc3-qcom.c:7: include/linux/property.h:491:78: note: expected 'const struct software_node *' but argument is of type 'const struct software_node' 491 | int device_add_software_node(struct device *dev, const struct software_node *swnode); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ vim +/device_add_software_node +620 drivers/usb/dwc3/dwc3-qcom.c 573 574 static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) 575 { 576 struct dwc3_qcom *qcom = platform_get_drvdata(pdev); 577 struct device *dev = &pdev->dev; 578 struct resource *res, *child_res = NULL; 579 struct platform_device *pdev_irq = qcom->urs_usb ? qcom->urs_usb : 580 pdev; 581 int irq; 582 int ret; 583 584 qcom->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); 585 if (!qcom->dwc3) 586 return -ENOMEM; 587 588 qcom->dwc3->dev.parent = dev; 589 qcom->dwc3->dev.type = dev->type; 590 qcom->dwc3->dev.dma_mask = dev->dma_mask; 591 qcom->dwc3->dev.dma_parms = dev->dma_parms; 592 qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask; 593 594 child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL); 595 if (!child_res) 596 return -ENOMEM; 597 598 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 599 if (!res) { 600 dev_err(&pdev->dev, "failed to get memory resource\n"); 601 ret = -ENODEV; 602 goto out; 603 } 604 605 child_res[0].flags = res->flags; 606 child_res[0].start = res->start; 607 child_res[0].end = child_res[0].start + 608 qcom->acpi_pdata->dwc3_core_base_size; 609 610 irq = platform_get_irq(pdev_irq, 0); 611 child_res[1].flags = IORESOURCE_IRQ; 612 child_res[1].start = child_res[1].end = irq; 613 614 ret = platform_device_add_resources(qcom->dwc3, child_res, 2); 615 if (ret) { 616 dev_err(&pdev->dev, "failed to add resources\n"); 617 goto out; 618 } 619 > 620 ret = device_add_software_node(&qcom->dwc3->dev, dwc3_qcom_swnode); 621 if (ret < 0) { 622 dev_err(&pdev->dev, "failed to add properties\n"); 623 goto out; 624 } 625 626 ret = platform_device_add(qcom->dwc3); 627 if (ret) { 628 dev_err(&pdev->dev, "failed to add device\n"); 629 device_remove_software_node(&qcom->dwc3->dev); 630 } 631 632 out: 633 kfree(child_res); 634 return ret; 635 } 636 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Heikki, I love your patch! Yet something to improve: [auto build test ERROR on usb/usb-testing] [also build test ERROR on next-20210125] [cannot apply to balbi-usb/testing/next char-misc/char-misc-testing v5.11-rc6] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Heikki-Krogerus/usb-Handle-device-properties-with-software-node-API/20210202-205900 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: riscv-randconfig-r031-20210202 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 275c6af7d7f1ed63a03d05b4484413e447133269) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/0day-ci/linux/commit/ca804315a8e0060b2be65411c7d32cbf4396a030 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Heikki-Krogerus/usb-Handle-device-properties-with-software-node-API/20210202-205900 git checkout ca804315a8e0060b2be65411c7d32cbf4396a030 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/usb/dwc3/dwc3-qcom.c:620:51: error: passing 'const struct software_node' to parameter of incompatible type 'const struct software_node *'; take the address with & ret = device_add_software_node(&qcom->dwc3->dev, dwc3_qcom_swnode); ^~~~~~~~~~~~~~~~ & include/linux/property.h:491:78: note: passing argument to parameter 'swnode' here int device_add_software_node(struct device *dev, const struct software_node *swnode); ^ 1 error generated. vim +620 drivers/usb/dwc3/dwc3-qcom.c 573 574 static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) 575 { 576 struct dwc3_qcom *qcom = platform_get_drvdata(pdev); 577 struct device *dev = &pdev->dev; 578 struct resource *res, *child_res = NULL; 579 struct platform_device *pdev_irq = qcom->urs_usb ? qcom->urs_usb : 580 pdev; 581 int irq; 582 int ret; 583 584 qcom->dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); 585 if (!qcom->dwc3) 586 return -ENOMEM; 587 588 qcom->dwc3->dev.parent = dev; 589 qcom->dwc3->dev.type = dev->type; 590 qcom->dwc3->dev.dma_mask = dev->dma_mask; 591 qcom->dwc3->dev.dma_parms = dev->dma_parms; 592 qcom->dwc3->dev.coherent_dma_mask = dev->coherent_dma_mask; 593 594 child_res = kcalloc(2, sizeof(*child_res), GFP_KERNEL); 595 if (!child_res) 596 return -ENOMEM; 597 598 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 599 if (!res) { 600 dev_err(&pdev->dev, "failed to get memory resource\n"); 601 ret = -ENODEV; 602 goto out; 603 } 604 605 child_res[0].flags = res->flags; 606 child_res[0].start = res->start; 607 child_res[0].end = child_res[0].start + 608 qcom->acpi_pdata->dwc3_core_base_size; 609 610 irq = platform_get_irq(pdev_irq, 0); 611 child_res[1].flags = IORESOURCE_IRQ; 612 child_res[1].start = child_res[1].end = irq; 613 614 ret = platform_device_add_resources(qcom->dwc3, child_res, 2); 615 if (ret) { 616 dev_err(&pdev->dev, "failed to add resources\n"); 617 goto out; 618 } 619 > 620 ret = device_add_software_node(&qcom->dwc3->dev, dwc3_qcom_swnode); 621 if (ret < 0) { 622 dev_err(&pdev->dev, "failed to add properties\n"); 623 goto out; 624 } 625 626 ret = platform_device_add(qcom->dwc3); 627 if (ret) { 628 dev_err(&pdev->dev, "failed to add device\n"); 629 device_remove_software_node(&qcom->dwc3->dev); 630 } 631 632 out: 633 kfree(child_res); 634 return ret; 635 } 636 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index d803ee98c628e..d857d6c160a66 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -567,6 +567,10 @@ static const struct property_entry dwc3_qcom_acpi_properties[] = { {} }; +static const struct software_node dwc3_qcom_swnode = { + .properties = dwc3_qcom_acpi_properties, +}; + static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) { struct dwc3_qcom *qcom = platform_get_drvdata(pdev); @@ -613,16 +617,17 @@ static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) goto out; } - ret = platform_device_add_properties(qcom->dwc3, - dwc3_qcom_acpi_properties); + ret = device_add_software_node(&qcom->dwc3->dev, dwc3_qcom_swnode); if (ret < 0) { dev_err(&pdev->dev, "failed to add properties\n"); goto out; } ret = platform_device_add(qcom->dwc3); - if (ret) + if (ret) { dev_err(&pdev->dev, "failed to add device\n"); + device_remove_software_node(&qcom->dwc3->dev); + } out: kfree(child_res); @@ -837,6 +842,7 @@ static int dwc3_qcom_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; int i; + device_remove_software_node(&qcom->dwc3->dev); of_platform_depopulate(dev); for (i = qcom->num_clocks - 1; i >= 0; i--) {
What platform_device_add_properties() does is it allocates dynamically a software node that will contain the device properties supplied to it, and then couples that node with the device. If the properties are constant, the node can be constant as well. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> --- drivers/usb/dwc3/dwc3-qcom.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)