Skip to content

Commit

Permalink
Merge tag 'pull-work.unaligned' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/viro/vfs

Pull generic unaligned.h cleanups from Al Viro:
 "Get rid of architecture-specific <asm/unaligned.h> includes, replacing
  them with a single generic <linux/unaligned.h> header file.

  It's the second largest (after asm/io.h) class of asm/* includes, and
  all but two architectures actually end up using exact same file.

  Massage the remaining two (arc and parisc) to do the same and just
  move the thing to from asm-generic/unaligned.h to linux/unaligned.h"

[ This is one of those things that we're better off doing outside the
  merge window, and would only cause extra conflict noise if it was in
  linux-next for the next release due to all the trivial #include line
  updates.  Rip off the band-aid.   - Linus ]

* tag 'pull-work.unaligned' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  move asm/unaligned.h to linux/unaligned.h
  arc: get rid of private asm/unaligned.h
  parisc: get rid of private asm/unaligned.h
  • Loading branch information
torvalds committed Oct 2, 2024
2 parents f23aa4c + 5f60d5f commit 7ec4621
Show file tree
Hide file tree
Showing 854 changed files with 876 additions and 890 deletions.
2 changes: 1 addition & 1 deletion Documentation/arch/arm/mem_alignment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ones.

Of course this is a bad idea to rely on the alignment trap to perform
unaligned memory access in general. If those access are predictable, you
are better to use the macros provided by include/asm/unaligned.h. The
are better to use the macros provided by include/linux/unaligned.h. The
alignment trap can fixup misaligned access for the exception cases, but at
a high performance cost. It better be rare.

Expand Down
2 changes: 1 addition & 1 deletion Documentation/core-api/unaligned-memory-access.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Avoiding unaligned accesses
===========================

The easiest way to avoid unaligned access is to use the get_unaligned() and
put_unaligned() macros provided by the <asm/unaligned.h> header file.
put_unaligned() macros provided by the <linux/unaligned.h> header file.

Going back to an earlier example of code that potentially causes unaligned
access::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ field2会导致非对齐访问,这并不是不合理的。你会期望field2
避免非对齐访问
==============

避免非对齐访问的最简单方法是使用<asm/unaligned.h>头文件提供的get_unaligned()和
避免非对齐访问的最简单方法是使用<linux/unaligned.h>头文件提供的get_unaligned()和
put_unaligned()宏。

回到前面的一个可能导致非对齐访问的代码例子::
Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <asm/gentrap.h>
#include <linux/uaccess.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <asm/sysinfo.h>
#include <asm/hwrpb.h>
#include <asm/mmu_context.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <linux/types.h>
#include <asm/byteorder.h>
#include <asm/page.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>

#ifdef CONFIG_ISA_ARCV2
#include <asm/barrier.h>
Expand Down
1 change: 1 addition & 0 deletions arch/arc/include/asm/mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ typedef struct {
unsigned long asid[NR_CPUS]; /* 8 bit MMU PID + Generation cycle */
} mm_context_t;

struct pt_regs;
extern void do_tlb_overlap_fault(unsigned long, unsigned long, struct pt_regs *);

#endif
Expand Down
27 changes: 0 additions & 27 deletions arch/arc/include/asm/unaligned.h

This file was deleted.

3 changes: 2 additions & 1 deletion arch/arc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
#include <linux/kgdb.h>
#include <asm/entry.h>
#include <asm/setup.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <asm/kprobes.h>
#include "unaligned.h"

void die(const char *str, struct pt_regs *regs, unsigned long address)
{
Expand Down
1 change: 1 addition & 0 deletions arch/arc/kernel/unaligned.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/ptrace.h>
#include <linux/uaccess.h>
#include <asm/disasm.h>
#include "unaligned.h"

#ifdef CONFIG_CPU_BIG_ENDIAN
#define BE 1
Expand Down
16 changes: 16 additions & 0 deletions arch/arc/kernel/unaligned.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
struct pt_regs;
struct callee_regs;

#ifdef CONFIG_ARC_EMUL_UNALIGNED
int misaligned_fixup(unsigned long address, struct pt_regs *regs,
struct callee_regs *cregs);
#else
static inline int
misaligned_fixup(unsigned long address, struct pt_regs *regs,
struct callee_regs *cregs)
{
/* Not fixed */
return 1;
}
#endif

2 changes: 1 addition & 1 deletion arch/arc/kernel/unwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <linux/uaccess.h>
#include <linux/ptrace.h>
#include <asm/sections.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <asm/unwind.h>

extern char __start_unwind[], __end_unwind[];
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/crypto/aes-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <asm/hwcap.h>
#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/aes.h>
#include <crypto/ctr.h>
#include <crypto/internal/simd.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/crypto/crc32-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <asm/hwcap.h>
#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>

#define PMULL_MIN_LEN 64L /* minimum size of buffer
* for crc32_pmull_le_16 */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/crypto/ghash-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <asm/hwcap.h>
#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/aes.h>
#include <crypto/gcm.h>
#include <crypto/b128ops.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/crypto/poly1305-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <asm/hwcap.h>
#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/algapi.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/poly1305.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/crypto/sha2-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <asm/hwcap.h>
#include <asm/simd.h>
#include <asm/neon.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>

#include "sha256_glue.h"

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/string.h>
#include <asm/page.h>
#include <asm/domain.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <asm/unified.h>
#include <asm/pgtable.h>
#include <asm/proc-fns.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mm/alignment.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <asm/cp15.h>
#include <asm/system_info.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <asm/opcodes.h>

#include "fault.h"
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/aes-ce-ccm-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

#include <asm/neon.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/aes.h>
#include <crypto/scatterwalk.h>
#include <crypto/internal/aead.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/aes-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/aes.h>
#include <crypto/algapi.h>
#include <crypto/internal/simd.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/ghash-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/aes.h>
#include <crypto/gcm.h>
#include <crypto/algapi.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/poly1305-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <asm/hwcap.h>
#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/algapi.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/poly1305.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/sha1-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/simd.h>
#include <crypto/sha1.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/sha2-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/simd.h>
#include <crypto/sha2.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/sha3-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <asm/hwcap.h>
#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/simd.h>
#include <crypto/sha3.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/sha512-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/simd.h>
#include <crypto/sha2.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/sm3-ce-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/simd.h>
#include <crypto/sm3.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/crypto/sm3-neon-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <asm/neon.h>
#include <asm/simd.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/simd.h>
#include <crypto/sm3.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/loongarch/crypto/crc32-loongarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <crypto/internal/hash.h>

#include <asm/cpu-features.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>

#define _CRC32(crc, value, size, type) \
do { \
Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/include/asm/flat.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef _ASM_MICROBLAZE_FLAT_H
#define _ASM_MICROBLAZE_FLAT_H

#include <asm/unaligned.h>
#include <linux/unaligned.h>

/*
* Microblaze works a little differently from other arches, because
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/boot/compressed/decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <linux/libfdt.h>

#include <asm/addrspace.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <asm-generic/vmlinux.lds.h>

#include "decompress.h"
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/crypto/crc32-mips.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <linux/module.h>
#include <linux/string.h>
#include <asm/mipsregs.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>

#include <crypto/internal/hash.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/mips/crypto/poly1305-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2019 Linaro Ltd. <ard.biesheuvel@linaro.org>
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <crypto/algapi.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/poly1305.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/nios2/kernel/misaligned.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <linux/seq_file.h>

#include <asm/traps.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>

/* instructions we emulate */
#define INST_LDHU 0x0b
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/boot/compressed/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <linux/uaccess.h>
#include <linux/elf.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <asm/page.h>
#include "sizes.h"

Expand Down
11 changes: 0 additions & 11 deletions arch/parisc/include/asm/unaligned.h

This file was deleted.

4 changes: 3 additions & 1 deletion arch/parisc/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/traps.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <linux/atomic.h>
#include <asm/smp.h>
#include <asm/pdc.h>
Expand All @@ -47,6 +47,8 @@
#include <linux/kgdb.h>
#include <linux/kprobes.h>

#include "unaligned.h"

#if defined(CONFIG_LIGHTWEIGHT_SPINLOCK_CHECK)
#include <asm/spinlock.h>
#endif
Expand Down
3 changes: 2 additions & 1 deletion arch/parisc/kernel/unaligned.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
#include <linux/ratelimit.h>
#include <linux/uaccess.h>
#include <linux/sysctl.h>
#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <asm/hardirq.h>
#include <asm/traps.h>
#include "unaligned.h"

/* #define DEBUG_UNALIGNED 1 */

Expand Down
3 changes: 3 additions & 0 deletions arch/parisc/kernel/unaligned.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
struct pt_regs;
void handle_unaligned(struct pt_regs *regs);
int check_unaligned(struct pt_regs *regs);
2 changes: 1 addition & 1 deletion arch/powerpc/crypto/aes-gcm-p10-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright 2022- IBM Inc. All rights reserved
*/

#include <asm/unaligned.h>
#include <linux/unaligned.h>
#include <asm/simd.h>
#include <asm/switch_to.h>
#include <crypto/aes.h>
Expand Down
Loading

0 comments on commit 7ec4621

Please sign in to comment.