diff options
author | Bob Liu <bob.liu@oracle.com> | 2015-04-03 02:42:59 -0400 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2015-04-27 06:41:12 -0400 |
commit | b44166cd46e28dd608d5baa5873047a40f32919c (patch) | |
tree | 799b236c472067869782b2cf937d9d0d87852fc4 /drivers/xen/grant-table.c | |
parent | 325d73bf8fea8af2227240b7305253fb052d3a68 (diff) |
xen/grant: introduce func gnttab_unmap_refs_sync()
There are several place using gnttab async unmap and wait for
completion, so move the common code to a function
gnttab_unmap_refs_sync().
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'drivers/xen/grant-table.c')
-rw-r--r-- | drivers/xen/grant-table.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 17972fbacddc..b1c7170e5c9e 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -123,6 +123,11 @@ struct gnttab_ops { | |||
123 | int (*query_foreign_access)(grant_ref_t ref); | 123 | int (*query_foreign_access)(grant_ref_t ref); |
124 | }; | 124 | }; |
125 | 125 | ||
126 | struct unmap_refs_callback_data { | ||
127 | struct completion completion; | ||
128 | int result; | ||
129 | }; | ||
130 | |||
126 | static struct gnttab_ops *gnttab_interface; | 131 | static struct gnttab_ops *gnttab_interface; |
127 | 132 | ||
128 | static int grant_table_version; | 133 | static int grant_table_version; |
@@ -863,6 +868,29 @@ void gnttab_unmap_refs_async(struct gntab_unmap_queue_data* item) | |||
863 | } | 868 | } |
864 | EXPORT_SYMBOL_GPL(gnttab_unmap_refs_async); | 869 | EXPORT_SYMBOL_GPL(gnttab_unmap_refs_async); |
865 | 870 | ||
871 | static void unmap_refs_callback(int result, | ||
872 | struct gntab_unmap_queue_data *data) | ||
873 | { | ||
874 | struct unmap_refs_callback_data *d = data->data; | ||
875 | |||
876 | d->result = result; | ||
877 | complete(&d->completion); | ||
878 | } | ||
879 | |||
880 | int gnttab_unmap_refs_sync(struct gntab_unmap_queue_data *item) | ||
881 | { | ||
882 | struct unmap_refs_callback_data data; | ||
883 | |||
884 | init_completion(&data.completion); | ||
885 | item->data = &data; | ||
886 | item->done = &unmap_refs_callback; | ||
887 | gnttab_unmap_refs_async(item); | ||
888 | wait_for_completion(&data.completion); | ||
889 | |||
890 | return data.result; | ||
891 | } | ||
892 | EXPORT_SYMBOL_GPL(gnttab_unmap_refs_sync); | ||
893 | |||
866 | static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes) | 894 | static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes) |
867 | { | 895 | { |
868 | int rc; | 896 | int rc; |