Commit c752c21c authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'auto-type-conversion-for-v6.19-rc1' of...

Merge tag 'auto-type-conversion-for-v6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-auto

Pull __auto_type to auto conversion from Peter Anvin:
 "Convert '__auto_type' to 'auto', defining a macro for 'auto' unless
  C23+ is in use"

* tag 'auto-type-conversion-for-v6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-auto:
  tools/virtio: replace "__auto_type" with "auto"
  selftests/bpf: replace "__auto_type" with "auto"
  arch/x86: replace "__auto_type" with "auto"
  arch/nios2: replace "__auto_type" and adjacent equivalent with "auto"
  fs/proc: replace "__auto_type" with "const auto"
  include/linux: change "__auto_type" to "auto"
  compiler_types.h: add "auto" as a macro for "__auto_type"
parents 3d99347a 4ecc26fa
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -172,15 +172,15 @@ do { \

#define __put_user(x, ptr)						\
({									\
	__auto_type __pu_ptr = (ptr);					\
	typeof(*__pu_ptr) __pu_val = (typeof(*__pu_ptr))(x);		\
	auto __pu_ptr = (ptr);						\
	auto __pu_val = (typeof(*__pu_ptr))(x);				\
	__put_user_common(__pu_val, __pu_ptr);				\
})

#define put_user(x, ptr)						\
({									\
	__auto_type __pu_ptr = (ptr);					\
	typeof(*__pu_ptr) __pu_val = (typeof(*__pu_ptr))(x);		\
	auto __pu_ptr = (ptr);						\
	auto __pu_val = (typeof(*__pu_ptr))(x);				\
	access_ok(__pu_ptr, sizeof(*__pu_ptr)) ?			\
		__put_user_common(__pu_val, __pu_ptr) :			\
		-EFAULT;						\
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ do { \

#define __WARN_FLAGS(cond_str, flags)					\
do {									\
	__auto_type __flags = BUGFLAG_WARNING|(flags);			\
	auto __flags = BUGFLAG_WARNING|(flags);				\
	instrumentation_begin();					\
	_BUG_FLAGS(cond_str, ASM_UD2, __flags, ARCH_WARN_REACHABLE);	\
	instrumentation_end();						\
+3 −3
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ KCFI_REFERENCE(__memset);
#define __HAVE_ARCH_MEMSET16
static inline void *memset16(uint16_t *s, uint16_t v, size_t n)
{
	const __auto_type s0 = s;
	const auto s0 = s;
	asm volatile (
		"rep stosw"
		: "+D" (s), "+c" (n)
@@ -44,7 +44,7 @@ static inline void *memset16(uint16_t *s, uint16_t v, size_t n)
#define __HAVE_ARCH_MEMSET32
static inline void *memset32(uint32_t *s, uint32_t v, size_t n)
{
	const __auto_type s0 = s;
	const auto s0 = s;
	asm volatile (
		"rep stosl"
		: "+D" (s), "+c" (n)
@@ -57,7 +57,7 @@ static inline void *memset32(uint32_t *s, uint32_t v, size_t n)
#define __HAVE_ARCH_MEMSET64
static inline void *memset64(uint64_t *s, uint64_t v, size_t n)
{
	const __auto_type s0 = s;
	const auto s0 = s;
	asm volatile (
		"rep stosq"
		: "+D" (s), "+c" (n)
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ static inline void __user *mask_user_address(const void __user *ptr)
	return ret;
}
#define masked_user_access_begin(x) ({				\
	__auto_type __masked_ptr = (x);				\
	auto __masked_ptr = (x);				\
	__masked_ptr = mask_user_address(__masked_ptr);		\
	__uaccess_begin(); __masked_ptr; })

+9 −10
Original line number Diff line number Diff line
@@ -303,7 +303,7 @@ static ssize_t proc_reg_read_iter(struct kiocb *iocb, struct iov_iter *iter)

static ssize_t pde_read(struct proc_dir_entry *pde, struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
	__auto_type read = pde->proc_ops->proc_read;
	const auto read = pde->proc_ops->proc_read;
	if (read)
		return read(file, buf, count, ppos);
	return -EIO;
@@ -325,7 +325,7 @@ static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count,

static ssize_t pde_write(struct proc_dir_entry *pde, struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
	__auto_type write = pde->proc_ops->proc_write;
	const auto write = pde->proc_ops->proc_write;
	if (write)
		return write(file, buf, count, ppos);
	return -EIO;
@@ -347,7 +347,7 @@ static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t

static __poll_t pde_poll(struct proc_dir_entry *pde, struct file *file, struct poll_table_struct *pts)
{
	__auto_type poll = pde->proc_ops->proc_poll;
	const auto poll = pde->proc_ops->proc_poll;
	if (poll)
		return poll(file, pts);
	return DEFAULT_POLLMASK;
@@ -369,7 +369,7 @@ static __poll_t proc_reg_poll(struct file *file, struct poll_table_struct *pts)

static long pde_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned int cmd, unsigned long arg)
{
	__auto_type ioctl = pde->proc_ops->proc_ioctl;
	const auto ioctl = pde->proc_ops->proc_ioctl;
	if (ioctl)
		return ioctl(file, cmd, arg);
	return -ENOTTY;
@@ -392,7 +392,7 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne
#ifdef CONFIG_COMPAT
static long pde_compat_ioctl(struct proc_dir_entry *pde, struct file *file, unsigned int cmd, unsigned long arg)
{
	__auto_type compat_ioctl = pde->proc_ops->proc_compat_ioctl;
	const auto compat_ioctl = pde->proc_ops->proc_compat_ioctl;
	if (compat_ioctl)
		return compat_ioctl(file, cmd, arg);
	return -ENOTTY;
@@ -414,7 +414,7 @@ static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned

static int pde_mmap(struct proc_dir_entry *pde, struct file *file, struct vm_area_struct *vma)
{
	__auto_type mmap = pde->proc_ops->proc_mmap;
	const auto mmap = pde->proc_ops->proc_mmap;
	if (mmap)
		return mmap(file, vma);
	return -EIO;
@@ -497,7 +497,7 @@ static int proc_reg_open(struct inode *inode, struct file *file)
	if (!use_pde(pde))
		return -ENOENT;

	__auto_type release = pde->proc_ops->proc_release;
	const auto release = pde->proc_ops->proc_release;
	if (release) {
		pdeo = kmem_cache_alloc(pde_opener_cache, GFP_KERNEL);
		if (!pdeo) {
@@ -534,10 +534,9 @@ static int proc_reg_release(struct inode *inode, struct file *file)
	struct pde_opener *pdeo;

	if (pde_is_permanent(pde)) {
		__auto_type release = pde->proc_ops->proc_release;
		if (release) {
		const auto release = pde->proc_ops->proc_release;
		if (release)
			return release(inode, file);
		}
		return 0;
	}

Loading