Skip to content

Commit b28089a

Browse files
committed
xen/xenbus: remove unused xenbus_map_ring()
xenbus_map_ring() is used nowhere in the tree, remove it. xenbus_unmap_ring() is used only locally, so make it static and move it up. Signed-off-by: Juergen Gross <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent 7111951 commit b28089a

File tree

2 files changed

+42
-91
lines changed

2 files changed

+42
-91
lines changed

drivers/xen/xenbus/xenbus_client.c

Lines changed: 42 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,48 @@ static int __xenbus_map_ring(struct xenbus_device *dev,
517517
return err;
518518
}
519519

520+
/**
521+
* xenbus_unmap_ring
522+
* @dev: xenbus device
523+
* @handles: grant handle array
524+
* @nr_handles: number of handles in the array
525+
* @vaddrs: addresses to unmap
526+
*
527+
* Unmap memory in this domain that was imported from another domain.
528+
* Returns 0 on success and returns GNTST_* on error
529+
* (see xen/include/interface/grant_table.h).
530+
*/
531+
static int xenbus_unmap_ring(struct xenbus_device *dev, grant_handle_t *handles,
532+
unsigned int nr_handles, unsigned long *vaddrs)
533+
{
534+
struct gnttab_unmap_grant_ref unmap[XENBUS_MAX_RING_GRANTS];
535+
int i;
536+
int err;
537+
538+
if (nr_handles > XENBUS_MAX_RING_GRANTS)
539+
return -EINVAL;
540+
541+
for (i = 0; i < nr_handles; i++)
542+
gnttab_set_unmap_op(&unmap[i], vaddrs[i],
543+
GNTMAP_host_map, handles[i]);
544+
545+
if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap, i))
546+
BUG();
547+
548+
err = GNTST_okay;
549+
for (i = 0; i < nr_handles; i++) {
550+
if (unmap[i].status != GNTST_okay) {
551+
xenbus_dev_error(dev, unmap[i].status,
552+
"unmapping page at handle %d error %d",
553+
handles[i], unmap[i].status);
554+
err = unmap[i].status;
555+
break;
556+
}
557+
}
558+
559+
return err;
560+
}
561+
520562
struct map_ring_valloc_hvm
521563
{
522564
unsigned int idx;
@@ -608,45 +650,6 @@ static int xenbus_map_ring_valloc_hvm(struct xenbus_device *dev,
608650
return err;
609651
}
610652

611-
612-
/**
613-
* xenbus_map_ring
614-
* @dev: xenbus device
615-
* @gnt_refs: grant reference array
616-
* @nr_grefs: number of grant reference
617-
* @handles: pointer to grant handle to be filled
618-
* @vaddrs: addresses to be mapped to
619-
* @leaked: fail to clean up a failed map, caller should not free vaddr
620-
*
621-
* Map pages of memory into this domain from another domain's grant table.
622-
* xenbus_map_ring does not allocate the virtual address space (you must do
623-
* this yourself!). It only maps in the pages to the specified address.
624-
* Returns 0 on success, and GNTST_* (see xen/include/interface/grant_table.h)
625-
* or -ENOMEM / -EINVAL on error. If an error is returned, device will switch to
626-
* XenbusStateClosing and the first error message will be saved in XenStore.
627-
* Further more if we fail to map the ring, caller should check @leaked.
628-
* If @leaked is not zero it means xenbus_map_ring fails to clean up, caller
629-
* should not free the address space of @vaddr.
630-
*/
631-
int xenbus_map_ring(struct xenbus_device *dev, grant_ref_t *gnt_refs,
632-
unsigned int nr_grefs, grant_handle_t *handles,
633-
unsigned long *vaddrs, bool *leaked)
634-
{
635-
phys_addr_t phys_addrs[XENBUS_MAX_RING_GRANTS];
636-
int i;
637-
638-
if (nr_grefs > XENBUS_MAX_RING_GRANTS)
639-
return -EINVAL;
640-
641-
for (i = 0; i < nr_grefs; i++)
642-
phys_addrs[i] = (unsigned long)vaddrs[i];
643-
644-
return __xenbus_map_ring(dev, gnt_refs, nr_grefs, handles,
645-
phys_addrs, GNTMAP_host_map, leaked);
646-
}
647-
EXPORT_SYMBOL_GPL(xenbus_map_ring);
648-
649-
650653
/**
651654
* xenbus_unmap_ring_vfree
652655
* @dev: xenbus device
@@ -858,51 +861,6 @@ static int xenbus_unmap_ring_vfree_hvm(struct xenbus_device *dev, void *vaddr)
858861
return rv;
859862
}
860863

861-
/**
862-
* xenbus_unmap_ring
863-
* @dev: xenbus device
864-
* @handles: grant handle array
865-
* @nr_handles: number of handles in the array
866-
* @vaddrs: addresses to unmap
867-
*
868-
* Unmap memory in this domain that was imported from another domain.
869-
* Returns 0 on success and returns GNTST_* on error
870-
* (see xen/include/interface/grant_table.h).
871-
*/
872-
int xenbus_unmap_ring(struct xenbus_device *dev,
873-
grant_handle_t *handles, unsigned int nr_handles,
874-
unsigned long *vaddrs)
875-
{
876-
struct gnttab_unmap_grant_ref unmap[XENBUS_MAX_RING_GRANTS];
877-
int i;
878-
int err;
879-
880-
if (nr_handles > XENBUS_MAX_RING_GRANTS)
881-
return -EINVAL;
882-
883-
for (i = 0; i < nr_handles; i++)
884-
gnttab_set_unmap_op(&unmap[i], vaddrs[i],
885-
GNTMAP_host_map, handles[i]);
886-
887-
if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap, i))
888-
BUG();
889-
890-
err = GNTST_okay;
891-
for (i = 0; i < nr_handles; i++) {
892-
if (unmap[i].status != GNTST_okay) {
893-
xenbus_dev_error(dev, unmap[i].status,
894-
"unmapping page at handle %d error %d",
895-
handles[i], unmap[i].status);
896-
err = unmap[i].status;
897-
break;
898-
}
899-
}
900-
901-
return err;
902-
}
903-
EXPORT_SYMBOL_GPL(xenbus_unmap_ring);
904-
905-
906864
/**
907865
* xenbus_read_driver_state
908866
* @path: path for driver

include/xen/xenbus.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,8 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,
209209
unsigned int nr_pages, grant_ref_t *grefs);
210210
int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs,
211211
unsigned int nr_grefs, void **vaddr);
212-
int xenbus_map_ring(struct xenbus_device *dev,
213-
grant_ref_t *gnt_refs, unsigned int nr_grefs,
214-
grant_handle_t *handles, unsigned long *vaddrs,
215-
bool *leaked);
216212

217213
int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr);
218-
int xenbus_unmap_ring(struct xenbus_device *dev,
219-
grant_handle_t *handles, unsigned int nr_handles,
220-
unsigned long *vaddrs);
221214

222215
int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port);
223216
int xenbus_free_evtchn(struct xenbus_device *dev, int port);

0 commit comments

Comments
 (0)