Re: [PATCH V3 13/15] parisc/kmap: Remove duplicate kmap code

From: Andrew Morton
Date: Thu May 07 2020 - 16:53:03 EST


On Thu, 7 May 2020 08:00:01 -0700 ira.weiny@xxxxxxxxx wrote:

> parisc reimplements the kmap calls except to flush it's dcache. This is
> arguably an abuse of kmap but regardless it is messy and confusing.
>
> Remove the duplicate code and have parisc define
> ARCH_HAS_FLUSH_ON_KUNMAP for a kunmap_flush_on_unmap() architecture
> specific call to flush the cache.

checkpatch says:

ERROR: #define of 'ARCH_HAS_FLUSH_ON_KUNMAP' is wrong - use Kconfig variables or standard guards instead
#69: FILE: arch/parisc/include/asm/cacheflush.h:103:
+#define ARCH_HAS_FLUSH_ON_KUNMAP

which is fair enough, I guess. More conventional would be

arch/parisc/include/asm/cacheflush.h:

static inline void kunmap_flush_on_unmap(void *addr)
{
...
}
#define kunmap_flush_on_unmap kunmap_flush_on_unmap


include/linux/highmem.h:

#ifndef kunmap_flush_on_unmap
static inline void kunmap_flush_on_unmap(void *addr)
{
}
#define kunmap_flush_on_unmap kunmap_flush_on_unmap
#endif


static inline void kunmap_atomic_high(void *addr)
{
/* Mostly nothing to do in the CONFIG_HIGHMEM=n case as kunmap_atomic()
* handles re-enabling faults + preemption */
kunmap_flush_on_unmap(addr);
}


but I don't really think it's worth bothering changing it.

(Ditto patch 3/15)