Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1011222pxb; Fri, 13 Nov 2020 01:38:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyiQiciBE0Mj6z+YvrsGlad6vFG0KiSkXVNbOHRyxTRTbjD/0RQTT7adBBxPjwc4pN2clrt X-Received: by 2002:aa7:de01:: with SMTP id h1mr1516922edv.269.1605260290202; Fri, 13 Nov 2020 01:38:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605260290; cv=none; d=google.com; s=arc-20160816; b=LKA9yJ1RcOVj6DCfeuTdib3+o+zXVZgbYW0Ih59D3Iu2PU5Ev0szbVCcLVxcgmgVcs iy1b7HuClooj9yiWiSZjvwQFheQEpQ3iTX+kD2kTtPFHUIms0R0UR7Gw6nB0T4XgWcBH aGoxDuHAOWq7qjM27qmG+jbN3JhK/VGcqojM0h+82U+w6OREpOY3RlhbWr0Qhwqpi729 nksAUYabPW6fYtbeoHfrMdmoAtM3Bnukr59icDxffTTz/OeZm/nh7r4qFVFONa+wWxNo KSSHVA7ialYq0NlubSWzExAjCla7s99juE6XSMEPMYnJON6JLV4tbryXmd3MpJWmG6kF NYag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=RqeDCv6ERz7mVN81ZgBbSwkvCzwv+aKRGxfG6PWmQvk=; b=rw5MdtDN4KBS2ES6GQ9m+JNT4lMtGHqh6Bwcts+nIZ/+Isds5sfWavjy6/ut0Q8oHi wTM6Of8jKx/3PCCKU/AvSZ+3PHu3bElmwTO9YKgvn2SCEeRd6OBQQlNzB2knR8QsKlVY 8flLHCHEqIIC4NDasz7CmbTB2K3ubYaEG+cQjwb2ajJS3PL5GWNdXvOFtv5D5thh7k+y 0IWwhaVvtMoEiTDafUtrXkrvtVg6lipXTEwuhs9CQK2e3z+TttqSwIQgqAyEeH3goWgx HBpERYOp3mihGeeJGqg2VvTD+1yLrX7FQlZSwaQ6yxzyVCHRK5OonwarfudiHfwKLeyN hTaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j14si5780581ejx.329.2020.11.13.01.37.45; Fri, 13 Nov 2020 01:38:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726255AbgKMJfn (ORCPT + 99 others); Fri, 13 Nov 2020 04:35:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726149AbgKMJfl (ORCPT ); Fri, 13 Nov 2020 04:35:41 -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 3DD0FC0613D1 for ; Fri, 13 Nov 2020 01:35:41 -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 1kdVUU-0003xq-0z; Fri, 13 Nov 2020 10:35:34 +0100 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kdVUR-00027t-Jr; Fri, 13 Nov 2020 10:35:31 +0100 Date: Fri, 13 Nov 2020 10:35:29 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Bartosz Golaszewski Cc: Alexandre Belloni , Heiko =?utf-8?Q?St=C3=BCbner?= , Yangtao Li , Linus Walleij , LKML , linux-tegra@vger.kernel.org, Thierry Reding , linux-riscv@lists.infradead.org, Fabio Estevam , Florian Fainelli , shc_work@mail.ru, Kevin Hilman , Chen-Yu Tsai , Jonathan Hunter , linux-rockchip@lists.infradead.org, Ludovic Desroches , bcm-kernel-feedback-list@broadcom.com, dl-linux-imx , Sylvain Lemieux , linux-pwm@vger.kernel.org, Ray Jui , Sascha Hauer , Maxime Ripard , Vladimir Zapolskiy , "moderated list:ARM/Mediatek SoC..." , linux-rpi-kernel@lists.infradead.org, Paul Walmsley , Matthias Brugger , linux-amlogic@lists.infradead.org, Lee Jones , Andy Shevchenko , arm-soc , Scott Branden , Greg Kroah-Hartman , Nicolas Ferre , Palmer Dabbelt , Sascha Hauer , Shawn Guo , claudiu.beznea@microchip.com, Nicolas Saenz Julienne Subject: Re: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource] Message-ID: <20201113093529.xy63ncisl4wuesig@pengutronix.de> References: <20191229080610.7597-1-tiny.windzz@gmail.com> <20201112161346.gp5nenuagx5wmwl2@pengutronix.de> <20201112190649.GA908613@ulmo> <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> <20201113070343.lhcsbyvi5baxn3lq@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="mk2yqeuqnozfxyjy" Content-Disposition: inline In-Reply-To: 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-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --mk2yqeuqnozfxyjy Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 13, 2020 at 10:12:46AM +0100, Bartosz Golaszewski wrote: > On Fri, Nov 13, 2020 at 8:04 AM Uwe Kleine-K=F6nig > wrote: > > > > 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 thi= s was > > > > unknowingly used for cases where it shouldn't have been used and th= en > > > > broke things (because some drivers must not do the request_mem_regi= on() > > > > for example). > > > > > > You have a link to such an accident? > > > > I got a hint in private here: https://lore.kernel.org/r/1555670144-2422= 0-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? >=20 > But devm_ioremap() doesn't request the region. Did you mean > devm_ioremap_resource() should become devm_request_ioremap_resource()? Yes indeed. The last paragraph should be: So the problem is not the added wrapper, but unclear semantics in the functions it uses. In my eyes devm_ioremap_resource() and devm_platform_ioremap_resource() should better be named devm_request_ioremap_resource() and devm_platform_request_ioremap_resource(). (Note that I created a patch series that implements this suggestion, but you were not on Cc: as I extensively trimmed the recipents assuming most people are not interested. See https://lore.kernel.org/r/20201113085327.125= 041-1-u.kleine-koenig@pengutronix.de) Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --mk2yqeuqnozfxyjy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEfnIqFpAYrP8+dKQLwfwUeK3K7AkFAl+uU14ACgkQwfwUeK3K 7AlU7QgAoZhawnyVQOW4iLHTE9/NQxowSwJSANvLVm53S0/6e+o77Hwa0KM5cta2 t3wyndXM7qElPrW4Bx2J23P/m4jGyoSN4Nb/f1dH8T/pmXy7tPOqqnO+slxOTs4Y nNoFSVWSUiDCp5dgRH11sKOCp5P7hxZZ/05DhqyLYsdwUmaTzXoc28xnvmFjydxP acgIc0UGMEYWNMUOSuF+rQros8xH2r2IQZDhG58L7fD2RAMCzj+UV72056PIqrmB AVlebjEzBpYtxjhOaosAA7DY53/wHpwVTBzmFxZUXf8JlM8j8A9fVM7uwPE0xWZ+ kmF704/YfebQRL8T1P/z6v9SjuT/Vw== =fO+P -----END PGP SIGNATURE----- --mk2yqeuqnozfxyjy--