From owner-p4-projects@FreeBSD.ORG Sat Oct 7 04:29:29 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 33EF116A417; Sat, 7 Oct 2006 04:29:29 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E240F16A412 for ; Sat, 7 Oct 2006 04:29:28 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id AD30043D49 for ; Sat, 7 Oct 2006 04:29:28 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k974TSTe098144 for ; Sat, 7 Oct 2006 04:29:28 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k974TShl098141 for perforce@freebsd.org; Sat, 7 Oct 2006 04:29:28 GMT (envelope-from imp@freebsd.org) Date: Sat, 7 Oct 2006 04:29:28 GMT Message-Id: <200610070429.k974TShl098141@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 107391 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Oct 2006 04:29:29 -0000 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[] = {