Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b128040a authored by Sudarshan Rajagopalan's avatar Sudarshan Rajagopalan
Browse files

iommu/io-pgtable-arm: Use right-shift for division



Since entry_size is always a power of 2, use appropriate
right-shift operation for division instead. Also, this change
helps to be compatible with 32-bit machines where lib support
for division of unsigned long long values are not supported.

Change-Id: I74d9656206126599b9e4052ee6c158f23da298de
Signed-off-by: default avatarSudarshan Rajagopalan <sudaraja@codeaurora.org>
parent 5915565f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -735,7 +735,8 @@ static int __arm_lpae_unmap(struct arm_lpae_io_pgtable *data,
		arm_lpae_iopte *table_base = table;
		int tl_offset = ARM_LPAE_LVL_IDX(iova, lvl + 1, data);
		int entry_size = ARM_LPAE_GRANULE(data);
		int max_entries = ARM_LPAE_BLOCK_SIZE(lvl, data) / entry_size;
		int max_entries = ARM_LPAE_BLOCK_SIZE(lvl, data) >>
				data->pg_shift;
		int entries = min_t(int, size / entry_size,
			max_entries - tl_offset);
		int table_len = entries * sizeof(*table);