Date: Fri, 15 Oct 2004 15:21:30 -0700 From: Bruce M Simpson <bms@spc.org> To: freebsd-net@FreeBSD.org Cc: freebsdnic@mailbox.intel.com Subject: [PATCH] Make em(4) use device sysctl tree Message-ID: <20041015222130.GL61186@empiric.icir.org>
next in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041015222130.GL61186>