From nobody Thu Mar 02 15:27:47 2023 X-Original-To: dev-commits-src-all@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 4PSFNM3n9wz3vwTT; Thu, 2 Mar 2023 15:27:47 +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 4PSFNM3DWKz4PBM; Thu, 2 Mar 2023 15:27:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677770867; 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=pRScWnv/2ppEWjrLP8quWrKzvdyQXgqYYt+OD/7uAC8=; b=KafqPfdu1VCCO4NuWG0n0jDab+TlCFdn1hjtbuQZeco6xeCDqKxvcJFjKjkPsasEiNC0zc YIQXPg5r4xP4aaWOH1J6HQGozCcM9uzFI7oXmtCXvTbpqmS8rghjgsixp98PSpGxoaouAC epKWxdZxyTfVecHLhbVuE5Mlv3ZmD4fsmV3Fo15MeQ9BT5Wl64HA/V0kfJaBF45yzW6+eD YGMXSRnOgQYC/NdZniXdC9Xlrmt/hR7XbKd9mPxEvStV8BbBPRwj24swvwftXaWnhWC4Sh 2/9c4dR54oZUyiZjW+qeQ7ypnnDGg3XSNJBdLp+wmxNVF150Ov0buV/Wxarx+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677770867; 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=pRScWnv/2ppEWjrLP8quWrKzvdyQXgqYYt+OD/7uAC8=; b=Vgpp6tg3zBMXSzMN6G6DaNV5CxnJ7pksODir+PKOhf3/cpefZGDbVZxQauy0CaiA8HtswT ZnJpKEg0lyjk12T4+VhE7xlL59LpjG4XkzFIz4iF+cjbjZNrwrl57YC8EyrfKQckocDga8 QzqODtJYjSwY3eiEQvntmz5MdD0PV5ViXW1/gRlSPYU9yM12B0oh9sQljl79Fo4ZQ09lao HLjiJfx92Qmk+RiROn6ys1BqFWSqtmCf+qp1/l7Pahavo6t6Bm7pbf4Czy7oQ1NIkl6EFs 5YcqGZoBskpxuz/9Dyjw0s19EzV7iK/0tFMUHtas0Aglu5QTsTYh5wuOy/oOGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677770867; a=rsa-sha256; cv=none; b=U22f7G85UQ0Q3y3FdwZmV4gQ4lUuBT/wBCNyW577bF7tM8zx5lA15J5F1JwFv+0whFBJG7 Ldnifj/mcMjeJIDZY0w/A58+39WvMvotDjzlhVAn59pQ3wau+OlBzy1kzhfZFUTTEIat/K +o6lf5XWpbWOu+slyrvOpKWp7eahKNG1ifujitiJADZRcgwvosWATYwuLoC/pT99iWGDgl Qkx4d1CNE0SqKO3nXvg48BOOyjHHRMYvBATsVyhggzC4gbcZZL35gX0r/rDHj8vxF4iU9E hz+8yzocmuu3ob7R0kk7Nldg7dORuVPaKsVs2GdToaUhIhu3qu0kRKmU3aX04g== 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 4PSFNM2GpdzLZB; Thu, 2 Mar 2023 15:27:47 +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 322FRlct054644; Thu, 2 Mar 2023 15:27:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 322FRl5J054643; Thu, 2 Mar 2023 15:27:47 GMT (envelope-from git) Date: Thu, 2 Mar 2023 15:27:47 GMT Message-Id: <202303021527.322FRl5J054643@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: 2c1b8eb29d92 - main - ftgpio: Fix panic at attach and use better device description List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 2c1b8eb29d92d0911e7493c6a16be04ff6064ad1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2c1b8eb29d92d0911e7493c6a16be04ff6064ad1 commit 2c1b8eb29d92d0911e7493c6a16be04ff6064ad1 Author: Stéphane Rochoy AuthorDate: 2023-03-02 15:16:35 +0000 Commit: Warner Losh CommitDate: 2023-03-02 15:17:04 +0000 ftgpio: Fix panic at attach and use better device description Use ftgpio_group_get_status instead of inlining an imperfect version of it to get correct register and avoid panic: ftgpio_group_get_ioreg: invalid register 0 for group 0 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/677 --- sys/dev/ftgpio/ftgpio.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sys/dev/ftgpio/ftgpio.c b/sys/dev/ftgpio/ftgpio.c index 874f6e832949..7acfdd5b900e 100644 --- a/sys/dev/ftgpio/ftgpio.c +++ b/sys/dev/ftgpio/ftgpio.c @@ -103,7 +103,7 @@ struct ftgpio_device { } ftgpio_devices[] = { { .devid = 0x0704, - .descr = "GPIO Controller on Fintek Super I/O", + .descr = "Fintek F81865", }, }; @@ -289,18 +289,12 @@ static bool ftgpio_pin_is_output(struct ftgpio_softc *sc, uint32_t pin_num) { unsigned group, index; - uint8_t group_io, ioreg; bool is_output; index = FTGPIO_PIN_GETINDEX(pin_num); group = FTGPIO_PIN_GETGROUP(pin_num); - ioreg = ftgpio_group_get_ioreg(sc, REG_OUTPUT_ENABLE, group); - group_io = superio_read(sc->dev, ioreg); - FTGPIO_VERBOSE_PRINTF(sc->dev, "group GPIO%u io is 0x%x (ioreg=0x%x)\n", - group, group_io, ioreg); - - is_output = group_io & (1 << index); + is_output = ftgpio_group_get_status(sc, group) & (1 << index); FTGPIO_VERBOSE_PRINTF(sc->dev, "pin %u io is %s\n", pin_num, group, index, (is_output ? "output" : "input")); return (is_output);