summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-15 16:23:35 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-15 16:23:35 +0000
commite81a9e6ddbbcf435959b012f5595da0ed2389886 (patch)
treeaa2643a45c77098fcb86874b7d751970cd00d379 /sys/arch
parentc8c7014162f692ead770cea7fb5b67b92fd04f97 (diff)
instead of passing OF nodes down to the drivers, pass name/compat string
pointers. This lets their match() functions actually make real decisions. OF-capable machines will pass name/compat pointers, but other machines will not. grudging ok kettenis
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/macppc/dev/maci2c.c23
-rw-r--r--sys/arch/macppc/dev/maci2cvar.h10
2 files changed, 16 insertions, 17 deletions
diff --git a/sys/arch/macppc/dev/maci2c.c b/sys/arch/macppc/dev/maci2c.c
index caea3cf2ab9..5b99452f577 100644
--- a/sys/arch/macppc/dev/maci2c.c
+++ b/sys/arch/macppc/dev/maci2c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: maci2c.c,v 1.1 2005/11/11 16:22:50 kettenis Exp $ */
+/* $OpenBSD: maci2c.c,v 1.2 2005/11/15 16:23:34 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -47,7 +47,8 @@ void
maciic_attach(struct device *parent, struct device *self, void *aux)
{
struct maci2cbus_attach_args *iba = aux;
- struct maci2c_attach_args ia;
+ struct i2c_attach_args ia;
+ char name[32], compat[32];
u_int32_t reg;
int node;
@@ -58,7 +59,16 @@ maciic_attach(struct device *parent, struct device *self, void *aux)
continue;
ia.ia_tag = iba->iba_tag;
ia.ia_addr = (reg >> 1);
- ia.ia_node = node;
+ ia.ia_name = NULL;
+ ia.ia_compat = NULL;
+ memset(compat, 0, sizeof compat);
+ memset(name, 0, sizeof name);
+ if (OF_getprop(node, "name", &name,
+ sizeof name))
+ ia.ia_name = name;
+ if (OF_getprop(node, "compatible", &compat,
+ sizeof compat))
+ ia.ia_compat = compat;
config_found(self, &ia, maciic_print);
}
}
@@ -66,13 +76,10 @@ maciic_attach(struct device *parent, struct device *self, void *aux)
int
maciic_print(void *aux, const char *pnp)
{
- struct maci2c_attach_args *ia = aux;
- char name[32];
+ struct i2c_attach_args *ia = aux;
if (pnp != NULL) {
- OF_getprop(ia->ia_node, "name", name, sizeof name);
- name[sizeof(name) - 1] = 0;
- printf("%s at %s", name, pnp);
+ printf("%s at %s", ia->ia_name, pnp);
}
printf(" addr 0x%x", ia->ia_addr);
diff --git a/sys/arch/macppc/dev/maci2cvar.h b/sys/arch/macppc/dev/maci2cvar.h
index 066a6f0ed98..7dc43716b20 100644
--- a/sys/arch/macppc/dev/maci2cvar.h
+++ b/sys/arch/macppc/dev/maci2cvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: maci2cvar.h,v 1.1 2005/11/11 16:22:50 kettenis Exp $ */
+/* $OpenBSD: maci2cvar.h,v 1.2 2005/11/15 16:23:34 deraadt Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -22,11 +22,3 @@ struct maci2cbus_attach_args {
i2c_tag_t iba_tag;
int iba_node;
};
-
-struct maci2c_attach_args {
- struct i2c_attach_args ia_ia;
- int ia_node;
-};
-
-#define ia_tag ia_ia.ia_tag
-#define ia_addr ia_ia.ia_addr