forked from Minki/linux
PCI: portdrv: remove redundant pcie type calculation
PCIe port type is already stored in 'pcie_type' field of struct pci_dev. So we don't need to get it from pci configuration space. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
parent
52a0f24bea
commit
2dd60e96b4
@ -291,19 +291,15 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
|
|||||||
int pcie_port_device_register(struct pci_dev *dev)
|
int pcie_port_device_register(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
struct pcie_port_data *port_data;
|
struct pcie_port_data *port_data;
|
||||||
int status, capabilities, irq_mode, i, nr_serv, pos;
|
int status, capabilities, irq_mode, i, nr_serv;
|
||||||
int vectors[PCIE_PORT_DEVICE_MAXSERVICES];
|
int vectors[PCIE_PORT_DEVICE_MAXSERVICES];
|
||||||
u16 reg16;
|
|
||||||
|
|
||||||
port_data = kzalloc(sizeof(*port_data), GFP_KERNEL);
|
port_data = kzalloc(sizeof(*port_data), GFP_KERNEL);
|
||||||
if (!port_data)
|
if (!port_data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
pci_set_drvdata(dev, port_data);
|
pci_set_drvdata(dev, port_data);
|
||||||
|
|
||||||
/* Get port type */
|
port_data->port_type = dev->pcie_type;
|
||||||
pos = pci_pcie_cap(dev);
|
|
||||||
pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, ®16);
|
|
||||||
port_data->port_type = (reg16 >> 4) & PORT_TYPE_MASK;
|
|
||||||
|
|
||||||
capabilities = get_port_device_capability(dev);
|
capabilities = get_port_device_capability(dev);
|
||||||
/* Root ports are capable of generating PME too */
|
/* Root ports are capable of generating PME too */
|
||||||
|
Loading…
Reference in New Issue
Block a user