Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1D91C2D0EA for ; Wed, 8 Apr 2020 09:45:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7DFF02074F for ; Wed, 8 Apr 2020 09:45:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726734AbgDHJpV (ORCPT ); Wed, 8 Apr 2020 05:45:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:53020 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbgDHJpV (ORCPT ); Wed, 8 Apr 2020 05:45:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 09C75AE07; Wed, 8 Apr 2020 09:45:20 +0000 (UTC) Date: Wed, 08 Apr 2020 11:45:20 +0200 Message-ID: From: Takashi Iwai To: Zhang Rui Cc: linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, viresh.kumar@linaro.org Subject: Re: [RFC PATCH 3/5] thermal: support statistics table resizing at runtime In-Reply-To: <20200408041917.2329-3-rui.zhang@intel.com> References: <20200408041917.2329-1-rui.zhang@intel.com> <20200408041917.2329-3-rui.zhang@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On Wed, 08 Apr 2020 06:19:15 +0200, Zhang Rui wrote: > > Introduce thermal_cdev_stats_update_max() which can be used to update > the cooling device statistics table when maximum cooling state of a > cooling device is changed. > > Signed-off-by: Zhang Rui Just a couple of small nitpicking: > @@ -787,6 +791,23 @@ void thermal_cdev_stats_update_cur(struct thermal_cooling_device *cdev, > spin_unlock(&stats->lock); > } > > +void thermal_cdev_stats_update_max(struct thermal_cooling_device *cdev) > +{ > + struct cooling_dev_stats *stats = cdev->stats; > + unsigned long cur_state, max_state; > + > + if (!stats) > + return; > + > + if (cdev->ops->get_max_state(cdev, &max_state)) > + return; > + > + if (cdev->ops->get_cur_state(cdev, &cur_state)) > + return; > + > + cooling_device_stats_resize(cdev, cur_state, max_state); > +} Don't we need to export this? > @@ -946,7 +975,15 @@ static void cooling_device_stats_setup(struct thermal_cooling_device *cdev) > cdev->stats = stats; > spin_lock_init(&stats->lock); > > - ret = cooling_device_stats_resize(cdev); > + ret = cdev->ops->get_max_state(cdev, &max_state); > + if (ret) > + return; > + > + /** > + * cooling device current state will be updated soon > + * during registration > + **/ This comment style is confusing as if a kernel-doc. thanks, Takashi