From patchwork Wed Mar 29 16:34:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 9651939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0EFDA60113 for ; Wed, 29 Mar 2017 16:35:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 016E0284F2 for ; Wed, 29 Mar 2017 16:35:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA073284F9; Wed, 29 Mar 2017 16:34:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71F8A284F2 for ; Wed, 29 Mar 2017 16:34:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754194AbdC2Qe7 (ORCPT ); Wed, 29 Mar 2017 12:34:59 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:34059 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752869AbdC2Qe6 (ORCPT ); Wed, 29 Mar 2017 12:34:58 -0400 Received: by mail-wr0-f196.google.com with SMTP id w43so4498496wrb.1; Wed, 29 Mar 2017 09:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WEDFIrbYHNGtPEYK9hooAz9XSIrOGeezL6OcYOGZkk8=; b=tmjDjQgh+1cVHW5kRRKqHDX3h9oRFFxHiVSd8ugcpCZOE7Q5v1IHKxk7C8ixYQxCUq I0zuartOMOwdZ7/kbFFx22IaWrL5mu0RrVPtixXpLqD0j2pm0bv+NJ0TgKyVOUPLPJvG 5lp/slBPHnQSy3GExlAuWmjZ0uXg4eCqUdy6sWwvl5Kmd5f0HiITKxg22cjDk8JrPk/u fE1Mojq19PjUoV9Q4bcXSRr5v8JUZqAbi7Q829gstBTeJt51GpNZPdUuR33lMX2OdV7R N7QJNiciUgKWAYgdYPnyrq3seRYO8TtNv3ZHUl0rnpZJgCoUbNdV6lm937imVzL8ZWvF ZjKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WEDFIrbYHNGtPEYK9hooAz9XSIrOGeezL6OcYOGZkk8=; b=njDjiMAMalp/UxovBLO6v7egWFfsM9B1KZjxESxSd1xnBSfhMjNidv9fOcWdrSC169 rWhLQDoaeCH/4kuGSItyuW8io5obKYG2Cm1tHCf6byjGe5zMj9CH8RH3S3VYNZ6ClPKQ qm0yt8iWXy7GoaIOGB9LQ/rH7f6lm40PEXPWIS96pYqOySpgpRjKCPb+IeXEeY7tB0rM q+8FzPk3/IRTAd3h1WW8jgdEQl0IbRr6p2bMqQSfS/SeWVBWir7ZNWrlzmIaxNGq2K7E eDFYlYFgnfm/maHZE1vYYI/C5hJ8uxG9crRRlDDc9cSkzhCoIuZUnuTQMEPw8OiQ2X/3 imoQ== X-Gm-Message-State: AFeK/H2N8z6Oml6ytIuZ1tIFGx3SQ3YgIdc7/AchvQ+nk/evU5Anq7d1t+IjZD0rKUNxLg== X-Received: by 10.223.130.183 with SMTP id 52mr1321855wrc.177.1490805295846; Wed, 29 Mar 2017 09:34:55 -0700 (PDT) Received: from localhost (port-8454.pppoe.wtnet.de. [84.46.33.39]) by smtp.gmail.com with ESMTPSA id v186sm8766870wmv.2.2017.03.29.09.34.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Mar 2017 09:34:55 -0700 (PDT) From: Thierry Reding To: "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson Cc: Jonathan Hunter , Stefan Kristiansson , Mikko Perttunen , linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 1/3] PM / Domains: Allow overriding the ->xlate() callback Date: Wed, 29 Mar 2017 18:34:50 +0200 Message-Id: <20170329163452.10761-2-thierry.reding@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170329163452.10761-1-thierry.reding@gmail.com> References: <20170329163452.10761-1-thierry.reding@gmail.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding Allow generic power domain providers to override the ->xlate() callback in case the default genpd_xlate_onecell() translation callback is not good enough. One potential use-case for this is to allow generic power domains to be specified by an ID rather than an index. Signed-off-by: Thierry Reding Acked-by: Ulf Hansson --- drivers/base/power/domain.c | 8 ++++---- include/linux/pm_domain.h | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index e697dec9d25b..c102557f6c7e 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1570,9 +1570,6 @@ EXPORT_SYMBOL_GPL(pm_genpd_remove); #ifdef CONFIG_PM_GENERIC_DOMAINS_OF -typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args, - void *data); - /* * Device Tree based PM domain providers. * @@ -1730,6 +1727,9 @@ int of_genpd_add_provider_onecell(struct device_node *np, mutex_lock(&gpd_list_lock); + if (!data->xlate) + data->xlate = genpd_xlate_onecell; + for (i = 0; i < data->num_domains; i++) { if (!data->domains[i]) continue; @@ -1740,7 +1740,7 @@ int of_genpd_add_provider_onecell(struct device_node *np, data->domains[i]->has_provider = true; } - ret = genpd_add_provider(np, genpd_xlate_onecell, data); + ret = genpd_add_provider(np, data->xlate, data); if (ret < 0) goto error; diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 5339ed5bd6f9..5163f371a308 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -204,9 +204,13 @@ static inline void pm_genpd_syscore_poweron(struct device *dev) {} /* OF PM domain providers */ struct of_device_id; +typedef struct generic_pm_domain *(*genpd_xlate_t)(struct of_phandle_args *args, + void *data); + struct genpd_onecell_data { struct generic_pm_domain **domains; unsigned int num_domains; + genpd_xlate_t xlate; }; #ifdef CONFIG_PM_GENERIC_DOMAINS_OF