From owner-freebsd-net@FreeBSD.ORG Fri Oct 15 22:21:44 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D565B16A4CE; Fri, 15 Oct 2004 22:21:44 +0000 (GMT) Received: from arginine.spc.org (arginine.spc.org [195.206.69.236]) by mx1.FreeBSD.org (Postfix) with ESMTP id C871943D49; Fri, 15 Oct 2004 22:21:43 +0000 (GMT) (envelope-from bms@spc.org) Received: from localhost (localhost [127.0.0.1]) by arginine.spc.org (Postfix) with ESMTP id E4B1C65414; Fri, 15 Oct 2004 23:21:41 +0100 (BST) Received: from arginine.spc.org ([127.0.0.1]) by localhost (arginine.spc.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 68270-01-3; Fri, 15 Oct 2004 23:21:41 +0100 (BST) Received: from empiric.dek.spc.org (dhcp120.icir.org [192.150.187.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by arginine.spc.org (Postfix) with ESMTP id E581965400; Fri, 15 Oct 2004 23:21:39 +0100 (BST) Received: by empiric.dek.spc.org (Postfix, from userid 1001) id 9DC7163E8; Fri, 15 Oct 2004 15:21:30 -0700 (PDT) Date: Fri, 15 Oct 2004 15:21:30 -0700 From: Bruce M Simpson To: freebsd-net@FreeBSD.org Message-ID: <20041015222130.GL61186@empiric.icir.org> Mail-Followup-To: freebsd-net@FreeBSD.org, tackerman@FreeBSD.org, freebsdnic@mailbox.intel.com, mux@FreeBSD.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PWfwoUCx3AFJRUBq" Content-Disposition: inline cc: mux@FreeBSD.org cc: tackerman@FreeBSD.org cc: freebsdnic@mailbox.intel.com Subject: [PATCH] Make em(4) use device sysctl tree X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2004 22:21:45 -0000 --PWfwoUCx3AFJRUBq Content-Type: multipart/mixed; boundary="k+G3HLlWI7eRTl+h" Content-Disposition: inline --k+G3HLlWI7eRTl+h Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here is a non-critical patch to bring em(4) into line with other drivers, by using the sysctl tree created for each device by the bus framework. Please review; Thanks. BMS --k+G3HLlWI7eRTl+h Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="em_sysctl.diff" Content-Transfer-Encoding: quoted-printable Index: if_em.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/dev/em/if_em.c,v retrieving revision 1.44.2.1 diff -u -p -r1.44.2.1 if_em.c --- if_em.c 1 Oct 2004 18:51:11 -0000 1.44.2.1 +++ if_em.c 15 Oct 2004 22:16:05 -0000 @@ -310,26 +310,14 @@ em_attach(device_t dev) em_adapter_list =3D adapter; =20 /* SYSCTL stuff */ - sysctl_ctx_init(&adapter->sysctl_ctx); - adapter->sysctl_tree =3D SYSCTL_ADD_NODE(&adapter->sysctl_ctx, - SYSCTL_STATIC_CHILDREN(_hw), - OID_AUTO, - device_get_nameunit(dev), - CTLFLAG_RD, - 0, ""); - if (adapter->sysctl_tree =3D=3D NULL) { - error =3D EIO; =20 - goto err_sysctl; - } - =20 - SYSCTL_ADD_PROC(&adapter->sysctl_ctx, - SYSCTL_CHILDREN(adapter->sysctl_tree), + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "debug_info", CTLTYPE_INT|CTLFLAG_RW, (void *)adapter, 0, em_sysctl_debug_info, "I", "Debug Information"); =20 - SYSCTL_ADD_PROC(&adapter->sysctl_ctx, - SYSCTL_CHILDREN(adapter->sysctl_tree), + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, (void *)adapter, 0, em_sysctl_stats, "I", "Statistics"); @@ -504,8 +492,6 @@ err_rx_desc: err_tx_desc: err_pci: em_free_pci_resources(adapter); - sysctl_ctx_free(&adapter->sysctl_ctx); -err_sysctl: return(error); =20 } @@ -553,9 +539,6 @@ em_detach(device_t dev) adapter->rx_desc_base =3D NULL; } =20 - /* Free the sysctl tree */ - sysctl_ctx_free(&adapter->sysctl_ctx); - /* Remove from the adapter list */ if (em_adapter_list =3D=3D adapter) em_adapter_list =3D adapter->next; @@ -3347,8 +3330,8 @@ em_add_int_delay_sysctl(struct adapter * info->adapter =3D adapter; info->offset =3D offset; info->value =3D value; - SYSCTL_ADD_PROC(&adapter->sysctl_ctx, - SYSCTL_CHILDREN(adapter->sysctl_tree), + SYSCTL_ADD_PROC(device_get_sysctl_ctx(adapter->dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(adapter->dev)), OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, info, 0, em_sysctl_int_delay, "I", description); } --k+G3HLlWI7eRTl+h-- --PWfwoUCx3AFJRUBq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Comment: '' iD8DBQFBcE1pueUpAYYNtTsRAnmBAJ9SC2cFoDg7s0WU2OHXVoaJ0g6niACfYeOJ yAgMUB5nIZhccTLXvQLvqag= =c4Yc -----END PGP SIGNATURE----- --PWfwoUCx3AFJRUBq--