Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christopher Alexander Tobias Schulze and committed by
David S. Miller
5cdceab3 18f38132

+14 -3
+6
drivers/sbus/char/bbc_envctrl.c
··· 452 452 if (!tp) 453 453 return; 454 454 455 + INIT_LIST_HEAD(&tp->bp_list); 456 + INIT_LIST_HEAD(&tp->glob_list); 457 + 455 458 tp->client = bbc_i2c_attach(bp, op); 456 459 if (!tp->client) { 457 460 kfree(tp); ··· 499 496 fp = kzalloc(sizeof(*fp), GFP_KERNEL); 500 497 if (!fp) 501 498 return; 499 + 500 + INIT_LIST_HEAD(&fp->bp_list); 501 + INIT_LIST_HEAD(&fp->glob_list); 502 502 503 503 fp->client = bbc_i2c_attach(bp, op); 504 504 if (!fp->client) {
+8 -3
drivers/sbus/char/bbc_i2c.c
··· 300 300 if (!bp) 301 301 return NULL; 302 302 303 + INIT_LIST_HEAD(&bp->temps); 304 + INIT_LIST_HEAD(&bp->fans); 305 + 303 306 bp->i2c_control_regs = of_ioremap(&op->resource[0], 0, 0x2, "bbc_i2c_regs"); 304 307 if (!bp->i2c_control_regs) 305 308 goto fail; 306 309 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 + } 310 315 311 316 bp->waiting = 0; 312 317 init_waitqueue_head(&bp->wq);