From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227TUdfq0fa561QdSnJEiXjABkO8yzxO6fJmmtMQiUfoxAeEQLtko82stRiMtRSfEgSCSCjC ARC-Seal: i=1; a=rsa-sha256; t=1516814103; cv=none; d=google.com; s=arc-20160816; b=TKa0klORlCz8L+i4aDa1ADbErj1VK9V8datNVDyTA4lpas/3nuo412qCWtmiXuhBof VFCLdWHm+9we8ZSfs+9z+NcvrlleJXNLoJIUArwuyis+D/ysBbj5TcDPOYL1bNwLDPgm 0ZuQLzxcPZEE8s1TbeXsdFzpqO5ltA7aPEBpjQmekHKf6/V/EsFPX2IktJX7dT91Yzyr 76+NeHkrLrReDIWu/HMN1d1T8u4I2uY5GLtvfjQhMRv33jpaaOgFE4ldjnxfKnvVKO1u KM5R3sLCAZZ43zle5yT5up7z9cbWKWWIkbbVRQI4RCkq4VWdbPPi9qVhnACpsxCMwUQm WVTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:sender:date :arc-authentication-results; bh=cLC4GZjHZXR9bWHonh4XnqtJilkgk7CyJr/pVoUMUg8=; b=pzWICxOJTeBeZAHnBJqcA3vuZ0BA8QtkICjoIK3B579wIu/UfUq/SU2S+66jAMvHbG E9d1iIGwI3AYvcSfhEnoavFbKXy/WCSYlPPz/89MHW0Jkd3PakY5LpdiiSCKYxMfJvka DDxwkQRPkFl11cac7CV0vyQByc/enIdJJ/vlvylqUCP2oRPibr1Xs+eoroxeJ8bafJQS t9c7fojToZluuqInjI0tB3D0BGtHi6f8V3pu8aNcGxRA6MkTTg5/eIGCr1w4ExmLsnAX TCEA9Y6wc0bcGC9sl/i2wW6ReqXYjGuk3g3nT0kzdl7/opsuMfc6JXmu+O5QAYungULe xPpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of ladis@linux-mips.org designates 148.251.95.138 as permitted sender) smtp.mailfrom=ladis@linux-mips.org Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of ladis@linux-mips.org designates 148.251.95.138 as permitted sender) smtp.mailfrom=ladis@linux-mips.org Date: Wed, 24 Jan 2018 18:15:01 +0100 Sender: Ladislav Michl From: Ladislav Michl To: Andy Shevchenko Cc: Linux Kernel Mailing List , "open list:MEMORY TECHNOLOGY..." , Thomas Gleixner , Tom Lendacky , Borislav Petkov , Ingo Molnar , Lorenzo Pieralisi , Philippe Ombredanne , Kate Stewart , Greg Kroah-Hartman , Boris Brezillon , Dmitry Torokhov , Bjorn Helgaas , Wei Yongjun Subject: Re: [PATCH v2 2/3] devres: Add devm_ioremap_shared_resource() Message-ID: <20180124171501.GA1043@lenoch> References: <20180124100604.GA19593@lenoch> <20180124100754.GC19593@lenoch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590467993608542121?= X-GMAIL-MSGID: =?utf-8?q?1590494865826791586?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Wed, Jan 24, 2018 at 06:21:38PM +0200, Andy Shevchenko wrote: > On Wed, Jan 24, 2018 at 12:07 PM, Ladislav Michl wrote: > > Implement managed ioremap function for shared resources. > > > +#define devm_ioremap_resource(dev, res) \ > > + __devm_ioremap_resource(dev, res, false) > > +#define devm_ioremap_shared_resource(dev, res) \ > > + __devm_ioremap_resource(dev, res, true) > > +void __iomem *__devm_ioremap_resource(struct device *dev, struct resource *res, > > + bool shared); > > I would rather do the following: > > _resource() -> _resource_exclusive() > > #define _resource() _resource_exclusive() > > Add _resource_shared() > > And use long names below in this file whenever refer to exclusive or > shared variant. Two separate functions were also considered, but I was unable to find small common implementation. If code size does not matter or you can provide a hint to make this solution small and nice, I'll go for it. > > void devm_iounmap(struct device *dev, void __iomem *addr); > > int check_signature(const volatile void __iomem *io_addr, > > const unsigned char *signature, int length); > > + > > void devm_ioremap_release(struct device *dev, void *res); > > This part doesn't belong to the change. > > > + * When possible, use devm_ioremap_resource() or > > + * devm_ioremap_shared_resource() instead. > > - * Checks that a resource is a valid memory region, requests the memory > > - * region and ioremaps it. All operations are managed and will be undone > > - * on driver detach. > > + * Checks that a resource is a valid memory region, eventually requests the > > + * memory region and ioremaps it. All operations are managed and will be > > + * undone on driver detach. > > Wording is changed and no clue in commit message why. Above will be moved to separate patch. ladis