[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202007182234.zszQVj9N%lkp@intel.com>
Date: Sat, 18 Jul 2020 23:04:06 +0800
From: kernel test robot <lkp@...el.com>
To: Suraj Upadhyay <usuraj35@...il.com>, gregkh@...uxfoundation.org
Cc: kbuild-all@...ts.01.org, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: kpc2000: Replace depracated MSI API.
Hi Suraj,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/0day-ci/linux/commits/Suraj-Upadhyay/staging-kpc2000-Replace-depracated-MSI-API/20200718-213859
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 9d5d041eebe3dcf7591ff7004896c329eb841ca6
config: alpha-allyesconfig (attached as .config)
compiler: alpha-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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
drivers/staging/kpc2000/kpc2000/core.c: In function 'kp2000_pcie_probe':
>> drivers/staging/kpc2000/kpc2000/core.c:443:30: error: 'dev' undeclared (first use in this function); did you mean 'pdev'?
443 | err = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_MSI);
| ^~~
| pdev
drivers/staging/kpc2000/kpc2000/core.c:443:30: note: each undeclared identifier is reported only once for each function it appears in
vim +443 drivers/staging/kpc2000/kpc2000/core.c
295
296 static int kp2000_pcie_probe(struct pci_dev *pdev,
297 const struct pci_device_id *id)
298 {
299 int err = 0;
300 struct kp2000_device *pcard;
301 unsigned long reg_bar_phys_addr;
302 unsigned long reg_bar_phys_len;
303 unsigned long dma_bar_phys_addr;
304 unsigned long dma_bar_phys_len;
305 u16 regval;
306
307 pcard = kzalloc(sizeof(*pcard), GFP_KERNEL);
308 if (!pcard)
309 return -ENOMEM;
310 dev_dbg(&pdev->dev, "probe: allocated struct kp2000_device @ %p\n",
311 pcard);
312
313 err = ida_simple_get(&card_num_ida, 1, INT_MAX, GFP_KERNEL);
314 if (err < 0) {
315 dev_err(&pdev->dev, "probe: failed to get card number (%d)\n",
316 err);
317 goto err_free_pcard;
318 }
319 pcard->card_num = err;
320 scnprintf(pcard->name, 16, "kpcard%u", pcard->card_num);
321
322 mutex_init(&pcard->sem);
323 mutex_lock(&pcard->sem);
324
325 pcard->pdev = pdev;
326 pci_set_drvdata(pdev, pcard);
327
328 err = pci_enable_device(pcard->pdev);
329 if (err) {
330 dev_err(&pcard->pdev->dev,
331 "probe: failed to enable PCIE2000 PCIe device (%d)\n",
332 err);
333 goto err_remove_ida;
334 }
335
336 /* Setup the Register BAR */
337 reg_bar_phys_addr = pci_resource_start(pcard->pdev, REG_BAR);
338 reg_bar_phys_len = pci_resource_len(pcard->pdev, REG_BAR);
339
340 pcard->regs_bar_base = ioremap(reg_bar_phys_addr, PAGE_SIZE);
341 if (!pcard->regs_bar_base) {
342 dev_err(&pcard->pdev->dev,
343 "probe: REG_BAR could not remap memory to virtual space\n");
344 err = -ENODEV;
345 goto err_disable_device;
346 }
347 dev_dbg(&pcard->pdev->dev,
348 "probe: REG_BAR virt hardware address start [%p]\n",
349 pcard->regs_bar_base);
350
351 err = pci_request_region(pcard->pdev, REG_BAR, KP_DRIVER_NAME_KP2000);
352 if (err) {
353 dev_err(&pcard->pdev->dev,
354 "probe: failed to acquire PCI region (%d)\n",
355 err);
356 err = -ENODEV;
357 goto err_unmap_regs;
358 }
359
360 pcard->regs_base_resource.start = reg_bar_phys_addr;
361 pcard->regs_base_resource.end = reg_bar_phys_addr +
362 reg_bar_phys_len - 1;
363 pcard->regs_base_resource.flags = IORESOURCE_MEM;
364
365 /* Setup the DMA BAR */
366 dma_bar_phys_addr = pci_resource_start(pcard->pdev, DMA_BAR);
367 dma_bar_phys_len = pci_resource_len(pcard->pdev, DMA_BAR);
368
369 pcard->dma_bar_base = ioremap(dma_bar_phys_addr,
370 dma_bar_phys_len);
371 if (!pcard->dma_bar_base) {
372 dev_err(&pcard->pdev->dev,
373 "probe: DMA_BAR could not remap memory to virtual space\n");
374 err = -ENODEV;
375 goto err_release_regs;
376 }
377 dev_dbg(&pcard->pdev->dev,
378 "probe: DMA_BAR virt hardware address start [%p]\n",
379 pcard->dma_bar_base);
380
381 pcard->dma_common_regs = pcard->dma_bar_base + KPC_DMA_COMMON_OFFSET;
382
383 err = pci_request_region(pcard->pdev, DMA_BAR, "kp2000_pcie");
384 if (err) {
385 dev_err(&pcard->pdev->dev,
386 "probe: failed to acquire PCI region (%d)\n", err);
387 err = -ENODEV;
388 goto err_unmap_dma;
389 }
390
391 pcard->dma_base_resource.start = dma_bar_phys_addr;
392 pcard->dma_base_resource.end = dma_bar_phys_addr +
393 dma_bar_phys_len - 1;
394 pcard->dma_base_resource.flags = IORESOURCE_MEM;
395
396 /* Read System Regs */
397 pcard->sysinfo_regs_base = pcard->regs_bar_base;
398 err = read_system_regs(pcard);
399 if (err)
400 goto err_release_dma;
401
402 // Disable all "user" interrupts because they're not used yet.
403 writeq(0xFFFFFFFFFFFFFFFFUL,
404 pcard->sysinfo_regs_base + REG_INTERRUPT_MASK);
405
406 // let the card master PCIe
407 pci_set_master(pcard->pdev);
408
409 // enable IO and mem if not already done
410 pci_read_config_word(pcard->pdev, PCI_COMMAND, ®val);
411 regval |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
412 pci_write_config_word(pcard->pdev, PCI_COMMAND, regval);
413
414 // Clear relaxed ordering bit
415 pcie_capability_clear_and_set_word(pcard->pdev, PCI_EXP_DEVCTL,
416 PCI_EXP_DEVCTL_RELAX_EN, 0);
417
418 // Set Max_Payload_Size and Max_Read_Request_Size
419 regval = (0x0) << 5; // Max_Payload_Size = 128 B
420 pcie_capability_clear_and_set_word(pcard->pdev, PCI_EXP_DEVCTL,
421 PCI_EXP_DEVCTL_PAYLOAD, regval);
422 regval = (0x0) << 12; // Max_Read_Request_Size = 128 B
423 pcie_capability_clear_and_set_word(pcard->pdev, PCI_EXP_DEVCTL,
424 PCI_EXP_DEVCTL_READRQ, regval);
425
426 // Enable error reporting for: Correctable Errors, Non-Fatal Errors,
427 // Fatal Errors, Unsupported Requests
428 pcie_capability_clear_and_set_word(pcard->pdev, PCI_EXP_DEVCTL, 0,
429 PCI_EXP_DEVCTL_CERE |
430 PCI_EXP_DEVCTL_NFERE |
431 PCI_EXP_DEVCTL_FERE |
432 PCI_EXP_DEVCTL_URRE);
433
434 err = dma_set_mask(PCARD_TO_DEV(pcard), DMA_BIT_MASK(64));
435 if (err) {
436 dev_err(&pcard->pdev->dev,
437 "CANNOT use DMA mask %0llx\n", DMA_BIT_MASK(64));
438 goto err_release_dma;
439 }
440 dev_dbg(&pcard->pdev->dev,
441 "Using DMA mask %0llx\n", dma_get_mask(PCARD_TO_DEV(pcard)));
442
> 443 err = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_MSI);
444 if (err < 0)
445 goto err_release_dma;
446
447 err = request_irq(pcard->pdev->irq, kp2000_irq_handler, IRQF_SHARED,
448 pcard->name, pcard);
449 if (err) {
450 dev_err(&pcard->pdev->dev,
451 "%s: failed to request_irq: %d\n", __func__, err);
452 goto err_disable_msi;
453 }
454
455 err = sysfs_create_files(&pdev->dev.kobj, kp_attr_list);
456 if (err) {
457 dev_err(&pdev->dev, "Failed to add sysfs files: %d\n", err);
458 goto err_free_irq;
459 }
460
461 err = kp2000_probe_cores(pcard);
462 if (err)
463 goto err_remove_sysfs;
464
465 /* Enable IRQs in HW */
466 writel(KPC_DMA_CARD_IRQ_ENABLE | KPC_DMA_CARD_USER_INTERRUPT_MODE,
467 pcard->dma_common_regs);
468
469 mutex_unlock(&pcard->sem);
470 return 0;
471
472 err_remove_sysfs:
473 sysfs_remove_files(&pdev->dev.kobj, kp_attr_list);
474 err_free_irq:
475 free_irq(pcard->pdev->irq, pcard);
476 err_disable_msi:
477 pci_disable_msi(pcard->pdev);
478 err_release_dma:
479 pci_release_region(pdev, DMA_BAR);
480 err_unmap_dma:
481 iounmap(pcard->dma_bar_base);
482 err_release_regs:
483 pci_release_region(pdev, REG_BAR);
484 err_unmap_regs:
485 iounmap(pcard->regs_bar_base);
486 err_disable_device:
487 pci_disable_device(pcard->pdev);
488 err_remove_ida:
489 mutex_unlock(&pcard->sem);
490 ida_simple_remove(&card_num_ida, pcard->card_num);
491 err_free_pcard:
492 kfree(pcard);
493 return err;
494 }
495
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (65069 bytes)
Powered by blists - more mailing lists