diff options
author | Johannes Thumshirn <johannes.thumshirn@men.de> | 2014-04-24 08:35:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-27 20:38:11 -0400 |
commit | 4ec65b77c64504e178d75aaba6ac96f68837416c (patch) | |
tree | 573c968f454b51209892fd0ede0c1d56d63f5649 /drivers/mcb | |
parent | 2e1c951f5da23faaa60224628f44b100ab212d46 (diff) |
mcb: Add support for shared PCI IRQs
Add support for shared PCI IRQs to mcb and mcb-pci.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mcb')
-rw-r--r-- | drivers/mcb/mcb-core.c | 20 | ||||
-rw-r--r-- | drivers/mcb/mcb-pci.c | 17 |
2 files changed, 31 insertions, 6 deletions
diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c index bbe12932d404..9018ab83517a 100644 --- a/drivers/mcb/mcb-core.c +++ b/drivers/mcb/mcb-core.c | |||
@@ -183,14 +183,14 @@ EXPORT_SYMBOL_GPL(mcb_device_register); | |||
183 | * | 183 | * |
184 | * Allocate a new @mcb_bus. | 184 | * Allocate a new @mcb_bus. |
185 | */ | 185 | */ |
186 | struct mcb_bus *mcb_alloc_bus(void) | 186 | struct mcb_bus *mcb_alloc_bus(struct device *carrier) |
187 | { | 187 | { |
188 | struct mcb_bus *bus; | 188 | struct mcb_bus *bus; |
189 | int bus_nr; | 189 | int bus_nr; |
190 | 190 | ||
191 | bus = kzalloc(sizeof(struct mcb_bus), GFP_KERNEL); | 191 | bus = kzalloc(sizeof(struct mcb_bus), GFP_KERNEL); |
192 | if (!bus) | 192 | if (!bus) |
193 | return NULL; | 193 | return ERR_PTR(-ENOMEM); |
194 | 194 | ||
195 | bus_nr = ida_simple_get(&mcb_ida, 0, 0, GFP_KERNEL); | 195 | bus_nr = ida_simple_get(&mcb_ida, 0, 0, GFP_KERNEL); |
196 | if (bus_nr < 0) { | 196 | if (bus_nr < 0) { |
@@ -200,7 +200,7 @@ struct mcb_bus *mcb_alloc_bus(void) | |||
200 | 200 | ||
201 | INIT_LIST_HEAD(&bus->children); | 201 | INIT_LIST_HEAD(&bus->children); |
202 | bus->bus_nr = bus_nr; | 202 | bus->bus_nr = bus_nr; |
203 | 203 | bus->carrier = carrier; | |
204 | return bus; | 204 | return bus; |
205 | } | 205 | } |
206 | EXPORT_SYMBOL_GPL(mcb_alloc_bus); | 206 | EXPORT_SYMBOL_GPL(mcb_alloc_bus); |
@@ -378,6 +378,13 @@ void mcb_release_mem(struct resource *mem) | |||
378 | } | 378 | } |
379 | EXPORT_SYMBOL_GPL(mcb_release_mem); | 379 | EXPORT_SYMBOL_GPL(mcb_release_mem); |
380 | 380 | ||
381 | static int __mcb_get_irq(struct mcb_device *dev) | ||
382 | { | ||
383 | struct resource *irq = &dev->irq; | ||
384 | |||
385 | return irq->start; | ||
386 | } | ||
387 | |||
381 | /** | 388 | /** |
382 | * mcb_get_irq() - Get device's IRQ number | 389 | * mcb_get_irq() - Get device's IRQ number |
383 | * @dev: The @mcb_device the IRQ is for | 390 | * @dev: The @mcb_device the IRQ is for |
@@ -386,9 +393,12 @@ EXPORT_SYMBOL_GPL(mcb_release_mem); | |||
386 | */ | 393 | */ |
387 | int mcb_get_irq(struct mcb_device *dev) | 394 | int mcb_get_irq(struct mcb_device *dev) |
388 | { | 395 | { |
389 | struct resource *irq = &dev->irq; | 396 | struct mcb_bus *bus = dev->bus; |
390 | 397 | ||
391 | return irq->start; | 398 | if (bus->get_irq) |
399 | return bus->get_irq(dev); | ||
400 | |||
401 | return __mcb_get_irq(dev); | ||
392 | } | 402 | } |
393 | EXPORT_SYMBOL_GPL(mcb_get_irq); | 403 | EXPORT_SYMBOL_GPL(mcb_get_irq); |
394 | 404 | ||
diff --git a/drivers/mcb/mcb-pci.c b/drivers/mcb/mcb-pci.c index 99c742cbfb5b..b59181965643 100644 --- a/drivers/mcb/mcb-pci.c +++ b/drivers/mcb/mcb-pci.c | |||
@@ -20,6 +20,15 @@ struct priv { | |||
20 | void __iomem *base; | 20 | void __iomem *base; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | static int mcb_pci_get_irq(struct mcb_device *mdev) | ||
24 | { | ||
25 | struct mcb_bus *mbus = mdev->bus; | ||
26 | struct device *dev = mbus->carrier; | ||
27 | struct pci_dev *pdev = to_pci_dev(dev); | ||
28 | |||
29 | return pdev->irq; | ||
30 | } | ||
31 | |||
23 | static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 32 | static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
24 | { | 33 | { |
25 | struct priv *priv; | 34 | struct priv *priv; |
@@ -67,7 +76,13 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
67 | 76 | ||
68 | pci_set_drvdata(pdev, priv); | 77 | pci_set_drvdata(pdev, priv); |
69 | 78 | ||
70 | priv->bus = mcb_alloc_bus(); | 79 | priv->bus = mcb_alloc_bus(&pdev->dev); |
80 | if (IS_ERR(priv->bus)) { | ||
81 | ret = PTR_ERR(priv->bus); | ||
82 | goto err_drvdata; | ||
83 | } | ||
84 | |||
85 | priv->bus->get_irq = mcb_pci_get_irq; | ||
71 | 86 | ||
72 | ret = chameleon_parse_cells(priv->bus, mapbase, priv->base); | 87 | ret = chameleon_parse_cells(priv->bus, mapbase, priv->base); |
73 | if (ret < 0) | 88 | if (ret < 0) |