From nobody Sat Dec 28 18:53:25 2024 X-Original-To: acpi@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 4YLBMp1P8zz5j35c for ; Sat, 28 Dec 2024 18:53:26 +0000 (UTC) (envelope-from bugzilla-noreply@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 4YLBMn5gBCz4ynW for ; Sat, 28 Dec 2024 18:53:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735412005; 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: in-reply-to:in-reply-to:references:references; bh=M1mY2uvMuCUG8+GIaepYicD91K0ae+LVP+tKVwY/T1E=; b=OlH6cjHnPtKH/IX160vpguwGuu8fvsXAAJSxHIPsy303n51mDl8gnm/LxgRMTpZwTVIqVN apGVgc/W/MDoqMmOy4KVI1BGkQYaA9M3xO5rBswk6eZxfg2FHnWOhoVNJ2fAlKa+nSbW9D rQHhnK9tAzrISIpzxoQxOcCn8vOzoIcz4pPW5irbgSCi6bhexsjl6sWAntFjpQVepIawxC NJ7uCoXH2Pvitv/Hq/N/A46cYfatOYh9w7+CYdRWGx5LV3SmAEFmlsbbncgfTbQizvdc81 OlpMhMVDMFE56+Be8nLMU0JcXQOcncW2BKbqDpOxCr6kpFKwmVpNric0VmscfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1735412005; a=rsa-sha256; cv=none; b=nNeENE6BhKlVHPylt9OMn/xu/JFqo6LSE+g55H9a1kcZ9SLgF9Du3Z+iHBpiO4E4jg5LKI icMEpD+59p5mRGZsyf13lsgUdG+qvKTEGLFlHLNGzmN+uwhxEGgde2IRRg0gRtRZU4vTUS waJSVqYY963B8WYdhaQ5xvl/BY+QvXbbFirkot4gHJx1DRlyMOUeKRlIJyMZPB8aGQxlfd NkaDcYWccxLu7NMkwfu7P6YQW9rrMJ3dDUd7TJ+1h4dByMGZIXlcumTh1n4C2u02VUgaCl oZhNx6xLK1A7ftN38A+J223XG+kTp404rq+uhzR9YL4XBq9ZbEZVKkkuAtWWxw== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4YLBMn4xN3zbj9 for ; Sat, 28 Dec 2024 18:53:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 4BSIrPNO043229 for ; Sat, 28 Dec 2024 18:53:25 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 4BSIrPbl043228 for acpi@FreeBSD.org; Sat, 28 Dec 2024 18:53:25 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: acpi@FreeBSD.org Subject: [Bug 283683] [PATCH] dev/acpica/acpi_cmbat.c: Add battery trip point (_BTP) Date: Sat, 28 Dec 2024 18:53:25 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 15.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: imp@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: imp@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cc assigned_to Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: ACPI and power management development List-Archive: https://lists.freebsd.org/archives/freebsd-acpi List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-acpi@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D283683 Warner Losh changed: What |Removed |Added ---------------------------------------------------------------------------- Status|New |Open CC| |imp@FreeBSD.org Assignee|acpi@FreeBSD.org |imp@FreeBSD.org --- Comment #1 from Warner Losh --- So there's a number of problems with the attached patch, though I think they are all style(9) issues: No space between if and ( in a few places. + if(ACPI_SUCCESS(acpi_GetHandleInScope(acpi_get_handle(dev), "_BTP", &tmp))) + { + sc->btp_warning_level =3D ACPI_BATTERY_BTP_WARNING_LEVEL; +=20=20=20=20=20=20=20 + struct sysctl_oid *cmbat_oid =3D device_get_sysctl_tree(dev= ); + SYSCTL_ADD_PROC(NULL, SYSCTL_CHILDREN(cmbat_oid), OID_AUTO, + "warning_level", CTLTYPE_INT | CTLFLAG_RW, dev, 0, + acpi_cmbat_btp_sysctl, "I" ,"battery warning level"); + } So here the struct sysctl_oid line should be the first line of this, with a blank line after it before the rest. Also the { for this should be at the end of the if line (which is one examp= le of the if complaint above) Also, the continuation of the SYSCTL_ADD_PROC macro should be indented by 4 spaces. + if(req->newptr && acpi_BatteryIsPresent(dev)) { + /* Write request. */ + + SYSCTL_IN(req, &sc->btp_warning_level, sizeof(sc->btp_warning_level)); +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 + /* Correct bogus writes. */ + if(sc->btp_warning_level < 0 || sc->btp_warning_level > 100) + sc->btp_warning_level =3D ACPI_BATTERY_BTP_WARNING_= LEVEL; +=20=20=20=20=20=20=20 + /* Call _BTP method */ + newtp =3D sc->bix.lfcap * sc->btp_warning_level / 100; + as =3D acpi_SetInteger(acpi_get_handle(dev), "_BTP", (uint3= 2_t) newtp); +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 + /* Error checking. */ + if (ACPI_FAILURE(as)) { + ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), + "error setting _BTP --%s\n", AcpiFormatException(as= )); + sc->btp_warning_level =3D 0; + } + } + + else if(req->newptr) /* Write request w/o battery. */ + sc->btp_warning_level =3D 0; + + else /* Read request. */ + SYSCTL_OUT(req, &sc->btp_warning_level, sizeof(sc->btp_warning_level)); + (same if complaints) The last two clauses in the if else chain should have { } around them. The /* Write request. */ comment should be indented one more tab I think that the error case should cause a return of EINVAL instead of 0 wh= en the ACPI call fails. +} \ No newline at end of file The file needs to end in a newline Would you be able to correct these issues with the patch? --=20 You are receiving this mail because: You are the assignee for the bug.=