Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4091978rdb; Thu, 28 Dec 2023 09:46:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IESJeXN9O/AQVhTcwzZnKPP0E3Va79VmhbQAWtRBdXo6Rrf1hLk1ioGsLE+4Mio6iYDaZ7B X-Received: by 2002:a05:6a20:914f:b0:18b:92b3:7c80 with SMTP id x15-20020a056a20914f00b0018b92b37c80mr14247610pzc.22.1703785612946; Thu, 28 Dec 2023 09:46:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703785612; cv=none; d=google.com; s=arc-20160816; b=fpB4wgMffbSiWuLSI145gPiw3XLks7cvY5MsujnSxD4VaiuFSdQ85VqLh6qwp/jyP6 Ga7WBFyI1P9W5oGTVm3UTEouqWp9VHqVKfK8ufvHvc4XVxpqPCRTsyhnBtdMhvAdFIb8 yXXrE5hOV/Gs2xs58GfM889mWliS9j920Jb7d5kRWqjcCbcSz7DPtbt35r2s5ARvLiNT JCSbhxvnBXgeA/xmWjR1AI9nenTcBftQEt3ZYuC4GOoQJB48ddHxgUqTGPCDQdVm/crx 5ruNYJwuYx+P96DIy+mtIF7dCFW1gd26WTxbeDAVEqFJ9fMrjTPNwp7NoU2bFPNFxpTS mF/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:references:cc:to:message-id:from:content-transfer-encoding :date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:dkim-signature; bh=rtDkFjG4UEMR0PjUgaZp0uUgO7ggIMJp7j+YKLSw+8k=; fh=3Jkwj+KPauj4B5yl24mxX7a3W3nCG2RZmMZ5qRG6U1E=; b=YHrSCPz+osWU/Bask4p6C9ZwUCoWhqrvIEyvy/b7RPFeaCAwBkA1W2PiIUcfTAnZ65 yHTsMAV2t5lvf6aVbENWzLoObl5GCk50dRzitbX8jbSYVRoXfDM39DuFH+Ock8fMhUEn x8OL2eiteOkLyKL4bVkUAPLPmhgS4imN8ZXokLnLf/JY95D3nUzdt9U61kyoYdYbRUFZ PWKSUALLwNmUDxmwUWLBr2rTqlyTO/X880lz6dgt6ccRiRSmR2LZintsbqUlNhwisgiU z2/6dK3rISw0dKPTt+TGWE8wq3xGKIN4xovhGzrlscWgJyNtcW784OXo4npc9THygrbx i07g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kapsi.fi header.s=20161220 header.b=EMk2cQCx; spf=pass (google.com: domain of linux-kernel+bounces-12819-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12819-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p20-20020a056a000b5400b006d9c8c29904si6012567pfo.184.2023.12.28.09.46.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 09:46:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12819-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=fail header.i=@kapsi.fi header.s=20161220 header.b=EMk2cQCx; spf=pass (google.com: domain of linux-kernel+bounces-12819-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12819-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 851F1B2119F for ; Thu, 28 Dec 2023 17:46:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 008EA101D8; Thu, 28 Dec 2023 17:46:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kapsi.fi header.i=@kapsi.fi header.b="EMk2cQCx" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.kapsi.fi (mail.kapsi.fi [91.232.154.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54F70101C2 for ; Thu, 28 Dec 2023 17:46:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iki.fi Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kapsi.fi DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=Subject:References:Cc:To:Message-ID:From: Content-Transfer-Encoding:Content-Type:Date:MIME-Version:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rtDkFjG4UEMR0PjUgaZp0uUgO7ggIMJp7j+YKLSw+8k=; b=EMk2cQCxOyGl3ud6E2QSBNpsyl YybtKOq0s6fvIEUSWx29MjsK/CAO3w8TnHPxITIoQBk+w5RyHRXbWeQ71GpjmYNwMig834VXmyIgF SPDABDCAyA3UkRQZLETn+mNQOo1xEfCTXw1rRoohNhEG9V3IFfqqpOptkj7h/CqHPnlYO0Y3dCu52 k9ZfP0WaC7KPxabv3Rw40hR/xv/vRBhAbvSwgpamLokFaLJB68PW6UK+TDWPuf+nCEG8hNX98Ph5t 10CbLOvUyaSybjlOqnqPle04j0DF+sjOFczcwjAwlN9KMmjsira17D/TeJPKCq5ya+Wgue8znJ/X9 Ga4FcBHA==; Received: from [2001:67c:1be8::200] (helo=rainloop.kapsi.fi) by mail.kapsi.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rIuBc-008JHs-19; Thu, 28 Dec 2023 19:28:48 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Thu, 28 Dec 2023 17:28:48 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: jyri.sarha@iki.fi Message-ID: <7fee3509faf9d134db2f537dccacbc1adf284cce@iki.fi> To: "Philipp Stanner" , "Jyri Sarha" , "Tomi Valkeinen" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Daniel Vetter" Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: undefined X-SA-Exim-Connect-IP: 2001:67c:1be8::200 X-SA-Exim-Mail-From: jyri.sarha@iki.fi X-Spam-Level: Subject: Re: [PATCH] drm/tilcdc: request and mapp iomem with devres X-SA-Exim-Version: 4.2.1 (built Wed, 06 Jul 2022 17:57:39 +0000) X-SA-Exim-Scanned: Yes (on mail.kapsi.fi) December 22, 2023 at 1:52 PM, "Philipp Stanner" wrote: >=20 >=20tilcdc currently just ioremaps its iomem, without doing the (a bit mo= re > robust) request on the memory first. The devm_ functions provide a hand= y > way to both request and ioremap the memory with automatic cleanup. >=20 >=20Replace the manual ioremap with the devm_ version. >=20 >=20Suggested-by: Thomas Zimmermann > Signed-off-by: Philipp Stanner Reviewed-by: Jyri Sarha Tested-by: Jyri Sarha 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(-) >=20 >=20diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/ti= lcdc/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); >=20 >=20- if (priv->mmio) > - iounmap(priv->mmio); > - > if (priv->wq) > destroy_workqueue(priv->wq); >=20 >=20@@ -201,7 +198,6 @@ static int tilcdc_init(const struct drm_driver *d= drv, struct device *dev) > struct platform_device *pdev =3D to_platform_device(dev); > struct device_node *node =3D dev->of_node; > struct tilcdc_drm_private *priv; > - struct resource *res; > u32 bpp =3D 0; > int ret; >=20 >=20@@ -226,17 +222,10 @@ static int tilcdc_init(const struct drm_driver = *ddrv, struct device *dev) > goto init_failed; > } >=20 >=20- res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); > - if (!res) { > - dev_err(dev, "failed to get memory resource\n"); > - ret =3D -EINVAL; > - goto init_failed; > - } > - > - priv->mmio =3D ioremap(res->start, resource_size(res)); > - if (!priv->mmio) { > - dev_err(dev, "failed to ioremap\n"); > - ret =3D -ENOMEM; > + priv->mmio =3D devm_platform_ioremap_resource(pdev, 0); > + if (IS_ERR(priv->mmio)) { > + dev_err(dev, "failed to request / ioremap\n"); > + ret =3D PTR_ERR(priv->mmio); > goto init_failed; > } >=20 >=20--=20 >=202.43.0 >