From: Konrad Rzeszutek Wilk Subject: [PATCH 01/11] [swiotlb] fix: Update 'setup_io_tlb_npages' to accept both arguments in either order. Date: Wed, 3 Feb 2010 12:08:02 -0500 Message-ID: <1265216892-14230-2-git-send-email-konrad.wilk@oracle.com> References: <20100203110407H.fujita.tomonori@lab.ntt.co.jp> <1265216892-14230-1-git-send-email-konrad.wilk@oracle.com> Return-path: In-Reply-To: <1265216892-14230-1-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: chrisw@sous-sol.org, fujita.tomonori@lab.ntt.co.jp, iommu@lists.linux-foundation.org, dwmw2@infradead.org Cc: Ian.Campbell@eu.citrix.com, jeremy@goop.org, xen-devel@lists.xensource.com, alex.williamson@hp.com, Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org Before this patch, if you specified 'swiotlb=force,1024' it would ignore both arguments. This fixes it and allows the user to specify it in any order (or none at all). Signed-off-by: Konrad Rzeszutek Wilk --- lib/swiotlb.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 437eedb..e6d9e32 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -102,16 +102,18 @@ static int late_alloc; static int __init setup_io_tlb_npages(char *str) { - if (isdigit(*str)) { - io_tlb_nslabs = simple_strtoul(str, &str, 0); - /* avoid tail segment of size < IO_TLB_SEGSIZE */ - io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE); + while (*str) { + if (isdigit(*str)) { + io_tlb_nslabs = simple_strtoul(str, &str, 0); + /* avoid tail segment of size < IO_TLB_SEGSIZE */ + io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE); + } + if (!strncmp(str, "force", 5)) + swiotlb_force = 1; + str += strcspn(str, ","); + if (*str == ',') + ++str; } - if (*str == ',') - ++str; - if (!strcmp(str, "force")) - swiotlb_force = 1; - return 1; } __setup("swiotlb=", setup_io_tlb_npages); -- 1.6.2.5