[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH for-next v3 11/22] x86/traps: move guest_has_trap_callback to pv/traps.c
>>> On 18.05.17 at 19:09, <wei.liu2@xxxxxxxxxx> wrote: > --- a/xen/arch/x86/pv/traps.c > +++ b/xen/arch/x86/pv/traps.c > @@ -264,6 +264,24 @@ long unregister_guest_nmi_callback(void) > return 0; > } > > +int guest_has_trap_callback(struct domain *d, uint16_t vcpuid, bool and all pointers (including the local variables) can be const afaict (albeit I question the value of both of the local variables, as each is being used just once). And let's please avoid uint16_t here when it doesn't really need to be other than unsigned int. > + unsigned int trap_nr) > +{ > + struct vcpu *v; > + struct trap_info *t; > + > + BUG_ON(d == NULL); > + BUG_ON(vcpuid >= d->max_vcpus); > + > + /* Sanity check - XXX should be more fine grained. */ > + BUG_ON(trap_nr >= NR_VECTORS); > + > + v = d->vcpu[vcpuid]; > + t = &v->arch.pv_vcpu.trap_ctxt[trap_nr]; > + > + return (t->address != 0); With the return type being bool, the != 0 (and the already pointless parentheses) could then be dropped too. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |