Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1572363ybl; Tue, 3 Dec 2019 09:12:42 -0800 (PST) X-Google-Smtp-Source: APXvYqylND8Ge1i0KmL7SwuP2cFCRLTfdmWC7w/6TA8LjQ9C9pe9GgkJkTfG6YHmf8VBj/DrDuog X-Received: by 2002:a9d:66ca:: with SMTP id t10mr3905882otm.352.1575393162291; Tue, 03 Dec 2019 09:12:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575393162; cv=none; d=google.com; s=arc-20160816; b=JSYCU/u/4kCepQGcxePAvOWpsw2ROolQ1YRH9hTCWRFa2GJVVX3eqybW0ZI9g8rfXo 5MbcWDFa9caVD6JuLShzRlvs/oyqHQOlBecj1dNzLf0oEThxiCCfNyz0GYE9EtbOhYme SjIwio3w/dq0jSHm0ZxLmmxVT7C+jjGG1V/NKCvQ2DHX0iLv2zqpxAl+HCvkh8MAeSMV +q8sI5DQ2Y78YJRfvvW0MxkrKvgYUEP6wBeQ8luyX2S8ToVMlQOLgFshNjt7Vmd2iGXO e5UAdevSsw0QaM9gVr0PNfFQwdhQCKBTJ6qTJ//hGcUDrpjibckQuYK6+ycN/mgbnttk 5lqA== 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=RYPCalvxomeQV1CkDjlQpVsPcmQcNpZDg8Vkr5RNt0c=; b=KM8x/elJRq3svMVava+50IxUSj5/pupB+fkceosd3qynuUJ7cHQx3rwHIHhy0PVwyo pKQwc2CxCNF8UeLbmTCmwfOOLC8YNnXemxDDEiA3P7oS1ZJGcHAYl4fzt0RmIPuiGPD+ Z1Ai+w05ArNCZdLUoIHCj/v6Z/v0m0OenbcLnNoi+Lt1YK8VIoDrrD9dS8mOUWsXfqxx 8Nj2UFNI45JgfRFeTj3YRGkBr90XNzsx6Yj+spGkOTksKalJ0ZKMzKmO4f9e4iFq9vGy KmzfmihcA4inUhQsEFWna6lq8+okL2DeRpNtpM4gAk5gFKt+hWaVwvD/PoncPku15iQq jOKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@verdurent-com.20150623.gappssmtp.com header.s=20150623 header.b=bKdTNc7W; 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 z2si1588380oix.100.2019.12.03.09.12.30; Tue, 03 Dec 2019 09:12:42 -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=bKdTNc7W; 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 S1726822AbfLCRLh (ORCPT + 99 others); Tue, 3 Dec 2019 12:11:37 -0500 Received: from mail-ua1-f68.google.com ([209.85.222.68]:40875 "EHLO mail-ua1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726105AbfLCRLh (ORCPT ); Tue, 3 Dec 2019 12:11:37 -0500 Received: by mail-ua1-f68.google.com with SMTP id p18so1637529uar.7 for ; Tue, 03 Dec 2019 09:11:37 -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=RYPCalvxomeQV1CkDjlQpVsPcmQcNpZDg8Vkr5RNt0c=; b=bKdTNc7Wqr668+yrFz8j1YGhU16Y4rqLkEgT0+/N9W5hwVVczyND1CDzIb/zEmN4or 2bHP9QhjOYz6WfvJ+Uq2fWdbM7ZtOHw2di6BzZe4Hd7noLUUTwrNS9n5N4BWuadig+8l 8IQydC1LrLzd5Z2rsMXECRfDDPB0D6vVOUfgIHEk0wcVfqDTFM7plsDknpyigh+8gDEy mHsP9jSD2KGAjqoYOfz60YmYF1OfW3bOVYXq5maVMfSuI9HbTdjrpz58U+pL2m1Ny327 X189Fy9UqvQ4FfmsqPlqxJ9CR0a5L5cjOOiPOXObew+1plAdkEtsf9/4MLWcy9vXQvXh kX0g== 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=RYPCalvxomeQV1CkDjlQpVsPcmQcNpZDg8Vkr5RNt0c=; b=jiZ/xW4XJxb5n0XZ0uC4oEOlJxCgztqT3IPEcIdGqrNPs6mJbZ8tj3fD8o0PuV9z/T N0q1yJu+gWqk/E9awsZtFJZ3f8vdZ7z62TmB6Igvvxeobk07xun1BQ5brXgwI87nTFyV HIjiMQZbY0sTHIqUPnnn0ZGpXAfEQ8f+uZ6/fpIc6MEZJgVmumTLytlXkPCZL5yuUzQR daAa8yN5aqrCfiftXU1CgXoT5gbEfQ+k6UKnJBqapwpMiwi/aSOfSuqPSP87yf/tQXGJ M9Zt4RmWicXDVCz6La7v2Znpfn2AB+IqU9anzrf8YEhJZfiWZSIcw0hjf4ASjToJ3n2M qUDQ== X-Gm-Message-State: APjAAAWDZ6PqtmW9bdnK59yblMJbDnJf/KWpim4iiIzhuMgQwcVyx9j1 8SpCaL7vsL5qmWSq9ajcUNTlYWMiNQYJ5mtTiCKB5g== X-Received: by 2002:a9f:3f46:: with SMTP id i6mr3994929uaj.60.1575393096169; Tue, 03 Dec 2019 09:11:36 -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: From: Amit Kucheria Date: Tue, 3 Dec 2019 22:41:24 +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 Tue, Dec 3, 2019 at 10:34 PM Amit Kucheria wrote: > > 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. Just noticed you dropped this for v4. Nevermind. > > 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 > >