Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp500318lqp; Thu, 4 Apr 2024 23:10:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVNC89aN+xsSvFnjRl7LiaGpfa5WYMvRBooHCEWYBgiBT/G+veE8wezzguClXoFZ2Nt0vqliGVoZ+rf/+ErWQhnyNGTF6Gw5eXA81AKAA== X-Google-Smtp-Source: AGHT+IENXiLQfkR5iyI5AaWqruyzWCPQykt0sSdmzYEmQoHI3Zwi8i361NILfsfHfpk+YTFXxufg X-Received: by 2002:a92:c244:0:b0:368:9ba9:fcb5 with SMTP id k4-20020a92c244000000b003689ba9fcb5mr571571ilo.4.1712297405205; Thu, 04 Apr 2024 23:10:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712297405; cv=pass; d=google.com; s=arc-20160816; b=KYQLhj9VnPf0/44tH6nwIOtBVIRn0iPJLgV7GRa+HVfcpmX6rnVQ0byMjG2IGgMKmk KVp2Amx8xG9o9mLeevybFyb1YZdifk4l9W1DJ/7s6isu+/YK0o30e2zF/XEbpZ2roYSY snZJ9uKF2BK59GhKe+1pyvX+PlERqulrftNVijmywKyERH7fbdAjrOc3U5uY6yZDN2kM KWQx74Pu+6DyP6njiblFwqx9eXRNE7JpB/wNbYOQDMOZc71np2Z5QoSKcUJVYe+XtOP5 0r2qRFX2I/Fz+u5LZu13DA/rL/hKzXYc5t+jWOlx9buILTVpLamGf72fCIlNYXpS+46S 53yA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bZCFUqwHs82maVEanIvmVQZuddrjIMnilFX8JZU9BWw=; fh=wet1jHxtCDJik+j0r9J7O6FCkuJ6/nC5qWF9PpiDg8k=; b=iXdnASPLOSQnpg38QxVVNoB9vT26Jd/aYk4ta/WYKTInM2FupsUQG98dV1TujmkW1J zK7NlEZn3m4774qBsrpJJZg+JF2LDkXXQTAwzbYDvY/riEBYc8V2d9IE1Madv+jVl5A/ PbEd0XNrR3Pt2G55cK3jEbIzVcq+SyjGpqrBZ6DoPluAF/WhaS623hYmJt6pzkvdvCoF nyagWgGdeTtzzmmQtnXGdG01OeE8/LtfL/jp6myaDJ9XMAAoDU0syIKA+Zou3/J+xhTO y4nS/yTb962vVeJ5J4FojjQTJyZtqCUSH+fhXfcJ3XYK67dgVeOeHBCFm4K1gn6mE1k7 mXuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MVN9rsRC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132442-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132442-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t31-20020a63535f000000b005dc80f256ccsi826084pgl.849.2024.04.04.23.10.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 23:10:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132442-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MVN9rsRC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-132442-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132442-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D618828121C for ; Fri, 5 Apr 2024 06:10:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5817A2E657; Fri, 5 Apr 2024 06:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MVN9rsRC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 801692D61A; Fri, 5 Apr 2024 06:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712297330; cv=none; b=SC6lZ4GdVdrnkzBDmQVHAMyi2G40b66VENibXrisijP0yeWHG7eSGCdhlTNnNUasoEvjZtLc+6JBFeWOkwHhUd5C/MIRgWouPrG2gFDFqZDJQXsNsvG/0ehFVCVs2mpUgkmuj9EHgKr31RzedrPGgWCS4QIijgJTZlJyL0TGdEw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712297330; c=relaxed/simple; bh=cWZjeTgOZCFr/5XpumqncS6R514+WzkceRCXWiA0OoM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iKsK8SHttElAVITUDvCysM4r9VPz+qr9QWNyn2MjyAOgJ4CQ/jfFUofTbLM+XG08C4RcPUyE4Ln/Hq8gDnsDRVWXXxrcDVNshyB2ka5VY16xsFGVFuqozz0mZXuo18yqTAGhQHF5zHbm0fMfNMhlU5N4WIl/0DBAM5+g6f6iUeA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MVN9rsRC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6D83C433F1; Fri, 5 Apr 2024 06:08:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712297330; bh=cWZjeTgOZCFr/5XpumqncS6R514+WzkceRCXWiA0OoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MVN9rsRCJEZ7kH/NLiRLBCYA25kGTEfdgzg7rP8fFBtzPeF+ncV5nHrTFs8vdOR/t KSU+7jM62DPqRKyLqmM0FklHsUUGv/AEOrUa97U0+u8DS4ZDkrHf1uNZcQv/AOzQtw T+O9ualZCKYebmSwYm1X+2jq0kIRTHa0+adceE+jlVMgnjYkvuobFqiIpPq/G6UN3F eTq3aVW0XAD4Pb/JvfL1wQV7WJsslLeUCi3qiHxcyKAG3EItkskiyGHeLtiR8TUAoT lNbOtAjY6UV02yQefOe88YtxLoxQ5ggh6ZJFGAq/w9qk7MyB/9zX0XOH4Dagv/KFfl p22ZbEIjnvRoQ== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Stefani Seibold , Andrew Morton Subject: [PATCH 06/15] kfifo: pass offset to setup_sgl_buf() instead of a pointer Date: Fri, 5 Apr 2024 08:08:17 +0200 Message-ID: <20240405060826.2521-7-jirislaby@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240405060826.2521-1-jirislaby@kernel.org> References: <20240405060826.2521-1-jirislaby@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit As a preparatory for dma addresses filling, we need the data offset instead of virtual pointer in setup_sgl_buf(). So pass the former instead the latter. And pointer to fifo is needed in setup_sgl_buf() now too. Signed-off-by: Jiri Slaby (SUSE) Cc: Stefani Seibold Cc: Andrew Morton --- lib/kfifo.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/kfifo.c b/lib/kfifo.c index 61e35550aea5..3a249ce4f281 100644 --- a/lib/kfifo.c +++ b/lib/kfifo.c @@ -305,9 +305,12 @@ int __kfifo_to_user(struct __kfifo *fifo, void __user *to, } EXPORT_SYMBOL(__kfifo_to_user); -static unsigned int setup_sgl_buf(struct scatterlist *sgl, void *buf, - int nents, unsigned int len) +static unsigned int setup_sgl_buf(struct __kfifo *fifo, struct scatterlist *sgl, + unsigned int data_offset, int nents, + unsigned int len) { + const void *buf = fifo->data + data_offset; + if (!nents || !len) return 0; @@ -332,8 +335,8 @@ static unsigned int setup_sgl(struct __kfifo *fifo, struct scatterlist *sgl, } len_to_end = min(len, size - off); - n = setup_sgl_buf(sgl, fifo->data + off, nents, len_to_end); - n += setup_sgl_buf(sgl + n, fifo->data, nents - n, len - len_to_end); + n = setup_sgl_buf(fifo, sgl, off, nents, len_to_end); + n += setup_sgl_buf(fifo, sgl + n, 0, nents - n, len - len_to_end); return n; } -- 2.44.0