All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors()
@ 2021-06-06  7:05 Dejin Zheng
  2021-06-06  7:05 ` [PATCH v6 1/4] PCI: " Dejin Zheng
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Dejin Zheng @ 2021-06-06  7:05 UTC (permalink / raw)
  To: helgaas, corbet, jarkko.nikula, andriy.shevchenko,
	mika.westerberg, rric, bhelgaas, linux-doc, linux-i2c, linux-pci
  Cc: linux-kernel, Dejin Zheng

Introduce pcim_alloc_irq_vectors(), a device-managed version of
pci_alloc_irq_vectors(), In some i2c drivers, If pcim_enable_device()
has been called before, then pci_alloc_irq_vectors() is actually a
device-managed function. It is used as a device-managed function, So
replace it with pcim_alloc_irq_vectors().

Changelog
---------
v5 -> v6:
	- rebase to 5.13-rc4
v4 -> v5:
	- Remove the check of enable device in pcim_alloc_irq_vectors()
	  and make it as a static line function.
	- Modify the subject name in patch 3 and patch 4.
v3 -> v4:
	- add some commit comments for patch 3
v2 -> v3:
	- Add some commit comments for replace some codes in
	  pcim_release() by pci_free_irq_vectors().
	- Simplify the error handling path in i2c designware
	  driver.
v1 -> v2:
	- Use pci_free_irq_vectors() to replace some code in
	  pcim_release().
	- Modify some commit messages.

Dejin Zheng (4):
  PCI: Introduce pcim_alloc_irq_vectors()
  Documentation: devres: Add pcim_alloc_irq_vectors()
  i2c: designware: Use pcim_alloc_irq_vectors() to allocate IRQ vectors
  i2c: thunderx: Use pcim_alloc_irq_vectors() to allocate IRQ vectors

 .../driver-api/driver-model/devres.rst        |  1 +
 drivers/i2c/busses/i2c-designware-pcidrv.c    | 15 ++++--------
 drivers/i2c/busses/i2c-thunderx-pcidrv.c      |  2 +-
 drivers/pci/pci.c                             |  5 +---
 include/linux/pci.h                           | 24 +++++++++++++++++++
 5 files changed, 31 insertions(+), 16 deletions(-)

-- 
2.30.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v6 1/4] PCI: Introduce pcim_alloc_irq_vectors()
  2021-06-06  7:05 [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors() Dejin Zheng
@ 2021-06-06  7:05 ` Dejin Zheng
  2021-06-06 19:31     ` kernel test robot
  2021-06-06  7:05 ` [PATCH v6 2/4] Documentation: devres: Add pcim_alloc_irq_vectors() Dejin Zheng
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Dejin Zheng @ 2021-06-06  7:05 UTC (permalink / raw)
  To: helgaas, corbet, jarkko.nikula, andriy.shevchenko,
	mika.westerberg, rric, bhelgaas, linux-doc, linux-i2c, linux-pci
  Cc: linux-kernel, Dejin Zheng

Introduce pcim_alloc_irq_vectors(), a device-managed version of
pci_alloc_irq_vectors(). Introducing this function can simplify
the error handling path in many drivers.

And use pci_free_irq_vectors() to replace some code in pcim_release(),
they are equivalent, and no functional change. It is more explicit
that pcim_alloc_irq_vectors() is a device-managed function.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Robert Richter <rric@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
v5 -> v6:
	- rebase to 5.13-rc4
v4 -> v5:
	- Remove the check of enable device in pcim_alloc_irq_vectors()
	  and make it as a static line function.
v3 -> v4:
	- No change
v2 -> v3:
	- Add some commit comments for replace some codes in
	  pcim_release() by pci_free_irq_vectors().
v1 -> v2:
	- Use pci_free_irq_vectors() to replace some code in
	  pcim_release().
	- Modify some commit messages.

 drivers/pci/pci.c   |  5 +----
 include/linux/pci.h | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b717680377a9..6319e5889688 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1989,10 +1989,7 @@ static void pcim_release(struct device *gendev, void *res)
 	struct pci_devres *this = res;
 	int i;
 
-	if (dev->msi_enabled)
-		pci_disable_msi(dev);
-	if (dev->msix_enabled)
-		pci_disable_msix(dev);
+	pci_free_irq_vectors(dev);
 
 	for (i = 0; i < DEVICE_COUNT_RESOURCE; i++)
 		if (this->region_mask & (1 << i))
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c20211e59a57..e9c95cab2540 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1825,6 +1825,30 @@ pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
 					      NULL);
 }
 
+/**
+ * pcim_alloc_irq_vectors - a device-managed pci_alloc_irq_vectors()
+ * @dev:		PCI device to operate on
+ * @min_vecs:		minimum number of vectors required (must be >= 1)
+ * @max_vecs:		maximum (desired) number of vectors
+ * @flags:		flags or quirks for the allocation
+ *
+ * Return the number of vectors allocated, (which might be smaller than
+ * @max_vecs) if successful, or a negative error code on error. If less
+ * than @min_vecs interrupt vectors are available for @dev the function
+ * will fail with -ENOSPC.
+ *
+ * It depends on calling pcim_enable_device() to make IRQ resources
+ * manageable.
+ */
+static inline int
+pcim_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
+			unsigned int max_vecs, unsigned int flags)
+{
+	if (!pci_is_managed(dev))
+		return -EINVAL;
+	return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags);
+}
+
 /* Include architecture-dependent settings and functions */
 
 #include <asm/pci.h>
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v6 2/4] Documentation: devres: Add pcim_alloc_irq_vectors()
  2021-06-06  7:05 [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors() Dejin Zheng
  2021-06-06  7:05 ` [PATCH v6 1/4] PCI: " Dejin Zheng
@ 2021-06-06  7:05 ` Dejin Zheng
  2021-06-06  7:05 ` [PATCH v6 3/4] i2c: designware: Use pcim_alloc_irq_vectors() to allocate IRQ vectors Dejin Zheng
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Dejin Zheng @ 2021-06-06  7:05 UTC (permalink / raw)
  To: helgaas, corbet, jarkko.nikula, andriy.shevchenko,
	mika.westerberg, rric, bhelgaas, linux-doc, linux-i2c, linux-pci
  Cc: linux-kernel, Dejin Zheng

Add pcim_alloc_irq_vectors(), a device-managed version of
pci_alloc_irq_vectors(). introducing this function can simplify
the error handling path in many drivers.

Reviewed-by: Robert Richter <rric@kernel.org>
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
v5 -> v6:
	- rebase to 5.13-rc4
v4 -> v5:
	- No change
v3 -> v4:
	- No change
v2 -> v3:
	- No change
v1 -> v2:
	- Modify some commit messages.

 Documentation/driver-api/driver-model/devres.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documentation/driver-api/driver-model/devres.rst
index e0814d214048..fad7d26ccf35 100644
--- a/Documentation/driver-api/driver-model/devres.rst
+++ b/Documentation/driver-api/driver-model/devres.rst
@@ -382,6 +382,7 @@ PCI
   devm_pci_alloc_host_bridge()  : managed PCI host bridge allocation
   devm_pci_remap_cfgspace()	: ioremap PCI configuration space
   devm_pci_remap_cfg_resource()	: ioremap PCI configuration space resource
+  pcim_alloc_irq_vectors()      : managed IRQ vectors allocation
   pcim_enable_device()		: after success, all PCI ops become managed
   pcim_pin_device()		: keep PCI device enabled after release
 
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v6 3/4] i2c: designware: Use pcim_alloc_irq_vectors() to allocate IRQ vectors
  2021-06-06  7:05 [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors() Dejin Zheng
  2021-06-06  7:05 ` [PATCH v6 1/4] PCI: " Dejin Zheng
  2021-06-06  7:05 ` [PATCH v6 2/4] Documentation: devres: Add pcim_alloc_irq_vectors() Dejin Zheng
@ 2021-06-06  7:05 ` Dejin Zheng
  2021-06-06  7:05 ` [PATCH v6 4/4] i2c: thunderx: " Dejin Zheng
  2021-06-07  9:09 ` [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors() Andy Shevchenko
  4 siblings, 0 replies; 11+ messages in thread
From: Dejin Zheng @ 2021-06-06  7:05 UTC (permalink / raw)
  To: helgaas, corbet, jarkko.nikula, andriy.shevchenko,
	mika.westerberg, rric, bhelgaas, linux-doc, linux-i2c, linux-pci
  Cc: linux-kernel, Dejin Zheng

The pcim_alloc_irq_vectors() function, an explicit device-managed version
of pci_alloc_irq_vectors(). If pcim_enable_device() has been called
before, then pci_alloc_irq_vectors() is actually a device-managed
function. It is used here as a device-managed function, So replace it
with pcim_alloc_irq_vectors(). At the same time, Remove the
pci_free_irq_vectors() function to simplify the error handling path.
the freeing resources will take automatically when device is gone.

Reviewed-by: Robert Richter <rric@kernel.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
v5 -> v6:
	- rebase to 5.13-rc4
v4 -> v5:
	- Modify the subject name.
v3 -> v4:
	- add some commit comments.
v2 -> v3:
	- simplify the error handling path.
v1 -> v2:
	- Modify some commit messages.

 drivers/i2c/busses/i2c-designware-pcidrv.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 0f409a4c2da0..2b1ef0934445 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -268,7 +268,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
 	if (!dev)
 		return -ENOMEM;
 
-	r = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
+	r = pcim_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
 	if (r < 0)
 		return r;
 
@@ -283,10 +283,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);
@@ -295,10 +293,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);
 
@@ -318,10 +314,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) {
 		r = navi_amd_register_client(dev);
@@ -349,7 +343,6 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)
 
 	i2c_del_adapter(&dev->adapter);
 	devm_free_irq(&pdev->dev, dev->irq, dev);
-	pci_free_irq_vectors(pdev);
 }
 
 /* work with hotplug and coldplug */
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v6 4/4] i2c: thunderx: Use pcim_alloc_irq_vectors() to allocate IRQ vectors
  2021-06-06  7:05 [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors() Dejin Zheng
                   ` (2 preceding siblings ...)
  2021-06-06  7:05 ` [PATCH v6 3/4] i2c: designware: Use pcim_alloc_irq_vectors() to allocate IRQ vectors Dejin Zheng
@ 2021-06-06  7:05 ` Dejin Zheng
  2021-06-07  9:09 ` [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors() Andy Shevchenko
  4 siblings, 0 replies; 11+ messages in thread
From: Dejin Zheng @ 2021-06-06  7:05 UTC (permalink / raw)
  To: helgaas, corbet, jarkko.nikula, andriy.shevchenko,
	mika.westerberg, rric, bhelgaas, linux-doc, linux-i2c, linux-pci
  Cc: linux-kernel, Dejin Zheng

The pcim_alloc_irq_vectors() function, an explicit device-managed version
of pci_alloc_irq_vectors(). If pcim_enable_device() has been called
before, then pci_alloc_irq_vectors() is actually a device-managed
function. It is used here as a device-managed function, So replace it
with pcim_alloc_irq_vectors().

Acked-by: Robert Richter <rric@kernel.org>
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
v5 -> v6:
	- rebase to 5.13-rc4
v4 -> v5:
	- Modify the subject name.
v3 -> v4:
	- No change.
v2 -> v3:
	- No change.
v1 -> v2:
	- Modify some commit messages.

 drivers/i2c/busses/i2c-thunderx-pcidrv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
index 12c90aa0900e..63354e9fb726 100644
--- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c
+++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
@@ -192,7 +192,7 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev,
 	i2c->hlc_int_enable = thunder_i2c_hlc_int_enable;
 	i2c->hlc_int_disable = thunder_i2c_hlc_int_disable;
 
-	ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
+	ret = pcim_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
 	if (ret < 0)
 		goto error;
 
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v6 1/4] PCI: Introduce pcim_alloc_irq_vectors()
  2021-06-06  7:05 ` [PATCH v6 1/4] PCI: " Dejin Zheng
@ 2021-06-06 19:31     ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-06-06 19:31 UTC (permalink / raw)
  To: Dejin Zheng, helgaas, corbet, jarkko.nikula, andriy.shevchenko,
	mika.westerberg, rric, bhelgaas, linux-doc, linux-i2c, linux-pci
  Cc: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 7944 bytes --]

Hi Dejin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pci/next]
[also build test ERROR on wsa/i2c/for-next lwn/docs-next linus/master v5.13-rc4 next-20210604]
[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/Dejin-Zheng/Introduce-pcim_alloc_irq_vectors/20210606-150730
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: sparc-randconfig-c004-20210606 (attached as .config)
compiler: sparc64-linux-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/7b311110dce8729956f7545d1f11b2bbd60f6193
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Dejin-Zheng/Introduce-pcim_alloc_irq_vectors/20210606-150730
        git checkout 7b311110dce8729956f7545d1f11b2bbd60f6193
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc 

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 >>):

   In file included from net/core/rtnetlink.c:37:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from arch/sparc/lib/iomap.c:5:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   cc1: all warnings being treated as errors
--
   In file included from drivers/gpu/drm/drm_file.c:38:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   drivers/gpu/drm/drm_file.c: At top level:
   drivers/gpu/drm/drm_file.c:789:6: warning: no previous prototype for 'drm_send_event_helper' [-Wmissing-prototypes]
     789 | void drm_send_event_helper(struct drm_device *dev,
         |      ^~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from drivers/ide/ide-proc.c:25:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   At top level:
   drivers/ide/ide-proc.c:457:37: warning: 'ide_media_proc_fops' defined but not used [-Wunused-const-variable=]
     457 | static const struct file_operations ide_media_proc_fops = {
         |                                     ^~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/ide.h:18,
                    from drivers/ide/ide-cd_ioctl.c:13:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   drivers/ide/ide-cd_ioctl.c: In function 'ide_cdrom_select_speed':
   drivers/ide/ide-cd_ioctl.c:212:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]
     212 |  int stat;
         |      ^~~~
   cc1: some warnings being treated as errors
--
   In file included from drivers/ata/ahci.h:22,
                    from drivers/ata/ahci_platform.c:21:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   In file included from drivers/ata/ahci_platform.c:21:
   drivers/ata/ahci_platform.c: At top level:
   drivers/ata/ahci.h:388:16: warning: initialized field overwritten [-Woverride-init]
     388 |  .can_queue  = AHCI_MAX_CMDS,   \
         |                ^~~~~~~~~~~~~
   drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
      40 |  AHCI_SHT(DRV_NAME),
         |  ^~~~~~~~
   drivers/ata/ahci.h:388:16: note: (near initialization for 'ahci_platform_sht.can_queue')
     388 |  .can_queue  = AHCI_MAX_CMDS,   \
         |                ^~~~~~~~~~~~~
   drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
      40 |  AHCI_SHT(DRV_NAME),
         |  ^~~~~~~~
   drivers/ata/ahci.h:392:17: warning: initialized field overwritten [-Woverride-init]
     392 |  .sdev_attrs  = ahci_sdev_attrs
         |                 ^~~~~~~~~~~~~~~
   drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
      40 |  AHCI_SHT(DRV_NAME),
         |  ^~~~~~~~
   drivers/ata/ahci.h:392:17: note: (near initialization for 'ahci_platform_sht.sdev_attrs')
     392 |  .sdev_attrs  = ahci_sdev_attrs
         |                 ^~~~~~~~~~~~~~~
   drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
      40 |  AHCI_SHT(DRV_NAME),
         |  ^~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from drivers/usb/host/xhci.c:11:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   drivers/usb/host/xhci.c: In function 'xhci_unmap_temp_buf':
   drivers/usb/host/xhci.c:1349:15: warning: variable 'len' set but not used [-Wunused-but-set-variable]
    1349 |  unsigned int len;
         |               ^~~
   cc1: some warnings being treated as errors

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for LOCKDEP
   Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
   Selected by
   - PROVE_LOCKING && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
   - DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT


vim +/pci_is_managed +1847 include/linux/pci.h

  1827	
  1828	/**
  1829	 * pcim_alloc_irq_vectors - a device-managed pci_alloc_irq_vectors()
  1830	 * @dev:		PCI device to operate on
  1831	 * @min_vecs:		minimum number of vectors required (must be >= 1)
  1832	 * @max_vecs:		maximum (desired) number of vectors
  1833	 * @flags:		flags or quirks for the allocation
  1834	 *
  1835	 * Return the number of vectors allocated, (which might be smaller than
  1836	 * @max_vecs) if successful, or a negative error code on error. If less
  1837	 * than @min_vecs interrupt vectors are available for @dev the function
  1838	 * will fail with -ENOSPC.
  1839	 *
  1840	 * It depends on calling pcim_enable_device() to make IRQ resources
  1841	 * manageable.
  1842	 */
  1843	static inline int
  1844	pcim_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
  1845				unsigned int max_vecs, unsigned int flags)
  1846	{
> 1847		if (!pci_is_managed(dev))
  1848			return -EINVAL;
  1849		return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags);
  1850	}
  1851	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28376 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v6 1/4] PCI: Introduce pcim_alloc_irq_vectors()
@ 2021-06-06 19:31     ` kernel test robot
  0 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-06-06 19:31 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 8107 bytes --]

Hi Dejin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pci/next]
[also build test ERROR on wsa/i2c/for-next lwn/docs-next linus/master v5.13-rc4 next-20210604]
[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/Dejin-Zheng/Introduce-pcim_alloc_irq_vectors/20210606-150730
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: sparc-randconfig-c004-20210606 (attached as .config)
compiler: sparc64-linux-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/7b311110dce8729956f7545d1f11b2bbd60f6193
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Dejin-Zheng/Introduce-pcim_alloc_irq_vectors/20210606-150730
        git checkout 7b311110dce8729956f7545d1f11b2bbd60f6193
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc 

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 >>):

   In file included from net/core/rtnetlink.c:37:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from arch/sparc/lib/iomap.c:5:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   cc1: all warnings being treated as errors
--
   In file included from drivers/gpu/drm/drm_file.c:38:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   drivers/gpu/drm/drm_file.c: At top level:
   drivers/gpu/drm/drm_file.c:789:6: warning: no previous prototype for 'drm_send_event_helper' [-Wmissing-prototypes]
     789 | void drm_send_event_helper(struct drm_device *dev,
         |      ^~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from drivers/ide/ide-proc.c:25:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   At top level:
   drivers/ide/ide-proc.c:457:37: warning: 'ide_media_proc_fops' defined but not used [-Wunused-const-variable=]
     457 | static const struct file_operations ide_media_proc_fops = {
         |                                     ^~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from include/linux/ide.h:18,
                    from drivers/ide/ide-cd_ioctl.c:13:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   drivers/ide/ide-cd_ioctl.c: In function 'ide_cdrom_select_speed':
   drivers/ide/ide-cd_ioctl.c:212:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]
     212 |  int stat;
         |      ^~~~
   cc1: some warnings being treated as errors
--
   In file included from drivers/ata/ahci.h:22,
                    from drivers/ata/ahci_platform.c:21:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   In file included from drivers/ata/ahci_platform.c:21:
   drivers/ata/ahci_platform.c: At top level:
   drivers/ata/ahci.h:388:16: warning: initialized field overwritten [-Woverride-init]
     388 |  .can_queue  = AHCI_MAX_CMDS,   \
         |                ^~~~~~~~~~~~~
   drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
      40 |  AHCI_SHT(DRV_NAME),
         |  ^~~~~~~~
   drivers/ata/ahci.h:388:16: note: (near initialization for 'ahci_platform_sht.can_queue')
     388 |  .can_queue  = AHCI_MAX_CMDS,   \
         |                ^~~~~~~~~~~~~
   drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
      40 |  AHCI_SHT(DRV_NAME),
         |  ^~~~~~~~
   drivers/ata/ahci.h:392:17: warning: initialized field overwritten [-Woverride-init]
     392 |  .sdev_attrs  = ahci_sdev_attrs
         |                 ^~~~~~~~~~~~~~~
   drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
      40 |  AHCI_SHT(DRV_NAME),
         |  ^~~~~~~~
   drivers/ata/ahci.h:392:17: note: (near initialization for 'ahci_platform_sht.sdev_attrs')
     392 |  .sdev_attrs  = ahci_sdev_attrs
         |                 ^~~~~~~~~~~~~~~
   drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
      40 |  AHCI_SHT(DRV_NAME),
         |  ^~~~~~~~
   cc1: some warnings being treated as errors
--
   In file included from drivers/usb/host/xhci.c:11:
   include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
>> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
    1847 |  if (!pci_is_managed(dev))
         |       ^~~~~~~~~~~~~~
   drivers/usb/host/xhci.c: In function 'xhci_unmap_temp_buf':
   drivers/usb/host/xhci.c:1349:15: warning: variable 'len' set but not used [-Wunused-but-set-variable]
    1349 |  unsigned int len;
         |               ^~~
   cc1: some warnings being treated as errors

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for LOCKDEP
   Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
   Selected by
   - PROVE_LOCKING && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
   - DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT


vim +/pci_is_managed +1847 include/linux/pci.h

  1827	
  1828	/**
  1829	 * pcim_alloc_irq_vectors - a device-managed pci_alloc_irq_vectors()
  1830	 * @dev:		PCI device to operate on
  1831	 * @min_vecs:		minimum number of vectors required (must be >= 1)
  1832	 * @max_vecs:		maximum (desired) number of vectors
  1833	 * @flags:		flags or quirks for the allocation
  1834	 *
  1835	 * Return the number of vectors allocated, (which might be smaller than
  1836	 * @max_vecs) if successful, or a negative error code on error. If less
  1837	 * than @min_vecs interrupt vectors are available for @dev the function
  1838	 * will fail with -ENOSPC.
  1839	 *
  1840	 * It depends on calling pcim_enable_device() to make IRQ resources
  1841	 * manageable.
  1842	 */
  1843	static inline int
  1844	pcim_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
  1845				unsigned int max_vecs, unsigned int flags)
  1846	{
> 1847		if (!pci_is_managed(dev))
  1848			return -EINVAL;
  1849		return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags);
  1850	}
  1851	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 28376 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors()
  2021-06-06  7:05 [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors() Dejin Zheng
                   ` (3 preceding siblings ...)
  2021-06-06  7:05 ` [PATCH v6 4/4] i2c: thunderx: " Dejin Zheng
@ 2021-06-07  9:09 ` Andy Shevchenko
  2021-06-07 14:30   ` Dejin Zheng
  4 siblings, 1 reply; 11+ messages in thread
From: Andy Shevchenko @ 2021-06-07  9:09 UTC (permalink / raw)
  To: Dejin Zheng
  Cc: helgaas, corbet, jarkko.nikula, mika.westerberg, rric, bhelgaas,
	linux-doc, linux-i2c, linux-pci, linux-kernel

On Sun, Jun 06, 2021 at 03:05:07PM +0800, Dejin Zheng wrote:
> Introduce pcim_alloc_irq_vectors(), a device-managed version of
> pci_alloc_irq_vectors(), In some i2c drivers, If pcim_enable_device()
> has been called before, then pci_alloc_irq_vectors() is actually a
> device-managed function. It is used as a device-managed function, So
> replace it with pcim_alloc_irq_vectors().

Thanks!

> Changelog
> ---------
> v5 -> v6:
> 	- rebase to 5.13-rc4

It's already rc5 and I believe you better use the subsystem tree against which
your series is (i.e. PCI for-next or how it is called there).

Besides that kbuild bot is not happy.


-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v6 1/4] PCI: Introduce pcim_alloc_irq_vectors()
  2021-06-06 19:31     ` kernel test robot
@ 2021-06-07 14:24       ` Dejin Zheng
  -1 siblings, 0 replies; 11+ messages in thread
From: Dejin Zheng @ 2021-06-07 14:24 UTC (permalink / raw)
  To: kernel test robot
  Cc: helgaas, corbet, jarkko.nikula, andriy.shevchenko,
	mika.westerberg, rric, bhelgaas, linux-doc, linux-i2c, linux-pci,
	kbuild-all

On Mon, Jun 07, 2021 at 03:31:04AM +0800, kernel test robot wrote:
> Hi Dejin,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on pci/next]
> [also build test ERROR on wsa/i2c/for-next lwn/docs-next linus/master v5.13-rc4 next-20210604]
> [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/Dejin-Zheng/Introduce-pcim_alloc_irq_vectors/20210606-150730
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
> config: sparc-randconfig-c004-20210606 (attached as .config)
> compiler: sparc64-linux-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/7b311110dce8729956f7545d1f11b2bbd60f6193
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Dejin-Zheng/Introduce-pcim_alloc_irq_vectors/20210606-150730
>         git checkout 7b311110dce8729956f7545d1f11b2bbd60f6193
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc 
> 
> 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 >>):
> 
>    In file included from net/core/rtnetlink.c:37:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    cc1: some warnings being treated as errors
> --

Thanks very much for Kernel test robot, I got the root cause of this build error.
I will send a new patch version for fix it.

The sparc defconfig disable PCI, so it can not found the CONFIG_PCI in pci.h,
and the pci_is_managed() function only exists in the pci.h when enable PCI.
so it will report builld this error when disable PCI.

BR,
Dejin
>    In file included from arch/sparc/lib/iomap.c:5:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    cc1: all warnings being treated as errors
> --
>    In file included from drivers/gpu/drm/drm_file.c:38:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    drivers/gpu/drm/drm_file.c: At top level:
>    drivers/gpu/drm/drm_file.c:789:6: warning: no previous prototype for 'drm_send_event_helper' [-Wmissing-prototypes]
>      789 | void drm_send_event_helper(struct drm_device *dev,
>          |      ^~~~~~~~~~~~~~~~~~~~~
>    cc1: some warnings being treated as errors
> --
>    In file included from drivers/ide/ide-proc.c:25:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    At top level:
>    drivers/ide/ide-proc.c:457:37: warning: 'ide_media_proc_fops' defined but not used [-Wunused-const-variable=]
>      457 | static const struct file_operations ide_media_proc_fops = {
>          |                                     ^~~~~~~~~~~~~~~~~~~
>    cc1: some warnings being treated as errors
> --
>    In file included from include/linux/ide.h:18,
>                     from drivers/ide/ide-cd_ioctl.c:13:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    drivers/ide/ide-cd_ioctl.c: In function 'ide_cdrom_select_speed':
>    drivers/ide/ide-cd_ioctl.c:212:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]
>      212 |  int stat;
>          |      ^~~~
>    cc1: some warnings being treated as errors
> --
>    In file included from drivers/ata/ahci.h:22,
>                     from drivers/ata/ahci_platform.c:21:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    In file included from drivers/ata/ahci_platform.c:21:
>    drivers/ata/ahci_platform.c: At top level:
>    drivers/ata/ahci.h:388:16: warning: initialized field overwritten [-Woverride-init]
>      388 |  .can_queue  = AHCI_MAX_CMDS,   \
>          |                ^~~~~~~~~~~~~
>    drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
>       40 |  AHCI_SHT(DRV_NAME),
>          |  ^~~~~~~~
>    drivers/ata/ahci.h:388:16: note: (near initialization for 'ahci_platform_sht.can_queue')
>      388 |  .can_queue  = AHCI_MAX_CMDS,   \
>          |                ^~~~~~~~~~~~~
>    drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
>       40 |  AHCI_SHT(DRV_NAME),
>          |  ^~~~~~~~
>    drivers/ata/ahci.h:392:17: warning: initialized field overwritten [-Woverride-init]
>      392 |  .sdev_attrs  = ahci_sdev_attrs
>          |                 ^~~~~~~~~~~~~~~
>    drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
>       40 |  AHCI_SHT(DRV_NAME),
>          |  ^~~~~~~~
>    drivers/ata/ahci.h:392:17: note: (near initialization for 'ahci_platform_sht.sdev_attrs')
>      392 |  .sdev_attrs  = ahci_sdev_attrs
>          |                 ^~~~~~~~~~~~~~~
>    drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
>       40 |  AHCI_SHT(DRV_NAME),
>          |  ^~~~~~~~
>    cc1: some warnings being treated as errors
> --
>    In file included from drivers/usb/host/xhci.c:11:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    drivers/usb/host/xhci.c: In function 'xhci_unmap_temp_buf':
>    drivers/usb/host/xhci.c:1349:15: warning: variable 'len' set but not used [-Wunused-but-set-variable]
>     1349 |  unsigned int len;
>          |               ^~~
>    cc1: some warnings being treated as errors
> 
> Kconfig warnings: (for reference only)
>    WARNING: unmet direct dependencies detected for LOCKDEP
>    Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
>    Selected by
>    - PROVE_LOCKING && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
>    - DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
> 
> 
> vim +/pci_is_managed +1847 include/linux/pci.h
> 
>   1827	
>   1828	/**
>   1829	 * pcim_alloc_irq_vectors - a device-managed pci_alloc_irq_vectors()
>   1830	 * @dev:		PCI device to operate on
>   1831	 * @min_vecs:		minimum number of vectors required (must be >= 1)
>   1832	 * @max_vecs:		maximum (desired) number of vectors
>   1833	 * @flags:		flags or quirks for the allocation
>   1834	 *
>   1835	 * Return the number of vectors allocated, (which might be smaller than
>   1836	 * @max_vecs) if successful, or a negative error code on error. If less
>   1837	 * than @min_vecs interrupt vectors are available for @dev the function
>   1838	 * will fail with -ENOSPC.
>   1839	 *
>   1840	 * It depends on calling pcim_enable_device() to make IRQ resources
>   1841	 * manageable.
>   1842	 */
>   1843	static inline int
>   1844	pcim_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
>   1845				unsigned int max_vecs, unsigned int flags)
>   1846	{
> > 1847		if (!pci_is_managed(dev))
>   1848			return -EINVAL;
>   1849		return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags);
>   1850	}
>   1851	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v6 1/4] PCI: Introduce pcim_alloc_irq_vectors()
@ 2021-06-07 14:24       ` Dejin Zheng
  0 siblings, 0 replies; 11+ messages in thread
From: Dejin Zheng @ 2021-06-07 14:24 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 8856 bytes --]

On Mon, Jun 07, 2021 at 03:31:04AM +0800, kernel test robot wrote:
> Hi Dejin,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on pci/next]
> [also build test ERROR on wsa/i2c/for-next lwn/docs-next linus/master v5.13-rc4 next-20210604]
> [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/Dejin-Zheng/Introduce-pcim_alloc_irq_vectors/20210606-150730
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
> config: sparc-randconfig-c004-20210606 (attached as .config)
> compiler: sparc64-linux-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/7b311110dce8729956f7545d1f11b2bbd60f6193
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Dejin-Zheng/Introduce-pcim_alloc_irq_vectors/20210606-150730
>         git checkout 7b311110dce8729956f7545d1f11b2bbd60f6193
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc 
> 
> 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 >>):
> 
>    In file included from net/core/rtnetlink.c:37:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    cc1: some warnings being treated as errors
> --

Thanks very much for Kernel test robot, I got the root cause of this build error.
I will send a new patch version for fix it.

The sparc defconfig disable PCI, so it can not found the CONFIG_PCI in pci.h,
and the pci_is_managed() function only exists in the pci.h when enable PCI.
so it will report builld this error when disable PCI.

BR,
Dejin
>    In file included from arch/sparc/lib/iomap.c:5:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    cc1: all warnings being treated as errors
> --
>    In file included from drivers/gpu/drm/drm_file.c:38:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    drivers/gpu/drm/drm_file.c: At top level:
>    drivers/gpu/drm/drm_file.c:789:6: warning: no previous prototype for 'drm_send_event_helper' [-Wmissing-prototypes]
>      789 | void drm_send_event_helper(struct drm_device *dev,
>          |      ^~~~~~~~~~~~~~~~~~~~~
>    cc1: some warnings being treated as errors
> --
>    In file included from drivers/ide/ide-proc.c:25:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    At top level:
>    drivers/ide/ide-proc.c:457:37: warning: 'ide_media_proc_fops' defined but not used [-Wunused-const-variable=]
>      457 | static const struct file_operations ide_media_proc_fops = {
>          |                                     ^~~~~~~~~~~~~~~~~~~
>    cc1: some warnings being treated as errors
> --
>    In file included from include/linux/ide.h:18,
>                     from drivers/ide/ide-cd_ioctl.c:13:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    drivers/ide/ide-cd_ioctl.c: In function 'ide_cdrom_select_speed':
>    drivers/ide/ide-cd_ioctl.c:212:6: warning: variable 'stat' set but not used [-Wunused-but-set-variable]
>      212 |  int stat;
>          |      ^~~~
>    cc1: some warnings being treated as errors
> --
>    In file included from drivers/ata/ahci.h:22,
>                     from drivers/ata/ahci_platform.c:21:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    In file included from drivers/ata/ahci_platform.c:21:
>    drivers/ata/ahci_platform.c: At top level:
>    drivers/ata/ahci.h:388:16: warning: initialized field overwritten [-Woverride-init]
>      388 |  .can_queue  = AHCI_MAX_CMDS,   \
>          |                ^~~~~~~~~~~~~
>    drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
>       40 |  AHCI_SHT(DRV_NAME),
>          |  ^~~~~~~~
>    drivers/ata/ahci.h:388:16: note: (near initialization for 'ahci_platform_sht.can_queue')
>      388 |  .can_queue  = AHCI_MAX_CMDS,   \
>          |                ^~~~~~~~~~~~~
>    drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
>       40 |  AHCI_SHT(DRV_NAME),
>          |  ^~~~~~~~
>    drivers/ata/ahci.h:392:17: warning: initialized field overwritten [-Woverride-init]
>      392 |  .sdev_attrs  = ahci_sdev_attrs
>          |                 ^~~~~~~~~~~~~~~
>    drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
>       40 |  AHCI_SHT(DRV_NAME),
>          |  ^~~~~~~~
>    drivers/ata/ahci.h:392:17: note: (near initialization for 'ahci_platform_sht.sdev_attrs')
>      392 |  .sdev_attrs  = ahci_sdev_attrs
>          |                 ^~~~~~~~~~~~~~~
>    drivers/ata/ahci_platform.c:40:2: note: in expansion of macro 'AHCI_SHT'
>       40 |  AHCI_SHT(DRV_NAME),
>          |  ^~~~~~~~
>    cc1: some warnings being treated as errors
> --
>    In file included from drivers/usb/host/xhci.c:11:
>    include/linux/pci.h: In function 'pcim_alloc_irq_vectors':
> >> include/linux/pci.h:1847:7: error: implicit declaration of function 'pci_is_managed' [-Werror=implicit-function-declaration]
>     1847 |  if (!pci_is_managed(dev))
>          |       ^~~~~~~~~~~~~~
>    drivers/usb/host/xhci.c: In function 'xhci_unmap_temp_buf':
>    drivers/usb/host/xhci.c:1349:15: warning: variable 'len' set but not used [-Wunused-but-set-variable]
>     1349 |  unsigned int len;
>          |               ^~~
>    cc1: some warnings being treated as errors
> 
> Kconfig warnings: (for reference only)
>    WARNING: unmet direct dependencies detected for LOCKDEP
>    Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86)
>    Selected by
>    - PROVE_LOCKING && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
>    - DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
> 
> 
> vim +/pci_is_managed +1847 include/linux/pci.h
> 
>   1827	
>   1828	/**
>   1829	 * pcim_alloc_irq_vectors - a device-managed pci_alloc_irq_vectors()
>   1830	 * @dev:		PCI device to operate on
>   1831	 * @min_vecs:		minimum number of vectors required (must be >= 1)
>   1832	 * @max_vecs:		maximum (desired) number of vectors
>   1833	 * @flags:		flags or quirks for the allocation
>   1834	 *
>   1835	 * Return the number of vectors allocated, (which might be smaller than
>   1836	 * @max_vecs) if successful, or a negative error code on error. If less
>   1837	 * than @min_vecs interrupt vectors are available for @dev the function
>   1838	 * will fail with -ENOSPC.
>   1839	 *
>   1840	 * It depends on calling pcim_enable_device() to make IRQ resources
>   1841	 * manageable.
>   1842	 */
>   1843	static inline int
>   1844	pcim_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs,
>   1845				unsigned int max_vecs, unsigned int flags)
>   1846	{
> > 1847		if (!pci_is_managed(dev))
>   1848			return -EINVAL;
>   1849		return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags);
>   1850	}
>   1851	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors()
  2021-06-07  9:09 ` [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors() Andy Shevchenko
@ 2021-06-07 14:30   ` Dejin Zheng
  0 siblings, 0 replies; 11+ messages in thread
From: Dejin Zheng @ 2021-06-07 14:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: helgaas, corbet, jarkko.nikula, mika.westerberg, rric, bhelgaas,
	linux-doc, linux-i2c, linux-pci, linux-kernel

On Mon, Jun 07, 2021 at 12:09:20PM +0300, Andy Shevchenko wrote:
> On Sun, Jun 06, 2021 at 03:05:07PM +0800, Dejin Zheng wrote:
> > Introduce pcim_alloc_irq_vectors(), a device-managed version of
> > pci_alloc_irq_vectors(), In some i2c drivers, If pcim_enable_device()
> > has been called before, then pci_alloc_irq_vectors() is actually a
> > device-managed function. It is used as a device-managed function, So
> > replace it with pcim_alloc_irq_vectors().
> 
> Thanks!
> 
> > Changelog
> > ---------
> > v5 -> v6:
> > 	- rebase to 5.13-rc4
> 
> It's already rc5 and I believe you better use the subsystem tree against which
> your series is (i.e. PCI for-next or how it is called there).
>

Andy, Thanks for your reminder, I will use PCI for-next branch for new patch
version.

BR,
Dejin
> Besides that kbuild bot is not happy.
> 
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-06-07 14:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-06  7:05 [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors() Dejin Zheng
2021-06-06  7:05 ` [PATCH v6 1/4] PCI: " Dejin Zheng
2021-06-06 19:31   ` kernel test robot
2021-06-06 19:31     ` kernel test robot
2021-06-07 14:24     ` Dejin Zheng
2021-06-07 14:24       ` Dejin Zheng
2021-06-06  7:05 ` [PATCH v6 2/4] Documentation: devres: Add pcim_alloc_irq_vectors() Dejin Zheng
2021-06-06  7:05 ` [PATCH v6 3/4] i2c: designware: Use pcim_alloc_irq_vectors() to allocate IRQ vectors Dejin Zheng
2021-06-06  7:05 ` [PATCH v6 4/4] i2c: thunderx: " Dejin Zheng
2021-06-07  9:09 ` [PATCH v6 0/4] Introduce pcim_alloc_irq_vectors() Andy Shevchenko
2021-06-07 14:30   ` Dejin Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.