[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3627579b-66dd-42aa-92ab-3d561cdfb2f8@app.fastmail.com>
Date: Fri, 01 Dec 2023 22:59:23 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Philipp Stanner" <pstanner@...hat.com>,
"Bjorn Helgaas" <bhelgaas@...gle.com>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Dan Williams" <dan.j.williams@...el.com>,
"Jonathan Cameron" <Jonathan.Cameron@...wei.com>,
"Jakub Kicinski" <kuba@...nel.org>,
"Dave Jiang" <dave.jiang@...el.com>,
"Uladzislau Koshchanka" <koshchanka@...il.com>,
"Neil Brown" <neilb@...e.de>,
"Niklas Schnelle" <schnelle@...ux.ibm.com>,
"John Sanpe" <sanpeqf@...il.com>,
"Kent Overstreet" <kent.overstreet@...il.com>,
"Masami Hiramatsu" <mhiramat@...nel.org>,
"Kees Cook" <keescook@...omium.org>,
"David Gow" <davidgow@...gle.com>,
"Yury Norov" <yury.norov@...il.com>,
"wuqiang.matt" <wuqiang.matt@...edance.com>,
"Jason Baron" <jbaron@...mai.com>,
"Kefeng Wang" <wangkefeng.wang@...wei.com>,
"Ben Dooks" <ben.dooks@...ethink.co.uk>,
"Danilo Krummrich" <dakr@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
Linux-Arch <linux-arch@...r.kernel.org>,
"Arnd Bergmann" <arnd@...nel.org>
Subject: Re: [PATCH v2 4/4] lib, pci: unify generic pci_iounmap()
On Fri, Dec 1, 2023, at 22:56, Philipp Stanner wrote:
> On Fri, 2023-12-01 at 22:32 +0100, Arnd Bergmann wrote:
>> On Fri, Dec 1, 2023, at 20:37, Philipp Stanner wrote:
>> The best I can think of is to move the lib/iomap.c version
>> of iomem_is_ioport() to include/asm-generic/iomap.h with
>> an #ifndef iomem_is_ioport / #define iomem_is_ioport
>> check around it. This file is only included on parisc, alpha,
>> sh and when CONFIG_GENERIC_IOMAP is set.
>
> My implementation from lib/iomap.c basically just throws away the
> IO_COND macro and does the checks manually:
>
> #if defined(ARCH_WANTS_GENERIC_IOMEM_IS_IOPORT)
> bool iomem_is_ioport(void __iomem *addr)
> {
> unsigned long port = (unsigned long __force)addr;
>
> if (port > PIO_OFFSET && port < PIO_RESERVED)
> return true;
>
> return false;
> }
> #endif /* ARCH_WANTS_GENERIC_IOMEM_IS_IOPORT */
>
> So we'd also need PIO_OFFSET and PIO_RESERVED, which are not present in
> asm-generic/iomap.h.
>
> Sure, we could move them there or into a common header. But I'm not
> sure if that is wise, meaning: is it really better than the ugly
> WANTS_GENERIC_IOMEM... macro?
>
> Our entire goal in this series is, after all, to simplify the
> implementation.
Right, in that case it's probably better to leave it in lib/iomap.c,
just keep the ARCH_WANTS_GENERIC_IOMEM_IS_IOPORT definition
in include/asm-generic/iomap.h as well then and keep it out of
the normal asm-generic/io.h path.
Arnd
Powered by blists - more mailing lists