From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 71E01C433E3 for ; Thu, 27 Aug 2020 06:26:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F68D2177B for ; Thu, 27 Aug 2020 06:26:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="c7RsnWL2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726882AbgH0G0v (ORCPT ); Thu, 27 Aug 2020 02:26:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726199AbgH0G0u (ORCPT ); Thu, 27 Aug 2020 02:26:50 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A346C06125E for ; Wed, 26 Aug 2020 23:26:50 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id p37so2625039pgl.3 for ; Wed, 26 Aug 2020 23:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YNHyAuR7GB3EfiCouUkXKnHb9Hzrnqg6mjMpHBgNiO8=; b=c7RsnWL2XAhTx7DSd2Pafooc6DvgnJ2jSwpvJHQhuxQ+30JZQ3lZ7R78LrzdmkmoZ+ mgtyt4+05RvlXNm5faEyrtJe7n7P9B1VYa4sch/ht6IAYDMogrykF50nGFbl3gh7u609 5Z9tasKQ2aj1JEgOWF1l/5PMrvg1rgN7Ni4sVw/YWReBzYqLGCiXiALOZV9BmD4WWLKC /KQHUX8o+J+DhwCWNku/hJ/FB09sGWIaTIzrTLEba18Dqpt+Lvc74/DaJIeL3Cx8Mom5 pdHIm5ykyAdQjQ6LEKBd24/g3QdjVRa/E5itZi6+Nnmz4EMpTXiZv3aJmzE049xltd8z YUCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YNHyAuR7GB3EfiCouUkXKnHb9Hzrnqg6mjMpHBgNiO8=; b=VraveXXQf6LDar0l76wAlQwKNxeCm98zfHEDwf8cYvuz6aQU0f2UOGMiE+cl+SiP4I ispO54WTrtEAMhQugm76/a0XJR2ThDE9x52GXunJ7MW4/z8lVMwF1eImaFmgxSTnOIER 2ct2epH6Gzy++dxtvGAuIvo9bmFubGwS4MKmbQWs6ert7PQZoaF7f4MqpWGV5oaDGja3 7Gw8hT9mVP0h9oxi55bFDOxFCMS7T9sMMqoxbefsSLTZ3TJOMlgYIs/j9YQxps9Rt/rv ztTiF1X4TQh38ph9ASGpeDoZLhU0qbAJ4Lae3x704ge1oxRUhn+QHP94GzdzWIpMjcc/ WF8g== X-Gm-Message-State: AOAM533eD6NnTYY4zPaxlHFA4hQuYAhURwUAcms7jo2uDvf6JB+UeCJG KNg8CwxRoWUeOxiopJxAk0Lh+g== X-Google-Smtp-Source: ABdhPJy6oNZf/4jPilo5d2a1xo9dBeE04Aa29ksfbQDk9Sq8XqX5IklGaZ3ChV7cRwosSpvmM3Ue1w== X-Received: by 2002:a62:a10f:: with SMTP id b15mr15494230pff.253.1598509609722; Wed, 26 Aug 2020 23:26:49 -0700 (PDT) Received: from localhost ([122.167.135.199]) by smtp.gmail.com with ESMTPSA id z1sm1322747pff.178.2020.08.26.23.26.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2020 23:26:48 -0700 (PDT) Date: Thu, 27 Aug 2020 11:56:46 +0530 From: Viresh Kumar To: Yue Hu Cc: rafael.j.wysocki@intel.com, Daniel Lezcano , rui.zhang@intel.com, amit.kucheria@verdurent.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, huyue2@yulong.com, zbestahu@163.com Subject: Re: [PATCH] thermal: sysfs: fall back to vzalloc for cooling device's statistics Message-ID: <20200827062646.adruzyyqq5uzlteq@vireshk-i7> References: <20200818063005.13828-1-zbestahu@gmail.com> <40b69f97-46e5-d62e-0d2f-604dfd4dafa1@linaro.org> <20200826101319.00003048.zbestahu@gmail.com> <20200827120327.00003740.zbestahu@gmail.com> <20200827051401.yryitpgq2gi3nkbh@vireshk-i7> <20200827142003.000071c1.zbestahu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200827142003.000071c1.zbestahu@gmail.com> User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27-08-20, 14:20, Yue Hu wrote: > Currenly, drivers/video/backlight does not call thermal_of_cooling_device_register() > to register thermal cooling device. The issue happened in msm-4.19 kernel for > QCOM/Android platform. Backlight in msm-4.19 kernel will register thermal cooling > device as below: > > +static int bd_cdev_get_max_brightness(struct thermal_cooling_device *cdev, > + unsigned long *state) > +{ > + struct backlight_device *bd = (struct backlight_device *)cdev->devdata; > + > + *state = bd->props.max_brightness; > + > + return 0; > +} > > > +static struct thermal_cooling_device_ops bd_cdev_ops = { > + .get_max_state = bd_cdev_get_max_brightness, > > +static void backlight_cdev_register(struct device *parent, > + struct backlight_device *bd) > +{ > + if (of_find_property(parent->of_node, "#cooling-cells", NULL)) { > + bd->cdev = thermal_of_cooling_device_register(parent->of_node, > + (char *)dev_name(&bd->dev), bd, &bd_cdev_ops); > > And the bd->props.max_brightness is getting from video/backlight/qcom-wled.c. Maybe > the driver should not assign 1024 to states/max_brightness. I'm not sure about it. > So i consider to change memory allocation methord. That's the origin of the patch. Thanks for the details. So this is not about upstream tree, as a rule we aren't going to make changes here for any downstream tree. Now coming back to the downstream driver, I also don't see a point in returning bd->props.max_brightness as the max number of states there. Maybe have 10 states, each occupying bd->props.max_brightness/10 brightness and so you will end up with 10 states only. But yeah, whatever downstream decides on that. -- viresh