Index: arch/arm/at91/at91spi.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/at91/at91spi.c,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -p -r1.7 -r1.7.2.1 --- arch/arm/at91/at91spi.c 7 Aug 2021 16:18:43 -0000 1.7 +++ arch/arm/at91/at91spi.c 9 Aug 2021 00:30:06 -0000 1.7.2.1 @@ -1,5 +1,5 @@ -/* $Id: at91spi.c,v 1.7 2021/08/07 16:18:43 thorpej Exp $ */ -/* $NetBSD: at91spi.c,v 1.7 2021/08/07 16:18:43 thorpej Exp $ */ +/* $Id: at91spi.c,v 1.7.2.1 2021/08/09 00:30:06 thorpej Exp $ */ +/* $NetBSD: at91spi.c,v 1.7.2.1 2021/08/09 00:30:06 thorpej Exp $ */ /*- * Copyright (c) 2007 Embedtronics Oy. All rights reserved. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: at91spi.c,v 1.7 2021/08/07 16:18:43 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: at91spi.c,v 1.7.2.1 2021/08/09 00:30:06 thorpej Exp $"); #include "locators.h" @@ -105,7 +105,6 @@ at91spi_attach_common(device_t parent, d { struct at91spi_softc *sc = device_private(self); struct at91bus_attach_args *sa = aux; - struct spibus_attach_args sba; bus_dma_segment_t segs; int rsegs, err; @@ -155,9 +154,6 @@ at91spi_attach_common(device_t parent, d aprint_error("%s: no slaves!\n", device_xname(sc->sc_dev)); } - memset(&sba, 0, sizeof(sba)); - sba.sba_controller = &sc->sc_spi; - /* initialize the queue */ SIMPLEQ_INIT(&sc->sc_q); @@ -193,7 +189,11 @@ at91spi_attach_common(device_t parent, d PUTREG(sc, SPI_PDC_BASE + PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN); /* attach slave devices */ - config_found(sc->sc_dev, &sba, spibus_print, CFARGS_NONE); + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(sc->sc_dev, &sba, spibus_print, + CFARGS(.devhandle = device_handle(sc->sc_dev))); } int Index: arch/arm/broadcom/bcm2835_spi.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/broadcom/bcm2835_spi.c,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -p -r1.11 -r1.11.2.1 --- arch/arm/broadcom/bcm2835_spi.c 7 Aug 2021 16:18:43 -0000 1.11 +++ arch/arm/broadcom/bcm2835_spi.c 9 Aug 2021 00:30:06 -0000 1.11.2.1 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_spi.c,v 1.11 2021/08/07 16:18:43 thorpej Exp $ */ +/* $NetBSD: bcm2835_spi.c,v 1.11.2.1 2021/08/09 00:30:06 thorpej Exp $ */ /* * Copyright (c) 2012 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.11 2021/08/07 16:18:43 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.11.2.1 2021/08/09 00:30:06 thorpej Exp $"); #include #include @@ -95,7 +95,6 @@ bcmspi_attach(device_t parent, device_t { struct bcmspi_softc * const sc = device_private(self); struct fdt_attach_args * const faa = aux; - struct spibus_attach_args sba; aprint_naive("\n"); aprint_normal(": SPI\n"); @@ -138,10 +137,11 @@ bcmspi_attach(device_t parent, device_t sc->sc_spi.sct_transfer = bcmspi_transfer; sc->sc_spi.sct_nslaves = 3; - memset(&sba, 0, sizeof(sba)); - sba.sba_controller = &sc->sc_spi; - - config_found(self, &sba, spibus_print, CFARGS_NONE); + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(self, &sba, spibus_print, + CFARGS(.devhandle = device_handle(self))); } static int Index: arch/arm/imx/imxspi.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/imx/imxspi.c,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -p -r1.9 -r1.9.2.1 --- arch/arm/imx/imxspi.c 7 Aug 2021 16:18:44 -0000 1.9 +++ arch/arm/imx/imxspi.c 9 Aug 2021 00:30:07 -0000 1.9.2.1 @@ -1,4 +1,4 @@ -/* $NetBSD: imxspi.c,v 1.9 2021/08/07 16:18:44 thorpej Exp $ */ +/* $NetBSD: imxspi.c,v 1.9.2.1 2021/08/09 00:30:07 thorpej Exp $ */ /*- * Copyright (c) 2014 Genetec Corporation. All rights reserved. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.9 2021/08/07 16:18:44 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.9.2.1 2021/08/09 00:30:07 thorpej Exp $"); #include "opt_imxspi.h" #include "opt_fdt.h" @@ -86,20 +86,6 @@ int imxspi_debug = IMXSPI_DEBUG; #define DPRINTFN(n,x) #endif -#ifdef FDT -static struct spi_controller * -imxspi_get_controller(device_t dev) -{ - struct imxspi_softc * const sc = device_private(dev); - - return &sc->sc_spi; -} - -static const struct fdtbus_spi_controller_func imxspi_funcs = { - .get_controller = imxspi_get_controller -}; -#endif - int imxspi_attach_common(device_t self) { @@ -140,16 +126,13 @@ imxspi_attach_common(device_t self) #ifdef FDT KASSERT(sc->sc_phandle != 0); - fdtbus_register_spi_controller(self, sc->sc_phandle, &imxspi_funcs); - (void) fdtbus_attach_spibus(self, sc->sc_phandle, spibus_print); -#else - struct spibus_attach_args sba; - memset(&sba, 0, sizeof(sba)); - sba.sba_controller = &sc->sc_spi; - - /* attach slave devices */ - config_found(sc->sc_dev, &sba, spibus_print, CFARGS_NONE); + fdtbus_register_spi_controller(&sc->sc_spi, sc->sc_phandle); #endif + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(self, &sba, spibus_print, + CFARGS(.devhandle = device_handle(self))); return 0; } Index: arch/arm/rockchip/rk_spi.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/rockchip/rk_spi.c,v retrieving revision 1.7 retrieving revision 1.7.8.1 diff -u -p -r1.7 -r1.7.8.1 --- arch/arm/rockchip/rk_spi.c 15 May 2021 08:46:00 -0000 1.7 +++ arch/arm/rockchip/rk_spi.c 9 Aug 2021 00:30:07 -0000 1.7.8.1 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_spi.c,v 1.7 2021/05/15 08:46:00 mrg Exp $ */ +/* $NetBSD: rk_spi.c,v 1.7.8.1 2021/08/09 00:30:07 thorpej Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.7 2021/05/15 08:46:00 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.7.8.1 2021/08/09 00:30:07 thorpej Exp $"); #include #include @@ -168,7 +168,6 @@ struct rk_spi_softc { #define SPIREG_WRITE(sc, reg, val) \ bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) -static struct spi_controller *rk_spi_get_controller(device_t); static int rk_spi_match(device_t, cfdata_t, void *); static void rk_spi_attach(device_t, device_t, void *); @@ -185,18 +184,6 @@ static int rk_spi_intr(void *); CFATTACH_DECL_NEW(rk_spi, sizeof(struct rk_spi_softc), rk_spi_match, rk_spi_attach, NULL, NULL); -static const struct fdtbus_spi_controller_func rk_spi_funcs = { - .get_controller = rk_spi_get_controller -}; - -static struct spi_controller * -rk_spi_get_controller(device_t dev) -{ - struct rk_spi_softc * const sc = device_private(dev); - - return &sc->sc_spi; -} - static int rk_spi_match(device_t parent, cfdata_t cf, void *aux) { @@ -264,8 +251,13 @@ rk_spi_attach(device_t parent, device_t sc->sc_spi.sct_transfer = rk_spi_transfer; sc->sc_spi.sct_nslaves = 2; - fdtbus_register_spi_controller(self, phandle, &rk_spi_funcs); - (void) fdtbus_attach_spibus(self, phandle, spibus_print); + fdtbus_register_spi_controller(&sc->sc_spi, phandle); + + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(self, &sba, spibus_print, + CFARGS(.devhandle = device_handle(self))); } static int Index: arch/arm/sunxi/sun4i_spi.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/sunxi/sun4i_spi.c,v retrieving revision 1.7 retrieving revision 1.7.14.1 diff -u -p -r1.7 -r1.7.14.1 --- arch/arm/sunxi/sun4i_spi.c 27 Jan 2021 03:10:20 -0000 1.7 +++ arch/arm/sunxi/sun4i_spi.c 9 Aug 2021 00:30:07 -0000 1.7.14.1 @@ -1,4 +1,4 @@ -/* $NetBSD: sun4i_spi.c,v 1.7 2021/01/27 03:10:20 thorpej Exp $ */ +/* $NetBSD: sun4i_spi.c,v 1.7.14.1 2021/08/09 00:30:07 thorpej Exp $ */ /* * Copyright (c) 2019 Tobias Nygren @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sun4i_spi.c,v 1.7 2021/01/27 03:10:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sun4i_spi.c,v 1.7.14.1 2021/08/09 00:30:07 thorpej Exp $"); #include #include @@ -65,7 +65,6 @@ struct sun4ispi_softc { #define SPIREG_WRITE(sc, reg, val) \ bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) -static struct spi_controller * sun4i_spi_get_controller(device_t); static int sun4ispi_match(device_t, cfdata_t, void *); static void sun4ispi_attach(device_t, device_t, void *); @@ -82,18 +81,6 @@ static int sun4ispi_intr(void *); CFATTACH_DECL_NEW(sun4i_spi, sizeof(struct sun4ispi_softc), sun4ispi_match, sun4ispi_attach, NULL, NULL); -static const struct fdtbus_spi_controller_func sun4i_spi_funcs = { - .get_controller = sun4i_spi_get_controller -}; - -static struct spi_controller * -sun4i_spi_get_controller(device_t dev) -{ - struct sun4ispi_softc * const sc = device_private(dev); - - return &sc->sc_spi; -} - static int sun4ispi_match(device_t parent, cfdata_t cf, void *aux) { @@ -164,8 +151,14 @@ sun4ispi_attach(device_t parent, device_ sc->sc_spi.sct_configure = sun4ispi_configure; sc->sc_spi.sct_transfer = sun4ispi_transfer; (void) of_getprop_uint32(phandle, "num-cs", &sc->sc_spi.sct_nslaves); - fdtbus_register_spi_controller(self, phandle, &sun4i_spi_funcs); - (void) fdtbus_attach_spibus(self, phandle, spibus_print); + + fdtbus_register_spi_controller(&sc->sc_spi, phandle); + + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(self, &sba, spibus_print, + CFARGS(.devhandle = device_handle(self))); } static int Index: arch/arm/sunxi/sun6i_spi.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/sunxi/sun6i_spi.c,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -p -r1.10 -r1.10.2.1 --- arch/arm/sunxi/sun6i_spi.c 7 Aug 2021 16:18:45 -0000 1.10 +++ arch/arm/sunxi/sun6i_spi.c 9 Aug 2021 00:30:07 -0000 1.10.2.1 @@ -1,4 +1,4 @@ -/* $NetBSD: sun6i_spi.c,v 1.10 2021/08/07 16:18:45 thorpej Exp $ */ +/* $NetBSD: sun6i_spi.c,v 1.10.2.1 2021/08/09 00:30:07 thorpej Exp $ */ /* * Copyright (c) 2019 Tobias Nygren @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sun6i_spi.c,v 1.10 2021/08/07 16:18:45 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sun6i_spi.c,v 1.10.2.1 2021/08/09 00:30:07 thorpej Exp $"); #include #include @@ -102,7 +102,6 @@ sun6ispi_attach(device_t parent, device_ { struct sun6ispi_softc * const sc = device_private(self); struct fdt_attach_args * const faa = aux; - struct spibus_attach_args sba; const int phandle = faa->faa_phandle; bus_addr_t addr; bus_size_t size; @@ -185,10 +184,11 @@ sun6ispi_attach(device_t parent, device_ sc->sc_spi.sct_transfer = sun6ispi_transfer; sc->sc_spi.sct_nslaves = 4; - memset(&sba, 0, sizeof(sba)); - sba.sba_controller = &sc->sc_spi; - - (void) config_found(self, &sba, spibus_print, CFARGS_NONE); + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(self, &sba, spibus_print, + CFARGS(.devhandle = device_handle(self))); } static int Index: arch/mips/alchemy/dev/auspi.c =================================================================== RCS file: /cvsroot/src/sys/arch/mips/alchemy/dev/auspi.c,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -p -r1.11 -r1.11.2.1 --- arch/mips/alchemy/dev/auspi.c 7 Aug 2021 16:18:58 -0000 1.11 +++ arch/mips/alchemy/dev/auspi.c 9 Aug 2021 00:30:08 -0000 1.11.2.1 @@ -1,4 +1,4 @@ -/* $NetBSD: auspi.c,v 1.11 2021/08/07 16:18:58 thorpej Exp $ */ +/* $NetBSD: auspi.c,v 1.11.2.1 2021/08/09 00:30:08 thorpej Exp $ */ /*- * Copyright (c) 2006 Urbana-Champaign Independent Media Center. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: auspi.c,v 1.11 2021/08/07 16:18:58 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: auspi.c,v 1.11.2.1 2021/08/09 00:30:08 thorpej Exp $"); #include "locators.h" @@ -124,7 +124,6 @@ auspi_attach(device_t parent, device_t s { struct auspi_softc *sc = device_private(self); struct aupsc_attach_args *aa = aux; - struct spibus_attach_args sba; const struct auspi_machdep *md; sc->sc_dev = self; @@ -147,9 +146,6 @@ auspi_attach(device_t parent, device_t s /* fix this! */ sc->sc_spi.sct_nslaves = sc->sc_md.am_nslaves; - memset(&sba, 0, sizeof(sba)); - sba.sba_controller = &sc->sc_spi; - /* enable SPI mode */ sc->sc_psc.psc_enable(sc, AUPSC_SEL_SPI); @@ -163,7 +159,11 @@ auspi_attach(device_t parent, device_t s sc->sc_ih = au_intr_establish(aa->aupsc_irq, 0, IPL_BIO, IST_LEVEL, auspi_intr, sc); - config_found(self, &sba, spibus_print, CFARGS_NONE); + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(self, &sba, spibus_print, + CFARGS(.devhandle = device_handle(self))); } int Index: arch/mips/atheros/dev/arspi.c =================================================================== RCS file: /cvsroot/src/sys/arch/mips/atheros/dev/arspi.c,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -p -r1.15 -r1.15.2.1 --- arch/mips/atheros/dev/arspi.c 7 Aug 2021 16:18:58 -0000 1.15 +++ arch/mips/atheros/dev/arspi.c 9 Aug 2021 00:30:08 -0000 1.15.2.1 @@ -1,4 +1,4 @@ -/* $NetBSD: arspi.c,v 1.15 2021/08/07 16:18:58 thorpej Exp $ */ +/* $NetBSD: arspi.c,v 1.15.2.1 2021/08/09 00:30:08 thorpej Exp $ */ /*- * Copyright (c) 2006 Urbana-Champaign Independent Media Center. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arspi.c,v 1.15 2021/08/07 16:18:58 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arspi.c,v 1.15.2.1 2021/08/09 00:30:08 thorpej Exp $"); #include "locators.h" @@ -146,7 +146,6 @@ void arspi_attach(device_t parent, device_t self, void *aux) { struct arspi_softc *sc = device_private(self); - struct spibus_attach_args sba; struct arbus_attach_args *aa = aux; /* @@ -191,9 +190,11 @@ arspi_attach(device_t parent, device_t s /* * Initialize and attach bus attach. */ - memset(&sba, 0, sizeof(sba)); - sba.sba_controller = &sc->sc_spi; - config_found(self, &sba, spibus_print, CFARGS_NONE); + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(self, &sba, spibus_print, + CFARGS(.devhandle = device_handle(self))); } void