* [PATCH 03/24] drm/aspeed: Use managed drmm_mode_config_cleanup
[not found] <20200904143941.110665-1-daniel.vetter@ffwll.ch>
@ 2020-09-04 14:39 ` Daniel Vetter
2020-09-04 14:39 ` [PATCH 06/24] drm/xlnx: Use devm_drm_dev_alloc Daniel Vetter
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2020-09-04 14:39 UTC (permalink / raw)
To: DRI Development
Cc: linux-aspeed, Andrew Jeffery, Daniel Vetter,
Intel Graphics Development, Joel Stanley, Daniel Vetter,
Sam Ravnborg, linux-arm-kernel
Since aspeed doesn't use devm_kzalloc anymore we can use the managed
mode config cleanup.
v2: Keep call order as suggested by Sam.
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@aj.id.au>
Cc: linux-aspeed@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
index 903f4f304647..2b424b2b85cc 100644
--- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
+++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
@@ -63,15 +63,21 @@ static const struct drm_mode_config_funcs aspeed_gfx_mode_config_funcs = {
.atomic_commit = drm_atomic_helper_commit,
};
-static void aspeed_gfx_setup_mode_config(struct drm_device *drm)
+static int aspeed_gfx_setup_mode_config(struct drm_device *drm)
{
- drm_mode_config_init(drm);
+ int ret;
+
+ ret = drmm_mode_config_init(drm);
+ if (ret)
+ return ret;
drm->mode_config.min_width = 0;
drm->mode_config.min_height = 0;
drm->mode_config.max_width = 800;
drm->mode_config.max_height = 600;
drm->mode_config.funcs = &aspeed_gfx_mode_config_funcs;
+
+ return ret;
}
static irqreturn_t aspeed_gfx_irq_handler(int irq, void *data)
@@ -144,7 +150,9 @@ static int aspeed_gfx_load(struct drm_device *drm)
writel(0, priv->base + CRT_CTRL1);
writel(0, priv->base + CRT_CTRL2);
- aspeed_gfx_setup_mode_config(drm);
+ ret = aspeed_gfx_setup_mode_config(drm);
+ if (ret < 0)
+ return ret;
ret = drm_vblank_init(drm, 1);
if (ret < 0) {
@@ -179,7 +187,6 @@ static int aspeed_gfx_load(struct drm_device *drm)
static void aspeed_gfx_unload(struct drm_device *drm)
{
drm_kms_helper_poll_fini(drm);
- drm_mode_config_cleanup(drm);
}
DEFINE_DRM_GEM_CMA_FOPS(fops);
--
2.28.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 06/24] drm/xlnx: Use devm_drm_dev_alloc
[not found] <20200904143941.110665-1-daniel.vetter@ffwll.ch>
2020-09-04 14:39 ` [PATCH 03/24] drm/aspeed: Use managed drmm_mode_config_cleanup Daniel Vetter
@ 2020-09-04 14:39 ` Daniel Vetter
2020-09-07 8:22 ` [PATCH] " Daniel Vetter
1 sibling, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2020-09-04 14:39 UTC (permalink / raw)
To: DRI Development
Cc: Hyun Kwon, Daniel Vetter, Intel Graphics Development,
Michal Simek, Laurent Pinchart, Daniel Vetter, linux-arm-kernel
Gets rid of drmm_add_final_kfree, which I want to unexport so that it
stops confusion people about this transitional state of rolling drm
managed memory out.
This also fixes the missing drm_dev_put in the error path of the probe
code.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Hyun Kwon <hyun.kwon@xilinx.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
index 26328c76305b..80b8edd20442 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
@@ -208,27 +208,16 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)
int ret;
/* Allocate private data. */
- dpsub = kzalloc(sizeof(*dpsub), GFP_KERNEL);
- if (!dpsub)
- return -ENOMEM;
+ dpsub = devm_drm_dev_alloc(&pdev->dev, &zynqmp_dpsub_drm_driver,
+ struct zynqmp_dpsub, drm);
+ if (IS_ERR(dpsub))
+ return PTR_ERR(dpsub);
dpsub->dev = &pdev->dev;
platform_set_drvdata(pdev, dpsub);
dma_set_mask(dpsub->dev, DMA_BIT_MASK(ZYNQMP_DISP_MAX_DMA_BIT));
- /*
- * Initialize the DRM device early, as the DRM core mandates usage of
- * the managed memory helpers tied to the DRM device.
- */
- ret = drm_dev_init(&dpsub->drm, &zynqmp_dpsub_drm_driver, &pdev->dev);
- if (ret < 0) {
- kfree(dpsub);
- return ret;
- }
-
- drmm_add_final_kfree(&dpsub->drm, dpsub);
-
/* Try the reserved memory. Proceed if there's none. */
of_reserved_mem_device_init(&pdev->dev);
@@ -286,8 +275,6 @@ static int zynqmp_dpsub_remove(struct platform_device *pdev)
clk_disable_unprepare(dpsub->apb_clk);
of_reserved_mem_device_release(&pdev->dev);
- drm_dev_put(drm);
-
return 0;
}
--
2.28.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] drm/xlnx: Use devm_drm_dev_alloc
2020-09-04 14:39 ` [PATCH 06/24] drm/xlnx: Use devm_drm_dev_alloc Daniel Vetter
@ 2020-09-07 8:22 ` Daniel Vetter
2020-09-08 19:16 ` Hyun Kwon
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2020-09-07 8:22 UTC (permalink / raw)
To: Intel Graphics Development, DRI Development
Cc: Hyun Kwon, Daniel Vetter, Michal Simek, Laurent Pinchart,
Daniel Vetter, linux-arm-kernel
Gets rid of drmm_add_final_kfree, which I want to unexport so that it
stops confusion people about this transitional state of rolling drm
managed memory out.
This also fixes the missing drm_dev_put in the error path of the probe
code.
v2: Drop the misplaced drm_dev_put from zynqmp_dpsub_drm_init (all
other paths leaked on error, this should have been in
zynqmp_dpsub_probe), now that subsumed by the auto-cleanup of
devm_drm_dev_alloc.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Hyun Kwon <hyun.kwon@xilinx.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: linux-arm-kernel@lists.infradead.org
---
drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 27 ++++++---------------------
1 file changed, 6 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
index 26328c76305b..8e69303aad3f 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
@@ -111,7 +111,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
/* Initialize mode config, vblank and the KMS poll helper. */
ret = drmm_mode_config_init(drm);
if (ret < 0)
- goto err_dev_put;
+ return ret;
drm->mode_config.funcs = &zynqmp_dpsub_mode_config_funcs;
drm->mode_config.min_width = 0;
@@ -121,7 +121,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
ret = drm_vblank_init(drm, 1);
if (ret)
- goto err_dev_put;
+ return ret;
drm->irq_enabled = 1;
@@ -154,8 +154,6 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
err_poll_fini:
drm_kms_helper_poll_fini(drm);
-err_dev_put:
- drm_dev_put(drm);
return ret;
}
@@ -208,27 +206,16 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)
int ret;
/* Allocate private data. */
- dpsub = kzalloc(sizeof(*dpsub), GFP_KERNEL);
- if (!dpsub)
- return -ENOMEM;
+ dpsub = devm_drm_dev_alloc(&pdev->dev, &zynqmp_dpsub_drm_driver,
+ struct zynqmp_dpsub, drm);
+ if (IS_ERR(dpsub))
+ return PTR_ERR(dpsub);
dpsub->dev = &pdev->dev;
platform_set_drvdata(pdev, dpsub);
dma_set_mask(dpsub->dev, DMA_BIT_MASK(ZYNQMP_DISP_MAX_DMA_BIT));
- /*
- * Initialize the DRM device early, as the DRM core mandates usage of
- * the managed memory helpers tied to the DRM device.
- */
- ret = drm_dev_init(&dpsub->drm, &zynqmp_dpsub_drm_driver, &pdev->dev);
- if (ret < 0) {
- kfree(dpsub);
- return ret;
- }
-
- drmm_add_final_kfree(&dpsub->drm, dpsub);
-
/* Try the reserved memory. Proceed if there's none. */
of_reserved_mem_device_init(&pdev->dev);
@@ -286,8 +273,6 @@ static int zynqmp_dpsub_remove(struct platform_device *pdev)
clk_disable_unprepare(dpsub->apb_clk);
of_reserved_mem_device_release(&pdev->dev);
- drm_dev_put(drm);
-
return 0;
}
--
2.28.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/xlnx: Use devm_drm_dev_alloc
2020-09-07 8:22 ` [PATCH] " Daniel Vetter
@ 2020-09-08 19:16 ` Hyun Kwon
2020-09-11 8:47 ` Daniel Vetter
0 siblings, 1 reply; 5+ messages in thread
From: Hyun Kwon @ 2020-09-08 19:16 UTC (permalink / raw)
To: Daniel Vetter
Cc: Intel Graphics Development, DRI Development, Michal Simek,
Laurent Pinchart, Daniel Vetter, linux-arm-kernel
Hi Daniel,
On Mon, Sep 07, 2020 at 01:22:25AM -0700, Daniel Vetter wrote:
> Gets rid of drmm_add_final_kfree, which I want to unexport so that it
> stops confusion people about this transitional state of rolling drm
> managed memory out.
>
> This also fixes the missing drm_dev_put in the error path of the probe
> code.
>
> v2: Drop the misplaced drm_dev_put from zynqmp_dpsub_drm_init (all
> other paths leaked on error, this should have been in
> zynqmp_dpsub_probe), now that subsumed by the auto-cleanup of
> devm_drm_dev_alloc.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Hyun Kwon <hyun.kwon@xilinx.com>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: linux-arm-kernel@lists.infradead.org
Looks correct to me.
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Thanks!
-hyun
> ---
> drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 27 ++++++---------------------
> 1 file changed, 6 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> index 26328c76305b..8e69303aad3f 100644
> --- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> @@ -111,7 +111,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
> /* Initialize mode config, vblank and the KMS poll helper. */
> ret = drmm_mode_config_init(drm);
> if (ret < 0)
> - goto err_dev_put;
> + return ret;
>
> drm->mode_config.funcs = &zynqmp_dpsub_mode_config_funcs;
> drm->mode_config.min_width = 0;
> @@ -121,7 +121,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
>
> ret = drm_vblank_init(drm, 1);
> if (ret)
> - goto err_dev_put;
> + return ret;
>
> drm->irq_enabled = 1;
>
> @@ -154,8 +154,6 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
>
> err_poll_fini:
> drm_kms_helper_poll_fini(drm);
> -err_dev_put:
> - drm_dev_put(drm);
> return ret;
> }
>
> @@ -208,27 +206,16 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)
> int ret;
>
> /* Allocate private data. */
> - dpsub = kzalloc(sizeof(*dpsub), GFP_KERNEL);
> - if (!dpsub)
> - return -ENOMEM;
> + dpsub = devm_drm_dev_alloc(&pdev->dev, &zynqmp_dpsub_drm_driver,
> + struct zynqmp_dpsub, drm);
> + if (IS_ERR(dpsub))
> + return PTR_ERR(dpsub);
>
> dpsub->dev = &pdev->dev;
> platform_set_drvdata(pdev, dpsub);
>
> dma_set_mask(dpsub->dev, DMA_BIT_MASK(ZYNQMP_DISP_MAX_DMA_BIT));
>
> - /*
> - * Initialize the DRM device early, as the DRM core mandates usage of
> - * the managed memory helpers tied to the DRM device.
> - */
> - ret = drm_dev_init(&dpsub->drm, &zynqmp_dpsub_drm_driver, &pdev->dev);
> - if (ret < 0) {
> - kfree(dpsub);
> - return ret;
> - }
> -
> - drmm_add_final_kfree(&dpsub->drm, dpsub);
> -
> /* Try the reserved memory. Proceed if there's none. */
> of_reserved_mem_device_init(&pdev->dev);
>
> @@ -286,8 +273,6 @@ static int zynqmp_dpsub_remove(struct platform_device *pdev)
> clk_disable_unprepare(dpsub->apb_clk);
> of_reserved_mem_device_release(&pdev->dev);
>
> - drm_dev_put(drm);
> -
> return 0;
> }
>
> --
> 2.28.0
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/xlnx: Use devm_drm_dev_alloc
2020-09-08 19:16 ` Hyun Kwon
@ 2020-09-11 8:47 ` Daniel Vetter
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2020-09-11 8:47 UTC (permalink / raw)
To: Hyun Kwon
Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
Michal Simek, Laurent Pinchart, Daniel Vetter, linux-arm-kernel
On Tue, Sep 08, 2020 at 12:16:00PM -0700, Hyun Kwon wrote:
> Hi Daniel,
>
> On Mon, Sep 07, 2020 at 01:22:25AM -0700, Daniel Vetter wrote:
> > Gets rid of drmm_add_final_kfree, which I want to unexport so that it
> > stops confusion people about this transitional state of rolling drm
> > managed memory out.
> >
> > This also fixes the missing drm_dev_put in the error path of the probe
> > code.
> >
> > v2: Drop the misplaced drm_dev_put from zynqmp_dpsub_drm_init (all
> > other paths leaked on error, this should have been in
> > zynqmp_dpsub_probe), now that subsumed by the auto-cleanup of
> > devm_drm_dev_alloc.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Hyun Kwon <hyun.kwon@xilinx.com>
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Michal Simek <michal.simek@xilinx.com>
> > Cc: linux-arm-kernel@lists.infradead.org
>
> Looks correct to me.
>
> Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Merged all patches up to this one here to drm-misc-next.
-Daniel
>
> Thanks!
>
> -hyun
>
> > ---
> > drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 27 ++++++---------------------
> > 1 file changed, 6 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> > index 26328c76305b..8e69303aad3f 100644
> > --- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> > +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> > @@ -111,7 +111,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
> > /* Initialize mode config, vblank and the KMS poll helper. */
> > ret = drmm_mode_config_init(drm);
> > if (ret < 0)
> > - goto err_dev_put;
> > + return ret;
> >
> > drm->mode_config.funcs = &zynqmp_dpsub_mode_config_funcs;
> > drm->mode_config.min_width = 0;
> > @@ -121,7 +121,7 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
> >
> > ret = drm_vblank_init(drm, 1);
> > if (ret)
> > - goto err_dev_put;
> > + return ret;
> >
> > drm->irq_enabled = 1;
> >
> > @@ -154,8 +154,6 @@ static int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
> >
> > err_poll_fini:
> > drm_kms_helper_poll_fini(drm);
> > -err_dev_put:
> > - drm_dev_put(drm);
> > return ret;
> > }
> >
> > @@ -208,27 +206,16 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)
> > int ret;
> >
> > /* Allocate private data. */
> > - dpsub = kzalloc(sizeof(*dpsub), GFP_KERNEL);
> > - if (!dpsub)
> > - return -ENOMEM;
> > + dpsub = devm_drm_dev_alloc(&pdev->dev, &zynqmp_dpsub_drm_driver,
> > + struct zynqmp_dpsub, drm);
> > + if (IS_ERR(dpsub))
> > + return PTR_ERR(dpsub);
> >
> > dpsub->dev = &pdev->dev;
> > platform_set_drvdata(pdev, dpsub);
> >
> > dma_set_mask(dpsub->dev, DMA_BIT_MASK(ZYNQMP_DISP_MAX_DMA_BIT));
> >
> > - /*
> > - * Initialize the DRM device early, as the DRM core mandates usage of
> > - * the managed memory helpers tied to the DRM device.
> > - */
> > - ret = drm_dev_init(&dpsub->drm, &zynqmp_dpsub_drm_driver, &pdev->dev);
> > - if (ret < 0) {
> > - kfree(dpsub);
> > - return ret;
> > - }
> > -
> > - drmm_add_final_kfree(&dpsub->drm, dpsub);
> > -
> > /* Try the reserved memory. Proceed if there's none. */
> > of_reserved_mem_device_init(&pdev->dev);
> >
> > @@ -286,8 +273,6 @@ static int zynqmp_dpsub_remove(struct platform_device *pdev)
> > clk_disable_unprepare(dpsub->apb_clk);
> > of_reserved_mem_device_release(&pdev->dev);
> >
> > - drm_dev_put(drm);
> > -
> > return 0;
> > }
> >
> > --
> > 2.28.0
> >
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-11 8:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20200904143941.110665-1-daniel.vetter@ffwll.ch>
2020-09-04 14:39 ` [PATCH 03/24] drm/aspeed: Use managed drmm_mode_config_cleanup Daniel Vetter
2020-09-04 14:39 ` [PATCH 06/24] drm/xlnx: Use devm_drm_dev_alloc Daniel Vetter
2020-09-07 8:22 ` [PATCH] " Daniel Vetter
2020-09-08 19:16 ` Hyun Kwon
2020-09-11 8:47 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).