* [PATCH] vdpa: solidrun: Replace deprecated PCI functions
@ 2024-12-02 12:23 Philipp Stanner
2024-12-02 17:17 ` kernel test robot
0 siblings, 1 reply; 2+ messages in thread
From: Philipp Stanner @ 2024-12-02 12:23 UTC (permalink / raw)
To: Alvaro Karsz, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Philipp Stanner, Stefano Garzarella
Cc: virtualization, linux-kernel
The PCI functions
pcim_iomap_regions()
pcim_iounmap_regions()
pcim_iomap_table()
have been deprecated by the PCI subsystem.
Replace these functions with their successors pcim_iomap_region() and
pcim_iounmap_region().
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
drivers/vdpa/solidrun/snet_main.c | 55 ++++++++++++++-----------------
1 file changed, 25 insertions(+), 30 deletions(-)
diff --git a/drivers/vdpa/solidrun/snet_main.c b/drivers/vdpa/solidrun/snet_main.c
index c8b74980dbd1..679c1c7dabf5 100644
--- a/drivers/vdpa/solidrun/snet_main.c
+++ b/drivers/vdpa/solidrun/snet_main.c
@@ -556,59 +556,57 @@ static const struct vdpa_config_ops snet_config_ops = {
static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
{
char *name;
- int ret, i, mask = 0;
+ int ret;
+ unsigned short i, bars_found = 0;
+ void __iomem *io;
+
+ name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev));
+ if (!name)
+ return -ENOMEM;
+
/* We don't know which BAR will be used to communicate..
* We will map every bar with len > 0.
*
* Later, we will discover the BAR and unmap all other BARs.
*/
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
- if (pci_resource_len(pdev, i))
- mask |= (1 << i);
+ if (pci_resource_len(pdev, i) == 0)
+ continue;
+
+ io = pcim_iomap_region(pdev, i, name);
+ if (IS_ERR(io)) {
+ SNET_ERR(pdev, "Failed to request and map PCI BARs\n");
+ return PTR_ERR(io);
+ }
+
+ psnet->bars[i] = io;
+ bars_found++;
}
/* No BAR can be used.. */
- if (!mask) {
+ if (bars_found == 0) {
SNET_ERR(pdev, "Failed to find a PCI BAR\n");
return -ENODEV;
}
- name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev));
- if (!name)
- return -ENOMEM;
-
- ret = pcim_iomap_regions(pdev, mask, name);
- if (ret) {
- SNET_ERR(pdev, "Failed to request and map PCI BARs\n");
- return ret;
- }
-
- for (i = 0; i < PCI_STD_NUM_BARS; i++) {
- if (mask & (1 << i))
- psnet->bars[i] = pcim_iomap_table(pdev)[i];
- }
-
return 0;
}
static int snet_open_vf_bar(struct pci_dev *pdev, struct snet *snet)
{
char *name;
- int ret;
name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "snet[%s]-bars", pci_name(pdev));
if (!name)
return -ENOMEM;
/* Request and map BAR */
- ret = pcim_iomap_regions(pdev, BIT(snet->psnet->cfg.vf_bar), name);
- if (ret) {
+ snet->bar = pcim_iomap_region(pdev, snet->psnet->cfg.vf_bar, name);
+ if (IS_ERR(snet->bar)) {
SNET_ERR(pdev, "Failed to request and map PCI BAR for a VF\n");
- return ret;
+ return PTR_ERR(snet->bar);
}
- snet->bar = pcim_iomap_table(pdev)[snet->psnet->cfg.vf_bar];
-
return 0;
}
@@ -656,15 +654,12 @@ static int psnet_detect_bar(struct psnet *psnet, u32 off)
static void psnet_unmap_unused_bars(struct pci_dev *pdev, struct psnet *psnet)
{
- int i, mask = 0;
+ unsigned short i;
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
if (psnet->bars[i] && i != psnet->barno)
- mask |= (1 << i);
+ pcim_iounmap_region(pdev, i);
}
-
- if (mask)
- pcim_iounmap_regions(pdev, mask);
}
/* Read SNET config from PCI BAR */
--
2.47.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vdpa: solidrun: Replace deprecated PCI functions
2024-12-02 12:23 [PATCH] vdpa: solidrun: Replace deprecated PCI functions Philipp Stanner
@ 2024-12-02 17:17 ` kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2024-12-02 17:17 UTC (permalink / raw)
To: Philipp Stanner, Alvaro Karsz, Michael S. Tsirkin, Jason Wang,
Xuan Zhuo, Eugenio =?unknown-8bit?B?UMOpcmV6?=,
Stefano Garzarella
Cc: oe-kbuild-all, virtualization, linux-kernel
Hi Philipp,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.13-rc1 next-20241128]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Philipp-Stanner/vdpa-solidrun-Replace-deprecated-PCI-functions/20241202-202728
base: linus/master
patch link: https://lore.kernel.org/r/20241202122353.9793-2-pstanner%40redhat.com
patch subject: [PATCH] vdpa: solidrun: Replace deprecated PCI functions
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20241203/202412030150.SVZbOVDL-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241203/202412030150.SVZbOVDL-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412030150.SVZbOVDL-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/vdpa/solidrun/snet_main.c: In function 'psnet_open_pf_bar':
>> drivers/vdpa/solidrun/snet_main.c:559:13: warning: unused variable 'ret' [-Wunused-variable]
559 | int ret;
| ^~~
vim +/ret +559 drivers/vdpa/solidrun/snet_main.c
555
556 static int psnet_open_pf_bar(struct pci_dev *pdev, struct psnet *psnet)
557 {
558 char *name;
> 559 int ret;
560 unsigned short i, bars_found = 0;
561 void __iomem *io;
562
563 name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "psnet[%s]-bars", pci_name(pdev));
564 if (!name)
565 return -ENOMEM;
566
567 /* We don't know which BAR will be used to communicate..
568 * We will map every bar with len > 0.
569 *
570 * Later, we will discover the BAR and unmap all other BARs.
571 */
572 for (i = 0; i < PCI_STD_NUM_BARS; i++) {
573 if (pci_resource_len(pdev, i) == 0)
574 continue;
575
576 io = pcim_iomap_region(pdev, i, name);
577 if (IS_ERR(io)) {
578 SNET_ERR(pdev, "Failed to request and map PCI BARs\n");
579 return PTR_ERR(io);
580 }
581
582 psnet->bars[i] = io;
583 bars_found++;
584 }
585
586 /* No BAR can be used.. */
587 if (bars_found == 0) {
588 SNET_ERR(pdev, "Failed to find a PCI BAR\n");
589 return -ENODEV;
590 }
591
592 return 0;
593 }
594
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-02 17:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02 12:23 [PATCH] vdpa: solidrun: Replace deprecated PCI functions Philipp Stanner
2024-12-02 17:17 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).