Alejandro-Colo…
Commits on Nov 20, 2021
-
linux/power_of_2.h: Implement [__]BUILD_BUG_ON_NOT_POWER_OF_2() in te…
…rms of __IS_POWER_OF_2[_OR_0]() Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/build_bug.h, linux/power_of_2.h: Move [__]BUILD_BUG_ON_NOT_POWE…
…R_OF_2() to <linux/power_of_2.h> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/power_of_2.h: Add __IS_POWER_OF_2(n) and __IS_POWER_OF_2_OR_0(n…
…) macros Tested: $ cat pow2.c #include <stdio.h> #define is_power_of_2_or_0(n) (((n) & ((n) - 1)) == 0) #define is_power_of_2(n) (is_power_of_2_or_0(n) && ((n) != 0)) int main(void) { printf("%i, %i, %i\n", 8, is_power_of_2_or_0(8), is_power_of_2(8)); printf("%i, %i, %i\n", 7, is_power_of_2_or_0(7), is_power_of_2(7)); printf("%i, %i, %i\n", 6, is_power_of_2_or_0(6), is_power_of_2(6)); printf("%i, %i, %i\n", 5, is_power_of_2_or_0(5), is_power_of_2(5)); printf("%i, %i, %i\n", 4, is_power_of_2_or_0(4), is_power_of_2(4)); printf("%i, %i, %i\n", 3, is_power_of_2_or_0(3), is_power_of_2(3)); printf("%i, %i, %i\n", 2, is_power_of_2_or_0(2), is_power_of_2(2)); printf("%i, %i, %i\n", 1, is_power_of_2_or_0(1), is_power_of_2(1)); printf("%i, %i, %i\n", 0, is_power_of_2_or_0(0), is_power_of_2(0)); } $ cc pow2.c $ ./a.out 8, 1, 1 7, 0, 0 6, 0, 0 5, 0, 0 4, 1, 1 3, 0, 0 2, 1, 1 1, 1, 1 0, 1, 0 Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com> -
linux/array_size.h: Add __is_array(a) to help readability
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/compiler.h, linux/array_size.h: Move __must_be_array() into <li…
…nux/array_size.h> Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/compiler.h: Implement __must_be_array() in terms of __must_be()
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/compiler_types.h, linux/same_type.h: Split __same_type() to a s…
…eparate header Include <linux/same_type.h> from <linux/compiler_types.h> for compatibility. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
Move BUILD_BUG_ON_ZERO to <linux/must_be.h>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/must_be.h: Add must_be() to improve readability of BUILD_BUG_ON…
…_ZERO() Historically, BUILD_BUG_ON_ZERO() has been hard to read. __must_be_array() is based on BUILD_BUG_ON_ZERO(), and unlike BUILD_BUG_ON_*(), it has a pretty readable name. Let's generalize it with this kind of usage: #define __must_be_array(a) must_be(__is_array(a)) So next step is to create macros of the kind: __is_array(a) Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/container_of.h: Cosmetic
Place braces in a ({}) expression similarly to how a function would have them. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com> -
linux/container_of.h: Remove unnecessary cast
Casts are dangerous. Moreover, (almost) everything converts to 'void *' implicitly, with the exception of pointers to const. Change the temporary to be const, and therefore allow implicit conversion from everything. Since we don't modify it, this also adds safety. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
Implement offsetof(), sizeof_member(), typeof_member(), and container…
…_of() in terms of memberof() Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
Implement container_of_safe() in terms of container_of()
There's no more a need for the temporary variable __mptr, since now it's only passed to functions that accept a 'const void *', and everything can convert automatically to it, reducing the need for the cast too. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/memberof.h: Add memberof(T, m) macro
(((T *)0)->m) if a typical construct used by some wrappers, and also directly in many places. Write a macro to encapsulate that construct, and avoid repetition (and possible mistakes). It also helps readability by reducing the complexity of mentally parsing so many symbols together, with a readable name. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/kernel.h, linux/array_size.h: Split ARRAY_SIZE() into a separat…
…e header Include <linux/array_size.h> from <linux/kernel.h> for compatibility. Include <linux/compiler.h> for __must_be_array(). Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/container_of.h, linux/typeof_member.h: Split typeof_member() in…
…to a separate header Include <linux/typeof_member.h> from <linux/container_of.h> for compatibility. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/stddef.h, linux/NULL.h: Split NULL into a separate header
Include <linux/NULL.h> from <linux/stddef.h> for compatibility. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/stddef.h, linux/offsetofend.h: Split offsetofend() into a separ…
…ate header Include <linux/offsetofend.h> from <linux/stddef.h> for compatibility. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/stddef.h, linux/sizeof_field.h: Split sizeof_field() into a sep…
…arate header Include <linux/sizeof_field.h> from <linux/stddef.h> for compatibility. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-
linux/stddef.h, linux/offsetof.h: Split offsetof() into a separate he…
…ader Include <linux/offsetof.h> from <linux/stddef.h> for compatibility. From <linux/offsetof.h>: Include the same exact deps that <linux/stddef.h> had. Changing that in any way broke my compilation. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com> f
Commits on Nov 18, 2021
-
of: property: fw_devlink: Fixup behaviour when 'node_not_dev' is set
In the struct supplier_bindings the member 'node_not_dev' is described as "The consumer node containing the property is never a device.", but that is inconsistent with the behaviour of the code in of_link_property(), as it calls of_get_compat_node() that starts parsing for a compatible property from the node it gets passed to it. The proper behaviour is to start at the node's parent, so let's do that. While at it, let's take the opportunity to update the description of the 'node_not_dev' flag, as to clarify its purpose. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Saravana Kannan <saravanak@google.com> Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20210902090221.820254-1-ulf.hansson@linaro.org
Commits on Nov 15, 2021
-
dt-bindings: vendor-prefixes: add T-Head Semiconductor
Add vendor prefix for T-Head Semiconductor [1] [2] [1] https://github.com/T-head-Semi [2] https://www.t-head.cn/ Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Cc: Rob Herring <robh@kernel.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: devicetree <devicetree@vger.kernel.org> Link: https://lore.kernel.org/r/20211103020921.3870764-1-guoren@kernel.org Signed-off-by: Rob Herring <robh@kernel.org>
Commits on Nov 14, 2021
-
-
kconfig: Add support for -Wimplicit-fallthrough
Add Kconfig support for -Wimplicit-fallthrough for both GCC and Clang. The compiler option is under configuration CC_IMPLICIT_FALLTHROUGH, which is enabled by default. Special thanks to Nathan Chancellor who fixed the Clang bug[1][2]. This bugfix only appears in Clang 14.0.0, so older versions still contain the bug and -Wimplicit-fallthrough won't be enabled for them, for now. This concludes a long journey and now we are finally getting rid of the unintentional fallthrough bug-class in the kernel, entirely. :) Link: llvm/llvm-project@9ed4a94 [1] Link: https://bugs.llvm.org/show_bug.cgi?id=51094 [2] Link: KSPP#115 Link: ClangBuiltLinux#236 Co-developed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Kees Cook <keescook@chromium.org> Co-developed-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Tested-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-
Merge tag 'xfs-5.16-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/x…
…fs-linux Pull xfs cleanups from Darrick Wong: "The most 'exciting' aspect of this branch is that the xfsprogs maintainer and I have worked through the last of the code discrepancies between kernel and userspace libxfs such that there are no code differences between the two except for #includes. IOWs, diff suffices to demonstrate that the userspace tools behave the same as the kernel, and kernel-only bits are clearly marked in the /kernel/ source code instead of just the userspace source. Summary: - Clean up open-coded swap() calls. - A little bit of #ifdef golf to complete the reunification of the kernel and userspace libxfs source code" * tag 'xfs-5.16-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: sync xfs_btree_split macros with userspace libxfs xfs: #ifdef out perag code for userspace xfs: use swap() to make dabtree code cleaner -
Merge tag 'for-5.16/parisc-3' of git://git.kernel.org/pub/scm/linux/k…
…ernel/git/deller/parisc-linux Pull more parisc fixes from Helge Deller: "Fix a build error in stracktrace.c, fix resolving of addresses to function names in backtraces, fix single-stepping in assembly code and flush userspace pte's when using set_pte_at()" * tag 'for-5.16/parisc-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc/entry: fix trace test in syscall exit path parisc: Flush kernel data mapping in set_pte_at() when installing pte for user page parisc: Fix implicit declaration of function '__kernel_text_address' parisc: Fix backtrace to always include init funtion names
-
Merge tag 'sh-for-5.16' of git://git.libc.org/linux-sh
Pull arch/sh updates from Rich Felker. * tag 'sh-for-5.16' of git://git.libc.org/linux-sh: sh: pgtable-3level: Fix cast to pointer from integer of different size sh: fix READ/WRITE redefinition warnings sh: define __BIG_ENDIAN for math-emu sh: math-emu: drop unused functions sh: fix kconfig unmet dependency warning for FRAME_POINTER sh: Cleanup about SPARSE_IRQ sh: kdump: add some attribute to function maple: fix wrong return value of maple_bus_init(). sh: boot: avoid unneeded rebuilds under arch/sh/boot/compressed/ sh: boot: add intermediate vmlinux.bin* to targets instead of extra-y sh: boards: Fix the cacography in irq.c sh: check return code of request_irq sh: fix trivial misannotations
-
Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Pull ARM fixes from Russell King: - Fix early_iounmap - Drop cc-option fallbacks for architecture selection * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm: ARM: 9156/1: drop cc-option fallbacks for architecture selection ARM: 9155/1: fix early early_iounmap()
-
Merge tag 'devicetree-fixes-for-5.16-1' of git://git.kernel.org/pub/s…
…cm/linux/kernel/git/robh/linux Pull devicetree fixes from Rob Herring: - Two fixes due to DT node name changes on Arm, Ltd. boards - Treewide rename of Ingenic CGU headers - Update ST email addresses - Remove Netlogic DT bindings - Dropping few more cases of redundant 'maxItems' in schemas - Convert toshiba,tc358767 bridge binding to schema * tag 'devicetree-fixes-for-5.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: dt-bindings: watchdog: sunxi: fix error in schema bindings: media: venus: Drop redundant maxItems for power-domain-names dt-bindings: Remove Netlogic bindings clk: versatile: clk-icst: Ensure clock names are unique of: Support using 'mask' in making device bus id dt-bindings: treewide: Update @st.com email address to @FOSS.st.com dt-bindings: media: Update maintainers for st,stm32-hwspinlock.yaml dt-bindings: media: Update maintainers for st,stm32-cec.yaml dt-bindings: mfd: timers: Update maintainers for st,stm32-timers dt-bindings: timer: Update maintainers for st,stm32-timer dt-bindings: i2c: imx: hardware do not restrict clock-frequency to only 100 and 400 kHz dt-bindings: display: bridge: Convert toshiba,tc358767.txt to yaml dt-bindings: Rename Ingenic CGU headers to ingenic,*.h
-
Merge tag 'timers-urgent-2021-11-14' of git://git.kernel.org/pub/scm/…
…linux/kernel/git/tip/tip Pull timer fix from Thomas Gleixner: "A single fix for POSIX CPU timers to address a problem where POSIX CPU timer delivery stops working for a new child task because copy_process() copies state information which is only valid for the parent task" * tag 'timers-urgent-2021-11-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: posix-cpu-timers: Clear task::posix_cputimers_work in copy_process()
-
Merge tag 'irq-urgent-2021-11-14' of git://git.kernel.org/pub/scm/lin…
…ux/kernel/git/tip/tip Pull irq fixes from Thomas Gleixner: "A set of fixes for the interrupt subsystem Core code: - A regression fix for the Open Firmware interrupt mapping code where a interrupt controller property in a node caused a map property in the same node to be ignored. Interrupt chip drivers: - Workaround a limitation in SiFive PLIC interrupt chip which silently ignores an EOI when the interrupt line is masked. - Provide the missing mask/unmask implementation for the CSKY MP interrupt controller. PCI/MSI: - Prevent a use after free when PCI/MSI interrupts are released by destroying the sysfs entries before freeing the memory which is accessed in the sysfs show() function. - Implement a mask quirk for the Nvidia ION AHCI chip which does not advertise masking capability despite implementing it. Even worse the chip comes out of reset with all MSI entries masked, which due to the missing masking capability never get unmasked. - Move the check which prevents accessing the MSI[X] masking for XEN back into the low level accessors. The recent consolidation missed that these accessors can be invoked from places which do not have that check which broke XEN. Move them back to he original place instead of sprinkling tons of these checks all over the code" * tag 'irq-urgent-2021-11-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: of/irq: Don't ignore interrupt-controller when interrupt-map failed irqchip/sifive-plic: Fixup EOI failed when masked irqchip/csky-mpintc: Fixup mask/unmask implementation PCI/MSI: Destroy sysfs before freeing entries PCI: Add MSI masking quirk for Nvidia ION AHCI PCI/MSI: Deal with devices lying about their MSI mask capability PCI/MSI: Move non-mask check back into low level accessors -
Merge tag 'locking-urgent-2021-11-14' of git://git.kernel.org/pub/scm…
…/linux/kernel/git/tip/tip Pull x86 static call update from Thomas Gleixner: "A single fix for static calls to make the trampoline patching more robust by placing explicit signature bytes after the call trampoline to prevent patching random other jumps like the CFI jump table entries" * tag 'locking-urgent-2021-11-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: static_call,x86: Robustify trampoline patching
-
Merge tag 'sched_urgent_for_v5.16_rc1' of git://git.kernel.org/pub/sc…
…m/linux/kernel/git/tip/tip Pull scheduler fixes from Borislav Petkov: - Avoid touching ~100 config files in order to be able to select the preemption model - clear cluster CPU masks too, on the CPU unplug path - prevent use-after-free in cfs - Prevent a race condition when updating CPU cache domains - Factor out common shared part of smp_prepare_cpus() into a common helper which can be called by both baremetal and Xen, in order to fix a booting of Xen PV guests * tag 'sched_urgent_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: preempt: Restore preemption model selection configs arch_topology: Fix missing clear cluster_cpumask in remove_cpu_topology() sched/fair: Prevent dead task groups from regaining cfs_rq's sched/core: Mitigate race cpus_share_cache()/update_top_cache_domain() x86/smp: Factor out parts of native_smp_prepare_cpus()
-
Merge tag 'perf_urgent_for_v5.16_rc1' of git://git.kernel.org/pub/scm…
…/linux/kernel/git/tip/tip Pull perf fixes from Borislav Petkov: - Prevent unintentional page sharing by checking whether a page reference to a PMU samples page has been acquired properly before that - Make sure the LBR_SELECT MSR is saved/restored too - Reset the LBR_SELECT MSR when resetting the LBR PMU to clear any residual data left * tag 'perf_urgent_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/core: Avoid put_page() when GUP fails perf/x86/vlbr: Add c->flags to vlbr event constraints perf/x86/lbr: Reset LBR_SELECT during vlbr reset
-
Merge tag 'x86_urgent_for_v5.16_rc1' of git://git.kernel.org/pub/scm/…
…linux/kernel/git/tip/tip Pull x86 fixes from Borislav Petkov: - Add the model number of a new, Raptor Lake CPU, to intel-family.h - Do not log spurious corrected MCEs on SKL too, due to an erratum - Clarify the path of paravirt ops patches upstream - Add an optimization to avoid writing out AMX components to sigframes when former are in init state * tag 'x86_urgent_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/cpu: Add Raptor Lake to Intel family x86/mce: Add errata workaround for Skylake SKX37 MAINTAINERS: Add some information to PARAVIRT_OPS entry x86/fpu: Optimize out sigframe xfeatures when in init state