From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v2 02/20] xen: Introduce a function to split a Linux page into Xen page Date: Thu, 16 Jul 2015 16:54:25 +0200 Message-ID: <55A7C5A1.7060006__6318.80347286842$1437058546$gmane$org@citrix.com> References: <1436474552-31789-1-git-send-email-julien.grall@citrix.com> <1436474552-31789-3-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZFkYW-0007PF-CY for xen-devel@lists.xenproject.org; Thu, 16 Jul 2015 14:54:36 +0000 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: Stefano Stabellini Cc: ian.campbell@citrix.com, linux-kernel@vger.kernel.org, David Vrabel , xen-devel@lists.xenproject.org, Boris Ostrovsky , linux-arm-kernel@lists.infradead.org List-Id: xen-devel@lists.xenproject.org Hi Stefano, On 16/07/2015 16:23, Stefano Stabellini wrote: >> diff --git a/include/xen/page.h b/include/xen/page.h >> index 8ebd37b..b1f7722 100644 >> --- a/include/xen/page.h >> +++ b/include/xen/page.h >> @@ -39,4 +39,24 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS]; >> >> extern unsigned long xen_released_pages; >> >> +typedef int (*xen_pfn_fn_t)(struct page *page, unsigned long pfn, void *data); >> +/* Break down the page in 4KB granularity and call fn foreach xen pfn */ >> +static inline int xen_apply_to_page(struct page *page, xen_pfn_fn_t fn, >> + void *data) >> +{ >> + unsigned long pfn = xen_page_to_pfn(page); >> + int i; >> + int ret; > > please initialize ret to 0 Hmmm... right. I'm not sure why the compiler didn't catch it. > >> + for (i = 0; i < XEN_PFN_PER_PAGE; i++, pfn++) { >> + ret = fn(page, pfn, data); >> + if (ret) >> + return ret; >> + } >> + >> + return ret; >> +} >> + >> + >> #endif /* _XEN_PAGE_H */ > > > Reviewed-by: Stefano Stabellini Thank you, -- Julien Grall