From: jyri.sarha@iki.fi
To: "Philipp Stanner" <pstanner@redhat.com>,
"Jyri Sarha" <jyri.sarha@iki.fi>,
"Tomi Valkeinen" <tomi.valkeinen@ideasonboard.com>,
"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>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/tilcdc: request and mapp iomem with devres
Date: Thu, 28 Dec 2023 17:28:48 +0000 [thread overview]
Message-ID: <7fee3509faf9d134db2f537dccacbc1adf284cce@iki.fi> (raw)
December 22, 2023 at 1:52 PM, "Philipp Stanner" <pstanner@redhat.com mailto:pstanner@redhat.com?to=%22Philipp%20Stanner%22%20%3Cpstanner%40redhat.com%3E > wrote:
>
> tilcdc currently just ioremaps its iomem, without doing the (a bit more
> robust) request on the memory first. The devm_ functions provide a handy
> way to both request and ioremap the memory with automatic cleanup.
>
> Replace the manual ioremap with the devm_ version.
>
> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Reviewed-by: Jyri Sarha <jyri.sarha@iki.fi>
Tested-by: Jyri Sarha <jyri.sarha@iki.fi>
I'll apply this shortly to drm-misc-next.
Thanks,
Jyri
> ---
> drivers/gpu/drm/tilcdc/tilcdc_drv.c | 19 ++++---------------
> 1 file changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 8ebd7134ee21..2ad3f44a6e2d 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -182,9 +182,6 @@ static void tilcdc_fini(struct drm_device *dev)
> if (priv->clk)
> clk_put(priv->clk);
>
> - if (priv->mmio)
> - iounmap(priv->mmio);
> -
> if (priv->wq)
> destroy_workqueue(priv->wq);
>
> @@ -201,7 +198,6 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
> struct platform_device *pdev = to_platform_device(dev);
> struct device_node *node = dev->of_node;
> struct tilcdc_drm_private *priv;
> - struct resource *res;
> u32 bpp = 0;
> int ret;
>
> @@ -226,17 +222,10 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
> goto init_failed;
> }
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res) {
> - dev_err(dev, "failed to get memory resource\n");
> - ret = -EINVAL;
> - goto init_failed;
> - }
> -
> - priv->mmio = ioremap(res->start, resource_size(res));
> - if (!priv->mmio) {
> - dev_err(dev, "failed to ioremap\n");
> - ret = -ENOMEM;
> + priv->mmio = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(priv->mmio)) {
> + dev_err(dev, "failed to request / ioremap\n");
> + ret = PTR_ERR(priv->mmio);
> goto init_failed;
> }
>
> --
> 2.43.0
>
next reply other threads:[~2023-12-28 17:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-28 17:28 jyri.sarha [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-12-22 11:52 Philipp Stanner
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=7fee3509faf9d134db2f537dccacbc1adf284cce@iki.fi \
--to=jyri.sarha@iki.fi \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=pstanner@redhat.com \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tzimmermann@suse.de \
/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®