Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6225310pxv; Thu, 29 Jul 2021 09:15:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmHe0Zj3oS1GJGsirjic8GbxxILBy2/2uMQnrPUgYATgL67MYx3wSNI3e/3zqYfWR/YK1v X-Received: by 2002:a17:906:3888:: with SMTP id q8mr5271694ejd.269.1627575320649; Thu, 29 Jul 2021 09:15:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627575320; cv=none; d=google.com; s=arc-20160816; b=fbSHVIFyKt1o7c2hQqdFuTF+wXtgXe+FG/7XjL2H5tO8fZdWOz83CUifKjyqC9Sa7/ Mk0WG6GNmDq33c480dQnPkQH3p6vdvpsrUKpPPph0N6klZg4CoYJfbTsEDE5rPs1KQHN W114MPubgyJyqrd29safPjCbP8cj10PaQ676akd9B5YD9e1q6CVNVfeS+C9DtnvS+JK/ edhy7AYmVdLLm4MQo0fEJpNUKEwmDsFWfLVKLBaH2glNwtu9oN667ugmNrE13XDMyn1b LWzaGg56heyMoxBqOFHcTKDwrsJr+X07RHeOQUCZpKYhQGTmLAQcqu65yF4fe8XAh1Es FAfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7rnfNZ1smkd3MOn2QE94nhDLg5Z3RCUAAhAiNnfRCE4=; b=LnlQ6kDbUbkv/4m/zYqabis+mMUdlceUu7qFlhzAxYW0jNCQPIgoI3mcC4tap8SWB6 y8TyIj+kVLFDjNeT0f8xKxlw/G1jhV7RtEpHxubhyMXnYiS4VfH1ehg4quFMM1KnByJF Jk7v933IvZ14mKsIEa22PmOrbWOx8S05gGhT5aFuk2j9F6iHPI7apRxfPyYx4ZLKWfqH m77GFfqO6l/OW9zFPf2yJloIUXpQJ2r9ycd4HYE35K28/runyJb03jd76qR92Caik+B1 KPNNbfNtYYAoBMXyRSRI/NEfilPcuBpR8J5zCXuDyCEll8jBpwYi59wruF+CnlsD+Tcu sVQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JO+Wc0xx; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gg2si3111113ejb.176.2021.07.29.09.14.54; Thu, 29 Jul 2021 09:15:20 -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=@chromium.org header.s=google header.b=JO+Wc0xx; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231666AbhG2QLG (ORCPT + 99 others); Thu, 29 Jul 2021 12:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234734AbhG2QKO (ORCPT ); Thu, 29 Jul 2021 12:10:14 -0400 Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F974C0619C0 for ; Thu, 29 Jul 2021 09:08:03 -0700 (PDT) Received: by mail-qv1-xf32.google.com with SMTP id p38so3621912qvp.11 for ; Thu, 29 Jul 2021 09:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7rnfNZ1smkd3MOn2QE94nhDLg5Z3RCUAAhAiNnfRCE4=; b=JO+Wc0xx+6zrqWzU8d5m29orUQfNIbr+4Or7rVWWlQ13j9DpUSX3xkJWhtz51wsxdG tiaNwM9js+uKQYNP4kt6zhVkU0DN/T9JgTXJUdHwFpFSunFwYIvk03BdYsklBUrYxQ4P oCjMOKJ1XcklPD/WBBqk1Xe2qXRuH5g8oUFpg= 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=7rnfNZ1smkd3MOn2QE94nhDLg5Z3RCUAAhAiNnfRCE4=; b=NpC1gMUV/yp3veGqhHQCRjRBmXidVOi9LwH1HTKJCZLfkP/HS5B43xGePucikbuk+w idCK995E8014lpWmboiHcWQAPYRnOurMxqx171y8iKGwmoawCb77JZ/NpTuy/pxOyV5d SkP0ayKuN3C4dDj5G40Nl/PpPslIPPyF+J2LbYUgFgseoB9sM/RjLlAPkZQy+0aOAzD6 2qM8vn81JmUSGamJxg1DzpS1ZhB8NvlcJJ345xbKkJuU9HjSbQAnfZFS65jUD+MzEWfU FT0AVlRLhgWoli5z5X6IPWcxoJGTBZZ91d3i5wnvnvEyBAplmWPstdqugZp6k9jjXBmT d2Lg== X-Gm-Message-State: AOAM532HQD4psMpllaCk8Xi+9CUvZLR8qrNQH4OBt9FrVdeTcTruSFc9 ayN/A+Dwe0eKp0btdmRXIzO+w2YgQsrWkg== X-Received: by 2002:a0c:8ecd:: with SMTP id y13mr6085234qvb.62.1627574882665; Thu, 29 Jul 2021 09:08:02 -0700 (PDT) Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com. [209.85.219.179]) by smtp.gmail.com with ESMTPSA id w14sm2025038qkm.81.2021.07.29.09.08.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Jul 2021 09:08:02 -0700 (PDT) Received: by mail-yb1-f179.google.com with SMTP id j77so9080607ybj.3 for ; Thu, 29 Jul 2021 09:08:01 -0700 (PDT) X-Received: by 2002:a25:b845:: with SMTP id b5mr7441639ybm.343.1627574881505; Thu, 29 Jul 2021 09:08:01 -0700 (PDT) MIME-Version: 1.0 References: <1627560036-1626-1-git-send-email-rnayak@codeaurora.org> <1627560036-1626-3-git-send-email-rnayak@codeaurora.org> In-Reply-To: <1627560036-1626-3-git-send-email-rnayak@codeaurora.org> From: Doug Anderson Date: Thu, 29 Jul 2021 09:07:50 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/3] nvmem: qfprom: sc7280: Handle the additional power-domains vote To: Rajendra Nayak Cc: Andy Gross , Bjorn Andersson , Srinivas Kandagatla , Rob Herring , linux-arm-msm , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , LKML , "Ravi Kumar Bokka (Temp)" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, Jul 29, 2021 at 5:01 AM Rajendra Nayak wrote: > > On sc7280, to reliably blow fuses, we need an additional vote > on max performance state of 'MX' power-domain. > Add support for power-domain performance state voting in the > driver. > > Signed-off-by: Rajendra Nayak > --- > drivers/nvmem/qfprom.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c > index 81fbad5..b5f27df 100644 > --- a/drivers/nvmem/qfprom.c > +++ b/drivers/nvmem/qfprom.c > @@ -12,6 +12,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > > @@ -139,6 +141,9 @@ static void qfprom_disable_fuse_blowing(const struct qfprom_priv *priv, > { > int ret; > > + dev_pm_genpd_set_performance_state(priv->dev, 0); > + pm_runtime_put(priv->dev); To me it feels as if this should be at the end of the function rather than the beginning. I guess it doesn't matter (?), but it feels wrong that we have writes to the register space after we're don't a pm_runtime_put(). > @@ -420,6 +440,12 @@ static int qfprom_probe(struct platform_device *pdev) > econfig.reg_write = qfprom_reg_write; > } > > + ret = devm_add_action_or_reset(dev, qfprom_runtime_disable, dev); > + if (ret) > + return ret; > + > + pm_runtime_enable(dev); > + Swap the order of the two. IOW first pm_runtime_enable(), then devm_add_action_or_reset(). Specifically the "_or_reset" means that if you fail to add the action (AKA devm_add_action() fails to allocate the tiny amount of memory it needs) it will actually _call_ the action. That means that in your code if the memory allocation fails you'll call pm_runtime_disable() without the corresponding pm_runtime_enable(). Other than those two issues this looks good to me. Feel free to add my Reviewed-by when you fix them. -Doug