Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp215406pxa; Wed, 26 Aug 2020 23:28:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6pJBMrcxXQcG0/J/Dgq/8Kx52TyzNM4hINdICvRrb3HPgM8gbwt71BxQzyYfsGPd7MziX X-Received: by 2002:a17:906:6895:: with SMTP id n21mr20550566ejr.155.1598509680688; Wed, 26 Aug 2020 23:28:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598509680; cv=none; d=google.com; s=arc-20160816; b=sTWhuVHZTlPd87ve91VuSWM12HwL+b7xERF5n8vWuhR26c0fmg0ug8dKseq8/MLcs7 /BTkWa3bMmH3HfehjTJk5JjIYQzUas6SA0dA7fmRezTc5oZW7qr2jCchHsJ9W0Ezv6Pg YfRPGOIs4TJO2lDtyEXA2m67YI302w7lpWVCuwhIjstJ+MeTJqbbcYTr3fveidRRykRE ogd+ktXQkPPWkN/dmxvfS05k2awcxw3phc3CzacdYsR55v7P5bPJrPUsAHncJhqcXDDs 0rGXeRZOhqW4nBob9Gk8d7ESPTACf2Jb3m/gchmIlq93vHr//wR+Tkc7XDfYhmTQNP0+ WTUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YNHyAuR7GB3EfiCouUkXKnHb9Hzrnqg6mjMpHBgNiO8=; b=nziE5GJYdrEGJDZL+QYpm7ocpk5FpyvSlK6PQJIxRXUQWK6KYO0ynoyep7gkRxI7Wj XqZSCgM5L7daWhU51byIMKWGd3COrWY8MCKx0ViVZbqs+7vNnlAM+axJmVB3dXaum+Zd gtEWaonShAJNcvOmGvV//BOPzRrBNo+dvH21y0xsg0BCe6fFJgm4PNJuKdrErXlhPGIE 2QvwalXfczd9G8CbgGn0e0ydLua4hgh5KlNBzdZjhyVR6APgzt8JO2v1z3wDG3p/h0xz ummE99Ztz8Kor90Y0W2ukD4j1QV+msJqrZkYGFACx4W0ig3ECtXoJzVW7dQWnLvy19nZ TPkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c7RsnWL2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o17si731080ejg.21.2020.08.26.23.27.37; Wed, 26 Aug 2020 23:28:00 -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=@linaro.org header.s=google header.b=c7RsnWL2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726395AbgH0G0v (ORCPT + 99 others); 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-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