xref: /linux/rust/helpers/pci.c (revision 07fdad3a93756b872da7b53647715c48d0f4a2d0)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/pci.h>
4 
5 u16 rust_helper_pci_dev_id(struct pci_dev *dev)
6 {
7 	return PCI_DEVID(dev->bus->number, dev->devfn);
8 }
9 
10 resource_size_t rust_helper_pci_resource_start(struct pci_dev *pdev, int bar)
11 {
12 	return pci_resource_start(pdev, bar);
13 }
14 
15 resource_size_t rust_helper_pci_resource_len(struct pci_dev *pdev, int bar)
16 {
17 	return pci_resource_len(pdev, bar);
18 }
19 
20 bool rust_helper_dev_is_pci(const struct device *dev)
21 {
22 	return dev_is_pci(dev);
23 }
24 
25 #ifndef CONFIG_PCI_MSI
26 int rust_helper_pci_irq_vector(struct pci_dev *pdev, unsigned int nvec)
27 {
28 	return pci_irq_vector(pdev, nvec);
29 }
30 
31 #endif
32