* [PATCH]iommu: make return value consistence
@ 2012-12-13 16:55 Wang YanQing
2012-12-13 17:10 ` Alex Williamson
0 siblings, 1 reply; 2+ messages in thread
From: Wang YanQing @ 2012-12-13 16:55 UTC (permalink / raw)
To: joerg.roedel; +Cc: alex.williamson, linux-kernel
if we don't define CONFIG_IOMMU_API the
dummy functions alway return -ENODEV
or -EINVAL except three function, so convert
them to the same behavior to make consistence
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
include/linux/iommu.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index f4a49a6..16e84f6 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -210,7 +210,7 @@ static inline bool iommu_present(struct bus_type *bus)
static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
{
- return NULL;
+ return ERR_PTR(-ENODEV);
}
static inline void iommu_domain_free(struct iommu_domain *domain)
@@ -275,7 +275,7 @@ static inline struct iommu_group *iommu_group_alloc(void)
static inline void *iommu_group_get_iommudata(struct iommu_group *group)
{
- return NULL;
+ return ERR_PTR(-EINVAL);
}
static inline void iommu_group_set_iommudata(struct iommu_group *group,
@@ -309,7 +309,7 @@ static inline int iommu_group_for_each_dev(struct iommu_group *group,
static inline struct iommu_group *iommu_group_get(struct device *dev)
{
- return NULL;
+ return ERR_PTR(-ENODEV);
}
static inline void iommu_group_put(struct iommu_group *group)
--
1.7.11.1.116.g8228a23
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH]iommu: make return value consistence
2012-12-13 16:55 [PATCH]iommu: make return value consistence Wang YanQing
@ 2012-12-13 17:10 ` Alex Williamson
0 siblings, 0 replies; 2+ messages in thread
From: Alex Williamson @ 2012-12-13 17:10 UTC (permalink / raw)
To: Wang YanQing; +Cc: joerg.roedel, linux-kernel
On Fri, 2012-12-14 at 00:55 +0800, Wang YanQing wrote:
> if we don't define CONFIG_IOMMU_API the
> dummy functions alway return -ENODEV
> or -EINVAL except three function, so convert
> them to the same behavior to make consistence
But if we do define CONFIG_IOMMU_API the actual functions return NULL
instead of ERR_PTR, so any conversion needs to include the actual
functions and update the callers as well. Thanks,
Alex
> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
> include/linux/iommu.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index f4a49a6..16e84f6 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -210,7 +210,7 @@ static inline bool iommu_present(struct bus_type *bus)
>
> static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
> {
> - return NULL;
> + return ERR_PTR(-ENODEV);
> }
>
> static inline void iommu_domain_free(struct iommu_domain *domain)
> @@ -275,7 +275,7 @@ static inline struct iommu_group *iommu_group_alloc(void)
>
> static inline void *iommu_group_get_iommudata(struct iommu_group *group)
> {
> - return NULL;
> + return ERR_PTR(-EINVAL);
> }
>
> static inline void iommu_group_set_iommudata(struct iommu_group *group,
> @@ -309,7 +309,7 @@ static inline int iommu_group_for_each_dev(struct iommu_group *group,
>
> static inline struct iommu_group *iommu_group_get(struct device *dev)
> {
> - return NULL;
> + return ERR_PTR(-ENODEV);
> }
>
> static inline void iommu_group_put(struct iommu_group *group)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-13 17:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-13 16:55 [PATCH]iommu: make return value consistence Wang YanQing
2012-12-13 17:10 ` Alex Williamson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox