Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp821318imm; Wed, 26 Sep 2018 07:19:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV61hHKywrWiyVcCHgjYJHtxgj6H8qKegQiacWNelaQDLl4KSb0i86tjfOsien1ZTR/ZCvlJG X-Received: by 2002:a17:902:9045:: with SMTP id w5-v6mr6496603plz.10.1537971553390; Wed, 26 Sep 2018 07:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537971553; cv=none; d=google.com; s=arc-20160816; b=jV7X6PWd6wu9RxMzi++Oq7gw23gb4LwWEFo6QVsu8ocDtl9Lj+FNEEsii5wM25tSKx +YXoxHmXNk6+OAkFlYFO7ShNQb9+deKan/7YPAoiXs1oU/Q4/Kigc4Y2BFy7zH3M8S+y DNGKul5oEl/AU9IUXGVUU+4FstQORB8OEyO4dIzrYUCtctNdW75a1c6OWmloLdZgdlc5 mIxs8/5de0RTcP1ckXk2bCOgrtuoVA3Wfhitu5j99h4i22K5NddUvTiYebarA1+Hvav9 hci3vbClt9LtvGlLUCdGouPsIUDGl9nQypMuzBt+sNY8/vucO1jNDCNxzQzh8A4n2zQB MtPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=PHnJSU7zm2noHnpLYo0rObnaZ5u0RUsSVsGFUEa2XlA=; b=KN/Ll26ATG7g5a/j7hPsLOVW5KJ5lEopnkjbDtI0N2gFAiX2PRB206kNwnDqwdCkty bd31RvtDTSR6NsVH4DWlWOYJ+63ZEmSfQh/Mjh5JHqQSBz8YEEKWaeOIa41BAPhynAmO MpYYW8E2Lp2cI9tWauHs7pd9tLlGN61kjKd0KQhlL2rUywGZMFva3uq8wVyD+w2W4ntn X0D+/b2WaRQnv5K3nqg0lHskiCZKWKW0uyW/Km+DdsV2LrUs/FxhjXYwYaUSi465gjts FVn/Z8IsvGzZ0ZKPZTs6amWbiswu80dD49rrB5p2soCcd4L3g7nT8o3EadMosgBLLtSt aEaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ursulin-net.20150623.gappssmtp.com header.s=20150623 header.b=Botxz4Wr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i21-v6si5145966pgg.513.2018.09.26.07.18.57; Wed, 26 Sep 2018 07:19:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ursulin-net.20150623.gappssmtp.com header.s=20150623 header.b=Botxz4Wr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728293AbeIZUaM (ORCPT + 99 others); Wed, 26 Sep 2018 16:30:12 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41477 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726937AbeIZU3r (ORCPT ); Wed, 26 Sep 2018 16:29:47 -0400 Received: by mail-wr1-f66.google.com with SMTP id j15-v6so23114879wrt.8 for ; Wed, 26 Sep 2018 07:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PHnJSU7zm2noHnpLYo0rObnaZ5u0RUsSVsGFUEa2XlA=; b=Botxz4WrvvSwaGIVjrzxacQ4F2xwEqrT5+3I9Rio+7LETAqifao5GyMXoYs3R3qukE 4m5ZYLSsA3IitBuX0qTFSZRvRY2sZupMuBpjww+AuDivfDUm0dafIogeW3j8GhRQFo6T GEturI/1D9Rwz2rAOfVRCcjhazE0X6lRdoPAFjXnpSpFmegXnd1754qKlwQ6h441RFUk wQbHKcvaGMjv51HzCCj2bQTzI+rRCcw/bSUDupjxyrFO4EZVzAL2hV2GJ+kfl5q5OZ+b PKaTxhq1AWUk90CmNbX21BiHuRObD4/Cx9drrYAPJFJ4JlxBsLnV2MN1E5B8rv4+lem8 MfWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PHnJSU7zm2noHnpLYo0rObnaZ5u0RUsSVsGFUEa2XlA=; b=BR/2UxHe445XTQTBk8N9VK3k0Zea8yLqMxuFGUj5gWyVlnCfKBIbjXH4HtBvPxR8og vAKLe8a5ShOX7noPyr9wFfcDWNS+hclzxGDP2jy24ry5WiGKVUKMZN43EhADybzRClAE eUPwyzESMikAzSu4AuRs2pfOWklzW3EquT3Vyvchl6CF7s5Wjk/+b8nZ8GoO+q0Ocz57 7ro5r/TqSmGAofmekE0Nfa4TxatuXAAzm9XajmElsMEn1Xbbx09SdoImFUJ3wm7m0oeq XpaMZovwvP0Cbs488g1Qj1t2YUXjmKTewHdJViG+O5qjGLlfBebhh84XiN8DAEjF5A2E 7V+g== X-Gm-Message-State: ABuFfojCU45PkncsSzulVvRpDkTMYbIJdM/wq2Tfya8sMIXvpGLl+xUG XiVXNe1Pgen2FEx/xNuBDJnZpnaEBf4= X-Received: by 2002:adf:fdca:: with SMTP id i10-v6mr5411920wrs.276.1537971396038; Wed, 26 Sep 2018 07:16:36 -0700 (PDT) Received: from localhost.localdomain ([95.144.165.37]) by smtp.gmail.com with ESMTPSA id v14-v6sm3209974wmh.41.2018.09.26.07.16.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Sep 2018 07:16:35 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: linux-kernel@vger.kernel.org Cc: tursulin@ursulin.net, tvrtko.ursulin@linux.intel.com, Tvrtko Ursulin , Bart Van Assche , Hannes Reinecke , Johannes Thumshirn , Jens Axboe Subject: [PATCH 2/6] lib/scatterlist: Use consistent types in sgl API Date: Wed, 26 Sep 2018 15:16:21 +0100 Message-Id: <20180926141625.17727-3-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926141625.17727-1-tvrtko.ursulin@linux.intel.com> References: <20180926141625.17727-1-tvrtko.ursulin@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tvrtko Ursulin There is an incosistency between data types used for order and number of sg elements in the API. Fix it so both are always unsigned int which, in the case of number of elements, matches the underlying struct scatterlist. Signed-off-by: Tvrtko Ursulin Cc: Bart Van Assche Cc: Hannes Reinecke Cc: Johannes Thumshirn Cc: Jens Axboe --- include/linux/scatterlist.h | 5 +++-- lib/scatterlist.c | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index bdede25901b5..f6cf4d7c9a69 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -285,8 +285,9 @@ struct scatterlist *sgl_alloc_order(unsigned long length, unsigned int order, unsigned int *nent_p); struct scatterlist *sgl_alloc(unsigned long length, gfp_t gfp, unsigned int *nent_p); -void sgl_free_n_order(struct scatterlist *sgl, int nents, int order); -void sgl_free_order(struct scatterlist *sgl, int order); +void sgl_free_n_order(struct scatterlist *sgl, unsigned int nents, + unsigned int order); +void sgl_free_order(struct scatterlist *sgl, unsigned int order); void sgl_free(struct scatterlist *sgl); #endif /* CONFIG_SGL_ALLOC */ diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 014018f90e28..23e53dce897d 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -549,11 +549,12 @@ EXPORT_SYMBOL(sgl_alloc); * - All pages in a chained scatterlist can be freed at once by setting @nents * to a high number. */ -void sgl_free_n_order(struct scatterlist *sgl, int nents, int order) +void sgl_free_n_order(struct scatterlist *sgl, unsigned int nents, + unsigned int order) { struct scatterlist *sg; struct page *page; - int i; + unsigned int i; for_each_sg(sgl, sg, nents, i) { if (!sg) @@ -571,9 +572,9 @@ EXPORT_SYMBOL(sgl_free_n_order); * @sgl: Scatterlist with one or more elements * @order: Second argument for __free_pages() */ -void sgl_free_order(struct scatterlist *sgl, int order) +void sgl_free_order(struct scatterlist *sgl, unsigned int order) { - sgl_free_n_order(sgl, INT_MAX, order); + sgl_free_n_order(sgl, UINT_MAX, order); } EXPORT_SYMBOL(sgl_free_order); -- 2.17.1