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,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 9EBADC4742C for ; Fri, 13 Nov 2020 09:13:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4DAFC2078D for ; Fri, 13 Nov 2020 09:13:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="f1bUvjmh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726352AbgKMJNB (ORCPT ); Fri, 13 Nov 2020 04:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbgKMJM7 (ORCPT ); Fri, 13 Nov 2020 04:12:59 -0500 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A672CC0617A6 for ; Fri, 13 Nov 2020 01:12:58 -0800 (PST) Received: by mail-ej1-x643.google.com with SMTP id o9so12323095ejg.1 for ; Fri, 13 Nov 2020 01:12:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ZEmt/VsFl2qImvUHyYQ40Mn9lV8wv5XsZxCOGudpurw=; b=f1bUvjmhfWE+ct5QqgGMY6/gkTD5psyD2wc7dPODO9KgsCqB0ixK2JPE4ApZME0L+f o+j/KQpgc+LGI+sy9NKih2qxrYPBpaQK80/YlKEIfiam5j6/jox/xl7S67zEJBgHRhL8 cC2JAk2kdxb8hl2qPEL8s8diqprVyEXWPho7OWj77Yhoa/sErE0JYFAGOOaQ5cATUGKY F5Cjaa+3H9MMjuJX7ZjrIP+4lHKh1L9GJKuN6KYWlOjulGQ+fl9kGjcaX+U5ulY6njT2 GONrmz7QkZvDGLaoc1q1EP8N6ae56fXmTlM6BM1RdxoaTw2tDzKkqRm1xqynDenDFr/+ WHIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ZEmt/VsFl2qImvUHyYQ40Mn9lV8wv5XsZxCOGudpurw=; b=T2Y7+BmtC2vrA1ndOVtvNJrCx+yvlo6pfGB6+4VHlDqzXFUyC9jefTYIDEANKTOguh 4lAoyKL6XDBwHWKcm1UcjK3D04an97eXicvXDRgLcPp6/PTgLp0yY6NQc+FEqhdOEsim b6/dqs5pc4ssIHxC3NBwO9RPD6gduBPukW5UiY3O+W9PAd+vibHL3bV8Pdb8ZYj31V1/ E0un1SOIIz2zSaXyCUfLen4/c/Nb9w7vdZ6CRqkU9gIEehSir+xe3ilcijd96Ph/SmOc GWuztg2Pot+TG+kRf6R5YfGlTEpUw42Pd+RtGQVJ0UDAMkYDQ98SxsGe9GK9yGTeW/Fx qIbQ== X-Gm-Message-State: AOAM530eY891bK7PpFAkAZLT2PzTHhqg7rF8nA2crHrccC3b5jikWlVC +rV1cwnUoRdUscVyguYgpd8rY9ttRpWppA06Ui6iQQ== X-Google-Smtp-Source: ABdhPJxtT1qVgA2FoQk7OAdlmJdj+DkZw+qwoVg8AzHfWl781Sx239Ic//jhdSO4tEd0RKQpUy7u9kHYLDSFOZst3ZE= X-Received: by 2002:a17:906:1c83:: with SMTP id g3mr989338ejh.168.1605258777288; Fri, 13 Nov 2020 01:12:57 -0800 (PST) MIME-Version: 1.0 References: <20191229080610.7597-1-tiny.windzz@gmail.com> <20201112161346.gp5nenuagx5wmwl2@pengutronix.de> <20201112190649.GA908613@ulmo> <20201112211429.kfyqzkmmchjo6pll@pengutronix.de> <20201113070343.lhcsbyvi5baxn3lq@pengutronix.de> In-Reply-To: <20201113070343.lhcsbyvi5baxn3lq@pengutronix.de> From: Bartosz Golaszewski Date: Fri, 13 Nov 2020 10:12:46 +0100 Message-ID: Subject: Re: About devm_platform_ioremap_resource [Was: Re: [PATCH 01/32] pwm: sun4i: convert to devm_platform_ioremap_resource] To: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= Cc: Thierry Reding , Alexandre Belloni , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Yangtao Li , Nicolas Ferre , Matthias Brugger , linux-riscv@lists.infradead.org, Fabio Estevam , Florian Fainelli , shc_work@mail.ru, Kevin Hilman , Ludovic Desroches , Jonathan Hunter , linux-rockchip@lists.infradead.org, Chen-Yu Tsai , 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 , linux-tegra@vger.kernel.org, linux-amlogic@lists.infradead.org, Lee Jones , arm-soc , Scott Branden , LKML , Palmer Dabbelt , Sascha Hauer , Shawn Guo , claudiu.beznea@microchip.com, Nicolas Saenz Julienne , Greg Kroah-Hartman , Andy Shevchenko , Linus Walleij Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 13, 2020 at 8:04 AM Uwe Kleine-K=C3=B6nig 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=C3=B6nig 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). > > > > 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? But devm_ioremap() doesn't request the region. Did you mean devm_ioremap_resource() should become devm_request_ioremap_resource()? Bartosz