bbc-i2c: Fix BBC I2C envctrl on SunBlade 2000
authorChristopher Alexander Tobias Schulze <cat.schulze@alice-dsl.net>
Sun, 3 Aug 2014 13:44:52 +0000 (15:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Aug 2014 01:24:16 +0000 (09:24 +0800)
[ Upstream commit 5cdceab3d5e02eb69ea0f5d8fa9181800baf6f77 ]

Fix regression in bbc i2c temperature and fan control on some Sun systems
that causes the driver to refuse to load due to the bbc_i2c_bussel resource not
being present on the (second) i2c bus where the temperature sensors and fan
control are located. (The check for the number of resources was removed when
the driver was ported to a pure OF driver in mid 2008.)

Signed-off-by: Christopher Alexander Tobias Schulze <cat.schulze@alice-dsl.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/sbus/char/bbc_envctrl.c
drivers/sbus/char/bbc_i2c.c

index 160e7510aca694913e407e03dd2bb1408c6cf0b7..0787b97561657d1116f48c32ae5efefb31d71c8d 100644 (file)
@@ -452,6 +452,9 @@ static void attach_one_temp(struct bbc_i2c_bus *bp, struct platform_device *op,
        if (!tp)
                return;
 
+       INIT_LIST_HEAD(&tp->bp_list);
+       INIT_LIST_HEAD(&tp->glob_list);
+
        tp->client = bbc_i2c_attach(bp, op);
        if (!tp->client) {
                kfree(tp);
@@ -497,6 +500,9 @@ static void attach_one_fan(struct bbc_i2c_bus *bp, struct platform_device *op,
        if (!fp)
                return;
 
+       INIT_LIST_HEAD(&fp->bp_list);
+       INIT_LIST_HEAD(&fp->glob_list);
+
        fp->client = bbc_i2c_attach(bp, op);
        if (!fp->client) {
                kfree(fp);
index c1441ed282eb911ff67a6363ce5a78f6cbe45199..e0e6cd605cca76062f51cf5f138ee1354518220c 100644 (file)
@@ -301,13 +301,18 @@ static struct bbc_i2c_bus * attach_one_i2c(struct platform_device *op, int index
        if (!bp)
                return NULL;
 
+       INIT_LIST_HEAD(&bp->temps);
+       INIT_LIST_HEAD(&bp->fans);
+
        bp->i2c_control_regs = of_ioremap(&op->resource[0], 0, 0x2, "bbc_i2c_regs");
        if (!bp->i2c_control_regs)
                goto fail;
 
-       bp->i2c_bussel_reg = of_ioremap(&op->resource[1], 0, 0x1, "bbc_i2c_bussel");
-       if (!bp->i2c_bussel_reg)
-               goto fail;
+       if (op->num_resources == 2) {
+               bp->i2c_bussel_reg = of_ioremap(&op->resource[1], 0, 0x1, "bbc_i2c_bussel");
+               if (!bp->i2c_bussel_reg)
+                       goto fail;
+       }
 
        bp->waiting = 0;
        init_waitqueue_head(&bp->wq);