parisc/PCI: Use dev_is_pci() to identify PCI devices
Use dev_is_pci() instead of equivalent local function. Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
df907938cc
commit
b0acbb9d36
1 changed files with 5 additions and 17 deletions
|
@ -282,18 +282,6 @@ find_pa_parent_type(const struct parisc_device *padev, int type)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PCI
|
|
||||||
static inline int is_pci_dev(struct device *dev)
|
|
||||||
{
|
|
||||||
return dev->bus == &pci_bus_type;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static inline int is_pci_dev(struct device *dev)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_node_path fills in @path with the firmware path to the device.
|
* get_node_path fills in @path with the firmware path to the device.
|
||||||
* Note that if @node is a parisc device, we don't fill in the 'mod' field.
|
* Note that if @node is a parisc device, we don't fill in the 'mod' field.
|
||||||
|
@ -306,7 +294,7 @@ static void get_node_path(struct device *dev, struct hardware_path *path)
|
||||||
int i = 5;
|
int i = 5;
|
||||||
memset(&path->bc, -1, 6);
|
memset(&path->bc, -1, 6);
|
||||||
|
|
||||||
if (is_pci_dev(dev)) {
|
if (dev_is_pci(dev)) {
|
||||||
unsigned int devfn = to_pci_dev(dev)->devfn;
|
unsigned int devfn = to_pci_dev(dev)->devfn;
|
||||||
path->mod = PCI_FUNC(devfn);
|
path->mod = PCI_FUNC(devfn);
|
||||||
path->bc[i--] = PCI_SLOT(devfn);
|
path->bc[i--] = PCI_SLOT(devfn);
|
||||||
|
@ -314,7 +302,7 @@ static void get_node_path(struct device *dev, struct hardware_path *path)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (dev != &root) {
|
while (dev != &root) {
|
||||||
if (is_pci_dev(dev)) {
|
if (dev_is_pci(dev)) {
|
||||||
unsigned int devfn = to_pci_dev(dev)->devfn;
|
unsigned int devfn = to_pci_dev(dev)->devfn;
|
||||||
path->bc[i--] = PCI_SLOT(devfn) | (PCI_FUNC(devfn)<< 5);
|
path->bc[i--] = PCI_SLOT(devfn) | (PCI_FUNC(devfn)<< 5);
|
||||||
} else if (dev->bus == &parisc_bus_type) {
|
} else if (dev->bus == &parisc_bus_type) {
|
||||||
|
@ -695,7 +683,7 @@ static int check_parent(struct device * dev, void * data)
|
||||||
if (dev->bus == &parisc_bus_type) {
|
if (dev->bus == &parisc_bus_type) {
|
||||||
if (match_parisc_device(dev, d->index, d->modpath))
|
if (match_parisc_device(dev, d->index, d->modpath))
|
||||||
d->dev = dev;
|
d->dev = dev;
|
||||||
} else if (is_pci_dev(dev)) {
|
} else if (dev_is_pci(dev)) {
|
||||||
if (match_pci_device(dev, d->index, d->modpath))
|
if (match_pci_device(dev, d->index, d->modpath))
|
||||||
d->dev = dev;
|
d->dev = dev;
|
||||||
} else if (dev->bus == NULL) {
|
} else if (dev->bus == NULL) {
|
||||||
|
@ -753,7 +741,7 @@ struct device *hwpath_to_device(struct hardware_path *modpath)
|
||||||
if (!parent)
|
if (!parent)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (is_pci_dev(parent)) /* pci devices already parse MOD */
|
if (dev_is_pci(parent)) /* pci devices already parse MOD */
|
||||||
return parent;
|
return parent;
|
||||||
else
|
else
|
||||||
return parse_tree_node(parent, 6, modpath);
|
return parse_tree_node(parent, 6, modpath);
|
||||||
|
@ -772,7 +760,7 @@ void device_to_hwpath(struct device *dev, struct hardware_path *path)
|
||||||
padev = to_parisc_device(dev);
|
padev = to_parisc_device(dev);
|
||||||
get_node_path(dev->parent, path);
|
get_node_path(dev->parent, path);
|
||||||
path->mod = padev->hw_path;
|
path->mod = padev->hw_path;
|
||||||
} else if (is_pci_dev(dev)) {
|
} else if (dev_is_pci(dev)) {
|
||||||
get_node_path(dev, path);
|
get_node_path(dev, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue