Linux-PM Archive on lore.kernel.org
 help / color / Atom feed
From: Stephen Boyd <swboyd@chromium.org>
To: Maulik Shah <mkshah@codeaurora.org>,
	agross@kernel.org, david.brown@linaro.org,
	linux-arm-msm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	bjorn.andersson@linaro.org, evgreen@chromium.org,
	dianders@chromium.org, rnayak@codeaurora.org,
	ilina@codeaurora.org, lsrao@codeaurora.org,
	ulf.hansson@linaro.org, Maulik Shah <mkshah@codeaurora.org>
Subject: Re: [PATCH 4/4] drivers: qcom: rpmh-rsc: Add RSC power domain support
Date: Wed, 14 Aug 2019 11:25:01 -0700
Message-ID: <5d5451fe.1c69fb81.ee115.1711@mx.google.com> (raw)
In-Reply-To: <20190813082442.25796-5-mkshah@codeaurora.org>

Quoting Maulik Shah (2019-08-13 01:24:42)
> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
> index e278fc11fe5c..bd8e9f1a43b4 100644
> --- a/drivers/soc/qcom/rpmh-rsc.c
> +++ b/drivers/soc/qcom/rpmh-rsc.c
> @@ -498,6 +498,32 @@ static int tcs_ctrl_write(struct rsc_drv *drv, const struct tcs_request *msg)
>         return ret;
>  }
>  
> +/**
> + *  rpmh_rsc_ctrlr_is_idle: Check if any of the AMCs are busy.
> + *
> + *  @drv: The controller
> + *
> + *  Returns false if the TCSes are engaged in handling requests,
> + *  True if controller is idle.
> + */
> +static bool rpmh_rsc_ctrlr_is_idle(struct rsc_drv *drv)
> +{
> +       int m;
> +       struct tcs_group *tcs = get_tcs_of_type(drv, ACTIVE_TCS);
> +       bool ret = true;
> +
> +       spin_lock(&drv->lock);
> +       for (m = tcs->offset; m < tcs->offset + tcs->num_tcs; m++) {
> +               if (!tcs_is_free(drv, m)) {

Isn't this a copy of an existing function in the rpmh driver?

> +                       ret = false;
> +                       break;
> +               }
> +       }
> +       spin_unlock(&drv->lock);
> +
> +       return ret;
> +}
> +
>  /**
>   * rpmh_rsc_write_ctrl_data: Write request to the controller
>   *
> @@ -521,6 +547,65 @@ int rpmh_rsc_write_ctrl_data(struct rsc_drv *drv, const struct tcs_request *msg)
>         return tcs_ctrl_write(drv, msg);
>  }
>  
> +int rpmh_domain_power_off(struct generic_pm_domain *rsc_pd)
> +{
> +       struct rsc_drv *drv = container_of(rsc_pd, struct rsc_drv, rsc_pd);
> +       int ret = 0;
> +
> +       /*
> +        * RPMh domain can not be powered off when there is pending ACK for
> +        * ACTIVE_TCS request. Exit when controller is busy.
> +        */
> +
> +       ret = rpmh_rsc_ctrlr_is_idle(drv);
> +       if (!ret)
> +               goto exit;

return 0? Shouldn't it return some negative value?

> +
> +       ret = rpmh_flush(&drv->client);
> +       if (ret)
> +               goto exit;

Why not just return rpmh_flush(...)?

The usage of goto in this function is entirely unnecessary.

> +
> +exit:
> +       return ret;
> +}
> +
> +static int rpmh_probe_power_domain(struct platform_device *pdev,
> +                                  struct rsc_drv *drv)
> +{
> +       int ret = -ENOMEM;
> +       struct generic_pm_domain *rsc_pd = &drv->rsc_pd;
> +       struct device_node *dn = pdev->dev.of_node;
> +
> +       rsc_pd->name = kasprintf(GFP_KERNEL, "%s", dn->name);
> +       if (!rsc_pd->name)
> +               goto exit;

return -ENOMEM;

> +
> +       rsc_pd->name = kbasename(rsc_pd->name);
> +       rsc_pd->power_off = rpmh_domain_power_off;
> +       rsc_pd->flags |= GENPD_FLAG_IRQ_SAFE;
> +
> +       ret = pm_genpd_init(rsc_pd, NULL, false);
> +       if (ret)
> +               goto free_name;
> +
> +       ret = of_genpd_add_provider_simple(dn, rsc_pd);
> +       if (ret)
> +               goto remove_pd;
> +
> +       pr_debug("init PM domain %s\n", rsc_pd->name);
> +
> +       return ret;

	ret = of_genpd_add_provider_simple(...)
	if (!ret)
		return 0;

Drop the pr_debug(), it's not useful.

> +
> +remove_pd:
> +       pm_genpd_remove(rsc_pd);
> +
> +free_name:
> +       kfree(rsc_pd->name);
> +
> +exit:
> +       return ret;

Please remove newlines between labels above.


  reply index

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13  8:24 [PATCH 0/4] " Maulik Shah
2019-08-13  8:24 ` [PATCH 1/4] drivers: qcom: rpmh: fix macro to accept NULL argument Maulik Shah
2019-08-14 17:59   ` Stephen Boyd
2019-08-13  8:24 ` [PATCH 2/4] drivers: qcom: rpmh: remove rpmh_flush export Maulik Shah
2019-08-14 18:20   ` Stephen Boyd
2019-08-13  8:24 ` [PATCH 3/4] dt-bindings: soc: qcom: Add RSC power domain specifier Maulik Shah
2019-08-14 18:02   ` Stephen Boyd
2019-08-13  8:24 ` [PATCH 4/4] drivers: qcom: rpmh-rsc: Add RSC power domain support Maulik Shah
2019-08-14 18:25   ` Stephen Boyd [this message]
2019-08-23  6:49     ` Maulik Shah
2019-08-14 18:19 ` [PATCH 0/4] " Stephen Boyd
2019-08-23  6:51   ` Maulik Shah

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5d5451fe.1c69fb81.ee115.1711@mx.google.com \
    --to=swboyd@chromium.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=david.brown@linaro.org \
    --cc=dianders@chromium.org \
    --cc=evgreen@chromium.org \
    --cc=ilina@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lsrao@codeaurora.org \
    --cc=mkshah@codeaurora.org \
    --cc=rnayak@codeaurora.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-PM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pm/0 linux-pm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pm linux-pm/ https://lore.kernel.org/linux-pm \
		linux-pm@vger.kernel.org linux-pm@archiver.kernel.org
	public-inbox-index linux-pm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox