Reputation: 141
Have a look at the bottom patch.
---
drivers/iommu/iommu.c | 4 ++--
drivers/iommu/msm_iommu_domains.c | 2 +-
include/linux/iommu.h | 6 +++++-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 7848f47..c2f694c 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -670,7 +670,7 @@ void iommu_set_fault_handler(struct iommu_domain *domain,
}
EXPORT_SYMBOL_GPL(iommu_set_fault_handler);
-struct iommu_domain *iommu_domain_alloc(struct bus_type *bus, int flags)
+struct iommu_domain *iommu_domain_alloc_flags(struct bus_type *bus, int flags)
{
struct iommu_domain *domain;
int ret;
@@ -695,7 +695,7 @@ out_free:
return NULL;
}
-EXPORT_SYMBOL_GPL(iommu_domain_alloc);
+EXPORT_SYMBOL_GPL(iommu_domain_alloc_flags);
void iommu_domain_free(struct iommu_domain *domain)
{
diff --git a/drivers/iommu/msm_iommu_domains.c b/drivers/iommu/msm_iommu_domains.c
index 26a3f85..7619e66 100644
--- a/drivers/iommu/msm_iommu_domains.c
+++ b/drivers/iommu/msm_iommu_domains.c
@@ -506,7 +506,7 @@ int msm_register_domain(struct msm_iova_layout *layout)
if (data->domain_num < 0)
goto free_pools;
- data->domain = iommu_domain_alloc(bus, layout->domain_flags);
+ data->domain = iommu_domain_alloc_flags(bus, layout->domain_flags);
if (!data->domain)
goto free_domain_num;
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index fb1efec..8bd9d3f 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -131,7 +131,11 @@ struct iommu_ops {
extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
extern bool iommu_present(struct bus_type *bus);
-extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus, int flags);
+extern struct iommu_domain *iommu_domain_alloc_flags(struct bus_type *bus, int flags);
+static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
+{
+ return iommu_domain_alloc_flags(bus, 0);
+}
extern struct iommu_group *iommu_group_get_by_id(int id);
extern void iommu_domain_free(struct iommu_domain *domain);
extern int iommu_attach_device(struct iommu_domain *domain,
--
What is the benefit of this patch, i.e. are there any performance wins?
Is it good programming practice to have inline
static
function calling one which is extern
?
If extern
means external linkage, i.e. function definition is elsewhere, is it safe that to use it in static
function which says "this function should be visible only within this translation unit"?
Judging by this answer: Inline functions and external linkage
So "external linkage" and "inline" are not exclusive; "external linkage" means that the function may be referred to in any translation unit, and "inline" means that it must be defined in any translation unit that calls it.
inline
and external
are obviously not in fight, but presence of static
is what is bothering me.
Thanks
Upvotes: 1
Views: 112
Reputation: 213711
What is the benefit of this patch, i.e. are there any performance wins?
Seems like a change of interface, they changed the name and parameters of a function, then added an extra function. It's a change of functionality, it has nothing to do with performance.
Is it good programming practice to have inline static function calling one which is extern?
Sure it is, it just means that the static
function is internal to the module where it is declared and not available to the caller.
is it safe that to use it in static function which says "this function should be visible only within this translation unit"?
When calling functions with extern linkage, there's no difference between doing so from a static
function or from anywhere else. The linkage of the caller has no relation to the linkage of the called function.
Upvotes: 1