public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Emilio Mendoza Reyes <emendoz@g.clemson.edu>,
	neil.armstrong@linaro.org, dianders@chromium.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/panel: Promote warn_dev to WARN for invalid calls in drm_panel.c
Date: Mon, 25 Mar 2024 11:37:52 +0200	[thread overview]
Message-ID: <87jzlqk5xr.fsf@intel.com> (raw)
In-Reply-To: <2388112.ElGaqSPkdT@mephi-laptop>

On Sat, 23 Mar 2024, Emilio Mendoza Reyes <emendoz@g.clemson.edu> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512

Please use git format-patch and/or send-email to send patches, without
the inline PGP.

>
> From: Emilio Mendoza Reyes <emendoz@clemson.edu>
>
> This patch is the second of a set of two.
>
> In the kernel docs there is a todo:
> Link: https://www.kernel.org/doc/html/v6.8/gpu/todo.html#clean-up-checks-for-already-prepared-enabled-in-panels
>
> The first patch addresses removing the duplicated code. This second
> patch addresses promoting instances of dev_warn to WARN as it is an
> error in other code for these functions to be called in the invalid
> state that triggers the checks.

The commit message for each patch should describe what that patch alone
does, independent of anything else. If you need to describe what the
series does, please use a cover letter.

Please do not refer to "this patch". Just use the imperative mood,
i.e. "Fix stuff" instead of "This patch fixes stuff".

> Signed-off-by: Emilio Mendoza Reyes <emendoz@clemson.edu>
> - ---
>  drivers/gpu/drm/drm_panel.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index cfbe020de54e..0b7602c8b387 100644
> - --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -114,7 +114,9 @@ int drm_panel_prepare(struct drm_panel *panel)
>  		return -EINVAL;
>  
>  	if (panel->prepared) {
> - -		dev_warn(panel->dev, "Skipping prepare of already prepared panel\n");
> +		const char *name = dev_name(panel->dev);
> +
> +		WARN(1, "Unexpected attempt to prepare an already prepared panel by %s\n", name);
>  		return 0;
>  	}
>  
> @@ -162,7 +164,9 @@ int drm_panel_unprepare(struct drm_panel *panel)
>  		return -EINVAL;
>  
>  	if (!panel->prepared) {
> - -		dev_warn(panel->dev, "Skipping unprepare of already unprepared panel\n");
> +		const char *name = dev_name(panel->dev);
> +
> +		WARN(1, "Unexpected attempt to unprepare an already unprepared panel by %s\n", name);

Please use dev_WARN() which will handle the device specific warns for
you, including dev_name().

BR,
Jani.

>  		return 0;
>  	}
>  
> @@ -208,7 +212,9 @@ int drm_panel_enable(struct drm_panel *panel)
>  		return -EINVAL;
>  
>  	if (panel->enabled) {
> - -		dev_warn(panel->dev, "Skipping enable of already enabled panel\n");
> +		const char *name = dev_name(panel->dev);
> +
> +		WARN(1, "Unexpected attempt to enable an already enabled panel by %s\n", name);
>  		return 0;
>  	}
>  
> @@ -246,7 +252,9 @@ int drm_panel_disable(struct drm_panel *panel)
>  		return -EINVAL;
>  
>  	if (!panel->enabled) {
> - -		dev_warn(panel->dev, "Skipping disable of already disabled panel\n");
> +		const char *name = dev_name(panel->dev);
> +
> +		WARN(1, "Unexpected attempt to disable an already disabled panel by %s\n", name);
>  		return 0;
>  	}
>  
> - -- 
> 2.44.0
>
> -----BEGIN PGP SIGNATURE-----
>
> iHUEARYKAB0WIQTcaZbABwnECYA0cZI0LAN3EqikFgUCZf+KPwAKCRA0LAN3Eqik
> FgImAQCqtDgta8+cyU8aAaWN2QTflyiHrNWqB1YmPkVggV1xSwEAx6Ge9YOH7vNL
> hmew94ipW21OuQzIeHtSjLpqJ5Creww=
> =aLEl
> -----END PGP SIGNATURE-----
>
>
>

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-03-25  9:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-24  2:04 [PATCH 2/2] drm/panel: Promote warn_dev to WARN for invalid calls in drm_panel.c Emilio Mendoza Reyes
2024-03-25  9:37 ` Jani Nikula [this message]
2024-03-25 12:46   ` Emilio Mendoza Reyes

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=87jzlqk5xr.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emendoz@g.clemson.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil.armstrong@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
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