Date: Sat, 7 Oct 2006 04:29:28 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 107391 for review Message-ID: <200610070429.k974TShl098141@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=107391 Change 107391 by imp@imp_lighthouse on 2006/10/07 04:29:14 Start on deferred ID. Affected files ... .. //depot/projects/arm/src/sys/dev/flash/at45d.c#3 edit Differences ... ==== //depot/projects/arm/src/sys/dev/flash/at45d.c#3 (text+ko) ==== @@ -39,9 +39,23 @@ struct at45d_softc { + struct intr_config_hook config_intrhook; + device_t dev; + struct mtx sc_mtx; int dummy; }; +#define AT45D_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define AT45D_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define AT45D_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \ + "at45d", MTX_DEF) +#define AT45D_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); +#define AT45D_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); +#define AT45D_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); + +static void at45d_delayed_attach(void *xsc); + #define CONTINUOUS_ARRAY_READ 0xE8 #define CONTINUOUS_ARRAY_READ_HF 0x0B #define CONTINUOUS_ARRAY_READ_LF 0x03 @@ -244,6 +258,17 @@ static int at45d_attach(device_t dev) { + struct at45d_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + AT45D_LOCK_INIT(sc); + + /* We'll see what kind of flash we have later... */ + sc->config_intrhook.ich_func = at45d_delayed_attach; + sc->config_intrhook.ich_arg = sc; + if (config_intrhook_establish(&sc->config_intrhook) != 0) + device_printf(dev, "config_intrhook_establish failed\n"); return (0); } @@ -253,6 +278,14 @@ return EIO; } +static void +at45d_delayed_attach(void *xsc) +{ + struct at45d_softc *sc = xsc; + + config_intrhook_disestablish(&sc->config_intrhook); +} + static devclass_t at45d_devclass; static device_method_t at45d_methods[] = {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610070429.k974TShl098141>