Re: [PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe
From: kbuild test robot
Date: Mon Dec 30 2019 - 12:11:32 EST
Hi Kishon,
I love your patch! Perhaps something to improve:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on pci/next arm-soc/for-next linus/master v5.5-rc4 next-20191220]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Kishon-Vijay-Abraham-I/Improvements-to-pci_endpoint_test-driver/20191230-203402
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d1eef1c619749b2a57e514a3fa67d9a516ffa919
config: arm-randconfig-a001-20191229 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.5.0
reproduce:
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
GCC_VERSION=7.5.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:11:0,
from include/linux/delay.h:22,
from drivers/misc/pci_endpoint_test.c:10:
drivers/misc/pci_endpoint_test.c: In function 'pci_endpoint_test_probe':
drivers/misc/pci_endpoint_test.c:73:22: error: 'PCI_DEVICE_ID_TI_J721E' undeclared (first use in this function); did you mean 'PCI_DEVICE_ID_TI_7510'?
((pdev)->device == PCI_DEVICE_ID_TI_J721E)
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> drivers/misc/pci_endpoint_test.c:693:2: note: in expansion of macro 'if'
if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
^~
drivers/misc/pci_endpoint_test.c:693:34: note: in expansion of macro 'is_j721e_pci_dev'
if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
^~~~~~~~~~~~~~~~
drivers/misc/pci_endpoint_test.c:73:22: note: each undeclared identifier is reported only once for each function it appears in
((pdev)->device == PCI_DEVICE_ID_TI_J721E)
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> drivers/misc/pci_endpoint_test.c:693:2: note: in expansion of macro 'if'
if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
^~
drivers/misc/pci_endpoint_test.c:693:34: note: in expansion of macro 'is_j721e_pci_dev'
if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
^~~~~~~~~~~~~~~~
vim +/if +693 drivers/misc/pci_endpoint_test.c
638
639 static int pci_endpoint_test_probe(struct pci_dev *pdev,
640 const struct pci_device_id *ent)
641 {
642 int err;
643 int id;
644 char name[20];
645 enum pci_barno bar;
646 void __iomem *base;
647 struct device *dev = &pdev->dev;
648 struct pci_endpoint_test *test;
649 struct pci_endpoint_test_data *data;
650 enum pci_barno test_reg_bar = BAR_0;
651 struct miscdevice *misc_device;
652
653 if (pci_is_bridge(pdev))
654 return -ENODEV;
655
656 test = devm_kzalloc(dev, sizeof(*test), GFP_KERNEL);
657 if (!test)
658 return -ENOMEM;
659
660 test->test_reg_bar = 0;
661 test->alignment = 0;
662 test->pdev = pdev;
663 test->irq_type = IRQ_TYPE_UNDEFINED;
664
665 if (no_msi)
666 irq_type = IRQ_TYPE_LEGACY;
667
668 data = (struct pci_endpoint_test_data *)ent->driver_data;
669 if (data) {
670 test_reg_bar = data->test_reg_bar;
671 test->test_reg_bar = test_reg_bar;
672 test->alignment = data->alignment;
673 irq_type = data->irq_type;
674 }
675
676 init_completion(&test->irq_raised);
677 mutex_init(&test->mutex);
678
679 err = pci_enable_device(pdev);
680 if (err) {
681 dev_err(dev, "Cannot enable PCI device\n");
682 return err;
683 }
684
685 err = pci_request_regions(pdev, DRV_MODULE_NAME);
686 if (err) {
687 dev_err(dev, "Cannot obtain PCI resources\n");
688 goto err_disable_pdev;
689 }
690
691 pci_set_master(pdev);
692
> 693 if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
694 if (!pci_endpoint_test_alloc_irq_vectors(test, irq_type))
695 goto err_disable_irq;
696
697 if (!pci_endpoint_test_request_irq(test))
698 goto err_disable_irq;
699 }
700
701 for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
702 if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
703 base = pci_ioremap_bar(pdev, bar);
704 if (!base) {
705 dev_err(dev, "Failed to read BAR%d\n", bar);
706 WARN_ON(bar == test_reg_bar);
707 }
708 test->bar[bar] = base;
709 }
710 }
711
712 test->base = test->bar[test_reg_bar];
713 if (!test->base) {
714 err = -ENOMEM;
715 dev_err(dev, "Cannot perform PCI test without BAR%d\n",
716 test_reg_bar);
717 goto err_iounmap;
718 }
719
720 pci_set_drvdata(pdev, test);
721
722 id = ida_simple_get(&pci_endpoint_test_ida, 0, 0, GFP_KERNEL);
723 if (id < 0) {
724 err = id;
725 dev_err(dev, "Unable to get id\n");
726 goto err_iounmap;
727 }
728
729 snprintf(name, sizeof(name), DRV_MODULE_NAME ".%d", id);
730 misc_device = &test->miscdev;
731 misc_device->minor = MISC_DYNAMIC_MINOR;
732 misc_device->name = kstrdup(name, GFP_KERNEL);
733 if (!misc_device->name) {
734 err = -ENOMEM;
735 goto err_ida_remove;
736 }
737 misc_device->fops = &pci_endpoint_test_fops,
738
739 err = misc_register(misc_device);
740 if (err) {
741 dev_err(dev, "Failed to register device\n");
742 goto err_kfree_name;
743 }
744
745 return 0;
746
747 err_kfree_name:
748 kfree(misc_device->name);
749
750 err_ida_remove:
751 ida_simple_remove(&pci_endpoint_test_ida, id);
752
753 err_iounmap:
754 for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
755 if (test->bar[bar])
756 pci_iounmap(pdev, test->bar[bar]);
757 }
758 pci_endpoint_test_release_irq(test);
759
760 err_disable_irq:
761 pci_endpoint_test_free_irq_vectors(test);
762 pci_release_regions(pdev);
763
764 err_disable_pdev:
765 pci_disable_device(pdev);
766
767 return err;
768 }
769
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation
Attachment:
.config.gz
Description: application/gzip