Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp201583pxy; Sat, 14 Aug 2021 04:48:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxt3nLNG7KEeZzXwpAwTOrugbii60zqz0ugyE1w4RRPNOG9DyOlYfER1U3B8i1pWoFSHj1/ X-Received: by 2002:a92:6901:: with SMTP id e1mr4812047ilc.70.1628941686425; Sat, 14 Aug 2021 04:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628941686; cv=none; d=google.com; s=arc-20160816; b=aV4kkbwhsvHPzLdiWmH4fApum7dREuyPBaA2s65ocDF81c+KjaSdcE/8yEyHlB3ZXa d6SV80Pu+Omc3CY1sK/ff9cOe6yPX006mC/3ftDi2l11DIy9ajr01j/bOPKF9Lntqj8X hY79uwRWEwVik3mc3DirxTLM765aZWhBPcSiVIRtoPbaFXUppaU0AhnWcMkiPJmKvPpC NmuArtnepY5V5nWr3+73YS/8gA9uFeX9pwQVS+ieyfdQSRKOH0SnqZl5oAKg0yiAJW7e y9emxOm5XhR7CGDxi9NBUfUBF7Cm2HZTwlbri41W+CHEBYsFX5hKk5iTStL9s5NzvQHj 4Jdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :cc:to:subject:from:date:dkim-signature; bh=QzUIRdaYTQ9jmi1Wxf/eLSw7zIX+FKz+RZjpUwwoIZY=; b=PryaBbufw/fDKV2VyWnk3WAbk7tk37OKhno9oWi7QQZSXVtpCmKFW4Svala77LBbWi R8rwKZiO4VlE9vrlbDYKM97F3cqgwkGTsA67iV0IGBCCQwXfKmrnzhXj9fHOcMj/cX8W gq3c//XS0E0CVJ69s6XSjEWur9djO7fvyjcoMi3gwOp2fISx51nmbwKALJ+qpSYMQ3kA NKgK5yXujnb9gTmZe/NVTiSlkd6UTG0vIG8SPgYDEcBIQ0IpAm5YSj4mdkoVE3VHkE0d rBQQ8Hv2xvOmdaL3X4JXT7OOXMJ2qma20mFbqGg8B+1+/vwMVg1TnmZg1S2h7SwXmvE9 XW5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=mbnrw8Gi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y15si4481621ioa.67.2021.08.14.04.47.55; Sat, 14 Aug 2021 04:48:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=mbnrw8Gi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238286AbhHNLqz (ORCPT + 99 others); Sat, 14 Aug 2021 07:46:55 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55939 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238185AbhHNLqx (ORCPT ); Sat, 14 Aug 2021 07:46:53 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 156C05C00E3; Sat, 14 Aug 2021 07:46:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sat, 14 Aug 2021 07:46:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=QzUIRd aYTQ9jmi1Wxf/eLSw7zIX+FKz+RZjpUwwoIZY=; b=mbnrw8GiRS19Go/KzCOsdQ eV13re8IxqaGsI+bAyAsaaUkIrfrhdikb+ZsJOv9Th3CspqsTE2GDAMhC47dSOQV +da40QCjXu/2QBLJyYlxCdPY3mCDU7E4OhQ/0CXZaEOT7N1iSOsIQYV4GU5FWzmO m0EJ1Sb0zgzH9e9r3DEVKDbaAd8t5CkJlOtW0eaRUaHWa9/wgYCjAV7qX4vinfyr +kvcukdUH5xL4VvqXEVnG/CYHmnDn8qLouSjUzvrO57cHnlh9IdcjWi7W2KfxTh+ cCRW8jmKlcPqNZ4EXLrIXJ6h+Rc1y3OpMnHr2kOKcWAQZ50UzbBQnPxn7T7+UpTg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkeejgdeghecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffuvffkjghfofggtgesthdtredtredtvdenucfhrhhomhepnfhukhgvucfl ohhnvghsuceolhhukhgvsehljhhonhgvshdruggvvheqnecuggftrfgrthhtvghrnhepgf effedufffhgfeuheegffffgeegveeifeeutefhieejffetudfgueevteehtdetnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhhukhgvsehljh honhgvshdruggvvh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 14 Aug 2021 07:46:20 -0400 (EDT) Date: Sat, 14 Aug 2021 23:46:06 +1200 From: Luke Jones Subject: Re: [PATCH v3 1/1] asus-wmi: Add support for platform_profile To: Andy Shevchenko Cc: Linux Kernel Mailing List , Hans de Goede , Bastien Nocera , Platform Driver Message-Id: In-Reply-To: References: <20210814043103.2535842-1-luke@ljones.dev> <20210814043103.2535842-2-luke@ljones.dev> X-Mailer: geary/40.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, thanks for the feedback. All is addressed, and some inline comment/reply. New version incoming pending pr_info() vs dev_info() On Sat, Aug 14 2021 at 12:40:39 +0300, Andy Shevchenko wrote: > On Sat, Aug 14, 2021 at 7:33 AM Luke D. Jones wrote: >> >> Add initial support for platform_profile where the support is >> based on availability of ASUS_THROTTLE_THERMAL_POLICY. >> >> Because throttle_thermal_policy is used by platform_profile and is >> writeable separately to platform_profile any userspace changes to >> throttle_thermal_policy need to notify platform_profile. >> >> In future throttle_thermal_policy sysfs should be removed so that >> only one method controls the laptop power profile. > > Some comments below. > > ... > >> + /* >> + * Ensure that platform_profile updates userspace with the >> change to ensure >> + * that platform_profile and throttle_thermal_policy_mode >> are in sync > > Missed period here and in other multi-line comments. > >> + */ > > ... > >> + /* All possible toggles like throttle_thermal_policy here */ >> + if (asus->throttle_thermal_policy_available) { >> + tp = asus->throttle_thermal_policy_mode; >> + } else { >> + return -1; >> + } >> + >> + if (tp < 0) >> + return tp; > > This will be better in a form > > if (!..._available) > return -ENODATA; // what -1 means? > I wasn't sure what the best return was here. On your suggestion I've changed to ENODATA > tp = ...; > if (tp < 0) > return tp; > > ... > >> + /* All possible toggles like throttle_thermal_policy here */ >> + if (!asus->throttle_thermal_policy_available) { >> + return -1; > > See above. > >> + } > > ... > >> + if (asus->throttle_thermal_policy_available) { >> + pr_info("Using throttle_thermal_policy for >> platform_profile support\n"); > > Why pr_*()? That seemed to be the convention? I see there is also dev_info(), so I've switched to that as it seems more appropriate. > >> + } else { >> + /* >> + * Not an error if a component platform_profile >> relies on is unavailable >> + * so early return, skipping the setup of >> platform_profile. >> + */ >> + return 0; > > Do it other way around, > > /* > * Comment > */ > if (!...) > return 0; Thanks, I think I was transliterating thought process to code as I went along. All updated now. > >> + } > > > -- > With Best Regards, > Andy Shevchenko