Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116711
b: refs/heads/master
c: cef354d
h: refs/heads/master
i:
  116709: 8814ec5
  116707: 00f7650
  116703: 508dd21
v: v3
  • Loading branch information
Alex Chiang authored and Jesse Barnes committed Oct 20, 2008
1 parent 4b2a66e commit d5edf16
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 93ff68a55aa92180a765d6c51c3303f6200167a6
refs/heads/master: cef354db0d7a7207ea78c716753d9216a9c2b7e1
5 changes: 5 additions & 0 deletions trunk/drivers/pci/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ EXPORT_SYMBOL(alloc_pci_dev);
static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
{
struct pci_dev *dev;
struct pci_slot *slot;
u32 l;
u8 hdr_type;
int delay = 1;
Expand Down Expand Up @@ -997,6 +998,10 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
dev->error_state = pci_channel_io_normal;
set_pcie_port_type(dev);

list_for_each_entry(slot, &bus->slots, list)
if (PCI_SLOT(devfn) == slot->number)
dev->slot = slot;

/* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer)
set this higher, assuming the system even supports it. */
dev->dma_mask = 0xffffffff;
Expand Down
10 changes: 10 additions & 0 deletions trunk/drivers/pci/slot.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ static ssize_t address_read_file(struct pci_slot *slot, char *buf)

static void pci_slot_release(struct kobject *kobj)
{
struct pci_dev *dev;
struct pci_slot *slot = to_pci_slot(kobj);

pr_debug("%s: releasing pci_slot on %x:%d\n", __func__,
slot->bus->number, slot->number);

list_for_each_entry(dev, &slot->bus->devices, bus_list)
if (PCI_SLOT(dev->devfn) == slot->number)
dev->slot = NULL;

list_del(&slot->list);

kfree(slot);
Expand Down Expand Up @@ -108,6 +113,7 @@ static struct kobj_type pci_slot_ktype = {
struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
const char *name)
{
struct pci_dev *dev;
struct pci_slot *slot;
int err;

Expand Down Expand Up @@ -150,6 +156,10 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
INIT_LIST_HEAD(&slot->list);
list_add(&slot->list, &parent->slots);

list_for_each_entry(dev, &parent->devices, bus_list)
if (PCI_SLOT(dev->devfn) == slot_nr)
dev->slot = slot;

/* Don't care if debug printk has a -1 for slot_nr */
pr_debug("%s: created pci_slot on %04x:%02x:%02x\n",
__func__, pci_domain_nr(parent), parent->number, slot_nr);
Expand Down

0 comments on commit d5edf16

Please sign in to comment.