From patchwork Thu Sep 15 12:05:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 9333411 X-Patchwork-Delegate: rjw@sisk.pl 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 CB7656077F for ; Thu, 15 Sep 2016 12:06:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8BBD296A1 for ; Thu, 15 Sep 2016 12:06:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD4CB296A3; Thu, 15 Sep 2016 12:06:37 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 DCF37296A1 for ; Thu, 15 Sep 2016 12:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934582AbcIOMGf (ORCPT ); Thu, 15 Sep 2016 08:06:35 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36633 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934609AbcIOMGc (ORCPT ); Thu, 15 Sep 2016 08:06:32 -0400 Received: by mail-lf0-f68.google.com with SMTP id s29so2060596lfg.3; Thu, 15 Sep 2016 05:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=avZugdFTOFpnxJAtnM9AtTR/07kJxU2cOZPvKJd/f/w=; b=eqfJII7jrxufG6G/K5g9sB2DyZ2zdK7ml+TKo/yRFOuS+y/P9RkGEIF+rF397H6+yC L59QcdsQ7I3kMLIVRUMKLVH+FzlqPmXWbYR3TzFRZBRHw9IjTVHPZOrQOOH8sYANZGhO viDPIVxF+zHD6/CZv+vFgeVN+ZqplCW8vBoRdrEFOZL0bQJmM0SeHW0uMewJCyx1/HzT TtB02zrrzV3Ai7nUnOCgFIRySy8xFAfUK7fCOgGQ1gioC+B7TjgkomYdufwYusqA44li SO54QiYSl2V5+fadGe7sUBZ1hJSEGY8MF7Bwfy2HN7ME61bFyA2eB3XCIII2m2u6QYu8 KgQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=avZugdFTOFpnxJAtnM9AtTR/07kJxU2cOZPvKJd/f/w=; b=nNOjh47Xt8H274hlp7r65HX6xw7FRo6ivoceC54lb1lUBZC7nYnlh6WzdHYJGVug4D Q0s2Ivz0df+SHVAAESPEJO3bPEN8Qi12zl5xwEXiIswVT95UPQ2VmzrgupPqTK7UETNM XDZJlwlz8o1g7vSEP1LJvqpdSRAZFUcc7onxn1CtZI3Md5X+hmpOKjJ6H0ClRgbyWoeg 9H5uX2AyKQeZprsFBpBmPVlex03FAncsm4rq2B4VhiVr+N5n/J2ggvXnDf+t4UdoCE9i j3UxNMOsGMLr38V3s9+MTqqUu3T+WGlOEv82FsL5KKs0u7xftFAwP+cqPKRBIO3TP7vp 1dEg== X-Gm-Message-State: AE9vXwOEHTorAyuUwzZ+ZVkDlxZ+KZu5bkrTBHmIZxk6EfXQm/TMCetGxdG2i14hx99I8g== X-Received: by 10.194.59.116 with SMTP id y20mr7504938wjq.181.1473941190285; Thu, 15 Sep 2016 05:06:30 -0700 (PDT) Received: from cizrna.lan ([109.72.12.249]) by smtp.gmail.com with ESMTPSA id md9sm3143233wjb.20.2016.09.15.05.06.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Sep 2016 05:06:29 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Cc: Tomeu Vizoso , Jon Hunter , Heiko Stuebner , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Pavel Machek , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v2] PM / Domains: Allow holes in genpd_data.domains array Date: Thu, 15 Sep 2016 14:05:23 +0200 Message-Id: <1473941123-15090-1-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <5256c34e-5afb-2cfe-9818-8e6a6e1f0fa3@nvidia.com> References: <5256c34e-5afb-2cfe-9818-8e6a6e1f0fa3@nvidia.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 In platforms such as Rockchip's, the array of domains isn't always filled without holes, as which domains are present depend on the particular SoC revision. By allowing holes to be in the array, such SoCs can still use a single set of constants to index the array of power domains. Fixes: 0159ec670763 ("PM / Domains: Verify the PM domain is present when adding a provider") Signed-off-by: Tomeu Vizoso Cc: Jon Hunter Cc: Heiko Stuebner Acked-by: Jon Hunter Acked-by: Ulf Hansson Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Acked-by: Kevin Hilman --- v2: Also skip holes in the error path. --- drivers/base/power/domain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index b0cf46dcae73..83ae3d7d3fdd 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1581,6 +1581,8 @@ int of_genpd_add_provider_onecell(struct device_node *np, mutex_lock(&gpd_list_lock); for (i = 0; i < data->num_domains; i++) { + if (!data->domains[i]) + continue; if (!pm_genpd_present(data->domains[i])) goto error; @@ -1598,6 +1600,8 @@ int of_genpd_add_provider_onecell(struct device_node *np, error: while (i--) { + if (!data->domains[i]) + continue; data->domains[i]->provider = NULL; data->domains[i]->has_provider = false; }