From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F04C6C55ABD for ; Fri, 13 Nov 2020 07:04:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8D1C221E9 for ; Fri, 13 Nov 2020 07:04:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726112AbgKMHES (ORCPT ); Fri, 13 Nov 2020 02:04:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726276AbgKMHES (ORCPT ); Fri, 13 Nov 2020 02:04:18 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C43C2C0613D6 for ; Thu, 12 Nov 2020 23:04:16 -0800 (PST) Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdT7e-0002r8-3x; Fri, 13 Nov 2020 08:03:50 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kdT7Z-0004f0-FQ; Fri, 13 Nov 2020 08:03:45 +0100 Date: Fri, 13 Nov 2020 08:03:43 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Thierry Reding Cc: alexandre.belloni@bootlin.com, heiko@sntech.de, Yangtao Li , nicolas.ferre@microchip.com, matthias.bgg@gmail.com, linux-riscv@lists.infradead.org, festevam@gmail.com, f.fainelli@gmail.com, shc_work@mail.ru, khilman@baylibre.com, ludovic.desroches@microchip.com, jonathanh@nvidia.com, linux-rockchip@lists.infradead.org, wens@csie.org, bcm-kernel-feedback-list@broadcom.com, linux-imx@nxp.com, slemieux.tyco@gmail.com, linux-pwm@vger.kernel.org, rjui@broadcom.com, s.hauer@pengutronix.de, mripard@kernel.org, vz@mleia.com, linux-mediatek@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, paul.walmsley@sifive.com, linux-tegra@vger.kernel.org, linux-amlogic@lists.infradead.org, Lee Jones , linux-arm-kernel@lists.infradead.org, sbranden@broadcom.com, linux-kernel@vger.kernel.org, palmer@dabbelt.com, kernel@pengutronix.de, shawnguo@kernel.org, claudiu.beznea@microchip.com, nsaenzjulienne@suse.de, Bartosz Golaszewski , Greg Kroah-Hartman , Andy Shevchenko , Linus Walleij Subject: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource] Message-ID: <20201113070343.lhcsbyvi5baxn3lq@pengutronix.de> References: <20191229080610.7597-1-tiny.windzz@gmail.com> <20201112161346.gp5nenuagx5wmwl2@pengutronix.de> <20201112190649.GA908613@ulmo> <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bfm7upvbg2x7q3rm" Content-Disposition: inline In-Reply-To: <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-tegra@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org --bfm7upvbg2x7q3rm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, [Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo] On Thu, Nov 12, 2020 at 10:14:29PM +0100, Uwe Kleine-K=F6nig wrote: > On Thu, Nov 12, 2020 at 08:06:49PM +0100, Thierry Reding wrote: > > I also think that it's overly narrow is scope, so you can't actually > > "blindly" use this helper and I've seen quite a few cases where this was > > unknowingly used for cases where it shouldn't have been used and then > > broke things (because some drivers must not do the request_mem_region() > > for example). >=20 > You have a link to such an accident? I got a hint in private here: https://lore.kernel.org/r/1555670144-24220-1-= git-send-email-aisheng.dong@nxp.com devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap(). IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().) So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap() and devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity? Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --bfm7upvbg2x7q3rm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl+uL8wACgkQwfwUeK3K 7AmhFQf/UMY3Z/O4ajFXsCh5aeqAW1EKy0wv+YtVLmLASYlkvBQ5OpoaFH6U7oZY a1BVjZ2I3q3pi1zMs+2dPAkylNi0VEIERvwncqHOfYN4FjdNsI85rKbxu4DNsWHJ wlaQxLwmUmDXDESpJ4RN8JqF/V/nPZfj/4V52ANK31PZ+i4fYnIlW6TU0cJwoJ9s aGSM2QwTb27uaRg5hqZqfOyIkt3wwkDJIF65H/vi64r0Gtm3c+0iKbEmlXr2XZCh APhFgQQDGFOMXdSBZeFxTtuLCzuG/RA3Fxb+7okleZUL6GrSwq7xWHJGorO136kq mo88jw2ceYf/qJA9E4atasOfbQUtlg== =gJ1m -----END PGP SIGNATURE----- --bfm7upvbg2x7q3rm-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0ADE1C55ABD for ; Fri, 13 Nov 2020 07:04:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 728BB2137B for ; Fri, 13 Nov 2020 07:04:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jZCEoRkl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 728BB2137B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=swAtYGLZo7pkc7lSklyAwSzN6gnAFu1SOxgwy00B4kA=; b=jZCEoRklHz9VCHBnzVXb2+HXg sBDPzkFPJt0Bu51iY5MSiRcC/6NhWD/SJtYzijdW3ZQ741byLJOqYWXYkH7/rmnjKBj2qN3GHVfRC kBavpjgIYiiRtfPKdQWY5RWqkYQZP4OBnaXm32Sme+1z51jXc57iAF+x4VbF9zVJHa9w59K2j/5Jm VxHgrglqENYx6O7gZ4JGa4aqndzS0L11Z203FEPm3pgknh42S3UhogdzjdFcgKK6MVNX0thaU3l2M iPwoYvhhJqD/jv83+NBp7QfpareoEp1xX4LD9WQ1qT9bhoROLlXzU0NfsRdLLYKVXReFfZJP5ZjMU +PWOIsyiA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdT81-0002dt-5Z; Fri, 13 Nov 2020 07:04:13 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdT7s-0002Yr-F3 for linux-riscv@lists.infradead.org; Fri, 13 Nov 2020 07:04:06 +0000 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdT7e-0002r8-3x; Fri, 13 Nov 2020 08:03:50 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kdT7Z-0004f0-FQ; Fri, 13 Nov 2020 08:03:45 +0100 Date: Fri, 13 Nov 2020 08:03:43 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Thierry Reding Subject: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource] Message-ID: <20201113070343.lhcsbyvi5baxn3lq@pengutronix.de> References: <20191229080610.7597-1-tiny.windzz@gmail.com> <20201112161346.gp5nenuagx5wmwl2@pengutronix.de> <20201112190649.GA908613@ulmo> <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> MIME-Version: 1.0 In-Reply-To: <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_020404_565925_3AC3A9A5 X-CRM114-Status: GOOD ( 18.74 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, heiko@sntech.de, Yangtao Li , Linus Walleij , linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-riscv@lists.infradead.org, festevam@gmail.com, f.fainelli@gmail.com, shc_work@mail.ru, Bartosz Golaszewski , khilman@baylibre.com, wens@csie.org, jonathanh@nvidia.com, linux-rockchip@lists.infradead.org, ludovic.desroches@microchip.com, bcm-kernel-feedback-list@broadcom.com, linux-imx@nxp.com, slemieux.tyco@gmail.com, linux-pwm@vger.kernel.org, rjui@broadcom.com, s.hauer@pengutronix.de, mripard@kernel.org, vz@mleia.com, linux-mediatek@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, paul.walmsley@sifive.com, matthias.bgg@gmail.com, linux-amlogic@lists.infradead.org, Lee Jones , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, sbranden@broadcom.com, Greg Kroah-Hartman , nicolas.ferre@microchip.com, palmer@dabbelt.com, kernel@pengutronix.de, shawnguo@kernel.org, claudiu.beznea@microchip.com, nsaenzjulienne@suse.de Content-Type: multipart/mixed; boundary="===============3513031770631625769==" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org --===============3513031770631625769== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bfm7upvbg2x7q3rm" Content-Disposition: inline --bfm7upvbg2x7q3rm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, [Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo] On Thu, Nov 12, 2020 at 10:14:29PM +0100, Uwe Kleine-K=F6nig wrote: > On Thu, Nov 12, 2020 at 08:06:49PM +0100, Thierry Reding wrote: > > I also think that it's overly narrow is scope, so you can't actually > > "blindly" use this helper and I've seen quite a few cases where this was > > unknowingly used for cases where it shouldn't have been used and then > > broke things (because some drivers must not do the request_mem_region() > > for example). >=20 > You have a link to such an accident? I got a hint in private here: https://lore.kernel.org/r/1555670144-24220-1-= git-send-email-aisheng.dong@nxp.com devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap(). IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().) So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap() and devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity? Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --bfm7upvbg2x7q3rm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl+uL8wACgkQwfwUeK3K 7AmhFQf/UMY3Z/O4ajFXsCh5aeqAW1EKy0wv+YtVLmLASYlkvBQ5OpoaFH6U7oZY a1BVjZ2I3q3pi1zMs+2dPAkylNi0VEIERvwncqHOfYN4FjdNsI85rKbxu4DNsWHJ wlaQxLwmUmDXDESpJ4RN8JqF/V/nPZfj/4V52ANK31PZ+i4fYnIlW6TU0cJwoJ9s aGSM2QwTb27uaRg5hqZqfOyIkt3wwkDJIF65H/vi64r0Gtm3c+0iKbEmlXr2XZCh APhFgQQDGFOMXdSBZeFxTtuLCzuG/RA3Fxb+7okleZUL6GrSwq7xWHJGorO136kq mo88jw2ceYf/qJA9E4atasOfbQUtlg== =gJ1m -----END PGP SIGNATURE----- --bfm7upvbg2x7q3rm-- --===============3513031770631625769== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv --===============3513031770631625769==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC172C4742C for ; Fri, 13 Nov 2020 07:04:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4F72A20B80 for ; Fri, 13 Nov 2020 07:04:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QmUf/3OA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F72A20B80 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=e/7zYCfw/xfc95UmeRdNBAq0RB2fYE1bcTiNPLLUcgg=; b=QmUf/3OAH2FRSNJ7J06B6yow8 E6I3bXT9VWGlQh/ISYkiCxRaQ5gYjIYxJwHg49C5B8byAZ0Jl1lOWfYQE5VdzTFzfyzu/NImHkB5M 1wqKD17u2mn+DBEQYZhEQRxwUKvcsUghKrTETkrScB+X8dA0M2tTbYCgsp8mTu+uxjH0NMjhkkMJ1 hunK2liF9R9iPd8BsUIV4bZAVJP7w29bSXjX4M64MJRs0hc5riExkJZ6KwSmlDE7mGgC2/ln4h6ej 2dYNgiehc2lssRMPPotL1mvviAHdeRhY4QrzMcRSMnHNbWRCe4K1RHGz1aLMjNmrLXXSGum6Iyy+s /rYcEGzLw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdT85-0002hV-9E; Fri, 13 Nov 2020 07:04:17 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdT7s-0002Z7-F4 for linux-rockchip@lists.infradead.org; Fri, 13 Nov 2020 07:04:06 +0000 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdT7e-0002r8-3x; Fri, 13 Nov 2020 08:03:50 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kdT7Z-0004f0-FQ; Fri, 13 Nov 2020 08:03:45 +0100 Date: Fri, 13 Nov 2020 08:03:43 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Thierry Reding Subject: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource] Message-ID: <20201113070343.lhcsbyvi5baxn3lq@pengutronix.de> References: <20191229080610.7597-1-tiny.windzz@gmail.com> <20201112161346.gp5nenuagx5wmwl2@pengutronix.de> <20201112190649.GA908613@ulmo> <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> MIME-Version: 1.0 In-Reply-To: <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-rockchip@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_020404_552734_F85DF493 X-CRM114-Status: GOOD ( 18.95 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, heiko@sntech.de, Yangtao Li , Linus Walleij , linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-riscv@lists.infradead.org, festevam@gmail.com, f.fainelli@gmail.com, shc_work@mail.ru, Bartosz Golaszewski , khilman@baylibre.com, wens@csie.org, jonathanh@nvidia.com, linux-rockchip@lists.infradead.org, ludovic.desroches@microchip.com, bcm-kernel-feedback-list@broadcom.com, linux-imx@nxp.com, slemieux.tyco@gmail.com, linux-pwm@vger.kernel.org, rjui@broadcom.com, s.hauer@pengutronix.de, mripard@kernel.org, vz@mleia.com, linux-mediatek@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, paul.walmsley@sifive.com, matthias.bgg@gmail.com, linux-amlogic@lists.infradead.org, Lee Jones , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, sbranden@broadcom.com, Greg Kroah-Hartman , nicolas.ferre@microchip.com, palmer@dabbelt.com, kernel@pengutronix.de, shawnguo@kernel.org, claudiu.beznea@microchip.com, nsaenzjulienne@suse.de Content-Type: multipart/mixed; boundary="===============4264988583093349061==" Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org --===============4264988583093349061== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bfm7upvbg2x7q3rm" Content-Disposition: inline --bfm7upvbg2x7q3rm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, [Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo] On Thu, Nov 12, 2020 at 10:14:29PM +0100, Uwe Kleine-K=F6nig wrote: > On Thu, Nov 12, 2020 at 08:06:49PM +0100, Thierry Reding wrote: > > I also think that it's overly narrow is scope, so you can't actually > > "blindly" use this helper and I've seen quite a few cases where this was > > unknowingly used for cases where it shouldn't have been used and then > > broke things (because some drivers must not do the request_mem_region() > > for example). >=20 > You have a link to such an accident? I got a hint in private here: https://lore.kernel.org/r/1555670144-24220-1-= git-send-email-aisheng.dong@nxp.com devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap(). IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().) So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap() and devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity? Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --bfm7upvbg2x7q3rm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl+uL8wACgkQwfwUeK3K 7AmhFQf/UMY3Z/O4ajFXsCh5aeqAW1EKy0wv+YtVLmLASYlkvBQ5OpoaFH6U7oZY a1BVjZ2I3q3pi1zMs+2dPAkylNi0VEIERvwncqHOfYN4FjdNsI85rKbxu4DNsWHJ wlaQxLwmUmDXDESpJ4RN8JqF/V/nPZfj/4V52ANK31PZ+i4fYnIlW6TU0cJwoJ9s aGSM2QwTb27uaRg5hqZqfOyIkt3wwkDJIF65H/vi64r0Gtm3c+0iKbEmlXr2XZCh APhFgQQDGFOMXdSBZeFxTtuLCzuG/RA3Fxb+7okleZUL6GrSwq7xWHJGorO136kq mo88jw2ceYf/qJA9E4atasOfbQUtlg== =gJ1m -----END PGP SIGNATURE----- --bfm7upvbg2x7q3rm-- --===============4264988583093349061== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip --===============4264988583093349061==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42FA7C63697 for ; Fri, 13 Nov 2020 07:04:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DCA0920B80 for ; Fri, 13 Nov 2020 07:04:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="o1yG4BMT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCA0920B80 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8vEfGaY1NSikFi7IzqJ54O3FukVFK/8tIeCECbDg42Y=; b=o1yG4BMT3Au3e2kBNn70Tj19s IywsgVRL7AriVDfn3EFeYIxUZyrRjc6Zy1uTRTAoBTV6ui5QDE6EshqhWhHhjJ3GpQeU+pSShLoU6 Cp3C3Y8Zt5a3S2HOSMzu3sVCSFgK0McSr4CZv6Aj9g2vmaYUh2wIazxp1y/vcmWiK12PFslT7KAGH hmpUaFpS0aaRH8USS/pKUulnd9VHbA7QBNISl0PPJNZ5aWxCBsFItWUd4lVTK1hzpc45+G6P3oGqu NVbF4ZigRRwv3SpMgDnMTWoQ2sjgIdD9WhMHrwLpriYpZ/JWs4hxJSbi8Qj3j0pI4+QU73numyfaw bNtJntv0g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdT86-0002ia-Fp; Fri, 13 Nov 2020 07:04:18 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdT7v-0002bg-Eh for linux-mediatek@lists.infradead.org; Fri, 13 Nov 2020 07:04:09 +0000 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdT7e-0002r8-3x; Fri, 13 Nov 2020 08:03:50 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kdT7Z-0004f0-FQ; Fri, 13 Nov 2020 08:03:45 +0100 Date: Fri, 13 Nov 2020 08:03:43 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Thierry Reding Subject: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource] Message-ID: <20201113070343.lhcsbyvi5baxn3lq@pengutronix.de> References: <20191229080610.7597-1-tiny.windzz@gmail.com> <20201112161346.gp5nenuagx5wmwl2@pengutronix.de> <20201112190649.GA908613@ulmo> <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> MIME-Version: 1.0 In-Reply-To: <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mediatek@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_020407_696108_81D6060C X-CRM114-Status: GOOD ( 18.74 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, heiko@sntech.de, Yangtao Li , Linus Walleij , linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-riscv@lists.infradead.org, festevam@gmail.com, f.fainelli@gmail.com, shc_work@mail.ru, Bartosz Golaszewski , khilman@baylibre.com, wens@csie.org, jonathanh@nvidia.com, linux-rockchip@lists.infradead.org, ludovic.desroches@microchip.com, bcm-kernel-feedback-list@broadcom.com, linux-imx@nxp.com, slemieux.tyco@gmail.com, linux-pwm@vger.kernel.org, rjui@broadcom.com, s.hauer@pengutronix.de, mripard@kernel.org, vz@mleia.com, linux-mediatek@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, paul.walmsley@sifive.com, matthias.bgg@gmail.com, linux-amlogic@lists.infradead.org, Lee Jones , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, sbranden@broadcom.com, Greg Kroah-Hartman , nicolas.ferre@microchip.com, palmer@dabbelt.com, kernel@pengutronix.de, shawnguo@kernel.org, claudiu.beznea@microchip.com, nsaenzjulienne@suse.de Content-Type: multipart/mixed; boundary="===============5496615259728014817==" Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org --===============5496615259728014817== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bfm7upvbg2x7q3rm" Content-Disposition: inline --bfm7upvbg2x7q3rm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, [Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo] On Thu, Nov 12, 2020 at 10:14:29PM +0100, Uwe Kleine-K=F6nig wrote: > On Thu, Nov 12, 2020 at 08:06:49PM +0100, Thierry Reding wrote: > > I also think that it's overly narrow is scope, so you can't actually > > "blindly" use this helper and I've seen quite a few cases where this was > > unknowingly used for cases where it shouldn't have been used and then > > broke things (because some drivers must not do the request_mem_region() > > for example). >=20 > You have a link to such an accident? I got a hint in private here: https://lore.kernel.org/r/1555670144-24220-1-= git-send-email-aisheng.dong@nxp.com devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap(). IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().) So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap() and devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity? Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --bfm7upvbg2x7q3rm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl+uL8wACgkQwfwUeK3K 7AmhFQf/UMY3Z/O4ajFXsCh5aeqAW1EKy0wv+YtVLmLASYlkvBQ5OpoaFH6U7oZY a1BVjZ2I3q3pi1zMs+2dPAkylNi0VEIERvwncqHOfYN4FjdNsI85rKbxu4DNsWHJ wlaQxLwmUmDXDESpJ4RN8JqF/V/nPZfj/4V52ANK31PZ+i4fYnIlW6TU0cJwoJ9s aGSM2QwTb27uaRg5hqZqfOyIkt3wwkDJIF65H/vi64r0Gtm3c+0iKbEmlXr2XZCh APhFgQQDGFOMXdSBZeFxTtuLCzuG/RA3Fxb+7okleZUL6GrSwq7xWHJGorO136kq mo88jw2ceYf/qJA9E4atasOfbQUtlg== =gJ1m -----END PGP SIGNATURE----- --bfm7upvbg2x7q3rm-- --===============5496615259728014817== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek --===============5496615259728014817==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 657ACC388F7 for ; Fri, 13 Nov 2020 07:04:51 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EB00920B80 for ; Fri, 13 Nov 2020 07:04:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0U4VulyO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB00920B80 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GSJLm+IG7ZoHhUrhwUgGsZOQ1O0ggGHzxpgRIhov76E=; b=0U4VulyOyHxRSN+h8VUcqC/yc Hra3ItwdogbkB7NHW7oPK4XXpbHP59qy9kdo3F3oo5EuFjVMa70OWZ5ELIKov2c7uQMJrElWYGZey GTVQNERfK0Th9bw7+PsWSBv6iJ0FuCKmLZlweQBCxfLphZxX0GrRl1wazHXTTYhpiNMRs9tw3Qogu jOYiSwNp2b6bmrDpiPZjBWfaxQHxILnjU016eO06usCE+P3QwxiLQKKOSMttn4S1p90G29OMftJmB jn4vjOU38W6brJBmDnKbsEaW7C2hYchV7bKTjuLsXJELDNLsOZLsZcOaEfKX41sRVDFERtjRe8+8V iczS3W4Og==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdT8D-0002lK-4R; Fri, 13 Nov 2020 07:04:25 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdT7y-0002dp-RC for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2020 07:04:14 +0000 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdT7e-0002r8-3x; Fri, 13 Nov 2020 08:03:50 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kdT7Z-0004f0-FQ; Fri, 13 Nov 2020 08:03:45 +0100 Date: Fri, 13 Nov 2020 08:03:43 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Thierry Reding Subject: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource] Message-ID: <20201113070343.lhcsbyvi5baxn3lq@pengutronix.de> References: <20191229080610.7597-1-tiny.windzz@gmail.com> <20201112161346.gp5nenuagx5wmwl2@pengutronix.de> <20201112190649.GA908613@ulmo> <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> MIME-Version: 1.0 In-Reply-To: <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_020411_000700_ED71B8B9 X-CRM114-Status: GOOD ( 20.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, heiko@sntech.de, Yangtao Li , Linus Walleij , linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-riscv@lists.infradead.org, festevam@gmail.com, f.fainelli@gmail.com, shc_work@mail.ru, Bartosz Golaszewski , khilman@baylibre.com, wens@csie.org, jonathanh@nvidia.com, linux-rockchip@lists.infradead.org, ludovic.desroches@microchip.com, bcm-kernel-feedback-list@broadcom.com, linux-imx@nxp.com, slemieux.tyco@gmail.com, linux-pwm@vger.kernel.org, rjui@broadcom.com, s.hauer@pengutronix.de, mripard@kernel.org, vz@mleia.com, linux-mediatek@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, paul.walmsley@sifive.com, matthias.bgg@gmail.com, linux-amlogic@lists.infradead.org, Lee Jones , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, sbranden@broadcom.com, Greg Kroah-Hartman , palmer@dabbelt.com, kernel@pengutronix.de, shawnguo@kernel.org, claudiu.beznea@microchip.com, nsaenzjulienne@suse.de Content-Type: multipart/mixed; boundary="===============4502554996128229076==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============4502554996128229076== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bfm7upvbg2x7q3rm" Content-Disposition: inline --bfm7upvbg2x7q3rm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, [Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo] On Thu, Nov 12, 2020 at 10:14:29PM +0100, Uwe Kleine-K=F6nig wrote: > On Thu, Nov 12, 2020 at 08:06:49PM +0100, Thierry Reding wrote: > > I also think that it's overly narrow is scope, so you can't actually > > "blindly" use this helper and I've seen quite a few cases where this was > > unknowingly used for cases where it shouldn't have been used and then > > broke things (because some drivers must not do the request_mem_region() > > for example). >=20 > You have a link to such an accident? I got a hint in private here: https://lore.kernel.org/r/1555670144-24220-1-= git-send-email-aisheng.dong@nxp.com devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap(). IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().) So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap() and devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity? Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --bfm7upvbg2x7q3rm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl+uL8wACgkQwfwUeK3K 7AmhFQf/UMY3Z/O4ajFXsCh5aeqAW1EKy0wv+YtVLmLASYlkvBQ5OpoaFH6U7oZY a1BVjZ2I3q3pi1zMs+2dPAkylNi0VEIERvwncqHOfYN4FjdNsI85rKbxu4DNsWHJ wlaQxLwmUmDXDESpJ4RN8JqF/V/nPZfj/4V52ANK31PZ+i4fYnIlW6TU0cJwoJ9s aGSM2QwTb27uaRg5hqZqfOyIkt3wwkDJIF65H/vi64r0Gtm3c+0iKbEmlXr2XZCh APhFgQQDGFOMXdSBZeFxTtuLCzuG/RA3Fxb+7okleZUL6GrSwq7xWHJGorO136kq mo88jw2ceYf/qJA9E4atasOfbQUtlg== =gJ1m -----END PGP SIGNATURE----- --bfm7upvbg2x7q3rm-- --===============4502554996128229076== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============4502554996128229076==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8041CC4742C for ; Fri, 13 Nov 2020 07:04:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3253820B80 for ; Fri, 13 Nov 2020 07:04:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="igDRAAmh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3253820B80 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TVUnzzbAu2Y0UUDlFKOhJpl5DevOZpxFGyYWKlGmAow=; b=igDRAAmhqr5lyj3adymr7rQAg RlshXHI1MtkuX+FQ32JYLwDl1nEpnHv55rjcq5FY3262yAhjnGHjSYca1trZvfxijmCwK7ea/cpGP y036TzOMgsT7FDdxYzZULORLZ71B+nzapC4lOimKIcwqNHg8uu274QfBUD6oCIIbYOIn5Xts6HMlj VA2NFfxb/dXI84B/cxxgsJsb8du4riP5zY7SdrqBCT3cAntdqLK3E+ZniLeKQ2MzfHwYZHhczUHcb 9h1O2MbKsCQiZ0J43kv4z/ER9SuVLh6snwR37aWxCpaDYAGypjizwXYX0+suvu4QDW91gLKCpWI3A eavVZhghw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdT88-0002jd-4G; Fri, 13 Nov 2020 07:04:20 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdT7y-0002dd-M9 for linux-amlogic@lists.infradead.org; Fri, 13 Nov 2020 07:04:13 +0000 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdT7e-0002r8-3x; Fri, 13 Nov 2020 08:03:50 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kdT7Z-0004f0-FQ; Fri, 13 Nov 2020 08:03:45 +0100 Date: Fri, 13 Nov 2020 08:03:43 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Thierry Reding Subject: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource] Message-ID: <20201113070343.lhcsbyvi5baxn3lq@pengutronix.de> References: <20191229080610.7597-1-tiny.windzz@gmail.com> <20201112161346.gp5nenuagx5wmwl2@pengutronix.de> <20201112190649.GA908613@ulmo> <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> MIME-Version: 1.0 In-Reply-To: <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-amlogic@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_020410_816022_EBC0B0BA X-CRM114-Status: GOOD ( 18.64 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, heiko@sntech.de, Yangtao Li , Linus Walleij , linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-riscv@lists.infradead.org, festevam@gmail.com, f.fainelli@gmail.com, shc_work@mail.ru, Bartosz Golaszewski , khilman@baylibre.com, wens@csie.org, jonathanh@nvidia.com, linux-rockchip@lists.infradead.org, ludovic.desroches@microchip.com, bcm-kernel-feedback-list@broadcom.com, linux-imx@nxp.com, slemieux.tyco@gmail.com, linux-pwm@vger.kernel.org, rjui@broadcom.com, s.hauer@pengutronix.de, mripard@kernel.org, vz@mleia.com, linux-mediatek@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, paul.walmsley@sifive.com, matthias.bgg@gmail.com, linux-amlogic@lists.infradead.org, Lee Jones , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, sbranden@broadcom.com, Greg Kroah-Hartman , nicolas.ferre@microchip.com, palmer@dabbelt.com, kernel@pengutronix.de, shawnguo@kernel.org, claudiu.beznea@microchip.com, nsaenzjulienne@suse.de Content-Type: multipart/mixed; boundary="===============2364418415735706887==" Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org --===============2364418415735706887== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bfm7upvbg2x7q3rm" Content-Disposition: inline --bfm7upvbg2x7q3rm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, [Added lkml and the people involved in commit 7945f929f1a7 ("drivers: provide devm_platform_ioremap_resource()") to Cc:. For the new readers: This is about patches making use of devm_platform_ioremap_resource() instead of open coding it. Full context at https://lore.kernel.org/r/20201112190649.GA908613@ulmo] On Thu, Nov 12, 2020 at 10:14:29PM +0100, Uwe Kleine-K=F6nig wrote: > On Thu, Nov 12, 2020 at 08:06:49PM +0100, Thierry Reding wrote: > > I also think that it's overly narrow is scope, so you can't actually > > "blindly" use this helper and I've seen quite a few cases where this was > > unknowingly used for cases where it shouldn't have been used and then > > broke things (because some drivers must not do the request_mem_region() > > for example). >=20 > You have a link to such an accident? I got a hint in private here: https://lore.kernel.org/r/1555670144-24220-1-= git-send-email-aisheng.dong@nxp.com devm_platform_ioremap_resource() is platform_get_resource() + devm_ioremap_resource() and here it was used to replace platform_get_resource() + devm_ioremap(). IMHO the unlucky thing in this situation is that devm_ioremap_resource() and devm_ioremap() are different by more than just how they get the area to remap. (i.e. devm_ioremap_resource() also does devm_request_mem_region().) So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap() and devm_platform_ioremap_resource() should better be named devm_request_ioremap() and devm_platform_request_ioremap_resource() respectively. Is it worth to rename these for clearity? Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --bfm7upvbg2x7q3rm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl+uL8wACgkQwfwUeK3K 7AmhFQf/UMY3Z/O4ajFXsCh5aeqAW1EKy0wv+YtVLmLASYlkvBQ5OpoaFH6U7oZY a1BVjZ2I3q3pi1zMs+2dPAkylNi0VEIERvwncqHOfYN4FjdNsI85rKbxu4DNsWHJ wlaQxLwmUmDXDESpJ4RN8JqF/V/nPZfj/4V52ANK31PZ+i4fYnIlW6TU0cJwoJ9s aGSM2QwTb27uaRg5hqZqfOyIkt3wwkDJIF65H/vi64r0Gtm3c+0iKbEmlXr2XZCh APhFgQQDGFOMXdSBZeFxTtuLCzuG/RA3Fxb+7okleZUL6GrSwq7xWHJGorO136kq mo88jw2ceYf/qJA9E4atasOfbQUtlg== =gJ1m -----END PGP SIGNATURE----- --bfm7upvbg2x7q3rm-- --===============2364418415735706887== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic --===============2364418415735706887==--