mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] perf/arm_pmu_platform: Fix an error message related to dev_err_probe() usage
Date: Mon, 8 Aug 2022 15:57:39 +0100	[thread overview]
Message-ID: <14029916-6037-9248-ddd1-24199e3d3ede@arm.com> (raw)
In-Reply-To: <aaeba9c12ccdb29f48fe19137cb5abeea85fbb24.1659732652.git.christophe.jaillet@wanadoo.fr>

On 2022-08-05 21:55, Christophe JAILLET wrote:
> dev_err() is a macro that expand dev_fmt, but dev_err_probe() is a
> function and cannot perform this macro expansion.
> 
> So hard code the "hw perfevents: " prefix and dd a comment explaining why.
> 
> Fixes: 11fa1dc8020a ("perf/arm_pmu_platform: Use dev_err_probe() for IRQ errors")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Untested, but I can't see how it could work.
> 
> v1 --> v2
>    - fix a typo in the comment
> ---
>   drivers/perf/arm_pmu_platform.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c
> index 513de1f54e2d..02cca4b8f0fd 100644
> --- a/drivers/perf/arm_pmu_platform.c
> +++ b/drivers/perf/arm_pmu_platform.c
> @@ -101,8 +101,11 @@ static int pmu_parse_irqs(struct arm_pmu *pmu)
>   	struct device *dev = &pdev->dev;
>   
>   	num_irqs = platform_irq_count(pdev);
> -	if (num_irqs < 0)
> -		return dev_err_probe(dev, num_irqs, "unable to count PMU IRQs\n");
> +	if (num_irqs < 0) {
> +		/* dev_err_probe() does not handle dev_fmt, so hard-code the prefix */
> +		return dev_err_probe(dev, num_irqs,
> +				     "hw perfevents: unable to count PMU IRQs\n");

Why not use dev_fmt directly? But even better, is there any practical 
reason why this couldn't be fixed at the source by indirecting 
dev_err_probe() through a macro wrapper just like all its friends:

#define dev_err_probe(dev, err, fmt, ...) \
	_dev_err_probe(dev, err, dev_fmt(fmt), ##__VA_ARGS__)

?

Thanks,
Robin.

> +	}
>   
>   	/*
>   	 * In this case we have no idea which CPUs are covered by the PMU.

  reply	other threads:[~2022-08-08 14:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 20:55 Christophe JAILLET
2022-08-08 14:57 ` Robin Murphy [this message]
2022-08-10 20:01   ` Christophe JAILLET

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=14029916-6037-9248-ddd1-24199e3d3ede@arm.com \
    --to=robin.murphy@arm.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=will@kernel.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
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

all inboxes | Powered by JetHome®