From 03790daf0ef18da07a62c9461c2f4e9690fdb479 Mon Sep 17 00:00:00 2001 From: joerg Date: Wed, 12 May 2004 13:43:41 +0000 Subject: Convert the #if 0 magic to #if SCAN_IICBUS, and make it actually compile again. While it's not generally recommended anymore, it might still prove useful for debugging purposes. --- sys/dev/iicbus/iicbus.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sys/dev/iicbus/iicbus.c') diff --git a/sys/dev/iicbus/iicbus.c b/sys/dev/iicbus/iicbus.c index 746ed1d..7d2070a 100644 --- a/sys/dev/iicbus/iicbus.c +++ b/sys/dev/iicbus/iicbus.c @@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$"); static devclass_t iicbus_devclass; +/* See comments below for why auto-scanning is a bad idea. */ +#define SCAN_IICBUS 0 + /* * Device methods */ @@ -83,7 +86,7 @@ iicbus_probe(device_t dev) return (0); } -#if 0 +#if SCAN_IICBUS static int iic_probe_device(device_t dev, u_char addr) { @@ -113,6 +116,10 @@ iic_probe_device(device_t dev, u_char addr) static int iicbus_attach(device_t dev) { +#if SCAN_IICBUS + unsigned char addr; +#endif + iicbus_reset(dev, IIC_FASTEST, 0, NULL); /* device probing is meaningless since the bus is supposed to be @@ -120,11 +127,11 @@ iicbus_attach(device_t dev) * accesses like stop after start to fast, reads for less than * x bytes... */ -#if 0 +#if SCAN_IICBUS printf("Probing for devices on iicbus%d:", device_get_unit(dev)); /* probe any devices */ - for (addr = FIRST_SLAVE_ADDR; addr <= LAST_SLAVE_ADDR; addr++) { + for (addr = 16; addr < 240; addr++) { if (iic_probe_device(dev, (u_char)addr)) { printf(" <%x>", addr); } -- cgit v1.1