From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH for-4.5 7/8] xen/irq: Handle multiple action per IRQ Date: Wed, 02 Apr 2014 15:01:40 +0100 Message-ID: <533C1844.907@linaro.org> References: <1390581822-32624-1-git-send-email-julien.grall@linaro.org> <1390581822-32624-8-git-send-email-julien.grall@linaro.org> <1392810905.29739.19.camel@kazak.uk.xensource.com> <53398D84.3020901@linaro.org> <1396281181.8667.29.camel@kazak.uk.xensource.com> <5339919D.7090801@linaro.org> <1396355354.8667.147.camel@kazak.uk.xensource.com> <533ABB8E.4070004@linaro.org> <1396358630.8667.174.camel@kazak.uk.xensource.com> <533AC486.8010401@linaro.org> <1396362699.8667.217.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WVLjb-0007vp-V6 for xen-devel@lists.xenproject.org; Wed, 02 Apr 2014 14:01:44 +0000 Received: by mail-we0-f182.google.com with SMTP id p61so263234wes.41 for ; Wed, 02 Apr 2014 07:01:42 -0700 (PDT) In-Reply-To: <1396362699.8667.217.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org, tim@xen.org, Keir Fraser , stefano.stabellini@citrix.com, patches@linaro.org List-Id: xen-devel@lists.xenproject.org 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