Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2019-03-19 19:07:29 -07:00
2 changed files with 30 additions and 0 deletions
+29
View File
@@ -510,6 +510,35 @@ typedef _Bool bool;
extern int hex_to_bin(char ch);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) && !defined(RHEL_MAJOR)
/* See also commit 9b3be9f99203 ("Move round_up/down to kernel.h") # v2.6.34 */
/*
* This looks more complex than it should be. But we need to
* get the type for the ~ right in round_down (it needs to be
* as wide as the result!), and we want to evaluate the macro
* arguments just once each.
*/
#define __round_mask(x, y) ((__typeof__(x))((y)-1))
/**
* round_up - round up to next specified power of 2
* @x: the value to round
* @y: multiple to round up to (must be a power of 2)
*
* Rounds @x up to next multiple of @y (which must be a power of 2).
* To perform arbitrary rounding up, use roundup() below.
*/
#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
/**
* round_down - round down to next specified power of 2
* @x: the value to round
* @y: multiple to round down to (must be a power of 2)
*
* Rounds @x down to next multiple of @y (which must be a power of 2).
* To perform arbitrary rounding down, use rounddown() below.
*/
#define round_down(x, y) ((x) & ~__round_mask(x, y))
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
/*
* See also "lib: hex2bin converts ascii hexadecimal string to binary" (commit
@@ -2685,6 +2685,7 @@ sub deviceAttributes {
my ($value, $is_key) = split("\n", _sysread($io) , 2);
close $io;
$value = "" if (!defined($value));
chomp $value;
$is_key = new_sysfs_interface() &&