[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 6 Jun 2022 21:28:22 +0800
From: Kefeng Wang <wangkefeng.wang@...wei.com>
To: Christoph Hellwig <hch@...radead.org>
CC: <catalin.marinas@....com>, <will@...nel.org>,
<akpm@...ux-foundation.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
<arnd@...db.de>, <anshuman.khandual@....com>
Subject: Re: [PATCH v4 5/6] arm64: mm: Convert to GENERIC_IOREMAP
On 2022/6/6 15:54, Christoph Hellwig wrote:
>> +#define ioremap_wc(addr, size) ioremap_prot((addr), (size), PROT_NORMAL_NC)
>> +#define ioremap_np(addr, size) ioremap_prot((addr), (size), PROT_DEVICE_nGnRnE)
> Please avoid the overly long lines here. Independt of that having
> a non-trivial body on a separate line tends to generlly be a lot more
> readable anyway.
Hi Christoph,
As commit bdc48fa11e46 ("checkpatch/coding-style: deprecate 80-column
warning") increased
the limit to 100 columns,so I don't get warning when using checkpatch,
and it is not a hard limit,
but if this is a mandatory requirement, I will resend them with break lines.
>> +#define ioremap_cache(addr, size) ({ \
>> + pfn_is_map_memory(__phys_to_pfn(addr)) ? \
>> + (void __iomem *)__phys_to_virt(addr) : ioremap_prot(addr, size, PROT_NORMAL); \
>> +})
> And this really should be an inline function.
We still need a define, see kernel/iomem.c,
#ifndef ioremap_cache
__weak void __iomem *ioremap_cache(resource_size_t offset, unsigned long
size)
{
return ioremap(offset, size);
}
#endif
>
>> +int iounmap_allowed(void __iomem *addr)
>> {
>> /*
>> * We could get an address outside vmalloc range in case
>> * of ioremap_cache() reusing a RAM mapping.
>> */
>> + return is_vmalloc_addr(addr) ? 0 : -EINVAL;
> As the generic ioremap only returns vmalloc addresses, this check
> really should go into common code.
Good point, will move into generic ioremap, thanks.
> .
Powered by blists - more mailing lists