Re: [Nouveau] [PATCH] drm/nouveau: Remove invalid reference to struct drm_device.pdev

2021-05-12 Thread Dave Airlie
On Thu, 13 May 2021 at 04:55, Thomas Zimmermann  wrote:
>
> The pdev field got removed from struct drm_device recently. Replace
> the invalid reference with an upcast from the struct's dev field.
>
> Signed-off-by: Thomas Zimmermann 
> Reported-by: Stephen Rothwell 
> Fixes: b347e04452ff ("drm: Remove pdev field from struct drm_device")
> Cc: Thomas Zimmermann 
> Cc: Maxime Ripard 
> Cc: Maarten Lankhorst 
> Cc: Maxime Ripard 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: dri-de...@lists.freedesktop.org

Reviewed-by: Dave Airlie 

> ---
> This patch should be merged through drm-misc-next.

please land asap.

Thanks,
Dave.
> ---
>  drivers/gpu/drm/nouveau/nouveau_connector.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c 
> b/drivers/gpu/drm/nouveau/nouveau_connector.c
> index 7f38788a6c2b..2a298c171d4d 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
> @@ -460,7 +460,8 @@ nouveau_connector_of_detect(struct drm_connector 
> *connector)
> struct drm_device *dev = connector->dev;
> struct nouveau_connector *nv_connector = nouveau_connector(connector);
> struct nouveau_encoder *nv_encoder;
> -   struct device_node *cn, *dn = pci_device_to_OF_node(dev->pdev);
> +   struct pci_dev *pdev = to_pci_dev(dev->dev);
> +   struct device_node *cn, *dn = pci_device_to_OF_node(pdev);
>
> if (!dn ||
> !((nv_encoder = find_encoder(connector, DCB_OUTPUT_TMDS)) ||
> --
> 2.31.1
>
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH] drm/nouveau: Remove invalid reference to struct drm_device.pdev

2021-05-12 Thread Thomas Zimmermann
The pdev field got removed from struct drm_device recently. Replace
the invalid reference with an upcast from the struct's dev field.

Signed-off-by: Thomas Zimmermann 
Reported-by: Stephen Rothwell 
Fixes: b347e04452ff ("drm: Remove pdev field from struct drm_device")
Cc: Thomas Zimmermann 
Cc: Maxime Ripard 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: dri-de...@lists.freedesktop.org
---
This patch should be merged through drm-misc-next.
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c 
b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 7f38788a6c2b..2a298c171d4d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -460,7 +460,8 @@ nouveau_connector_of_detect(struct drm_connector *connector)
struct drm_device *dev = connector->dev;
struct nouveau_connector *nv_connector = nouveau_connector(connector);
struct nouveau_encoder *nv_encoder;
-   struct device_node *cn, *dn = pci_device_to_OF_node(dev->pdev);
+   struct pci_dev *pdev = to_pci_dev(dev->dev);
+   struct device_node *cn, *dn = pci_device_to_OF_node(pdev);

if (!dn ||
!((nv_encoder = find_encoder(connector, DCB_OUTPUT_TMDS)) ||
--
2.31.1

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [PATCH v2 1/2] drm/nouveau: Fix ida leak

2021-05-12 Thread Pierre Moreau
Why remove the const modifier on `nb`?

On 2021-05-11 — 16:28, Zhen Lei wrote:
> When the 'nb' value allocated from 'bl_ida' is greater than or equal to
> 100, it will not be released. In fact, we can simplify operations by
> limiting the range of idas that can be applied for.
> 
> By the way, delete the const modifier of the local variable 'nb'.
> 
> Fixes: db1a0ae21461 ("drm/nouveau/bl: Assign different names to interfaces")
> Signed-off-by: Zhen Lei 
> ---
>  drivers/gpu/drm/nouveau/nouveau_backlight.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c 
> b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> index 72f35a2babcb20e..d1c998e645fb4b6 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> @@ -51,8 +51,9 @@ static bool
>  nouveau_get_backlight_name(char backlight_name[BL_NAME_SIZE],
>  struct nouveau_backlight *bl)
>  {
> - const int nb = ida_simple_get(_ida, 0, 0, GFP_KERNEL);
> - if (nb < 0 || nb >= 100)
> + int nb = ida_simple_get(_ida, 0, 100, GFP_KERNEL);
> +
> + if (nb < 0)
>   return false;
>   if (nb > 0)
>   snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
> -- 
> 2.26.0.106.g9fadedd
> 
> 
> ___
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [PATCH v2 2/2] drm/nouveau: Fix error return code in nouveau_backlight_init()

2021-05-12 Thread Pierre Moreau
Reviewed-by: Pierre Moreau 

On 2021-05-11 — 16:28, Zhen Lei wrote:
> Fix to return a negative error code from the error handling case instead
> of 0, as done elsewhere in this function.
> 
> Fixes: db1a0ae21461 ("drm/nouveau/bl: Assign different names to interfaces")
> Suggested-by: Pierre Moreau 
> Signed-off-by: Zhen Lei 
> ---
>  drivers/gpu/drm/nouveau/nouveau_backlight.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c 
> b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> index d1c998e645fb4b6..f0856adbe775624 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c
> @@ -47,20 +47,20 @@ struct nouveau_backlight {
>   int id;
>  };
>  
> -static bool
> +static int
>  nouveau_get_backlight_name(char backlight_name[BL_NAME_SIZE],
>  struct nouveau_backlight *bl)
>  {
>   int nb = ida_simple_get(_ida, 0, 100, GFP_KERNEL);
>  
>   if (nb < 0)
> - return false;
> + return nb;
>   if (nb > 0)
>   snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight%d", nb);
>   else
>   snprintf(backlight_name, BL_NAME_SIZE, "nv_backlight");
>   bl->id = nb;
> - return true;
> + return 0;
>  }
>  
>  static int
> @@ -273,7 +273,8 @@ nouveau_backlight_init(struct drm_connector *connector)
>   if (!bl)
>   return -ENOMEM;
>  
> - if (!nouveau_get_backlight_name(backlight_name, bl)) {
> + ret = nouveau_get_backlight_name(backlight_name, bl);
> + if (ret) {
>   NV_ERROR(drm, "Failed to retrieve a unique name for the 
> backlight interface\n");
>   goto fail_alloc;
>   }
> -- 
> 2.26.0.106.g9fadedd
> 
> 
> ___
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau