xref: /kernel/linux/linux-5.10/arch/s390/pci/pci_bus.h (revision 8c2ecf20)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright IBM Corp. 2020
4 *
5 * Author(s):
6 *   Pierre Morel <pmorel@linux.ibm.com>
7 *
8 */
9
10int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops);
11void zpci_bus_device_unregister(struct zpci_dev *zdev);
12
13void zpci_release_device(struct kref *kref);
14static inline void zpci_zdev_put(struct zpci_dev *zdev)
15{
16	if (zdev)
17		kref_put(&zdev->kref, zpci_release_device);
18}
19
20static inline void zpci_zdev_get(struct zpci_dev *zdev)
21{
22	kref_get(&zdev->kref);
23}
24
25int zpci_alloc_domain(int domain);
26void zpci_free_domain(int domain);
27int zpci_setup_bus_resources(struct zpci_dev *zdev,
28			     struct list_head *resources);
29
30static inline struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus,
31					       unsigned int devfn)
32{
33	struct zpci_bus *zbus = bus->sysdata;
34
35	return (devfn >= ZPCI_FUNCTIONS_PER_BUS) ? NULL : zbus->function[devfn];
36}
37
38