[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH for-4.5 7/8] xen/irq: Handle multiple action per IRQ
On 04/01/2014 03:31 PM, Ian Campbell wrote: > On Tue, 2014-04-01 at 14:52 +0100, Julien Grall wrote: >> On 04/01/2014 02:23 PM, Ian Campbell wrote: >>> On Tue, 2014-04-01 at 14:13 +0100, Julien Grall wrote: >>>>>> - I need to use 2 variables to search for an element in a list as there >>>>>> is >>>>>> no way to know after the end of the loop if we found or not an element. >>>>> >>>>> You've written that a bit weirdly IMHO. >>>>> >>>>> list_for_each(...) >>>>> if (not the one we want) >>>>> continue >>>>> free the one we wanted >>>>> break; >>>>> >>>>> don't worry about warning on a non-existent IRQ, or set a simple >>>>> boolean. >>>> >>>> We have to worry about non-existent action otherwise Xen may segfault... >>> >>> Why? If it doesn't exist we don't do anything. >>> >>> >> >> We can't free in the loop because the action may be used on another CPU >> at the same it. (see "active" loop at the end). So I still need two >> variables (one for the loop and one for the real action). > > Perhaps the "goto found" pattern might help here then? I'm not a big fan of "goto". But in this case the code might be cleaner. -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |