* [PATCH v2] iommu-common: Do not use 64 bit constant 0xffffffffffffffffl for computing align_mask
@ 2015-07-21 4:49 Sowmini Varadhan
2015-07-21 19:59 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Sowmini Varadhan @ 2015-07-21 4:49 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, benh, davem, linux, linux, sowmini.varadhan
Using a 64 bit constant generates "warning: integer constant is too
large for 'long' type" on 32 bit platforms. Instead use ~0ul and
BITS_PER_LONG.
Detected by Andrew Morton on ARMD.
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
---
v2: use BITS_PER_LONG and ulong as discussed on mailing list.
lib/iommu-common.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/iommu-common.c b/lib/iommu-common.c
index df30632..ff19f66 100644
--- a/lib/iommu-common.c
+++ b/lib/iommu-common.c
@@ -119,7 +119,7 @@ unsigned long iommu_tbl_range_alloc(struct device *dev,
unsigned long align_mask = 0;
if (align_order > 0)
- align_mask = 0xffffffffffffffffl >> (64 - align_order);
+ align_mask = ~0ul >> (BITS_PER_LONG - align_order);
/* Sanity check */
if (unlikely(npages == 0)) {
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] iommu-common: Do not use 64 bit constant 0xffffffffffffffffl for computing align_mask
2015-07-21 4:49 [PATCH v2] iommu-common: Do not use 64 bit constant 0xffffffffffffffffl for computing align_mask Sowmini Varadhan
@ 2015-07-21 19:59 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2015-07-21 19:59 UTC (permalink / raw)
To: Sowmini Varadhan; +Cc: linux-kernel, akpm, benh, davem, linux
On Tue, Jul 21, 2015 at 06:49:41AM +0200, Sowmini Varadhan wrote:
> Using a 64 bit constant generates "warning: integer constant is too
> large for 'long' type" on 32 bit platforms. Instead use ~0ul and
> BITS_PER_LONG.
>
> Detected by Andrew Morton on ARMD.
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Looks ok afaics.
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2: use BITS_PER_LONG and ulong as discussed on mailing list.
>
> lib/iommu-common.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lib/iommu-common.c b/lib/iommu-common.c
> index df30632..ff19f66 100644
> --- a/lib/iommu-common.c
> +++ b/lib/iommu-common.c
> @@ -119,7 +119,7 @@ unsigned long iommu_tbl_range_alloc(struct device *dev,
> unsigned long align_mask = 0;
>
> if (align_order > 0)
> - align_mask = 0xffffffffffffffffl >> (64 - align_order);
> + align_mask = ~0ul >> (BITS_PER_LONG - align_order);
>
> /* Sanity check */
> if (unlikely(npages == 0)) {
> --
> 1.7.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-21 20:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-21 4:49 [PATCH v2] iommu-common: Do not use 64 bit constant 0xffffffffffffffffl for computing align_mask Sowmini Varadhan
2015-07-21 19:59 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox