From patchwork Mon Jan 8 09:20:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 185869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp910371dyq; Mon, 8 Jan 2024 01:22:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfMlF4+U9WlGXnbRqKpJHaohY23gIk9drmtGvwsWwyuoIUlf1CpGUfcNhmW2nm4jdi6LCx X-Received: by 2002:a05:620a:144c:b0:783:1512:20bf with SMTP id i12-20020a05620a144c00b00783151220bfmr3319066qkl.144.1704705752274; Mon, 08 Jan 2024 01:22:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704705752; cv=none; d=google.com; s=arc-20160816; b=dJ8hRP0ZaerhNPg2eEnCXlRlFvmm2DrePOZEDSmwLtjX49VpogtyvK7UwzCnlEBbyg sQM7lf/j6AbmqX/ap8g52MZoi4IELtpCB05bVxSsOy3fy+nD6sIqsZ9RrX2UanXUsIcv fjHyFi2z4MSRf74CBqWxPZFd2249AUQCn3Uj9quyO3bk2S7vT3zi1dnZRWzi5EV/tK3i sG88RveUIv/A8011WGp7NDrYr3Ze3GwOXZ4+SpLMFiNYLczdddXcfdv9NM9z/fm6ennX Qb3KYKs3mIOlg2tG+HVTvaW4+3HbY8NEqQY1Q/RLwarWcIOayBK8CSoUIqsXU7WQui5y CIFw== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=arbdXlZxmXJOFEKJF2R1zNrEF3q6fd9QYRmRT41BVKs=; fh=L/75A92C4r6s7p0wl3tLaypnglq6P35gl2qn6oQwgpg=; b=nZJXZLtH47cQUnT9e5/pNe88D3n+PCeuoGlEeunnGgTDTo9AOvaGLOxS9diylD5n1o pEbIFCGVnbBqyRoSkycPVMK/c1n1KyOuAF41I/tAb2cwXy0FUm3NN9hhQ6FldYdWyBve TaWRyvDVjH5Ylmi4urylgAfSGvjeagKWmNXjtRq0oE+2wRTKuw3SN25iet33W4rTwOEN iFYhugqTynTiZ/u2p/3wyBHHyR1yP65i9QcTbEmjTkASON8dE2cu1h+MvHY/ZhU0lTHN iy+v4ds7cP7syHEbwDaRGtzVhABHoUGybO67tPm/BYi4q+0kgRF/rMdQRnyZ5VS8o923 Oh1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TQJb9I9j; spf=pass (google.com: domain of linux-kernel+bounces-19271-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19271-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m14-20020ae9e00e000000b0078321dbb29fsi1783333qkk.11.2024.01.08.01.22.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:22:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19271-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TQJb9I9j; spf=pass (google.com: domain of linux-kernel+bounces-19271-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19271-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 02C4B1C21E01 for ; Mon, 8 Jan 2024 09:22:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47C951428A; Mon, 8 Jan 2024 09:21:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TQJb9I9j" 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 433EC13FED for ; Mon, 8 Jan 2024 09:21:02 +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=1704705662; 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: in-reply-to:in-reply-to:references:references; bh=arbdXlZxmXJOFEKJF2R1zNrEF3q6fd9QYRmRT41BVKs=; b=TQJb9I9j6/7hbwQeb/wFmek7SeqDCADNKmhpbpxgdYsECjU4rh6MA2/n6a5WqASn9IdgAp BZGj5gErIt2AVELcLkDafrKu/lRvKZjuxAJAzyegXZkDfHuUW/23lsXCOhVI5QdzOD5psX Uv2umGx9a0cLB+yEsQAxOZkN19WIgWg= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-350-6LY5NC2iP8mqumGGCBsoxA-1; Mon, 08 Jan 2024 04:20:55 -0500 X-MC-Unique: 6LY5NC2iP8mqumGGCBsoxA-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-42989eb8897so2846731cf.0 for ; Mon, 08 Jan 2024 01:20:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704705655; x=1705310455; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=arbdXlZxmXJOFEKJF2R1zNrEF3q6fd9QYRmRT41BVKs=; b=JpYF09Qia3T10pHXTfMzCk8NMDJqexfwJzyO6PXBNyRwEXMwhcIBdb94i8GxQcYt1s 2zTw6Na3cYVgl3hb2vFw997gCKLrrH/iEzjVMK8Adzg0I6NjLS4oANXbc4DR9VS67GMr NSgymJuoJ+gMH679G5ajAAMA8yFGAE3TVB11cFXz4yFDAwy/epeyE7rvSQEMCavIxt+V zFhlTaOIJ+WTPOxlQVRDkRYhJaH1yr8ibmATzai1+z9TlpIAi5jB6ebSPJQgrRqelGlc +BQ1Lx5Q74KXyaiBiZ1+7QpwiTv/JWuMuuNL+YG1ui8YMP1UGVg4fgw2FAkIV36PiEXE kGCA== X-Gm-Message-State: AOJu0Yy6sQXrZ759Ly8bU9at68fYru8NuJdHEI9TrXTNqsc+JaME8L5M 9YeL0ukuN+BGm2PwW9lqdMXEX+4uiHP6mgydoybnpohUsU8ug7WBEKXaQuxls+hvtp7AT68tCy9 xZfS1C1Kc7Qxob+GDghASX4Pzco6NVWqV X-Received: by 2002:a05:6214:19c5:b0:67f:4c05:4d34 with SMTP id j5-20020a05621419c500b0067f4c054d34mr6990908qvc.5.1704705655233; Mon, 08 Jan 2024 01:20:55 -0800 (PST) X-Received: by 2002:a05:6214:19c5:b0:67f:4c05:4d34 with SMTP id j5-20020a05621419c500b0067f4c054d34mr6990895qvc.5.1704705654917; Mon, 08 Jan 2024 01:20:54 -0800 (PST) Received: from pstanner-thinkpadt14sgen1.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id dm4-20020ad44e24000000b00680613267d5sm2732554qvb.115.2024.01.08.01.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:20:54 -0800 (PST) From: Philipp Stanner To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Laurentiu Palcu , Lucas Stach , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Mark Brown , Takashi Iwai , David Gow , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Philipp Stanner Subject: [PATCH v2 1/2] platform_device: add devres function region-reqs Date: Mon, 8 Jan 2024 10:20:42 +0100 Message-ID: <20240108092042.16949-3-pstanner@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240108092042.16949-2-pstanner@redhat.com> References: <20240108092042.16949-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787513538780569078 X-GMAIL-MSGID: 1787513538780569078 Some drivers want to use (request) a region exclusively but nevertheless create several mappings within that region. Currently, there is no managed devres function to request a region without mapping it. Add the function devm_platform_get_resource(). Signed-off-by: Philipp Stanner --- drivers/base/platform.c | 38 +++++++++++++++++++++++++++++++++ include/linux/platform_device.h | 3 +++ 2 files changed, 41 insertions(+) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 10c577963418..7b29e6da31ae 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -82,6 +82,44 @@ struct resource *platform_get_mem_or_io(struct platform_device *dev, } EXPORT_SYMBOL_GPL(platform_get_mem_or_io); +/** + * devm_platform_get_and_request_resource - get and request a resource + * + * @pdev: the platform device to get the resource from + * @type: resource type (either IORESOURCE_MEM or IORESOURCE_IO) + * @num: resource index + * @name: name to be associated with the request + * + * Return: a pointer to the resource on success, an ERR_PTR on failure. + * + * Gets a resource and requests it. Use this instead of + * devm_platform_ioremap_resource() only if you have to create several single + * mappings with devm_ioremap(). + */ +struct resource *devm_platform_get_and_request_resource( + struct platform_device *pdev, unsigned int type, + unsigned int num, const char *name) +{ + struct resource *res; + + res = platform_get_resource(pdev, type, num); + if (!res) + return ERR_PTR(-EINVAL); + + if (type & IORESOURCE_MEM) + res = devm_request_mem_region(&pdev->dev, res->start, res->end, name); + else if (type & IORESOURCE_IO) + res = devm_request_region(&pdev->dev, res->start, res->end, name); + else + return ERR_PTR(-EINVAL); + + if (!res) + return ERR_PTR(-EBUSY); + + return res; +} +EXPORT_SYMBOL_GPL(devm_platform_get_and_request_resource); + #ifdef CONFIG_HAS_IOMEM /** * devm_platform_get_and_ioremap_resource - call devm_ioremap_resource() for a diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 7a41c72c1959..44e4ba930d5f 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -59,6 +59,9 @@ extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); extern struct resource *platform_get_mem_or_io(struct platform_device *, unsigned int); +extern struct resource *devm_platform_get_and_request_resource( + struct platform_device *pdev, unsigned int type, + unsigned int num, const char *name); extern struct device * platform_find_device_by_driver(struct device *start, From patchwork Mon Jan 8 09:20:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 185868 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp910331dyq; Mon, 8 Jan 2024 01:22:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGlAHKJ3GpVKc84MNA6cPniDnhVJyoBI9KqM0PvAUXwLWw+5lB3DPU+9Cd8Y0YpbA2hdnBk X-Received: by 2002:a50:c012:0:b0:557:ba20:17c with SMTP id r18-20020a50c012000000b00557ba20017cmr411307edb.42.1704705744186; Mon, 08 Jan 2024 01:22:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704705744; cv=none; d=google.com; s=arc-20160816; b=g5Mb42cSbHhSvSvH8SAhe+siChcWOdHvXL7PT5dxSuwSX/5YZ5YpeeJ4LtIKAWo0IH PKA1tgEzXf93NXFxNSqUkvltQNQo77VUzgexpunOOzWGGiCpRbg34kSWSro1rAnz5HI7 ZBg7S90b3gLImtlz22X53m8j+lFIJhdZmjmsDheWEPC/V11f87JLLAJLMqk+MAKLG+S4 KaYUVFMaXk8zhwkmW69AIIycKbLoYN4JksRexIFHHDdt6ixBQNZZnXW/owJwf6OL3GcM rb3oa3aLKnP5WqeGausfw3rkkDUxCUo8s2plHBkWjM80roGvh7oifoUQ9JBz8SCGUFNU iCRQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OT2gYV6QW0aw9hDO4YgXL/qxcf2YqqLjTuz//C31W+E=; fh=L/75A92C4r6s7p0wl3tLaypnglq6P35gl2qn6oQwgpg=; b=U1xNM8Y45KMo1GMecKGr8xNd+lTUJeAPkVdtjvKZ2M4rV8PYGpzi1ayq1zGwGmJ9yh H5TYdDJV0tyN1myadHv/qzMD1Ym3HWaftuOplQeZPyt6RnQCCXfCA7pZo6YieTWztvVb afk/dBvYSZA76R4o9YYDIjlO7jAHikIMRiHdZtKOyKGMy+kvBtr3saGPda8b/RGg8O3y wLTWKm5BhSrMmoTIRsZpNnI9ingf+/02G7871XjPETPFEQyPeBlEveanT+EyNLv6UjzW atjJ55aNKVAh7gSqakvtIZcX+0JrtyNukyMc4T/Pi/lZrpIgxfnajDJjtTKgJRIz3TkD 2dOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V18Xy4s4; spf=pass (google.com: domain of linux-kernel+bounces-19270-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19270-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t26-20020a508d5a000000b00554af4ee5eesi2924494edt.427.2024.01.08.01.22.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:22:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19270-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V18Xy4s4; spf=pass (google.com: domain of linux-kernel+bounces-19270-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19270-ouuuleilei=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 C43F11F2114F for ; Mon, 8 Jan 2024 09:22:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A65CA1401D; Mon, 8 Jan 2024 09:21:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V18Xy4s4" 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 A67E313FF0 for ; Mon, 8 Jan 2024 09:21:01 +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=1704705660; 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: in-reply-to:in-reply-to:references:references; bh=OT2gYV6QW0aw9hDO4YgXL/qxcf2YqqLjTuz//C31W+E=; b=V18Xy4s4kkGU14mVBIc4ecoafU1JKsRJXFIujoOwJVudg2ulJeDLJiaw1V+K9wD3+6DgEy HV3HhNTe8DpsnOe+jcyKfcX3C/Qvso+sJToXmBg9xXUup2q3PXEqwiREO++bUY3y38k5yO rb4xyJuXBhqyy1EfBZLvU/GHfzBzHPM= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-534-XRVMqmm8PHyN0kdktVEbxg-1; Mon, 08 Jan 2024 04:20:58 -0500 X-MC-Unique: XRVMqmm8PHyN0kdktVEbxg-1 Received: by mail-oi1-f197.google.com with SMTP id 5614622812f47-3bbbfe871afso426519b6e.1 for ; Mon, 08 Jan 2024 01:20:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704705658; x=1705310458; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OT2gYV6QW0aw9hDO4YgXL/qxcf2YqqLjTuz//C31W+E=; b=uMnB9mfJ7Es/B00zsPmF48K7ORVEG8+tGwK7RqyvkK6qw+la0SgIlrjNtk9V86QG+r 1YUlB4bhofVa46Bkg3/IQTBObPGDFFn8x3DuFM3/r7N7aeAoF4CzWckcPSyVuQRnjPw4 hlWbOdF7WCyMBKSR/MCma+HFFmw3PSNq7EpuLUdAQL6pwJjJm1h9+oSYJyCRUeh1rJLI cS7eg/OQoKA0wGtf4o/e4pHPskcOYbNOhQE+FixfolYbj/RDOb/19aKZR/5uhtxNMvzG ApMaTIdhNnG+ldVNtL5xeorWRH846AOqJAhgIsPzvcnjWcmn6obSDKsP5V9oBdU6r9zf x2iA== X-Gm-Message-State: AOJu0YwrGypazqGpXaeQN9kY/hbdsVWzYy/qGYs5Ag6fV5vq043rJGDB LhRa5xgj/3vmvc57pduBiBSaabDWil2NaXw1y7cwrj+qXwMsR3NEKr9ZYgkoYV/Z7ubj0WSL5Kq dFvVt+eGL+wB8ohz1q0DqQ+Hdadx7IUN5 X-Received: by 2002:a05:6808:b29:b0:3bd:1fe4:731d with SMTP id t9-20020a0568080b2900b003bd1fe4731dmr5145675oij.2.1704705658322; Mon, 08 Jan 2024 01:20:58 -0800 (PST) X-Received: by 2002:a05:6808:b29:b0:3bd:1fe4:731d with SMTP id t9-20020a0568080b2900b003bd1fe4731dmr5145658oij.2.1704705658009; Mon, 08 Jan 2024 01:20:58 -0800 (PST) Received: from pstanner-thinkpadt14sgen1.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id dm4-20020ad44e24000000b00680613267d5sm2732554qvb.115.2024.01.08.01.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 01:20:57 -0800 (PST) From: Philipp Stanner To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Laurentiu Palcu , Lucas Stach , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Mark Brown , Takashi Iwai , David Gow , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Philipp Stanner Subject: [PATCH v2 2/2] drm/dcss: request memory region Date: Mon, 8 Jan 2024 10:20:43 +0100 Message-ID: <20240108092042.16949-4-pstanner@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240108092042.16949-2-pstanner@redhat.com> References: <20240108092042.16949-2-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787513530468072294 X-GMAIL-MSGID: 1787513530468072294 The driver's memory regions are currently just ioremap()ed, but not reserved through a request. That's not a bug, but having the request is a little more robust. Implement the region-request through the corresponding managed devres-function. Signed-off-by: Philipp Stanner --- drivers/gpu/drm/imx/dcss/dcss-dev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c b/drivers/gpu/drm/imx/dcss/dcss-dev.c index 4f3af0dfb344..63dbb8d9c1b0 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-dev.c +++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c @@ -177,10 +177,11 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool hdmi_output) return ERR_PTR(-ENODEV); } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, "cannot get memory resource\n"); - return ERR_PTR(-EINVAL); + res = devm_platform_get_and_request_resource(pdev, IORESOURCE_MEM, + 0, "dcss"); + if (IS_ERR(res)) { + dev_err(dev, "cannot get / request memory resource\n"); + return res; } dcss = kzalloc(sizeof(*dcss), GFP_KERNEL);