On Fri, Nov 06, 2015 at 08:10:44PM +0800, Baoquan He wrote:
> Add functions to check whether translation is already enabled in IOMMU.
>
> Signed-off-by: Baoquan He <[email protected]>
> ---
> drivers/iommu/amd_iommu_init.c | 26 ++++++++++++++++++++++++++
> drivers/iommu/amd_iommu_proto.h | 4 ++++
> 2 files changed, 30 insertions(+)
>
> diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
> index 1dcd8e3..6ef86b1 100644
> --- a/drivers/iommu/amd_iommu_init.c
> +++ b/drivers/iommu/amd_iommu_init.c
> @@ -229,6 +229,27 @@ static int amd_iommu_enable_interrupts(void);
> static int __init iommu_go_to_state(enum iommu_init_state state);
> static void init_device_table_dma(void);
>
> +static u8 g_pre_enabled;
Better use bool here ...
> +
> +bool translation_pre_enabled(void)
... since this function returns bool anyway, and ...
> +{
> + return !!g_pre_enabled;
... use save the ugly !! operators.
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu