diff options
| author | Henrik Rydberg <rydberg@alnilam.(none)> | 2010-02-01 22:03:33 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@alnilam.(none)> | 2010-02-01 22:03:33 +0100 |
| commit | f0b1dbdc00bda57c62199cbdc44acbadbb1121b0 (patch) | |
| tree | 5234055bf794c28662b139c22e153f7a720a37bc /src/capabilities.c | |
| parent | 30869603dc5d36ad2d82cff82900c7e05a4b35c1 (diff) | |
janitor: stick to kernel-style formattingalpha-1
With this commit, the whole code base complies with the
kernel format style, and patches can be checked against
the kernel-provided ./scripts/checkpatch.pl
Diffstat (limited to 'src/capabilities.c')
| -rw-r--r-- | src/capabilities.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/capabilities.c b/src/capabilities.c index 201c127..cdd05c5 100644 --- a/src/capabilities.c +++ b/src/capabilities.c | |||
| @@ -21,15 +21,11 @@ | |||
| 21 | 21 | ||
| 22 | #include "capabilities.h" | 22 | #include "capabilities.h" |
| 23 | 23 | ||
| 24 | //////////////////////////////////////////////////////// | ||
| 25 | |||
| 26 | #define SETABS(c, x, map, key, fd) \ | 24 | #define SETABS(c, x, map, key, fd) \ |
| 27 | c->has_##x = getbit(map, key) && getabs(&c->abs_##x, key, fd) | 25 | (c->has_##x = getbit(map, key) && getabs(&c->abs_##x, key, fd)) |
| 28 | 26 | ||
| 29 | #define ADDCAP(s, c, x) strcat(s, c->has_##x ? " " #x : "") | 27 | #define ADDCAP(s, c, x) strcat(s, c->has_##x ? " " #x : "") |
| 30 | 28 | ||
| 31 | //////////////////////////////////////////////////////// | ||
| 32 | |||
| 33 | static const int bits_per_long = 8 * sizeof(long); | 29 | static const int bits_per_long = 8 * sizeof(long); |
| 34 | 30 | ||
| 35 | static inline int nlongs(int nbit) | 31 | static inline int nlongs(int nbit) |
| @@ -37,20 +33,18 @@ static inline int nlongs(int nbit) | |||
| 37 | return (nbit + bits_per_long - 1) / bits_per_long; | 33 | return (nbit + bits_per_long - 1) / bits_per_long; |
| 38 | } | 34 | } |
| 39 | 35 | ||
| 40 | static inline bool getbit(const unsigned long* map, int key) | 36 | static inline int getbit(const unsigned long *map, int key) |
| 41 | { | 37 | { |
| 42 | return (map[key / bits_per_long] >> (key % bits_per_long)) & 0x01; | 38 | return (map[key / bits_per_long] >> (key % bits_per_long)) & 0x01; |
| 43 | } | 39 | } |
| 44 | 40 | ||
| 45 | static bool getabs(struct input_absinfo *abs, int key, int fd) | 41 | static int getabs(struct input_absinfo *abs, int key, int fd) |
| 46 | { | 42 | { |
| 47 | int rc; | 43 | int rc; |
| 48 | SYSCALL(rc = ioctl(fd, EVIOCGABS(key), abs)); | 44 | SYSCALL(rc = ioctl(fd, EVIOCGABS(key), abs)); |
| 49 | return rc >= 0; | 45 | return rc >= 0; |
| 50 | } | 46 | } |
| 51 | 47 | ||
| 52 | //////////////////////////////////////////////////////// | ||
| 53 | |||
| 54 | int read_capabilities(struct Capabilities *cap, int fd) | 48 | int read_capabilities(struct Capabilities *cap, int fd) |
| 55 | { | 49 | { |
| 56 | unsigned long evbits[nlongs(EV_MAX)]; | 50 | unsigned long evbits[nlongs(EV_MAX)]; |
| @@ -87,8 +81,6 @@ int read_capabilities(struct Capabilities *cap, int fd) | |||
| 87 | return 0; | 81 | return 0; |
| 88 | } | 82 | } |
| 89 | 83 | ||
| 90 | //////////////////////////////////////////////////////// | ||
| 91 | |||
| 92 | void output_capabilities(const struct Capabilities *cap) | 84 | void output_capabilities(const struct Capabilities *cap) |
| 93 | { | 85 | { |
| 94 | char line[1024]; | 86 | char line[1024]; |
| @@ -126,5 +118,3 @@ void output_capabilities(const struct Capabilities *cap) | |||
| 126 | cap->abs_position_y.minimum, | 118 | cap->abs_position_y.minimum, |
| 127 | cap->abs_position_y.maximum); | 119 | cap->abs_position_y.maximum); |
| 128 | } | 120 | } |
| 129 | |||
| 130 | //////////////////////////////////////////////////////// | ||
