Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Sahil Chandna <quic_chandna@quicinc.com>
To: Mukesh Ojha <quic_mojha@quicinc.com>, <andersson@kernel.org>,
	<konrad.dybcio@linaro.org>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] soc: qcom: llcc: Add llcc device availability check
Date: Thu, 22 Feb 2024 23:37:45 +0530	[thread overview]
Message-ID: <c60638be-e12e-4148-8c20-1dbba9c817da@quicinc.com> (raw)
In-Reply-To: <20240220122805.9084-1-quic_mojha@quicinc.com>

On 2/20/2024 5:58 PM, Mukesh Ojha wrote:
> When llcc driver is enabled  and llcc device is not
> physically there on the SoC, client can get
> -EPROBE_DEFER on calling llcc_slice_getd() and it
> is possible they defer forever.
> 
> Let's add a check device availabilty and set the
> appropriate applicable error in drv_data.
> 
> Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
> ---
>   drivers/soc/qcom/llcc-qcom.c | 23 ++++++++++++++++++++++-
>   1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
> index 4ca88eaebf06..cb336b183bba 100644
> --- a/drivers/soc/qcom/llcc-qcom.c
> +++ b/drivers/soc/qcom/llcc-qcom.c
> @@ -769,6 +769,27 @@ static const struct qcom_sct_config x1e80100_cfgs = {
>   };
>   
>   static struct llcc_drv_data *drv_data = (void *) -EPROBE_DEFER;
> +static DEFINE_MUTEX(dev_avail);
what is the requirement for mutex lock here? Since we are only trying to 
find if node present or not
> +
> +static bool is_llcc_device_available(void)
> +{
> +	static struct llcc_drv_data *ptr;
> +
> +	mutex_lock(&dev_avail);
> +	if (!ptr) {
> +		struct device_node *node;
> +
> +		node = of_find_node_by_name(NULL, "system-cache-controller");
> +		if (!of_device_is_available(node)) {
> +			pr_warn("llcc-qcom: system-cache-controller node not found\n");
> +			drv_data = ERR_PTR(-ENODEV);
> +		}
> +		of_node_put(node);
> +		ptr = drv_data;
> +	}
> +	mutex_unlock(&dev_avail);
> +	return (PTR_ERR(ptr) != -ENODEV) ? true : false;
> +}
>   
>   /**
>    * llcc_slice_getd - get llcc slice descriptor
> @@ -783,7 +804,7 @@ struct llcc_slice_desc *llcc_slice_getd(u32 uid)
>   	struct llcc_slice_desc *desc;
>   	u32 sz, count;
>   
> -	if (IS_ERR(drv_data))
> +	if (!is_llcc_device_available() || IS_ERR(drv_data))
>   		return ERR_CAST(drv_data);
>   
>   	cfg = drv_data->cfg;


  reply	other threads:[~2024-02-22 18:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 12:28 [PATCH] soc: qcom: llcc: Add llcc device availability check Mukesh Ojha
2024-02-22 18:07 ` Sahil Chandna [this message]
2024-02-26 10:32   ` Mukesh Ojha
2024-02-26 10:49     ` Sahil Chandna
2024-02-26 11:00       ` Mukesh Ojha
2024-03-07 10:21 ` Krzysztof Kozlowski
2024-03-12 16:25   ` Mukesh Ojha
2024-03-12 16:47     ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly 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=c60638be-e12e-4148-8c20-1dbba9c817da@quicinc.com \
    --to=quic_chandna@quicinc.com \
    --cc=andersson@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_mojha@quicinc.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox