Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp269227rwr; Thu, 27 Apr 2023 00:39:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6L30v1m8OuemgcQ89aQvZ3YViSXmJzy94W31IrG9x2w13i5aXgYvjEWayD0n2Y7tQ6r+Px X-Received: by 2002:a17:90a:1912:b0:23b:4bce:97de with SMTP id 18-20020a17090a191200b0023b4bce97demr914155pjg.4.1682581198124; Thu, 27 Apr 2023 00:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682581198; cv=none; d=google.com; s=arc-20160816; b=qR7i6LaX6UExFHZhleTsAduWrPwFamxatfeSkPnN2LUDx7e+Cja/fAKheafRuvZdOA LDGsGdOk3+D9w94HiyLOL+BQED0T6kQQxHh8iEVOAld8tE1WwJsg9Al0/GY5H+pXUr95 LCz4PgvCmilaTw0eJLvJrZ/kvT2ZGGW4pujZdkzSkrNRBrMePIwK/0B04L8tmsqFX7aI 8WFeG0OhlYEzuVsb/nZ9OierHLLRLvv7BkTZlkK9111WVkY3p37ewvZnMkh3TbXj5Xpr Gi3ZVGl7YvnqUq6BDCn4GfjAMfohV5TH5/ECk2kitAzY52lWOwUGigeN2kOr/41DPj6P WcIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:in-reply-to :content-disposition:mime-version:references:message-id:subject:from :date:dkim-signature; bh=HJ3ETqPadb7zUTID7tP1U9AwKITVOi9X0oV/h6wnoSo=; b=fjWaq/n7xcExSsts+NM/po2IS+YMABVx1XEfnDSMZKdgK5YxBIVgrNxb+mBEE7RhvV lxSJNk321G21NP20ksExic0n1xEFWXagZdm9zTwUibbHIxBxfQI2woqLcPqQuu/p84za B1cxmZO+P4trMvv1Re5kcau1VdbrucywlqQXMpQZfgSYBSRJNbh1cCBL27QNcPa/Z7xY blW2U4MKaPQzaB+Hra552jypR6PlNUeXZPnt8eO842pCh0YBGAAKVobsyovywxZx125M RZIDIN5pJyyf6/akikrVaYqgMrEHGYN+kIH+26S9t1ntlKYCyRVnenaiEhDT1avocpQe McxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@equiv.tech header.s=org header.b=uptKegTm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=equiv.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a170902dace00b0019bf9b4b5f1si18989849plx.629.2023.04.27.00.39.44; Thu, 27 Apr 2023 00:39:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@equiv.tech header.s=org header.b=uptKegTm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=equiv.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239395AbjD0Hhs (ORCPT + 99 others); Thu, 27 Apr 2023 03:37:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243020AbjD0Hhr (ORCPT ); Thu, 27 Apr 2023 03:37:47 -0400 Received: from s.wrqvtbkv.outbound-mail.sendgrid.net (s.wrqvtbkv.outbound-mail.sendgrid.net [149.72.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 709F010CE for ; Thu, 27 Apr 2023 00:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=equiv.tech; h=from:subject:references:mime-version:content-type:in-reply-to:to:cc: content-transfer-encoding:cc:content-type:from:subject:to; s=org; bh=HJ3ETqPadb7zUTID7tP1U9AwKITVOi9X0oV/h6wnoSo=; b=uptKegTmRlxsYzrx+9oJn0Az6iDbGnsQiVZZ29fgprqKYWAgCFVPHnhiIiExFNk8l8N2 xSUzf8NzDMUv25leThxNllGV5iRAkl3+1NGauNep1rPfpJaRVM9PfVlXV8WeeyAofaZ6sS RKXcH3fZ8Js02sdGutBCLCuNhv7oJa9lI= Received: by filterdrecv-5848969764-pz6sb with SMTP id filterdrecv-5848969764-pz6sb-1-644A2648-6 2023-04-27 07:37:44.16317308 +0000 UTC m=+152153.380604064 Received: from localhost (unknown) by geopod-ismtpd-3 (SG) with ESMTP id Dj5W3I_3RIewIlJRj5gQrw Thu, 27 Apr 2023 07:37:43.976 +0000 (UTC) Date: Thu, 27 Apr 2023 07:37:44 +0000 (UTC) From: James Seo Subject: Re: [PATCH v3] hwmon: add HP WMI Sensors driver Message-ID: References: <20230424100459.41672-1-james@equiv.tech> <30339393-0ba2-9788-6ad8-98c89afc6994@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <30339393-0ba2-9788-6ad8-98c89afc6994@gmx.de> X-SG-EID: =?us-ascii?Q?1X41iaRO4wVP+tFXGLuxpQ0yxxMDhGIesR5UcsYKVengQKgidLJSXwOMZlPQwP?= =?us-ascii?Q?Ws8SOh1Mhvy+aML+f3d=2FS7ziskCfXzIzt9Z3SfQ?= =?us-ascii?Q?dtno+5xENtBaNbUdyeC0nzzETKiFnRLsLddkgG6?= =?us-ascii?Q?nHGIHM=2FkNY1=2FENI9=2FiMhHLxNtVtGZNS776WeRQE?= =?us-ascii?Q?cn3S7JoFAHmxU2NoMPXxDg7JQh4esq=2FvHRKA+9O?= =?us-ascii?Q?unPGpDo61aY9qXSxYL0oY=2Fe2pvgTFui4m71J6j?= To: Armin Wolf Cc: James Seo , Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org X-Entity-ID: Y+qgTyM7KJvXcwsg19bS4g== Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 26, 2023 at 09:35:33PM +0200, Armin Wolf wrote: > Am 26.04.23 um 15:16 schrieb James Seo: > >> On Mon, Apr 24, 2023 at 11:13:36PM +0200, Armin Wolf wrote: >>> Am 24.04.23 um 12:05 schrieb James Seo: >>> >>>> + for (i = 0; i < HP_WMI_MAX_INSTANCES; i++, pevents++) { >>> Hi, >>> >>> the WMI driver core already knows how many instances of a given WMI object are available. >>> Unfortunately, this information is currently unavailable to drivers. Would it be convenient >>> for you to access this information? I could try to implement such a function if needed. >>> >>>> + for (i = 0; i < HP_WMI_MAX_INSTANCES; i++, info++) { >>> Same as above. >>> >> Hello, >> >> Having the WMI object instance count wouldn't make much difference to >> me for now. The driver has to iterate through all instances during >> init anyway. If I were forced to accommodate 50+ sensors, I'd rewrite >> some things and I think I'd want such a function then, but I picked >> the current arbitrary limit of 32 because even that seems unlikely. >> >> So, maybe don't worry about it unless you want to. Or am I missing >> something? >> > Hi, > > i already have a experimental patch available which adds such a function. > If you could test this patch to see if it works, then i could submit it upstream > where other drivers could profit from being able to know the number of > WMI object instances. > Both your proposed functions worked as expected. > Your driver could also profit from such a function, as it could optimize the amount > of memory allocated to store WMI object data. I suppose I might as well. I assume I'm supposed to wait until your new functions are merged before making changes that rely on them? > The current instance discovery algorithm > (using a for-loop and break on error) also has a potential issue: when a single WMI call > fails for some reason (ACPI error, ...), all following WMI instances are being ignored. > This is the intended behavior for now, on the assumption that a real ACPI failure probably indicates that the system has bigger problems. I do have vague plans to make the driver more tolerant of failure to retrieve or validate instances, but haven't decided anything yet. Regards, James