aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDave Airlie2010-07-07 18:37:34 +1000
committerDave Airlie2010-07-07 18:37:34 +1000
commit6dbe7465713f0e45f0e867105ca944978d57346e (patch)
tree448d7e5f08fa59ca15277d6567825abd74e08e60 /drivers
parent023eb571a1d0eae738326042dcffa974257eb8c8 (diff)
parent815c4163b6c8ebf8152f42b0a5fd015cfdcedc78 (diff)
Merge tag 'v2.6.35-rc4' into drm-testing
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dma/ppc4xx/adma.c4
-rw-r--r--drivers/edac/i7core_edac.c53
-rw-r--r--drivers/power/z2_battery.c12
3 files changed, 46 insertions, 23 deletions
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 5a22ca6927e5..7c3747902a37 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -4257,10 +4257,12 @@ static int ppc440spe_adma_setup_irqs(struct ppc440spe_adma_device *adev,
struct ppc440spe_adma_chan *chan,
int *initcode)
{
+ struct of_device *ofdev;
struct device_node *np;
int ret;
- np = container_of(adev->dev, struct of_device, dev)->node;
+ ofdev = container_of(adev->dev, struct of_device, dev);
+ np = ofdev->dev.of_node;
if (adev->id != PPC440SPE_XOR_ID) {
adev->err_irq = irq_of_parse_and_map(np, 1);
if (adev->err_irq == NO_IRQ) {
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 6b8b7b41ec5f..cc9357da0e34 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1233,10 +1233,28 @@ static void __init i7core_xeon_pci_fixup(struct pci_id_table *table)
for (i = 0; i < MAX_SOCKET_BUSES; i++)
pcibios_scan_specific_bus(255-i);
}
+ pci_dev_put(pdev);
table++;
}
}
+static unsigned i7core_pci_lastbus(void)
+{
+ int last_bus = 0, bus;
+ struct pci_bus *b = NULL;
+
+ while ((b = pci_find_next_bus(b)) != NULL) {
+ bus = b->number;
+ debugf0("Found bus %d\n", bus);
+ if (bus > last_bus)
+ last_bus = bus;
+ }
+
+ debugf0("Last bus %d\n", last_bus);
+
+ return last_bus;
+}
+
/*
* i7core_get_devices Find and perform 'get' operation on the MCH's
* device/functions we want to reference for this driver
@@ -1244,7 +1262,8 @@ static void __init i7core_xeon_pci_fixup(struct pci_id_table *table)
* Need to 'get' device 16 func 1 and func 2
*/
int i7core_get_onedevice(struct pci_dev **prev, int devno,
- struct pci_id_descr *dev_descr, unsigned n_devs)
+ struct pci_id_descr *dev_descr, unsigned n_devs,
+ unsigned last_bus)
{
struct i7core_dev *i7core_dev;
@@ -1291,10 +1310,7 @@ int i7core_get_onedevice(struct pci_dev **prev, int devno,
}
bus = pdev->bus->number;
- if (bus == 0x3f)
- socket = 0;
- else
- socket = 255 - bus;
+ socket = last_bus - bus;
i7core_dev = get_i7core_dev(socket);
if (!i7core_dev) {
@@ -1358,17 +1374,21 @@ int i7core_get_onedevice(struct pci_dev **prev, int devno,
static int i7core_get_devices(struct pci_id_table *table)
{
- int i, rc;
+ int i, rc, last_bus;
struct pci_dev *pdev = NULL;
struct pci_id_descr *dev_descr;
+ last_bus = i7core_pci_lastbus();
+
while (table && table->descr) {
dev_descr = table->descr;
for (i = 0; i < table->n_devs; i++) {
pdev = NULL;
do {
- rc = i7core_get_onedevice(&pdev, i, &dev_descr[i],
- table->n_devs);
+ rc = i7core_get_onedevice(&pdev, i,
+ &dev_descr[i],
+ table->n_devs,
+ last_bus);
if (rc < 0) {
if (i == 0) {
i = table->n_devs;
@@ -1927,21 +1947,26 @@ fail:
* 0 for FOUND a device
* < 0 for error code
*/
+
+static int probed = 0;
+
static int __devinit i7core_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
- int dev_idx = id->driver_data;
int rc;
struct i7core_dev *i7core_dev;
+ /* get the pci devices we want to reserve for our use */
+ mutex_lock(&i7core_edac_lock);
+
/*
* All memory controllers are allocated at the first pass.
*/
- if (unlikely(dev_idx >= 1))
+ if (unlikely(probed >= 1)) {
+ mutex_unlock(&i7core_edac_lock);
return -EINVAL;
-
- /* get the pci devices we want to reserve for our use */
- mutex_lock(&i7core_edac_lock);
+ }
+ probed++;
rc = i7core_get_devices(pci_dev_table);
if (unlikely(rc < 0))
@@ -2013,6 +2038,8 @@ static void __devexit i7core_remove(struct pci_dev *pdev)
i7core_dev->socket);
}
}
+ probed--;
+
mutex_unlock(&i7core_edac_lock);
}
diff --git a/drivers/power/z2_battery.c b/drivers/power/z2_battery.c
index 9cca465436e3..85064a9f649e 100644
--- a/drivers/power/z2_battery.c
+++ b/drivers/power/z2_battery.c
@@ -9,19 +9,13 @@
*
*/
-#include <linux/init.h>
-#include <linux/kernel.h>
#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/power_supply.h>
-#include <linux/i2c.h>
-#include <linux/spinlock.h>
-#include <linux/interrupt.h>
#include <linux/gpio.h>
+#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
-#include <asm/irq.h>
-#include <asm/mach/irq.h>
+#include <linux/power_supply.h>
+#include <linux/slab.h>
#include <linux/z2_battery.h>
#define Z2_DEFAULT_NAME "Z2"