Skip to content

Commit 7dcfe50

Browse files
niklas88Vasily Gorbik
authored andcommitted
s390/pci: rename get_zdev_by_bus() to zdev_from_bus()
Getting a zpci_dev via get_zdev_by_bus() uses the long lived reference held in zbus->function[devfn]. This is accounted for in pcibios_add_device() and pcibios_release_device(). Therefore there is no need to increment the reference count in get_zdev_by_bus() as is done for get_zdev_by_fid(). Instead callers must not access the device after pcibios_release_device() was called which is necessary for common PCI code anyway. With this though the very similar naming may be misleading so rename get_zdev_by_bus() to zdev_from_bus() emphasizing that we are directly referencing the zdev via the bus. Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent c122383 commit 7dcfe50

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

arch/s390/pci/pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,15 +400,15 @@ EXPORT_SYMBOL(pci_iounmap);
400400
static int pci_read(struct pci_bus *bus, unsigned int devfn, int where,
401401
int size, u32 *val)
402402
{
403-
struct zpci_dev *zdev = get_zdev_by_bus(bus, devfn);
403+
struct zpci_dev *zdev = zdev_from_bus(bus, devfn);
404404

405405
return (zdev) ? zpci_cfg_load(zdev, where, val, size) : -ENODEV;
406406
}
407407

408408
static int pci_write(struct pci_bus *bus, unsigned int devfn, int where,
409409
int size, u32 val)
410410
{
411-
struct zpci_dev *zdev = get_zdev_by_bus(bus, devfn);
411+
struct zpci_dev *zdev = zdev_from_bus(bus, devfn);
412412

413413
return (zdev) ? zpci_cfg_store(zdev, where, val, size) : -ENODEV;
414414
}

arch/s390/pci/pci_bus.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ void zpci_free_domain(int domain);
3333
int zpci_setup_bus_resources(struct zpci_dev *zdev,
3434
struct list_head *resources);
3535

36-
static inline struct zpci_dev *get_zdev_by_bus(struct pci_bus *bus,
37-
unsigned int devfn)
36+
static inline struct zpci_dev *zdev_from_bus(struct pci_bus *bus,
37+
unsigned int devfn)
3838
{
3939
struct zpci_bus *zbus = bus->sysdata;
4040

0 commit comments

Comments
 (0)