Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp741403rdb; Fri, 22 Dec 2023 03:52:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IELjCSpkpmLnjWVCRyIXTE/VgRIecI0b8uuefqx2bjo6IEeqCOFmazVC7Bc28omQu1yuPwZ X-Received: by 2002:a17:906:b80b:b0:a26:b036:9ca5 with SMTP id dv11-20020a170906b80b00b00a26b0369ca5mr574696ejb.84.1703245965726; Fri, 22 Dec 2023 03:52:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703245965; cv=none; d=google.com; s=arc-20160816; b=v/7d4rFMRUpkU7ja+vMGC3UaqxlZmfooilRELi2rMeJAX73ut05HLmrOpArOt5C6fS jSYUtskKaYs3wGsPIaAKvYB3/JEzKPXFCiLbENOoNi4F6LdDf5WRbk//oHjE1WX6XOXr f3/2CQNSKFKfAlQ7DQK80lKHGAfM/b1hQFQsR514OQGB4wxUH5RYY94lI2j5NPQyDz8u 5MzsNPlCa1/XAlti+Ocs98myJNN7e76HwiVtupk36p5h+z6WfIOefZW1jOnAKwTvLAMH YaoBAlHStcf77d8Qw8kP+SKWoxySufpespnZ4WmuTC9bcpNUrsXA+cfpRDllLL45SZmd x2/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=qeM/S/omrfSVhML5YUobmUmWfHTQ46GRH696mY5TNyo=; fh=KobvcnZebfMFXh88HzO2HTK5nxD/IFn9ZmF/AFKYi2s=; b=gaGu0FmDypEViKJE7EJhQMiXpmQgiYL/76yxn6dO8sKy1vlS+PDYY0WFcT7J5sqGPY IBOZ/ap3QQSHY2WyrVA8kaAamWJ4cKuLE722DqoL/EOIEsZce15zVsYeuV8tdG6628ZF OQ1yqC1+sel5iERjEA2/8VlVMnMbLLZ8vdzxvfNXuGbtiqLF3Qww3+EdAH9r7cBXkOYi jxwISE2GQSf7p2YM9QEMFIpOlqCjQkoGzr6oLrsSLQh5dBQ4BB52LgRF7W0lh41p3XX9 F44/B5mnpd3qIir1y59GFk0gkMz516fsB87V72Jjltnh3dW2TfvE4tjW1nzw7qYQn4B3 QsTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L1aPVIwz; spf=pass (google.com: domain of linux-kernel+bounces-9674-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9674-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gz15-20020a170906f2cf00b00a23513bdde0si1696639ejb.591.2023.12.22.03.52.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 03:52:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9674-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L1aPVIwz; spf=pass (google.com: domain of linux-kernel+bounces-9674-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9674-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7D8BF1F2427C for ; Fri, 22 Dec 2023 11:52:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60A2B17985; Fri, 22 Dec 2023 11:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="L1aPVIwz" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 47EB217751 for ; Fri, 22 Dec 2023 11:52:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703245954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=qeM/S/omrfSVhML5YUobmUmWfHTQ46GRH696mY5TNyo=; b=L1aPVIwzO/ys5wDIMmHz9LQoFWLrFYgsjIhMzZk+zlYp3Tvdgm46um1vpofoJk+sDCEnT2 ZhdkHGCpGE2cW2+E28/PS98Jkx/RHm8/UMHn5X7jYxutraI5rsBQXRNiaohIAWQUQtqqEM VyjEqJ0iYzw26u/n3/FnPmWhQG/EkVk= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-356-xX47TCWlMr-TndOBd4kxoA-1; Fri, 22 Dec 2023 06:52:32 -0500 X-MC-Unique: xX47TCWlMr-TndOBd4kxoA-1 Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-50e3288601bso342676e87.1 for ; Fri, 22 Dec 2023 03:52:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703245951; x=1703850751; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qeM/S/omrfSVhML5YUobmUmWfHTQ46GRH696mY5TNyo=; b=k+McB1ygvn0wKPhY6V2v7yqiJ3QROkAbTSawQHbyghBRB38YKeGER2WlRPPsLVLp9+ tXusT7AjXOGwt9d+UXarry2ef1nNpYuO7syJTn32k+kEqn4FoT55bbHn0UGEpLki4BVd N3ejzdlyJcXSlRCbKIEBx3DgMXBS5QE7A0+kVNv9o93sgP7RDI6BTlxU30p28QB5InpS cSKReiA0p0e69TQxudyAr9nsZAGD0Dkd67aMJL1d711WQ9oW+WjMO6ILG7wqD+4whvkF c4rofYW2UTH8PVUOqW+qkEhltZIZAhgOhT4rQSahjD/Ij+lZjub/VHTgkEuqv6VMJyuy hgsQ== X-Gm-Message-State: AOJu0Yz50tgeR1TVLCzEORLlUBvTKagkQkkxju5lkOHqZYeRIH324xVT It+wd9mvG4yU3K44hQtoSUc9zzf+LcGmVJ+KAvsA/gqYbMe7XSht20l973mWc6oK08kdPm1X3gM d1l/js0HiWyGoA8XZj5kKzKV7Q8MIzMc6 X-Received: by 2002:a05:6512:3127:b0:50e:2460:d703 with SMTP id p7-20020a056512312700b0050e2460d703mr1361168lfd.0.1703245951143; Fri, 22 Dec 2023 03:52:31 -0800 (PST) X-Received: by 2002:a05:6512:3127:b0:50e:2460:d703 with SMTP id p7-20020a056512312700b0050e2460d703mr1361141lfd.0.1703245950241; Fri, 22 Dec 2023 03:52:30 -0800 (PST) Received: from pstanner-thinkpadt14sgen1.remote.csb ([2001:9e8:32ea:8600:227b:d2ff:fe26:2a7a]) by smtp.gmail.com with ESMTPSA id h8-20020a05600c314800b003fee6e170f9sm6602732wmo.45.2023.12.22.03.52.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 03:52:29 -0800 (PST) From: Philipp Stanner To: 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, Philipp Stanner Subject: [PATCH] drm/tilcdc: request and mapp iomem with devres Date: Fri, 22 Dec 2023 12:52:17 +0100 Message-ID: <20231222115216.19218-2-pstanner@redhat.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Philipp Stanner --- 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