From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v2 08/15] xen/arm: use device api to detect GIC version Date: Wed, 09 Apr 2014 15:32:24 +0100 Message-ID: <534559F8.9060409@linaro.org> References: <1396612593-443-1-git-send-email-vijay.kilari@gmail.com> <1396612593-443-9-git-send-email-vijay.kilari@gmail.com> <533EBC9F.1080504@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Vijay Kilari Cc: Ian Campbell , Stefano Stabellini , Prasun Kapoor , Vijaya Kumar K , xen-devel@lists.xen.org, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On 04/09/2014 03:28 PM, Vijay Kilari wrote: >>> + >>> + dt_for_each_device_node(dt_host, node) >>> + { >>> + rc = device_init(node, DEVICE_GIC, NULL); >>> + if ( !rc ) >>> + num_gics++; >> >> Xen only supports a single GIC for now. You have to initialized the >> correct one (see dt_find_interrupt_controller). > > dt_find_interrupt_controller expects compatibility string as below to fetch > the gic node which can be passed to device_init(). > > static const struct dt_device_match gic_ids[] __initconst = > { > DT_MATCH_GIC, > { /* sentinel */ }, > }; > > In such case, generic driver has to pass compatibility strings of both > GIC v3 & GIC v2 to find the node in dt. Is this ok? > > Other way is to break when num_gics = 1 when it finds the first gic node. Why can't you modify dt_find_interrupt_controller? Or even better, take the code from it and use it directly in your function... -- Julien Grall