提交 3189713a 编写于 作者: C Christoph Hellwig 提交者: Joerg Roedel

iommu: remove iommu_set_cmd_line_dma_api and iommu_cmd_line_dma_api

Don't obsfucate the trivial bit flag check.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Acked-by: NWill Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20210401155256.298656-18-hch@lst.deSigned-off-by: NJoerg Roedel <jroedel@suse.de>
上级 7e147547
...@@ -70,16 +70,6 @@ static const char * const iommu_group_resv_type_string[] = { ...@@ -70,16 +70,6 @@ static const char * const iommu_group_resv_type_string[] = {
#define IOMMU_CMD_LINE_DMA_API BIT(0) #define IOMMU_CMD_LINE_DMA_API BIT(0)
static void iommu_set_cmd_line_dma_api(void)
{
iommu_cmd_line |= IOMMU_CMD_LINE_DMA_API;
}
static bool iommu_cmd_line_dma_api(void)
{
return !!(iommu_cmd_line & IOMMU_CMD_LINE_DMA_API);
}
static int iommu_alloc_default_domain(struct iommu_group *group, static int iommu_alloc_default_domain(struct iommu_group *group,
struct device *dev); struct device *dev);
static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus, static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus,
...@@ -130,9 +120,7 @@ static const char *iommu_domain_type_str(unsigned int t) ...@@ -130,9 +120,7 @@ static const char *iommu_domain_type_str(unsigned int t)
static int __init iommu_subsys_init(void) static int __init iommu_subsys_init(void)
{ {
bool cmd_line = iommu_cmd_line_dma_api(); if (!(iommu_cmd_line & IOMMU_CMD_LINE_DMA_API)) {
if (!cmd_line) {
if (IS_ENABLED(CONFIG_IOMMU_DEFAULT_PASSTHROUGH)) if (IS_ENABLED(CONFIG_IOMMU_DEFAULT_PASSTHROUGH))
iommu_set_default_passthrough(false); iommu_set_default_passthrough(false);
else else
...@@ -146,7 +134,8 @@ static int __init iommu_subsys_init(void) ...@@ -146,7 +134,8 @@ static int __init iommu_subsys_init(void)
pr_info("Default domain type: %s %s\n", pr_info("Default domain type: %s %s\n",
iommu_domain_type_str(iommu_def_domain_type), iommu_domain_type_str(iommu_def_domain_type),
cmd_line ? "(set via kernel command line)" : ""); (iommu_cmd_line & IOMMU_CMD_LINE_DMA_API) ?
"(set via kernel command line)" : "");
return 0; return 0;
} }
...@@ -2757,16 +2746,14 @@ EXPORT_SYMBOL_GPL(iommu_alloc_resv_region); ...@@ -2757,16 +2746,14 @@ EXPORT_SYMBOL_GPL(iommu_alloc_resv_region);
void iommu_set_default_passthrough(bool cmd_line) void iommu_set_default_passthrough(bool cmd_line)
{ {
if (cmd_line) if (cmd_line)
iommu_set_cmd_line_dma_api(); iommu_cmd_line |= IOMMU_CMD_LINE_DMA_API;
iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY; iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
} }
void iommu_set_default_translated(bool cmd_line) void iommu_set_default_translated(bool cmd_line)
{ {
if (cmd_line) if (cmd_line)
iommu_set_cmd_line_dma_api(); iommu_cmd_line |= IOMMU_CMD_LINE_DMA_API;
iommu_def_domain_type = IOMMU_DOMAIN_DMA; iommu_def_domain_type = IOMMU_DOMAIN_DMA;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册