diff options
| author | jmcneill <jmcneill@NetBSD.org> | 2015-12-13 17:14:56 +0000 |
|---|---|---|
| committer | jmcneill <jmcneill@NetBSD.org> | 2015-12-13 17:14:56 +0000 |
| commit | b8fc7409a924683f62dddd7488add0cdffe7e194 (patch) | |
| tree | b12897ee037ca7e2b17555729210b78db626a271 /sys/dev | |
| parent | e575728c6dced0386b750be9218b0bcbd8c9b65e (diff) | |
allow child devices to be passed in attach args instead of device dictionary
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/i2c/i2c.c | 20 | ||||
| -rw-r--r-- | sys/dev/i2c/i2cvar.h | 4 |
2 files changed, 16 insertions, 8 deletions
diff --git a/sys/dev/i2c/i2c.c b/sys/dev/i2c/i2c.c index 6c6ad141278..cc55e71f4cb 100644 --- a/sys/dev/i2c/i2c.c +++ b/sys/dev/i2c/i2c.c @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.c,v 1.50 2015/12/10 05:33:28 pgoyette Exp $ */ +/* $NetBSD: i2c.c,v 1.51 2015/12/13 17:14:56 jmcneill Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ #endif #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.50 2015/12/10 05:33:28 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.51 2015/12/13 17:14:56 jmcneill Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -217,11 +217,17 @@ iic_attach(device_t parent, device_t self, void *aux) if (!pmf_device_register(self, NULL, NULL)) aprint_error_dev(self, "couldn't establish power handler\n"); - props = device_properties(parent); - if (!prop_dictionary_get_bool(props, "i2c-indirect-config", - &indirect_config)) - indirect_config = true; - child_devices = prop_dictionary_get(props, "i2c-child-devices"); + if (iba->iba_child_devices) { + child_devices = iba->iba_child_devices; + indirect_config = false; + } else { + props = device_properties(parent); + if (!prop_dictionary_get_bool(props, "i2c-indirect-config", + &indirect_config)) + indirect_config = true; + child_devices = prop_dictionary_get(props, "i2c-child-devices"); + } + if (child_devices) { unsigned int i, count; prop_dictionary_t dev; diff --git a/sys/dev/i2c/i2cvar.h b/sys/dev/i2c/i2cvar.h index e668375add6..fb30cf31985 100644 --- a/sys/dev/i2c/i2cvar.h +++ b/sys/dev/i2c/i2cvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: i2cvar.h,v 1.8 2010/02/28 15:33:21 snj Exp $ */ +/* $NetBSD: i2cvar.h,v 1.9 2015/12/13 17:14:56 jmcneill Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -39,6 +39,7 @@ #define _DEV_I2C_I2CVAR_H_ #include <dev/i2c/i2c_io.h> +#include <prop/proplib.h> /* Flags passed to i2c routines. */ #define I2C_F_WRITE 0x00 /* new transfer is a write */ @@ -110,6 +111,7 @@ typedef struct i2c_controller { struct i2cbus_attach_args { i2c_tag_t iba_tag; /* the controller */ int iba_type; /* bus type */ + prop_array_t iba_child_devices; /* child devices (direct config) */ }; /* Used to attach devices on the i2c bus. */ |
