From nobody Mon Mar 20 20:36:51 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PgRNg3g7xz40Cnc; Mon, 20 Mar 2023 20:36:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PgRNg2wLnz3R0l; Mon, 20 Mar 2023 20:36:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n8s6X7Lhp2GpxDlTL45DO56TgmBkkr+PBseTINZpl74=; b=ZZ5EFX8VZo8nIIa17pNcyMPsX1sKhLiJPTOpk/GUh/07EfGbDl1RgGSpSLVVSPRheFUyMM IalIv2vy/iyCqxpehbrS7Izq5I+mMpTVRtXtZhkNY9GgHUuioODNBI7G+yt+Fv+QkLyYPC 32KbygH/nfpoWYublWc5945G1gnG2t/cVb4H/3HYjFCIrE2EjLUgXFrUv6y/KUzNMUmCJK rev8FODU7qGyDWiEhWdRZi2edJM+mndIHuzHglzVG6Fmwfo2xLSOYAOW2zZh9/s5K/1vYI CV7SqD1ohvSendyh9NYdP55ngKhgGxK1OnE5rzDJZNn/UbmTJOf7atKO3gvI2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679344611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n8s6X7Lhp2GpxDlTL45DO56TgmBkkr+PBseTINZpl74=; b=s9zLccAYHmj7xfxFI7V6YMXTYa/PTUnOwxHyNW+sIfqJ3FD2T5bEE2ESJBFoPvqHefh3Sl E1vCn/61bKg49nFiOH7CTiwAZSMj7TI1wP1Qj5F/Wjjg2KrKqrGONIUzZ0ceDMvkZrv673 9dvQP+GTByyWS6132/6QVrQRJZXS9uWNmI2Nr0AOLfF/313MsAqMltgGrUFc3zxLhozG6c phC/pbPYmLGVlzPtmhQeUEjQWRVyyWBNLs0B2o30/qsRNCf4HcUErQmk5bVBnSAU2ji31f VWBO3SKvag0GHZs6lFPPqxMWFGlltQvXt1HroXZ92jtcqvkS6ZAk4FTmP3la1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679344611; a=rsa-sha256; cv=none; b=mQ3sPLQfzkCruAZSF/qY+uxRgcy5X+vrakq0mL+zi843Os1qvykqCTxJxv89A2cvUTpa3S veLVBbZrE0z6ddpkYm84XACy9LQ1i0i1zznx+RvCD3P7BJ+nVVYothKFqTEgl3dxJntl94 K1ATNrptt5qKd/cCeH+axGKX7gapG9XNu/MfR5OAtD74aAxSxdJhVTP9lqojO+914rzTHO PItmGPoo6AeQyLCMzguBzB7y2ATONxSyzOTwpOXI6+rH5DOpkG6qVWNCLOlS7XsK2Cb8Lp 9s6Ov5lQdggYryxduTtFjGOUCjXpvv8ncmjUeMBq128crd5ebx+5pE+CmNGEaw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PgRNg1yrMzkyv; Mon, 20 Mar 2023 20:36:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32KKapsF066199; Mon, 20 Mar 2023 20:36:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32KKap5j066198; Mon, 20 Mar 2023 20:36:51 GMT (envelope-from git) Date: Mon, 20 Mar 2023 20:36:51 GMT Message-Id: <202303202036.32KKap5j066198@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: c650e1949558 - main - arm: nexus code tidy-up List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c650e1949558c1993d7486859ad9804fd582129e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c650e1949558c1993d7486859ad9804fd582129e commit c650e1949558c1993d7486859ad9804fd582129e Author: Mitchell Horne AuthorDate: 2023-02-06 15:57:33 +0000 Commit: Mitchell Horne CommitDate: 2023-03-20 20:35:47 +0000 arm: nexus code tidy-up Make a pass at the various nexus implementations, fixing some very minor style issues, obsolete comments, etc. The method declaration section has become unwieldy in many respects. Attempt to tame it by: - Using generated method typedefs - Grouping methods roughly by category, and then alphabetically. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D38495 --- sys/arm/arm/nexus.c | 90 +++++++++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 48 deletions(-) diff --git a/sys/arm/arm/nexus.c b/sys/arm/arm/nexus.c index 0cd960ec3682..48e766b0cc62 100644 --- a/sys/arm/arm/nexus.c +++ b/sys/arm/arm/nexus.c @@ -45,20 +45,20 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -#include #include -#include -#include -#include #include #include -#include +#include +#include #include +#include +#include #include @@ -79,37 +79,31 @@ struct nexus_device { static struct rman mem_rman; static struct rman irq_rman; -static int nexus_probe(device_t); -static int nexus_attach(device_t); -static int nexus_print_child(device_t, device_t); -static device_t nexus_add_child(device_t, u_int, const char *, int); -static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - rman_res_t, rman_res_t, rman_res_t, u_int); -static int nexus_activate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_adjust_resource(device_t, device_t, int, struct resource *, - rman_res_t, rman_res_t); -static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); -static bus_dma_tag_t nexus_get_dma_tag(device_t dev, device_t child); +static device_probe_t nexus_probe; +static device_attach_t nexus_attach; + +static bus_add_child_t nexus_add_child; +static bus_print_child_t nexus_print_child; + +static bus_activate_resource_t nexus_activate_resource; +static bus_adjust_resource_t nexus_adjust_resource; +static bus_alloc_resource_t nexus_alloc_resource; +static bus_deactivate_resource_t nexus_deactivate_resource; +static bus_release_resource_t nexus_release_resource; + #ifdef SMP -static int nexus_bind_intr(device_t, device_t, struct resource *, int); +static bus_bind_intr_t nexus_bind_intr; #endif -static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, - enum intr_polarity pol); -static int nexus_describe_intr(device_t dev, device_t child, - struct resource *irq, void *cookie, const char *descr); -static int nexus_deactivate_resource(device_t, device_t, int, int, - struct resource *); -static int nexus_release_resource(device_t, device_t, int, int, - struct resource *); - -static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, - int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); -static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); +static bus_config_intr_t nexus_config_intr; +static bus_describe_intr_t nexus_describe_intr; +static bus_setup_intr_t nexus_setup_intr; +static bus_teardown_intr_t nexus_teardown_intr; + +static bus_get_bus_tag_t nexus_get_bus_tag; +static bus_get_dma_tag_t nexus_get_dma_tag; #ifdef FDT -static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, - int icells, pcell_t *intr); +static ofw_bus_map_intr_t nexus_ofw_map_intr; #endif /* @@ -123,27 +117,29 @@ static device_method_t nexus_methods[] = { /* Device interface */ DEVMETHOD(device_probe, nexus_probe), DEVMETHOD(device_attach, nexus_attach), + /* Bus interface */ - DEVMETHOD(bus_print_child, nexus_print_child), DEVMETHOD(bus_add_child, nexus_add_child), - DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), - DEVMETHOD(bus_activate_resource, nexus_activate_resource), + DEVMETHOD(bus_print_child, nexus_print_child), + DEVMETHOD(bus_activate_resource, nexus_activate_resource), DEVMETHOD(bus_adjust_resource, nexus_adjust_resource), - DEVMETHOD(bus_config_intr, nexus_config_intr), - DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), + DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), + DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), +#ifdef SMP + DEVMETHOD(bus_bind_intr, nexus_bind_intr), +#endif + DEVMETHOD(bus_config_intr, nexus_config_intr), + DEVMETHOD(bus_describe_intr, nexus_describe_intr), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), DEVMETHOD(bus_get_dma_tag, nexus_get_dma_tag), - DEVMETHOD(bus_describe_intr, nexus_describe_intr), -#ifdef SMP - DEVMETHOD(bus_bind_intr, nexus_bind_intr), -#endif #ifdef FDT + /* ofw_bus interface */ DEVMETHOD(ofw_bus_map_intr, nexus_ofw_map_intr), #endif - { 0, 0 } + DEVMETHOD_END }; static driver_t nexus_driver = { @@ -218,7 +214,6 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) child = device_add_child_ordered(bus, order, name, unit); - /* should we free this in nexus_child_detached? */ device_set_ivars(child, ndev); return (child); @@ -227,7 +222,6 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) /* * Allocate a resource on behalf of child. NB: child is usually going to be a * child of one of our descendants, not a direct child of nexus0. - * (Exceptions include footbridge.) */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, @@ -309,9 +303,9 @@ nexus_get_bus_tag(device_t bus __unused, device_t child __unused) { #ifdef FDT - return(fdtbus_bs_tag); + return (fdtbus_bs_tag); #else - return((void *)1); + return ((void *)1); #endif } @@ -319,7 +313,7 @@ static bus_dma_tag_t nexus_get_dma_tag(device_t dev, device_t child) { - return nexus_dma_tag; + return (nexus_dma_tag); } void @@ -348,7 +342,7 @@ nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, if ((rman_get_flags(res) & RF_SHAREABLE) == 0) flags |= INTR_EXCL; - return(intr_setup_irq(child, res, filt, intr, arg, flags, cookiep)); + return (intr_setup_irq(child, res, filt, intr, arg, flags, cookiep)); } static int