aboutsummaryrefslogtreecommitdiff
path: root/include/linux/units.h
AgeCommit message (Collapse)AuthorFilesLines
2023-12-06units: add missing headerAndy Shevchenko1-0/+1
BITS_PER_BYTE is defined in bits.h. Link: https://lkml.kernel.org/r/[email protected] Fixes: e8eed5f7366f ("units: Add BYTES_PER_*BIT") Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Cc: Damian Muszynski <[email protected]> Cc: Rasmus Villemoes <[email protected]> Cc: Herbert Xu <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
2023-10-27units: Add BYTES_PER_*BITDamian Muszynski1-0/+4
There is going to be a new user of the BYTES_PER_[K/M/G]BIT definition besides possibly existing ones. Add them to the header. Signed-off-by: Damian Muszynski <[email protected]> Reviewed-by: Giovanni Cabiddu <[email protected]> Reviewed-by: Tero Kristo <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
2022-08-28units: complement the set of Hz unitsDmitry Rokosov1-0/+3
Currently, Hz units do not have milli, micro and nano Hz coefficients. Some drivers (IIO especially) use their analogues to calculate appropriate Hz values. This patch includes them to units.h definitions, so they can be used from different kernel places. Signed-off-by: Dmitry Rokosov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
2021-09-08Merge branch 'akpm' (patches from Andrew)Linus Torvalds1-3/+7
Merge more updates from Andrew Morton: "147 patches, based on 7d2a07b769330c34b4deabeed939325c77a7ec2f. Subsystems affected by this patch series: mm (memory-hotplug, rmap, ioremap, highmem, cleanups, secretmem, kfence, damon, and vmscan), alpha, percpu, procfs, misc, core-kernel, MAINTAINERS, lib, checkpatch, epoll, init, nilfs2, coredump, fork, pids, criu, kconfig, selftests, ipc, and scripts" * emailed patches from Andrew Morton <[email protected]>: (94 commits) scripts: check_extable: fix typo in user error message mm/workingset: correct kernel-doc notations ipc: replace costly bailout check in sysvipc_find_ipc() selftests/memfd: remove unused variable Kconfig.debug: drop selecting non-existing HARDLOCKUP_DETECTOR_ARCH configs: remove the obsolete CONFIG_INPUT_POLLDEV prctl: allow to setup brk for et_dyn executables pid: cleanup the stale comment mentioning pidmap_init(). kernel/fork.c: unexport get_{mm,task}_exe_file coredump: fix memleak in dump_vma_snapshot() fs/coredump.c: log if a core dump is aborted due to changed file permissions nilfs2: use refcount_dec_and_lock() to fix potential UAF nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group nilfs2: fix NULL pointer in nilfs_##name##_attr_release nilfs2: fix memory leak in nilfs_sysfs_create_device_group trap: cleanup trap_init() init: move usermodehelper_enable() to populate_rootfs() ...
2021-09-08units: add the HZ macrosDaniel Lezcano1-0/+4
The macros for the unit conversion for frequency are duplicated in different places. Provide these macros in the 'units' header, so they can be reused. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]> Reviewed-by: Christian Eggers <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Cc: Chanwoo Choi <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Jonathan Cameron <[email protected]> Cc: Jonathan Cameron <[email protected]> Cc: Kyungmin Park <[email protected]> Cc: Lars-Peter Clausen <[email protected]> Cc: Lukasz Luba <[email protected]> Cc: Maxime Coquelin <[email protected]> Cc: Miquel Raynal <[email protected]> Cc: MyungJoo Ham <[email protected]> Cc: Peter Meerwald <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Zhang Rui <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2021-09-08units: change from 'L' to 'UL'Daniel Lezcano1-3/+3
Patch series "Add Hz macros", v3. There are multiple definitions of the HZ_PER_MHZ or HZ_PER_KHZ in the different drivers. Instead of duplicating this definition again and again, add one in the units.h header to be reused in all the place the redefiniton occurs. At the same time, change the type of the Watts, as they can not be negative. This patch (of 10): The users of the macros are safe to be assigned with an unsigned instead of signed as the variables using them are themselves unsigned. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Jonathan Cameron <[email protected]> Cc: Christian Eggers <[email protected]> Cc: Lukasz Luba <[email protected]> Cc: MyungJoo Ham <[email protected]> Cc: Kyungmin Park <[email protected]> Cc: Lars-Peter Clausen <[email protected]> Cc: Peter Meerwald <[email protected]> Cc: Zhang Rui <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Miquel Raynal <[email protected]> Cc: Maxime Coquelin <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Daniel Lezcano <[email protected]> Cc: Chanwoo Choi <[email protected]> Cc: Jonathan Cameron <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2021-08-11units: Add SI metric prefix definitionsAndy Shevchenko1-0/+16
Sometimes it's useful to have well-defined SI metric prefix to be used to self-describe the formulas or equations. List most popular ones in the units.h. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
2021-02-15Merge branches 'powercap' and 'pm-misc'Rafael J. Wysocki1-0/+4
* powercap: powercap: intel_rapl: Use topology interface in rapl_init_domains() powercap: intel_rapl: Use topology interface in rapl_add_package() powercap/intel_rapl: add support for AlderLake Mobile powercap/drivers/dtpm: Fix size of object being allocated powercap/drivers/dtpm: Fix an IS_ERR() vs NULL check powercap/drivers/dtpm: Fix some missing unlock bugs powercap/drivers/dtpm: Fix a double shift bug powercap/drivers/dtpm: Fix __udivdi3 and __aeabi_uldivmod unresolved symbols powercap/drivers/dtpm: Add CPU energy model based support powercap/drivers/dtpm: Add API for dynamic thermal power management Documentation/powercap/dtpm: Add documentation for dtpm units: Add Watt units * pm-misc: PM: Kconfig: remove unneeded "default n" options PM: EM: update Kconfig description and drop "default n" option
2020-12-22units: Add Watt unitsDaniel Lezcano1-0/+4
As there are the temperature units, let's add the Watt macros definition. Signed-off-by: Daniel Lezcano <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-12-15kernel.h: split out mathematical helpersAndy Shevchenko1-1/+1
kernel.h is being used as a dump for all kinds of stuff for a long time. Here is the attempt to start cleaning it up by splitting out mathematical helpers. At the same time convert users in header and lib folder to use new header. Though for time being include new header back to kernel.h to avoid twisted indirected includes for existing users. [[email protected]: fix powerpc build] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Andy Shevchenko <[email protected]> Cc: "Paul E. McKenney" <[email protected]> Cc: Trond Myklebust <[email protected]> Cc: Jeff Layton <[email protected]> Cc: Rasmus Villemoes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2020-01-31include/linux/units.h: add helpers for kelvin to/from Celsius conversionAkinobu Mita1-0/+84
Patch series "add header file for kelvin to/from Celsius conversion helpers", v4. There are several helper macros to convert kelvin to/from Celsius in <linux/thermal.h> for thermal drivers. These are useful for any other drivers or subsystems, but it's odd to include <linux/thermal.h> just for the helpers. This adds a new <linux/units.h> that provides the equivalent inline functions for any drivers or subsystems, and switches all the users of conversion helpers in <linux/thermal.h> to use <linux/units.h> helpers. This patch (of 12): There are several helper macros to convert kelvin to/from Celsius in <linux/thermal.h> for thermal drivers. These are useful for any other drivers or subsystems, but it's odd to include <linux/thermal.h> just for the helpers. This adds a new <linux/units.h> that provides the equivalent inline functions for any drivers or subsystems. It is intended to replace the helpers in <linux/thermal.h>. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Akinobu Mita <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Cc: Sujith Thomas <[email protected]> Cc: Darren Hart <[email protected]> Cc: Zhang Rui <[email protected]> Cc: Daniel Lezcano <[email protected]> Cc: Amit Kucheria <[email protected]> Cc: Jean Delvare <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Keith Busch <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Sagi Grimberg <[email protected]> Cc: Kalle Valo <[email protected]> Cc: Stanislaw Gruszka <[email protected]> Cc: Johannes Berg <[email protected]> Cc: Emmanuel Grumbach <[email protected]> Cc: Luca Coelho <[email protected]> Cc: Jonathan Cameron <[email protected]> Cc: Hartmut Knaack <[email protected]> Cc: Lars-Peter Clausen <[email protected]> Cc: Peter Meerwald-Stadler <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Jonathan Cameron <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>