aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/eventfd.c
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2012-06-29 11:56:08 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-07-02 20:10:30 -0400
commitd4db2935e4fffeba42540b0dc9d85e3036701221 (patch)
tree57b69cdc6e976f649e48f81570c8d912a7d44d7e /virt/kvm/eventfd.c
parentca24a145573124732152daff105ba68cc9a2b545 (diff)
KVM: Pass kvm_irqfd to functions
Prune this down to just the struct kvm_irqfd so we can avoid changing function definition for every flag or field we use. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt/kvm/eventfd.c')
-rw-r--r--virt/kvm/eventfd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index f59c1e8de7a2..c307c24c147a 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -198,7 +198,7 @@ static void irqfd_update(struct kvm *kvm, struct _irqfd *irqfd,
198} 198}
199 199
200static int 200static int
201kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi) 201kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
202{ 202{
203 struct kvm_irq_routing_table *irq_rt; 203 struct kvm_irq_routing_table *irq_rt;
204 struct _irqfd *irqfd, *tmp; 204 struct _irqfd *irqfd, *tmp;
@@ -212,12 +212,12 @@ kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi)
212 return -ENOMEM; 212 return -ENOMEM;
213 213
214 irqfd->kvm = kvm; 214 irqfd->kvm = kvm;
215 irqfd->gsi = gsi; 215 irqfd->gsi = args->gsi;
216 INIT_LIST_HEAD(&irqfd->list); 216 INIT_LIST_HEAD(&irqfd->list);
217 INIT_WORK(&irqfd->inject, irqfd_inject); 217 INIT_WORK(&irqfd->inject, irqfd_inject);
218 INIT_WORK(&irqfd->shutdown, irqfd_shutdown); 218 INIT_WORK(&irqfd->shutdown, irqfd_shutdown);
219 219
220 file = eventfd_fget(fd); 220 file = eventfd_fget(args->fd);
221 if (IS_ERR(file)) { 221 if (IS_ERR(file)) {
222 ret = PTR_ERR(file); 222 ret = PTR_ERR(file);
223 goto fail; 223 goto fail;
@@ -298,19 +298,19 @@ kvm_eventfd_init(struct kvm *kvm)
298 * shutdown any irqfd's that match fd+gsi 298 * shutdown any irqfd's that match fd+gsi
299 */ 299 */
300static int 300static int
301kvm_irqfd_deassign(struct kvm *kvm, int fd, int gsi) 301kvm_irqfd_deassign(struct kvm *kvm, struct kvm_irqfd *args)
302{ 302{
303 struct _irqfd *irqfd, *tmp; 303 struct _irqfd *irqfd, *tmp;
304 struct eventfd_ctx *eventfd; 304 struct eventfd_ctx *eventfd;
305 305
306 eventfd = eventfd_ctx_fdget(fd); 306 eventfd = eventfd_ctx_fdget(args->fd);
307 if (IS_ERR(eventfd)) 307 if (IS_ERR(eventfd))
308 return PTR_ERR(eventfd); 308 return PTR_ERR(eventfd);
309 309
310 spin_lock_irq(&kvm->irqfds.lock); 310 spin_lock_irq(&kvm->irqfds.lock);
311 311
312 list_for_each_entry_safe(irqfd, tmp, &kvm->irqfds.items, list) { 312 list_for_each_entry_safe(irqfd, tmp, &kvm->irqfds.items, list) {
313 if (irqfd->eventfd == eventfd && irqfd->gsi == gsi) { 313 if (irqfd->eventfd == eventfd && irqfd->gsi == args->gsi) {
314 /* 314 /*
315 * This rcu_assign_pointer is needed for when 315 * This rcu_assign_pointer is needed for when
316 * another thread calls kvm_irq_routing_update before 316 * another thread calls kvm_irq_routing_update before
@@ -338,12 +338,12 @@ kvm_irqfd_deassign(struct kvm *kvm, int fd, int gsi)
338} 338}
339 339
340int 340int
341kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags) 341kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
342{ 342{
343 if (flags & KVM_IRQFD_FLAG_DEASSIGN) 343 if (args->flags & KVM_IRQFD_FLAG_DEASSIGN)
344 return kvm_irqfd_deassign(kvm, fd, gsi); 344 return kvm_irqfd_deassign(kvm, args);
345 345
346 return kvm_irqfd_assign(kvm, fd, gsi); 346 return kvm_irqfd_assign(kvm, args);
347} 347}
348 348
349/* 349/*