Received: by 10.223.176.46 with SMTP id f43csp2179194wra; Sun, 21 Jan 2018 13:16:07 -0800 (PST) X-Google-Smtp-Source: AH8x226CsfTb9TZwFh1VRXi2aZAaEcomULhsiWQMYZ9CgID138MQTycwd4gDd+NAiJWxF5EZHmAj X-Received: by 10.98.7.207 with SMTP id 76mr6108949pfh.130.1516569367843; Sun, 21 Jan 2018 13:16:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516569367; cv=none; d=google.com; s=arc-20160816; b=OLqv2x2BSJkzncbyAbq0DzSEoN++ajCSLhYTNexgKoBDVbHAie2wo0gjEosq7DQR+H gVLpGBzDFXR2N3YDXFnsbhxwDL7JyLmCtsXmOwqrpfh5pMjcE3d90kJ0OKNuxtkMvU25 l1/BcyrnIzFdVg5mo14pAiLTycpp2/UoINABVB37hbGjVD2MgCmaDDBSLy4K77REfpq4 hs/laed3tC+/ktyRM0crPIsPHIZy/xKD37OjcoMsmP9MwStV0CJCMmPFgK+uEKxVLOsp q9n3pcMcsXGohFGYERB37kwhTNzFy+riosKKsIls/pL9LdNJPlMok56EpM2EBBwfkyEZ MMDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=ufQF5w84rLMu7MY8hYyL977NKBaAWXd1Wlba5XSAMgY=; b=nTPLzipyo2hsir5J7ZZ/1vavYbNA3cvy1Tg5ANAc465+mCHC2ALMUaX9yvLJBSjs7o 8grKtZpdDdyXXA4k9Too8xTU2GHqacnPGt1u0GKskcn6Bp4X6KwRTzxJRsRKdaKWWu41 whjs7nbrUpJ9pxjZrD6Duii3W1MoSZEL/Ajqq2NtqbMV40Y92RYRUHgRIrJXZ1xjWeKk +Vr1JqGT94MYf8r/aYnZcJkSGzvwD4Jy/Va7clLf8totAjdo/2U6zBSFXGUHp19rh2lv dDFNe7EiA9wPeilmWwHYcQLwusuJYPlG7Ter2rkKwdClQNRLtzkMNu6k1DoI3et21ujA n1Sg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si989962plh.549.2018.01.21.13.15.53; Sun, 21 Jan 2018 13:16:07 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751233AbeAUVOj (ORCPT + 99 others); Sun, 21 Jan 2018 16:14:39 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:39738 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbeAUVOh (ORCPT ); Sun, 21 Jan 2018 16:14:37 -0500 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23992604AbeAUVOe3KU-G (ORCPT + 1 other); Sun, 21 Jan 2018 22:14:34 +0100 Date: Sun, 21 Jan 2018 22:14:32 +0100 From: Ladislav Michl To: Bjorn Helgaas , Wei Yongjun Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Dmitry Torokhov Subject: [RFC 0/5] Add managed ioremap function for shared resources Message-ID: <20180121211432.GA15151@lenoch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Many drivers can simplified by using devm_ioremap_resource() instead of open coding its functionality. However, as pointed by Wei Yongjun, that function cannot be used when memory region is already taken. See previous discussion here: https://www.spinics.net/lists/linux-pci/msg68495.html To ease job of driver developers, new function for that purpose is implemented and its usage shown. Also, there are few cleanup patches, which may bring some controversy, but seemed usefull to do along the way. Feel free to object or suggest something else. Thank you. Ladislav Michl (5): devres: Move managed io function declarations into device.h PCI: Move managed resource alloc to devres devres: Make devm_ioremap_release() static devres: Add devm_ioremap_shared_resource() mtd: nand: davinci: Use devm_ioremap_shared_resource() drivers/mtd/nand/davinci_nand.c | 24 +++------ drivers/pci/pci.c | 82 ------------------------------- include/linux/device.h | 65 +++++++++++++++++++++++- include/linux/io.h | 39 --------------- include/linux/ioport.h | 23 --------- lib/devres.c | 106 ++++++++++++++++++++++++++++++++++++---- 6 files changed, 168 insertions(+), 171 deletions(-) -- 2.15.1