From: patrick Date: Fri, 5 Feb 2021 00:08:26 +0000 (+0000) Subject: Rename probe/attach functions to fit our regular naming scheme. Replace X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c81f110b78bf8166a73c582a549cbebedbc00ce3;p=openbsd Rename probe/attach functions to fit our regular naming scheme. Replace &armv7_bs_tag with fdt_cons_bs_tag, which is our early console bus tag for both arm64 and armv7. On armv7, it points to &armv7_bs_tag. With this we can get rid of the armv7var.h include. Reduce a bit of diff to imxuart(4). ok kettenis@ --- diff --git a/sys/dev/fdt/exuart.c b/sys/dev/fdt/exuart.c index a9d5b547eb8..1800d44088e 100644 --- a/sys/dev/fdt/exuart.c +++ b/sys/dev/fdt/exuart.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exuart.c,v 1.1 2021/02/05 00:05:20 patrick Exp $ */ +/* $OpenBSD: exuart.c,v 1.2 2021/02/05 00:08:26 patrick Exp $ */ /* * Copyright (c) 2005 Dale Rahn * @@ -38,7 +38,6 @@ #include #endif -#include #include #include @@ -87,8 +86,8 @@ struct exuart_softc { }; -int exuartprobe(struct device *parent, void *self, void *aux); -void exuartattach(struct device *parent, struct device *self, void *aux); +int exuart_match(struct device *, void *, void *); +void exuart_attach(struct device *, struct device *, void *); void exuartcnprobe(struct consdev *cp); void exuartcninit(struct consdev *cp); @@ -116,7 +115,7 @@ struct cfdriver exuart_cd = { }; struct cfattach exuart_ca = { - sizeof(struct exuart_softc), exuartprobe, exuartattach + sizeof(struct exuart_softc), exuart_match, exuart_attach }; bus_space_tag_t exuartconsiot; @@ -125,6 +124,9 @@ bus_addr_t exuartconsaddr; tcflag_t exuartconscflag = TTYDEF_CFLAG; int exuartdefaultrate = B115200; +struct cdevsw exuartdev = + cdev_tty_init(3/*XXX NEXUART */ ,exuart); /* 12: serial port */ + void exuart_init_cons(void) { @@ -148,34 +150,32 @@ exuart_init_cons(void) if (fdt_get_reg(node, 0, ®)) return; - exuartcnattach(&armv7_bs_tag, reg.addr, B115200, TTYDEF_CFLAG); + exuartcnattach(fdt_cons_bs_tag, reg.addr, B115200, TTYDEF_CFLAG); } int -exuartprobe(struct device *parent, void *self, void *aux) +exuart_match(struct device *parent, void *self, void *aux) { struct fdt_attach_args *faa = aux; return OF_is_compatible(faa->fa_node, "samsung,exynos4210-uart"); } -struct cdevsw exuartdev = - cdev_tty_init(3/*XXX NEXUART */ ,exuart); /* 12: serial port */ - void -exuartattach(struct device *parent, struct device *self, void *aux) +exuart_attach(struct device *parent, struct device *self, void *aux) { - struct fdt_attach_args *faa = aux; struct exuart_softc *sc = (struct exuart_softc *) self; + struct fdt_attach_args *faa = aux; int maj; if (faa->fa_nreg < 1) return; - sc->sc_iot = faa->fa_iot; sc->sc_irq = arm_intr_establish_fdt(faa->fa_node, IPL_TTY, exuart_intr, sc, sc->sc_dev.dv_xname); + + sc->sc_iot = faa->fa_iot; if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, faa->fa_reg[0].size, 0, &sc->sc_ioh)) panic("%s: bus_space_map failed!", __func__);