diff options
| author | 2012-09-25 13:41:02 +0100 | |
|---|---|---|
| committer | 2012-09-25 13:41:02 +0100 | |
| commit | ac48f6cb5f268daff06b636444819e5ffb462611 (patch) | |
| tree | 56bcc8b2de42738764ac65056067a17cb97609f4 /include/linux/kernel.h | |
| parent | spi/mxs: Make the SPI block clock speed configurable via DT (diff) | |
| parent | Linux 3.6-rc6 (diff) | |
| download | wireguard-linux-ac48f6cb5f268daff06b636444819e5ffb462611.tar.xz wireguard-linux-ac48f6cb5f268daff06b636444819e5ffb462611.zip | |
Merge tag 'v3.6-rc6' into spi-mxs
Linux 3.6-rc6
Conflicts (overlap between moving code that accesses registers around
and factoring the register access out into a SSP layer):
drivers/mmc/host/mxs-mmc.c
Diffstat (limited to 'include/linux/kernel.h')
| -rw-r--r-- | include/linux/kernel.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 604382143bcf..594b419b7d20 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -82,10 +82,18 @@ __x - (__x % (y)); \ } \ ) + +/* + * Divide positive or negative dividend by positive divisor and round + * to closest integer. Result is undefined for negative divisors. + */ #define DIV_ROUND_CLOSEST(x, divisor)( \ { \ - typeof(divisor) __divisor = divisor; \ - (((x) + ((__divisor) / 2)) / (__divisor)); \ + typeof(x) __x = x; \ + typeof(divisor) __d = divisor; \ + (((typeof(x))-1) >= 0 || (__x) >= 0) ? \ + (((__x) + ((__d) / 2)) / (__d)) : \ + (((__x) - ((__d) / 2)) / (__d)); \ } \ ) |
