From nobody Fri Jul 4 14:07:17 2025 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 4bYb6t0c7Yz619c0; Fri, 04 Jul 2025 14:07:18 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bYb6s35cqz3gFm; Fri, 04 Jul 2025 14:07:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751638037; 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=eQ+6rCnFfXGHTgr2gjJcSzmlZ3dGwppS9JzKdd7Vp54=; b=eTEwdbuvtFIIVNptuqembEmWlz54+2pJKKgdDssQkCQZI9jKqoZYHx7E2WyGjDeZbyIN4m 5765qP6/AYy1eKUiTzF1CKG0taCL4sAaWAdbCVtB51LJfXneFRc+WOBccu/eo/B2buUVkW 3YTSPHbX3pivw7lDqu/1rQc/K7n6BT58232LqCWYKI8mjh/PIeItqYNfDQBgVO+r0LczSm dx0VzH4fH/wGYlftdDjGsQBVlp4yt727D1eea/MyYs1QyMk3Zp1CQET5Fi3PhyKqHtB/mS FK0WK8Muwnrsh4l2YIOFDt/aV5VmqQt77Kiei6I2PB6DqDbq2Oy7luRcZq6D5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751638037; 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=eQ+6rCnFfXGHTgr2gjJcSzmlZ3dGwppS9JzKdd7Vp54=; b=QXLX3f0Divc+RioLSOUKKNG6D8bKoIGWa2pHP6iNUw+zlVePVytLt4o6xjuNJJgbe9r7Rq fFSRw3cfrBqqie3XUm3zQ5pV1ysKdUrups3+Ub82R+4YxWviyyAkBnqbx/m6TrnYsh7mIo tPZXSC0F/WJhlKliMvjWlkAQNf958Be76coPqf2XnZCaHPMA8ermIgyPFiQBw91pk5iApn /lLeapK5mjt80aetWxFnkwA72ikFMEil+2rW7zgDYsIHIQQe2hb9j4mRyqYKhcpfl0SlBA eOso+bSqyNIumg1UcWakIL8EYSRchU+y2XGgA5Q9+Hu5acsum0HFsbDgEQVj1w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751638037; a=rsa-sha256; cv=none; b=XunxfzGql5sR6g2VReCSnwZb1/0v3u2ncIkDSp+InbqBRUvnKVKpjX+p9/u6R6/nWSCraP MA5puZI2DbvUqlUc8yVGNJ2Q+LCI4fR2rQDcjlIKnbNIpAqpEBxJ7L4SbF+N5OPr5qBu6z IxOZNenv6CBDddyH/Ag6pWLinLxr5Ah7ncpqXPITzYV6PtbtQTMI8Lrt/cyjVZeynfekfG mlGiyrCVKS6133w+cP3vgGZsJMkiLx2WbgJyZjzYkVRZO1S52ATmiHHghu96b7YeHaY7w3 QS+I0d/Lg7fQtuETFjGQjc9zWoe/crkR3wxSupm0OHiOAzeGmSGWTXV8yZi3sg== 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 4bYb6s2SJ4ztRT; Fri, 04 Jul 2025 14:07:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 564E7Heu080661; Fri, 4 Jul 2025 14:07:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 564E7Hgd080658; Fri, 4 Jul 2025 14:07:17 GMT (envelope-from git) Date: Fri, 4 Jul 2025 14:07:17 GMT Message-Id: <202507041407.564E7Hgd080658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ahmad Khalifa Subject: git: 2c356c8b8f79 - main - gpiobus: add a gpiobus_add_bus function 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c356c8b8f79c08d42b23a72b7a320b59d955a3f Auto-Submitted: auto-generated The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=2c356c8b8f79c08d42b23a72b7a320b59d955a3f commit 2c356c8b8f79c08d42b23a72b7a320b59d955a3f Author: Ahmad Khalifa AuthorDate: 2025-07-04 13:51:25 +0000 Commit: Ahmad Khalifa CommitDate: 2025-07-04 13:55:55 +0000 gpiobus: add a gpiobus_add_bus function Some drivers need to postpone the attachment of gpiobus until hardware init is done. Add a new gpiobus_add_bus function to accommodate this case. Suggested by: mmel, andrew Reviewed by: mmel, imp, andrew Approved by: imp (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D51133 --- sys/dev/gpio/gpiobus.c | 20 ++++++++++++++++++-- sys/dev/gpio/gpiobusvar.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index 2e2618805e7b..6b5379b6084a 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -293,7 +293,7 @@ gpiobus_print_pins(struct gpiobus_ivar *devi, struct sbuf *sb) } device_t -gpiobus_attach_bus(device_t dev) +gpiobus_add_bus(device_t dev) { device_t busdev; @@ -307,8 +307,24 @@ gpiobus_attach_bus(device_t dev) #ifdef FDT ofw_gpiobus_register_provider(dev); #endif - bus_attach_children(dev); + return (busdev); +} +/* + * Attach a gpiobus child. + * Note that the controller is expected + * to be fully initialized at this point. + */ +device_t +gpiobus_attach_bus(device_t dev) +{ + device_t busdev; + + busdev = gpiobus_add_bus(dev); + if (busdev == NULL) + return (NULL); + + bus_attach_children(dev); return (busdev); } diff --git a/sys/dev/gpio/gpiobusvar.h b/sys/dev/gpio/gpiobusvar.h index 74783e112f89..3ae0767466c9 100644 --- a/sys/dev/gpio/gpiobusvar.h +++ b/sys/dev/gpio/gpiobusvar.h @@ -172,6 +172,7 @@ struct resource *gpio_alloc_intr_resource(device_t consumer_dev, int *rid, * these should not be called directly by other drivers. */ int gpio_check_flags(uint32_t, uint32_t); +device_t gpiobus_add_bus(device_t); device_t gpiobus_attach_bus(device_t); int gpiobus_detach_bus(device_t); int gpiobus_attach(device_t);