Skip to content

Commit 5cdceab

Browse files
catschulzedavem330
authored andcommitted
bbc-i2c: Fix BBC I2C envctrl on SunBlade 2000
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>
1 parent 18f3813 commit 5cdceab

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎drivers/sbus/char/bbc_envctrl.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,9 @@ static void attach_one_temp(struct bbc_i2c_bus *bp, struct platform_device *op,
452452
if (!tp)
453453
return;
454454

455+
INIT_LIST_HEAD(&tp->bp_list);
456+
INIT_LIST_HEAD(&tp->glob_list);
457+
455458
tp->client = bbc_i2c_attach(bp, op);
456459
if (!tp->client) {
457460
kfree(tp);
@@ -497,6 +500,9 @@ static void attach_one_fan(struct bbc_i2c_bus *bp, struct platform_device *op,
497500
if (!fp)
498501
return;
499502

503+
INIT_LIST_HEAD(&fp->bp_list);
504+
INIT_LIST_HEAD(&fp->glob_list);
505+
500506
fp->client = bbc_i2c_attach(bp, op);
501507
if (!fp->client) {
502508
kfree(fp);

‎drivers/sbus/char/bbc_i2c.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,18 @@ static struct bbc_i2c_bus * attach_one_i2c(struct platform_device *op, int index
300300
if (!bp)
301301
return NULL;
302302

303+
INIT_LIST_HEAD(&bp->temps);
304+
INIT_LIST_HEAD(&bp->fans);
305+
303306
bp->i2c_control_regs = of_ioremap(&op->resource[0], 0, 0x2, "bbc_i2c_regs");
304307
if (!bp->i2c_control_regs)
305308
goto fail;
306309

307-
bp->i2c_bussel_reg = of_ioremap(&op->resource[1], 0, 0x1, "bbc_i2c_bussel");
308-
if (!bp->i2c_bussel_reg)
309-
goto fail;
310+
if (op->num_resources == 2) {
311+
bp->i2c_bussel_reg = of_ioremap(&op->resource[1], 0, 0x1, "bbc_i2c_bussel");
312+
if (!bp->i2c_bussel_reg)
313+
goto fail;
314+
}
310315

311316
bp->waiting = 0;
312317
init_waitqueue_head(&bp->wq);

0 commit comments

Comments
 (0)