All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Siddh Raman Pant <code@siddh.me>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>, Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Suraj Upadhyay <usuraj35@gmail.com>
Subject: Re: [PATCH v9 1/8] Revert "drm: mipi-dsi: Convert logging to drm_* functions."
Date: Tue, 6 Jun 2023 15:55:37 +0300	[thread overview]
Message-ID: <20230606125537.GC25774@pendragon.ideasonboard.com> (raw)
In-Reply-To: <bff523677c65a4a6b1c06152b154cf5651f51d68.1686047727.git.code@siddh.me>

Hi Siddh,

Thank you for the patch.

On Tue, Jun 06, 2023 at 04:15:15PM +0530, Siddh Raman Pant wrote:
> This reverts commit 1040e424353f5f4d39f6f3aa8723eb3bd6ea6446.
> 
> It used an incorrect way to use drm_* functions. Only drm_device ptrs
> should be passed, but the mentioned commit passed mipi_dsi_host ptr.
> It worked by accident due to macro magic.
> 
> Reported-by: Jani Nikula <jani.nikula@linux.intel.com>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Siddh Raman Pant <code@siddh.me>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Any chance we could prevent this from happening by turning the macros
into inline functions ?

> ---
>  drivers/gpu/drm/drm_mipi_dsi.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index 3fd6c733ff4e..a37af4edf394 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -33,7 +33,6 @@
>  
>  #include <drm/display/drm_dsc.h>
>  #include <drm/drm_mipi_dsi.h>
> -#include <drm/drm_print.h>
>  
>  #include <video/mipi_display.h>
>  
> @@ -156,18 +155,19 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
>  static struct mipi_dsi_device *
>  of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
>  {
> +	struct device *dev = host->dev;
>  	struct mipi_dsi_device_info info = { };
>  	int ret;
>  	u32 reg;
>  
>  	if (of_alias_from_compatible(node, info.type, sizeof(info.type)) < 0) {
> -		drm_err(host, "modalias failure on %pOF\n", node);
> +		dev_err(dev, "modalias failure on %pOF\n", node);
>  		return ERR_PTR(-EINVAL);
>  	}
>  
>  	ret = of_property_read_u32(node, "reg", &reg);
>  	if (ret) {
> -		drm_err(host, "device node %pOF has no valid reg property: %d\n",
> +		dev_err(dev, "device node %pOF has no valid reg property: %d\n",
>  			node, ret);
>  		return ERR_PTR(-EINVAL);
>  	}
> @@ -202,21 +202,22 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
>  			      const struct mipi_dsi_device_info *info)
>  {
>  	struct mipi_dsi_device *dsi;
> +	struct device *dev = host->dev;
>  	int ret;
>  
>  	if (!info) {
> -		drm_err(host, "invalid mipi_dsi_device_info pointer\n");
> +		dev_err(dev, "invalid mipi_dsi_device_info pointer\n");
>  		return ERR_PTR(-EINVAL);
>  	}
>  
>  	if (info->channel > 3) {
> -		drm_err(host, "invalid virtual channel: %u\n", info->channel);
> +		dev_err(dev, "invalid virtual channel: %u\n", info->channel);
>  		return ERR_PTR(-EINVAL);
>  	}
>  
>  	dsi = mipi_dsi_device_alloc(host);
>  	if (IS_ERR(dsi)) {
> -		drm_err(host, "failed to allocate DSI device %ld\n",
> +		dev_err(dev, "failed to allocate DSI device %ld\n",
>  			PTR_ERR(dsi));
>  		return dsi;
>  	}
> @@ -227,7 +228,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
>  
>  	ret = mipi_dsi_device_add(dsi);
>  	if (ret) {
> -		drm_err(host, "failed to add DSI device %d\n", ret);
> +		dev_err(dev, "failed to add DSI device %d\n", ret);
>  		kfree(dsi);
>  		return ERR_PTR(ret);
>  	}
> 

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Siddh Raman Pant <code@siddh.me>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Maxime Ripard <mripard@kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Suraj Upadhyay <usuraj35@gmail.com>
Subject: Re: [PATCH v9 1/8] Revert "drm: mipi-dsi: Convert logging to drm_* functions."
Date: Tue, 6 Jun 2023 15:55:37 +0300	[thread overview]
Message-ID: <20230606125537.GC25774@pendragon.ideasonboard.com> (raw)
In-Reply-To: <bff523677c65a4a6b1c06152b154cf5651f51d68.1686047727.git.code@siddh.me>

Hi Siddh,

Thank you for the patch.

On Tue, Jun 06, 2023 at 04:15:15PM +0530, Siddh Raman Pant wrote:
> This reverts commit 1040e424353f5f4d39f6f3aa8723eb3bd6ea6446.
> 
> It used an incorrect way to use drm_* functions. Only drm_device ptrs
> should be passed, but the mentioned commit passed mipi_dsi_host ptr.
> It worked by accident due to macro magic.
> 
> Reported-by: Jani Nikula <jani.nikula@linux.intel.com>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Siddh Raman Pant <code@siddh.me>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Any chance we could prevent this from happening by turning the macros
into inline functions ?

> ---
>  drivers/gpu/drm/drm_mipi_dsi.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index 3fd6c733ff4e..a37af4edf394 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -33,7 +33,6 @@
>  
>  #include <drm/display/drm_dsc.h>
>  #include <drm/drm_mipi_dsi.h>
> -#include <drm/drm_print.h>
>  
>  #include <video/mipi_display.h>
>  
> @@ -156,18 +155,19 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
>  static struct mipi_dsi_device *
>  of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
>  {
> +	struct device *dev = host->dev;
>  	struct mipi_dsi_device_info info = { };
>  	int ret;
>  	u32 reg;
>  
>  	if (of_alias_from_compatible(node, info.type, sizeof(info.type)) < 0) {
> -		drm_err(host, "modalias failure on %pOF\n", node);
> +		dev_err(dev, "modalias failure on %pOF\n", node);
>  		return ERR_PTR(-EINVAL);
>  	}
>  
>  	ret = of_property_read_u32(node, "reg", &reg);
>  	if (ret) {
> -		drm_err(host, "device node %pOF has no valid reg property: %d\n",
> +		dev_err(dev, "device node %pOF has no valid reg property: %d\n",
>  			node, ret);
>  		return ERR_PTR(-EINVAL);
>  	}
> @@ -202,21 +202,22 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
>  			      const struct mipi_dsi_device_info *info)
>  {
>  	struct mipi_dsi_device *dsi;
> +	struct device *dev = host->dev;
>  	int ret;
>  
>  	if (!info) {
> -		drm_err(host, "invalid mipi_dsi_device_info pointer\n");
> +		dev_err(dev, "invalid mipi_dsi_device_info pointer\n");
>  		return ERR_PTR(-EINVAL);
>  	}
>  
>  	if (info->channel > 3) {
> -		drm_err(host, "invalid virtual channel: %u\n", info->channel);
> +		dev_err(dev, "invalid virtual channel: %u\n", info->channel);
>  		return ERR_PTR(-EINVAL);
>  	}
>  
>  	dsi = mipi_dsi_device_alloc(host);
>  	if (IS_ERR(dsi)) {
> -		drm_err(host, "failed to allocate DSI device %ld\n",
> +		dev_err(dev, "failed to allocate DSI device %ld\n",
>  			PTR_ERR(dsi));
>  		return dsi;
>  	}
> @@ -227,7 +228,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
>  
>  	ret = mipi_dsi_device_add(dsi);
>  	if (ret) {
> -		drm_err(host, "failed to add DSI device %d\n", ret);
> +		dev_err(dev, "failed to add DSI device %d\n", ret);
>  		kfree(dsi);
>  		return ERR_PTR(ret);
>  	}
> 

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2023-06-06 12:56 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06 10:45 [PATCH v9 0/8] drm: Remove usage of deprecated DRM_* macros Siddh Raman Pant
2023-06-06 10:45 ` Siddh Raman Pant
2023-06-06 10:45 ` [PATCH v9 1/8] Revert "drm: mipi-dsi: Convert logging to drm_* functions." Siddh Raman Pant
2023-06-06 10:45   ` Siddh Raman Pant
2023-06-06 12:55   ` Laurent Pinchart [this message]
2023-06-06 12:55     ` Laurent Pinchart
2023-06-06 13:07     ` Jani Nikula
2023-06-06 13:07       ` Jani Nikula
2023-06-06 13:21     ` Siddh Raman Pant
2023-06-06 13:21       ` Siddh Raman Pant
2023-06-06 10:45 ` [PATCH v9 2/8] drm/print: Fix and add support for NULL as first argument in drm_* macros Siddh Raman Pant
2023-06-06 10:45   ` Siddh Raman Pant
2023-06-06 14:05   ` Laurent Pinchart
2023-06-06 14:05     ` Laurent Pinchart
2023-06-06 14:34     ` Siddh Raman Pant
2023-06-06 14:34       ` Siddh Raman Pant
2023-06-06 14:47       ` Laurent Pinchart
2023-06-06 14:47         ` Laurent Pinchart
2023-06-06 10:45 ` [PATCH v9 3/8] drm: Remove usage of deprecated DRM_INFO Siddh Raman Pant
2023-06-06 10:45   ` Siddh Raman Pant
2023-06-06 14:23   ` Laurent Pinchart
2023-06-06 14:23     ` Laurent Pinchart
2023-06-06 14:38     ` Siddh Raman Pant
2023-06-06 14:38       ` Siddh Raman Pant
2023-06-06 14:46       ` Laurent Pinchart
2023-06-06 14:46         ` Laurent Pinchart
2023-06-06 16:39         ` Siddh Raman Pant
2023-06-06 16:39           ` Siddh Raman Pant
2023-06-06 10:45 ` [PATCH v9 4/8] drm: Remove usage of deprecated DRM_NOTE Siddh Raman Pant
2023-06-06 10:45   ` Siddh Raman Pant
2023-06-06 14:39   ` Laurent Pinchart
2023-06-06 14:39     ` Laurent Pinchart
2023-06-06 10:45 ` [PATCH v9 5/8] drm: Remove usage of deprecated DRM_ERROR Siddh Raman Pant
2023-06-06 10:45   ` Siddh Raman Pant
2023-06-06 14:44   ` Laurent Pinchart
2023-06-06 14:44     ` Laurent Pinchart
2023-06-06 17:06     ` Siddh Raman Pant
2023-06-06 17:06       ` Siddh Raman Pant
2023-06-06 17:13       ` Laurent Pinchart
2023-06-06 17:13         ` Laurent Pinchart
2023-06-06 10:45 ` [PATCH v9 6/8] drm: Remove usage of deprecated DRM_DEBUG Siddh Raman Pant
2023-06-06 10:45   ` Siddh Raman Pant
2023-06-06 14:57   ` Laurent Pinchart
2023-06-06 14:57     ` Laurent Pinchart
2023-06-06 17:14     ` Siddh Raman Pant
2023-06-06 17:14       ` Siddh Raman Pant
2023-06-06 10:45 ` [PATCH v9 7/8] drm: Remove usage of deprecated DRM_DEBUG_DRIVER Siddh Raman Pant
2023-06-06 10:45   ` Siddh Raman Pant
2023-06-06 14:38   ` Laurent Pinchart
2023-06-06 14:38     ` Laurent Pinchart
2023-06-06 10:45 ` [PATCH v9 8/8] drm: Remove usage of deprecated DRM_DEBUG_KMS Siddh Raman Pant
2023-06-06 10:45   ` Siddh Raman Pant
2023-06-06 15:04   ` Laurent Pinchart
2023-06-06 15:04     ` Laurent Pinchart
2023-06-06 17:17     ` Siddh Raman Pant
2023-06-06 17:17       ` Siddh Raman Pant
2023-06-06 21:39     ` Jani Nikula
2023-06-06 21:39       ` Jani Nikula
2023-06-07  3:53       ` Laurent Pinchart
2023-06-07  3:53         ` Laurent Pinchart
2023-06-07  8:12         ` Jani Nikula
2023-06-07  8:12           ` Jani Nikula
2023-06-06 11:30 ` [PATCH v9 0/8] drm: Remove usage of deprecated DRM_* macros Jani Nikula
2023-06-06 11:30   ` Jani Nikula
2023-06-06 15:05 ` Laurent Pinchart
2023-06-06 15:05   ` Laurent Pinchart
2023-06-06 17:29   ` Siddh Raman Pant
2023-06-06 17:29     ` Siddh Raman Pant
2023-06-06 17:49     ` Laurent Pinchart
2023-06-06 17:49       ` Laurent Pinchart
2023-06-06 18:17       ` Siddh Raman Pant
2023-06-06 18:17         ` Siddh Raman Pant
2023-06-07  4:30         ` Laurent Pinchart
2023-06-07  4:30           ` Laurent Pinchart

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=20230606125537.GC25774@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=code@siddh.me \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=usuraj35@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.