From nobody Tue Oct 15 11:01:17 2024 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 4XSWPB0KbGz5YlSC; Tue, 15 Oct 2024 11:01: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XSWP95SBNz4X9W; Tue, 15 Oct 2024 11:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728990077; 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=M8Yk518vrXUtuqXn7KOPQBMLiJA+tblBnaHoEqDI/x0=; b=pkwKBAX7i6GDlvlVdB4yv7GeLKq8PPfE7gn7qdtT/ZT2zM9jQVRoeSJuKDa3A2VwnndGIJ jCY1hTYhga1r+buoS4XWieeL3IhQYEQZsvIUwxWJ49PaCcKx/l9bPkgfWL/VAnNlFMCvwY l8spkACOaBsAImvbevWkVnEm3lv+1ROTyAyWNpCekk4OcmoCzDiI1D91LdCIlB5V55vEiT M31G0NUi6VO/eDctIgc3mrXmFakoCDZNRyXkod3YRLvVV9ZEn2FsH7SWaJPnSkn688o8UY g/cKcIMiwOikFQpcNOI51kRwM5LCPBVc5jt5FEMVrBoQs/lfwaW2aksCUaseIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728990077; 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=M8Yk518vrXUtuqXn7KOPQBMLiJA+tblBnaHoEqDI/x0=; b=TrDaqm3if23iA6HgQQqePLrZoWO6ppRMiAVE0m1zgEnMjkopvMRubQA4JLTXuN7YFnnBcL yHRdL/nFj5HOjg7VSzCm3iVRArF+JpU01W+3UWZ3zjw1etc0G25Kpe5EehVGOVFjdF1OS9 HCDxWbQOJwnryeOiykGbTyyXdYoHqprT+UzhhVecvcW6B256+QwNOBXQHtPEshHEaWJbuy BSa0rR0M+vRTtERVb25gaBhmL/ytHsNXyPn87EZbTXnGV8RZDxCiPgsd4RHkoL4cp0G7M8 FFcBATBlOH1ElcrE+hc/70kuvVSMbHUgL1vwdmM5BM4kJPjgsgUDNZZS6KKPQw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728990077; a=rsa-sha256; cv=none; b=YRHk0MzQdYXdZRnopbSeduWhB97w2ecTZF1IkEbLzLX6ZQZ1K5B7vfvzUMNYwg0fPVP2lI 4AUgt9Bcm44BEqzkYEyVC+MpB1jwhDciaPG3ridsKvjqSW12EnxSsH+aC3f5yz0qeyj9CY un8blFG2shYhg13C/8Bc/vZHdqR96aWcMSqagmZn8nfjn58OC/U4IR6MoXNGJzvrRWv9ho er7xFnhV+cSg3aPpNLLqyiy0OZ9OsEJrGxPqJwLaW5DnDV6FFEMuLL+ShlESEwpBw52VNe KiRrcMERJmsktbIoIDjhlyt5xFGjBNS1q/eJU01uBJoQ7s9O2HntSRaqBYnnww== 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 4XSWP954FfzJnY; Tue, 15 Oct 2024 11:01: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 49FB1HRj077424; Tue, 15 Oct 2024 11:01:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FB1HA5077421; Tue, 15 Oct 2024 11:01:17 GMT (envelope-from git) Date: Tue, 15 Oct 2024 11:01:17 GMT Message-Id: <202410151101.49FB1HA5077421@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 76bfa33f2598 - main - uart: Go back to returning '0' when we've probed the device. 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76bfa33f259891a8b9108e20141bd18e2c8d312f Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=76bfa33f259891a8b9108e20141bd18e2c8d312f commit 76bfa33f259891a8b9108e20141bd18e2c8d312f Author: Warner Losh AuthorDate: 2024-10-15 10:59:29 +0000 Commit: Warner Losh CommitDate: 2024-10-15 10:59:29 +0000 uart: Go back to returning '0' when we've probed the device. Two reasons for this: we know it's a uart after we call probe and it returns successfully. Second, uart passes data between probe and attach with softc. As it is now, we call probe twice, once in the bidding process and once after bidding id done. However, the probe process for uart isn't completely idempotent (we change state of the uart sometimes). The second call can result in odd behavior (though so far only in buggy version of other code I've not committed). The bigger problem is the softc: newbus creates it, we populate it, then frees it when we don't return 0 to claim the device. It then calls us again, we repopulate it, and this time it doesn't free it before calling attach. Returning 0 avoids both of these issues. The justification for doing it in the commit that changed it was 'while I'm here', so there doesn't seem to be a use case for it. Sponsored by: Netflix Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D47095 --- sys/dev/uart/uart_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c index d0c4a54c8038..e608d6c95ead 100644 --- a/sys/dev/uart/uart_core.c +++ b/sys/dev/uart/uart_core.c @@ -571,7 +571,7 @@ uart_bus_probe(device_t dev, int regshft, int regiowidth, int rclk, int rid, int error = UART_PROBE(sc); bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres); - return ((error) ? error : BUS_PROBE_DEFAULT); + return ((error) ? error : 0); } int