Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13201165ybl; Sun, 29 Dec 2019 06:38:37 -0800 (PST) X-Google-Smtp-Source: APXvYqxubz1Z0l+NARnS5+5rYVm/1G+/DHjef9tZyWtNEGO+oS8jWEll1d9vkaoLy2O5VGDPSQXH X-Received: by 2002:a9d:2dca:: with SMTP id g68mr63480514otb.150.1577630317035; Sun, 29 Dec 2019 06:38:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577630317; cv=none; d=google.com; s=arc-20160816; b=CXzoqpY4lcUcxSdpFs+4pkPyW1J2AiI13SqaM2hSFfRotZeo8TR6J05RVQxqC2lzEU oreuJCftYkzcaUL2JzS2vM9orPdF7r4QZv1K+1gRdEk52tJltAtQGBzaEI+2NDhP7Bw8 HTT7LSDMGDNDm8iU7NMRBzQS/1TT6ClZqYNM8K7New5pSM/UIRYzERX1pLOmr1VUkTQY gA2hXTTGuJaV2Qghtewq0gtgMlEDV5pOkSBqz6oIaTFS8SsZTdRzVs2XZ1F3KJjWGiZ+ qPkCv/9KMgRg8UjqVP75L0MIdrVdE0WqRZ0sZDhtzwk/hRkEuvu9RePYT+FeYUtn9CpV QQNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6P+l8FSlWBBte5aUxpeVJfQc+EhiRf7R8DtYJ/9CnDI=; b=igtVibUh7tcuDW8g1EoNIy81JNY8Il0B5zXVf5/f7NkDCSqMjtFDQRbCqjR1jV+2Ra 0R/o2uisWUmCcSE3PUmUi84h6KXtG8eoHRif9hZQODSWffBYWwJ9pEGnpkES/8rJ/DUU XLj5oiafIVfqbvn2IN7buCoBmSAAL6dclNGidFcraLwWM3sIJzEMcxSDbSrdCIoaQUs1 a0RP9MohHR23h/PpytoSI+NeiVrdFQ6yhtqDEhBO883REJwJXR16MHWKNjSOAGLP+YIi mAWkM2mXIwcWKsgLUa6LbnFQcaagudrcSHk3+4yA930JBNY17SyimKsjG6XL6rzx0bli 3FSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yb35NC83; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si21890091otq.51.2019.12.29.06.38.13; Sun, 29 Dec 2019 06:38:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yb35NC83; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726579AbfL2Ogu (ORCPT + 99 others); Sun, 29 Dec 2019 09:36:50 -0500 Received: from mail-io1-f66.google.com ([209.85.166.66]:33957 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbfL2Ogu (ORCPT ); Sun, 29 Dec 2019 09:36:50 -0500 Received: by mail-io1-f66.google.com with SMTP id z193so29496906iof.1; Sun, 29 Dec 2019 06:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=6P+l8FSlWBBte5aUxpeVJfQc+EhiRf7R8DtYJ/9CnDI=; b=Yb35NC83I5I7rr0g/aKTefVU+PtUCvsF58AputPF9VqGwwq7HGoXHrAnRrVrLe38i6 Gf+D4lTUnef2r3wkZf8VDdia0LNTt235huRgflqorMssYPMYr4l/m6KB9VUllvTHAePW XZxc3+rT+021SRw9QkIi+UjCsHh8uScYVEdAEpn3zWCGELqGQB8Dw1qIKGvIsB8Z30o3 Een5bv+OzDYelHKWETGXB1Y6ckk3cqOgz6cetWgeyFrVQU7yQLgq96zKokez/fP+j1bY EiGvFTHWhctAmC6rvvxPIA2/Xb5MnX1T/0Ee826qf8wcEzcS/R38qKb5dX66aPlORovX AkaQ== 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=6P+l8FSlWBBte5aUxpeVJfQc+EhiRf7R8DtYJ/9CnDI=; b=dHd+XkXPUYGqM6wCsrnEdg8L8R+9gscNq7oUstvGwKsPlPG0XB5vIg4YfseZ9dNyUE NLBRQdEMjlPzvoZgca+Rint2qy1J2PTXXsMm+dexd+zxZM+9kYv30PSStzjnhXuofNfx 5JQlrYsJ+Rn1LzH4ZCN0onNlSFL9ND5Ez/3Qent63JqLnSxt8TO1w0U/FIPpmoldcMm/ fHTKTTL3s0fow+ngbx2CET7yvZS1Kg92Y4qpprW+nBI/XLUZT1NSyjVGbsDI/TE+ic19 UtzpppOa/7If1FYJC9U9ubq/mhfDgTK+2angkXIFBamQT7aZZnbmA1i0XUfsdPRbedwR mQ7A== X-Gm-Message-State: APjAAAUIKY6nOJSRn7em8FFaUBN5rNm51skxDvpdqschSB9AIdigaJej enoYxms5qLoItnGARLNo/MF1mDJsFXC7e98BeHs= X-Received: by 2002:a02:3ece:: with SMTP id s197mr48415001jas.30.1577630209372; Sun, 29 Dec 2019 06:36:49 -0800 (PST) MIME-Version: 1.0 References: <20191229104325.10132-1-tiny.windzz@gmail.com> In-Reply-To: From: Frank Lee Date: Sun, 29 Dec 2019 22:36:38 +0800 Message-ID: Subject: Re: [PATCH 1/2] lib: devres: provide devm_ioremap_resource_nocache() To: Bartosz Golaszewski Cc: Jonathan Corbet , Greg KH , Arnd Bergmann , Stephen Boyd , Mauro Carvalho Chehab , Matti Vaittinen , Phil Edworthy , suzuki.poulose@arm.com, saravanak@google.com, Heikki Krogerus , dan.j.williams@intel.com, Joe Perches , Jeff Kirsher , mans@mansr.com, Thomas Gleixner , hdegoede@redhat.com, Andrew Morton , Ulf Hansson , ztuowen@gmail.com, Sergei Shtylyov , linux-doc , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 29, 2019 at 8:11 PM Bartosz Golaszewski wrote: > > niedz., 29 gru 2019 o 11:43 Yangtao Li napisa=C5= =82(a): > > > > Provide a variant of devm_ioremap_resource() for nocache ioremap. > > > > Signed-off-by: Yangtao Li > > --- > > Documentation/driver-api/driver-model/devres.rst | 1 + > > include/linux/device.h | 2 ++ > > lib/devres.c | 15 +++++++++++++++ > > 3 files changed, 18 insertions(+) > > > > diff --git a/Documentation/driver-api/driver-model/devres.rst b/Documen= tation/driver-api/driver-model/devres.rst > > index 13046fcf0a5d..af1b1b9e3a17 100644 > > --- a/Documentation/driver-api/driver-model/devres.rst > > +++ b/Documentation/driver-api/driver-model/devres.rst > > @@ -317,6 +317,7 @@ IOMAP > > devm_ioremap_uc() > > devm_ioremap_wc() > > devm_ioremap_resource() : checks resource, requests memory region, i= oremaps > > + devm_ioremap_resource_nocache() > > devm_ioremap_resource_wc() > > devm_platform_ioremap_resource() : calls devm_ioremap_resource() for= platform device > > devm_platform_ioremap_resource_wc() > > diff --git a/include/linux/device.h b/include/linux/device.h > > index 96ff76731e93..3aa353aa52e2 100644 > > --- a/include/linux/device.h > > +++ b/include/linux/device.h > > @@ -962,6 +962,8 @@ extern void devm_free_pages(struct device *dev, uns= igned long addr); > > > > void __iomem *devm_ioremap_resource(struct device *dev, > > const struct resource *res); > > +void __iomem *devm_ioremap_resource_nocache(struct device *dev, > > + const struct resource *res)= ; > > void __iomem *devm_ioremap_resource_wc(struct device *dev, > > const struct resource *res); > > > > diff --git a/lib/devres.c b/lib/devres.c > > index f56070cf970b..a182f8479fbf 100644 > > --- a/lib/devres.c > > +++ b/lib/devres.c > > @@ -188,6 +188,21 @@ void __iomem *devm_ioremap_resource(struct device = *dev, > > } > > EXPORT_SYMBOL(devm_ioremap_resource); > > > > +/** > > + * devm_ioremap_resource_nocache() - nocache variant of > > + * devm_ioremap_resource() > > + * @dev: generic device to handle the resource for > > + * @res: resource to be handled > > + * > > + * Returns a pointer to the remapped memory or an ERR_PTR() encoded er= ror code > > + * on failure. > > + */ > > +void __iomem *devm_ioremap_resource_nocache(struct device *dev, > > + const struct resource *res) > > +{ > > + return __devm_ioremap_resource(dev, res, DEVM_IOREMAP_NC); > > +} > > + > > /** > > * devm_ioremap_resource_wc() - write-combined variant of > > * devm_ioremap_resource() > > -- > > 2.17.1 > > > > This has been discussed before. The nocache variants of ioremap() are > being phased out as they're only ever needed on one obscure > architecture IIRC. This is not needed, rather we should convert all > nocache calls to regular ioremap(). Thanks for pointing out! I have seen the use of ioremap_nocache in many architectures, so they are wrong and should be changed to ioremap? Yangtao > > Bart