From patchwork Sat Jul 22 17:25:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Seo X-Patchwork-Id: 13322989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F9DBC0015E for ; Sat, 22 Jul 2023 18:16:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229557AbjGVSQf (ORCPT ); Sat, 22 Jul 2023 14:16:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbjGVSQc (ORCPT ); Sat, 22 Jul 2023 14:16:32 -0400 Received: from rs227.mailgun.us (rs227.mailgun.us [209.61.151.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 737A41BB for ; Sat, 22 Jul 2023 11:16:30 -0700 (PDT) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=equiv.tech; q=dns/txt; s=mx; t=1690049789; x=1690056989; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Subject: Cc: To: To: From: From: Sender: Sender; bh=KTX5c2W9IC0se4k6UfvNshruBo0qc1MufVYnBdWH05Q=; b=lLFzIWw0nQLkUKZwVRv0AakQgFi6o91BfdmdkSXozSt9zP6o0j8Sq6I+5CXzc/s5xIKkIllljSPtUcEy8YRoLl4dCQLSc7QXZpSuYoqMpbYZ00cR7ZuQH1a8sO13AGc/UkV4Wh0pOJg5EhGHNsfF0sMVgOdpHYvrxkW2e6VQwlfFwFwxQeQWlYcge1AuJdJINPbIJyGh961PSBhOqO60B5gbPqEkQdtzrgG9qMFckbRajN2HbiMNDMoFbp+QEIUYfHtwdSFF/VBGJBmWz3sBrsO3PhKw1PMWtN5/MSI/j+yGv9bSt1LeiNYuVu4Z6TWAD3RyduOxnP3hg2ynr8AgRw== X-Mailgun-Sending-Ip: 209.61.151.227 X-Mailgun-Sid: WyJkOWUwNSIsImxpbnV4LWh3bW9uQHZnZXIua2VybmVsLm9yZyIsIjkzZDVhYiJd Received: from mail.equiv.tech (equiv.tech [142.93.28.83]) by 34081948f2f3 with SMTP id 64bc11259b55128dd86df009 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 22 Jul 2023 17:25:57 GMT Sender: james@equiv.tech From: James Seo To: Jean Delvare , Guenter Roeck Cc: James Seo , linux-hwmon@vger.kernel.org, platform-driver-x86@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] hwmon: hp-wmi-sensors: Get WMI instance count from WMI driver core Date: Sat, 22 Jul 2023 10:25:13 -0700 Message-Id: <20230722172513.9324-2-james@equiv.tech> In-Reply-To: <20230722172513.9324-1-james@equiv.tech> References: <20230722172513.9324-1-james@equiv.tech> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 2a2b13ae50cf ("platform/x86: wmi: Allow retrieving the number of WMI object instances") means we no longer need to find this ourselves. Signed-off-by: James Seo --- drivers/hwmon/hp-wmi-sensors.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c index ebe2fb513480..3a99cc5f44b2 100644 --- a/drivers/hwmon/hp-wmi-sensors.c +++ b/drivers/hwmon/hp-wmi-sensors.c @@ -435,25 +435,11 @@ static union acpi_object *hp_wmi_get_wobj(const char *guid, u8 instance) /* hp_wmi_wobj_instance_count - find count of WMI object instances */ static u8 hp_wmi_wobj_instance_count(const char *guid) { - u8 hi = HP_WMI_MAX_INSTANCES; - union acpi_object *wobj; - u8 lo = 0; - u8 mid; - - while (lo < hi) { - mid = (lo + hi) / 2; - - wobj = hp_wmi_get_wobj(guid, mid); - if (!wobj) { - hi = mid; - continue; - } + int count; - lo = mid + 1; - kfree(wobj); - } + count = wmi_instance_count(guid); - return lo; + return clamp(count, 0, (int)HP_WMI_MAX_INSTANCES); } static int check_wobj(const union acpi_object *wobj, From patchwork Sat Jul 22 17:25:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Seo X-Patchwork-Id: 13322984 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B1F6C001DE for ; Sat, 22 Jul 2023 17:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229861AbjGVRbQ (ORCPT ); Sat, 22 Jul 2023 13:31:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbjGVRbN (ORCPT ); Sat, 22 Jul 2023 13:31:13 -0400 X-Greylist: delayed 301 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 22 Jul 2023 10:31:11 PDT Received: from so254-32.mailgun.net (so254-32.mailgun.net [198.61.254.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F8171FD7 for ; Sat, 22 Jul 2023 10:31:11 -0700 (PDT) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=equiv.tech; q=dns/txt; s=mx; t=1690047070; x=1690054270; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Subject: Cc: To: To: From: From: Sender: Sender; bh=gBGdbi7zMsDc4jLtV1jMwsUxbQ0E089NfPCcUt+Wu1E=; b=Nyc5Ud47dz2emmmwJoKzbVFZ+ee022avYs0+M/2S5eoVUyuBSUTdrhJYRQyQJdNnfass/7aw9lRLcOPnNOQDu47tsE9aX7lzF3A92w1vHGW30XO+CwsEpshUwECW/CG4d/Cd3yDtKHeHwRVL13l2vyc0osZa7o3G2r3toAczzkZYKlARP8nfR66fv38bmzSWKzuw0Pvm3u6bZYHm4DIvJomrU9pMidXqRdf67Y0Vfebiv04fneOWj+5wppTmCACrDtKJCRgtVd/yd8eUgVkcGpaYFn9Hy75s0RnryVVHUE87jXwQuITiiOZxuUNdKKsUiqJQDJ83Ya9Y7bFvakqCFg== X-Mailgun-Sending-Ip: 198.61.254.32 X-Mailgun-Sid: WyJkOWUwNSIsImxpbnV4LWh3bW9uQHZnZXIua2VybmVsLm9yZyIsIjkzZDVhYiJd Received: from mail.equiv.tech (equiv.tech [142.93.28.83]) by 1b08b7c1fb5c with SMTP id 64bc11319b55128dd86e2553 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 22 Jul 2023 17:26:09 GMT Sender: james@equiv.tech From: James Seo To: Jean Delvare , Guenter Roeck Cc: James Seo , linux-hwmon@vger.kernel.org, platform-driver-x86@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] docs: hwmon: hp-wmi-sensors: Change document title Date: Sat, 22 Jul 2023 10:25:14 -0700 Message-Id: <20230722172513.9324-3-james@equiv.tech> In-Reply-To: <20230722172513.9324-1-james@equiv.tech> References: <20230722172513.9324-1-james@equiv.tech> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Change title to "Kernel driver hp-wmi-sensors" for consistency with most of the rest of Documentation/hwmon. --- Documentation/hwmon/hp-wmi-sensors.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/hwmon/hp-wmi-sensors.rst b/Documentation/hwmon/hp-wmi-sensors.rst index a6bca9aecdde..a611c6263074 100644 --- a/Documentation/hwmon/hp-wmi-sensors.rst +++ b/Documentation/hwmon/hp-wmi-sensors.rst @@ -2,9 +2,9 @@ .. include:: -=========================== -Linux HP WMI Sensors Driver -=========================== +============================ +Kernel driver hp-wmi-sensors +============================ :Copyright: |copy| 2023 James Seo