Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1564579ybl; Tue, 3 Dec 2019 09:06:05 -0800 (PST) X-Google-Smtp-Source: APXvYqxJ2NXOnl9OlbndZPmT13pIHgghHsT7FD+c+dwJvFEDk+p1I+QD/XlmjzzUXmt1qiJ8sCqS X-Received: by 2002:a05:6830:1bd5:: with SMTP id v21mr4157606ota.154.1575392765846; Tue, 03 Dec 2019 09:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575392765; cv=none; d=google.com; s=arc-20160816; b=cznmPgKadlnDPI++Lv7hQZCnB9YX24m1lNHSTz+RAFIRHKA6WS7nuLb+7ic5vrDFvN eWt6vo85j0NuWN8wdJA/3AROaEzjuWrt5HQLxiVLEH40aX1hig3FaoCO+OPQuDrCX3+e Y3DIN45q2IsOjdRxLsb4VKNTbKJMSZqQxt6sw1vlSZuz/OX8YGQU5171GUqcTZvV1+wf ImQ5upQT+UK7+zKjgxFIflARw6SShKDg/V9UK+9lMAEhcr5AqsHUFHHtuN8hu0fqcLa4 rgx3aJEheJO8F62beQA3uQbQZhXg8x/lUTWMoA7WPXCTLeIj0ttv2iJ2jYE7gQuBI9xz Wq3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=uKEl7qNFIi9X+QXW3XmiWYr6gtYvjeFPeIzark7e3Kc=; b=ETRLBM0pN4dmRXTHLdsWz7ePWjIEiY1gBoMwwS61mdJ0S8x75G+rC/DfeN5ifjdtmQ 0lZPKBW/yunZ7+du/MtG/CN6mH913m/3jKuwan2057eE4yR9zT6u9DA8duESvp7Du4Ip d0UD5pDYAIG55gILDzVkbVxNyiGhujhtCGRhOVxoVA+Gl1CtmCwyMAWighcBfuMsFHsO UZcVXVuPqr01mWKwOTLihKnVNAT9i6t33NW7jXe3L04sSEDR8VwMng3udMIpTRt/IuEg ZWr10x6OP7vB6by3zUEAKFpUSiHkNCa7lVYZI2ulNCzG/gJ843JCjkjqc/fGYol9ZbwS ALUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b=SjVDebo2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 25si1641110oij.75.2019.12.03.09.05.49; Tue, 03 Dec 2019 09:06:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b=SjVDebo2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbfLCREu (ORCPT + 99 others); Tue, 3 Dec 2019 12:04:50 -0500 Received: from mail-vk1-f196.google.com ([209.85.221.196]:37978 "EHLO mail-vk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726422AbfLCREu (ORCPT ); Tue, 3 Dec 2019 12:04:50 -0500 Received: by mail-vk1-f196.google.com with SMTP id m128so1279807vkb.5 for ; Tue, 03 Dec 2019 09:04:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verdurent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uKEl7qNFIi9X+QXW3XmiWYr6gtYvjeFPeIzark7e3Kc=; b=SjVDebo2l6qnq7mYoXHOBDv0TSRRFcvV4BhItzIdS86qcLi/YIVmYbcnMxfknlqYhD H52BgHICLzr/0f1O9mYTSo7jipwh5XdXG2e43ThUq/cg5K/QXemoWUoN1FeNo0mJ7jbH NbX3nBYGI//sD+fqG/anKzbDV+iTxAlPVbm/OMzcNs7NqScICyX16MbERmNKyg37k6b6 7ypUIEYiPBPmYNlPgSBSN0mANQvs4b+JZgWjrUVRSN7+oqZSY5Z+qmmnBgf8J0rGztgl odsRuDHvduZxdG4alX06JadsjaAZ0e6hbxAWq9Tu4Bv9CU0R7G1vkNXBxt4M9VDoyt+p O+Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uKEl7qNFIi9X+QXW3XmiWYr6gtYvjeFPeIzark7e3Kc=; b=CSKgWDcmf7ZRjXv3yvQU7rBr6Q2OlumhFbA7cgzCZ1sIoigMsK4WikPmkl4ppa+7Qx GKoYIUzKhk4z6ojknE/IblhXktAvO/JF4quZRso6iPquzFAZdNZy60+J0EcmmzShxmTl 9oRDyY0Jr88pi88pepRRXSv7ZMCvnKENwlgG7Ll3Ynz0nEyryIYBdcXiUice+wKi3Znx LJ5SUS1OMPFG11clLU/a8AeDX7Oin/MaKB8o9kUZsIpsKMnJprS3krO4dD7LhFGurkcK 7iw4+3u0MpA1voVjY4J8gaPxT4MU6Hxp5Sl+yAxNJ5LR5k0F0B0u+RgS9oJJh8hq0Lsj MVvw== X-Gm-Message-State: APjAAAXaTlf6ATq6JNQgixcW3XX0ojX+a7EGVlBSliUlCUpGaZgHoiyc d2S+ICU426X0WTj59mJi3/XHSYwAQO7LkjlSHjdW8A== X-Received: by 2002:ac5:c4f8:: with SMTP id b24mr3242890vkl.79.1575392688846; Tue, 03 Dec 2019 09:04:48 -0800 (PST) MIME-Version: 1.0 References: <1571254641-13626-1-git-send-email-thara.gopinath@linaro.org> <1571254641-13626-4-git-send-email-thara.gopinath@linaro.org> In-Reply-To: <1571254641-13626-4-git-send-email-thara.gopinath@linaro.org> From: Amit Kucheria Date: Tue, 3 Dec 2019 22:34:37 +0530 Message-ID: Subject: Re: [PATCH v3 3/7] thermal: core: Add late init hook to cooling device ops To: Thara Gopinath Cc: Eduardo Valentin , Zhang Rui , Ulf Hansson , Daniel Lezcano , Bjorn Andersson , Andy Gross , Mark Rutland , "Rafael J. Wysocki" , Linux PM list , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-arm-msm , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 17, 2019 at 1:07 AM Thara Gopinath wrote: > > Add a hook in thermal_cooling_device_ops to be called after > the cooling device has been initialized and registered > but before binding it to a thermal zone. > > In this patch series it is used to hook up a power domain > to the device pointer of cooling device. > > It can be used for any other relevant late initializations > of a cooling device as well. Please describe WHY this hook is needed. > Signed-off-by: Thara Gopinath > --- > drivers/thermal/thermal_core.c | 13 +++++++++++++ > include/linux/thermal.h | 1 + > 2 files changed, 14 insertions(+) > > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > index 886e8fa..c2ecb73 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -994,6 +994,19 @@ __thermal_cooling_device_register(struct device_node *np, > list_add(&cdev->node, &thermal_cdev_list); > mutex_unlock(&thermal_list_lock); > > + /* Call into cdev late initialization if defined */ > + if (cdev->ops->late_init) { > + result = cdev->ops->late_init(cdev); > + if (result) { > + ida_simple_remove(&thermal_cdev_ida, cdev->id); > + put_device(&cdev->device); > + mutex_lock(&thermal_list_lock); > + list_del(&cdev->node); > + mutex_unlock(&thermal_list_lock); > + return ERR_PTR(result); > + } > + } > + > /* Update binding information for 'this' new cdev */ > bind_cdev(cdev); > > diff --git a/include/linux/thermal.h b/include/linux/thermal.h > index e45659c..e94b3de 100644 > --- a/include/linux/thermal.h > +++ b/include/linux/thermal.h > @@ -125,6 +125,7 @@ struct thermal_cooling_device_ops { > struct thermal_zone_device *, unsigned long, u32 *); > int (*power2state)(struct thermal_cooling_device *, > struct thermal_zone_device *, u32, unsigned long *); > + int (*late_init)(struct thermal_cooling_device *); > }; > > struct thermal_cooling_device { > -- > 2.1.4 >