Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp76123lqj; Thu, 11 Apr 2024 10:12:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWELYyCEKqRI0D0gPXQR2r0zhNdXuO9qerZYxzmKDoOcHX9NHlzZ5PnsqH1Tns1gt9ItfODPnfXCAi8iaTS1Px8BRuS3EbnRX4Rb4yVlg== X-Google-Smtp-Source: AGHT+IEHah7fzqLqjRLGJ6/jvz38mp2xzhJbiFbMQDnwTAJXu1lotvai0qO1PlJkFuYKe9B7soG1 X-Received: by 2002:a50:d50a:0:b0:56d:fc50:ec50 with SMTP id u10-20020a50d50a000000b0056dfc50ec50mr207769edi.13.1712855526475; Thu, 11 Apr 2024 10:12:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712855526; cv=pass; d=google.com; s=arc-20160816; b=yKd6GUr0WWxo7+KhEqBZW5uxq6VUqMffigqreDSSjW9ZzbOhUmyIGGYHSUXp2VFSnh E4UwNKIQh0vOUMcpCCUYK/b5QPivQnecYTqISBPkWNlUYWyzt5WTXFDdXW84XtNcHEKg LK0NL0RLQ1VH9Y+NoBe6n5kGrnu7Sa68iuuFCTXtlYaGWi3bqfiN692Yfjj5prJZvb8A 6vGaTcXSa2PYLLI7apal4tUQxlU6gt4j+26hHhDNzAEs49XEr3CRElQhbZw70PFwdLyi 7YhRwnUdRCWCde/36uZakZmm9cCXmWx6MtzGxmVDPn4EwbbvtUlg+a4k1Axsbev51jYo CXjw== 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=Z7WWPETmJQxbWvG9OQdVyXT26hRdCxaZ5v08Hz5199Q=; fh=2FInBIgEh7xt9W7JS1z2wQ7fUhvLHtwfAfkXluU3JoI=; b=0+Xl5aB28c3Et65l/vKGUGFZFzaPTURj/ckJJg97fSROiz/9ULl6RpH/5bRZ6hA3VQ 0NHSlZaJDwEnEeud6DZ+5sH5f68M/IrYjarop1NJhjSxXD2M2QrcMIzPfhkIDstRTdH4 CrPZHZ16RDnRSM2EcGXGHDlA1fJtScCAONwsZWOcSV8VOIpS0EfN9hDg+MCL1ey4Qttk 4PtfMNE97+hs5fruAa+X5oGhreu3WJ/6uxvI9SbqmPMvGINIGPde+1MPUkekZI4XoEir H4ULDyvWW2X5GXp6nTpHgwV1in2e5a32i2ddMs3zRYQodpIRc0WcM6w58+pqcCetplO+ IVxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=uSWUGr1w; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-141184-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141184-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ev12-20020a056402540c00b0056fe1c1e455si899443edb.429.2024.04.11.10.12.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 10:12:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141184-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=uSWUGr1w; arc=pass (i=1 spf=pass spfdomain=kernel.dk dkim=pass dkdomain=kernel-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-141184-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141184-linux.lists.archive=gmail.com@vger.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4DDE51F22E49 for ; Thu, 11 Apr 2024 17:11:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7269168AF1; Thu, 11 Apr 2024 15:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="uSWUGr1w" Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A91441F962C for ; Thu, 11 Apr 2024 15:42:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712850174; cv=none; b=baifW7NYGbofyEP03aawFZSpEwmK+bM7OZ4H5aYtp3D1mcuEuP7iBXrI56oSGQd0eOS4b1N5IG9Tafj9VzlTSns/vMpFmud3KENxtonzSlwJVJ5RicXEO/Cr9Co//afKzLauPgAetX7O3+qbGAnTetIf9mwBQWM5lyw7/bx4mwY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712850174; c=relaxed/simple; bh=PNTIyww3Yjh9XMFowg/nTgO62vsnmR2F+vKnrOQQ+E8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MctdgcAZuxFoHrNLQrXeChkSTyMhl1GGUlR4Z13D8uy0/HOXpO87d1kFBQ4r83e66vtZkd52CzLLK6z0LattB7SRQo5ogvqvMbNleV0SL/ZpmFqw9rCYNmDnm/3G9vLtSWy2G+V3kUu934axgPUbkOSsqZQHTIruXZUx9sEXQ08= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=uSWUGr1w; arc=none smtp.client-ip=209.85.166.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Received: by mail-il1-f171.google.com with SMTP id e9e14a558f8ab-36a224d7414so198005ab.1 for ; Thu, 11 Apr 2024 08:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712850172; x=1713454972; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z7WWPETmJQxbWvG9OQdVyXT26hRdCxaZ5v08Hz5199Q=; b=uSWUGr1wisrlkS/k93m0w7X4mtI6DJzTTpfoJq+E6XD25Di7LpkPm7TUEAiTAXlC6B RTk+ksGVgT+wweG6vIf/UxBaEUK41nrG8zfFZzb/ROOZpuvstJibDBn9I1BG7qURZY1f e3yohUBleXTlVC7eZpV+k7wjZLLFelQBXtyxsyC/8MYvtR3zv8gt0ZgYbOAssWVeww0N YH6GBBlHX8arSlI1SzXHqYNfR2pqplmCOATu2FHTmk2A88GvTu6HEtXtSm552uOq9yJD lmJ+umNJcXmYQqOS277Kzq1ebys09fN7Y+XVJ5UodeHD9xtzRw7wVbOBOfF4KeedzOTW rUYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712850172; x=1713454972; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z7WWPETmJQxbWvG9OQdVyXT26hRdCxaZ5v08Hz5199Q=; b=tCgfbgnfTlqHI0Uvi2REUFuD0Ecnv6LfqBjriTDlh1mkiwh4m7N8kr6DkS31xtqN0h eZpOh5vi7FiBk5s+o5Dr1vXVQ96czYjpvtjIOz/KKbZ8QGvoCzErh3Ozx9UCLYkWr3Ly WPSqEaLVDKgZUR/vkOrjIKP1aOAY7E0SIMtVAHfpW8mQrFn74vNWPH/DxB6wEe0ii7bS SGkDouU4F8qapMp0zqT6CpTVSlFBL5iKao3im8lMKIBzWYXUePlGQIihimVkbQEPb2Su 5Pdw07B8WUp0Lr8VqeYVNVna17fzbgMMVrH9SLCFocNLjKdcp5Cz8fwYb59piUnwDqU0 Q1Tw== X-Gm-Message-State: AOJu0YyoMldwO18nSCLQJIeh4/IbwYAoBjFI05py7+6KktYPiK/Sx/WD 3iUDOm8VPrK7FIh5Ysc8+Lny3n38Kj0YACVeOXFeJefLuJopnJdM2O0HpQR7KjLD67IFElzOm8R h X-Received: by 2002:a6b:6605:0:b0:7d4:1dae:da1a with SMTP id a5-20020a6b6605000000b007d41daeda1amr164701ioc.2.1712850172497; Thu, 11 Apr 2024 08:42:52 -0700 (PDT) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id jc25-20020a056638891900b0047f14b7f6c0sm457056jab.5.2024.04.11.08.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 08:42:52 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 401/437] drivers/gnss: convert to read/write iterators Date: Thu, 11 Apr 2024 09:19:01 -0600 Message-ID: <20240411153126.16201-402-axboe@kernel.dk> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240411153126.16201-1-axboe@kernel.dk> References: <20240411153126.16201-1-axboe@kernel.dk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Signed-off-by: Jens Axboe --- drivers/gnss/core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c index 48f2ee0f78c4..ce66ffb85832 100644 --- a/drivers/gnss/core.c +++ b/drivers/gnss/core.c @@ -119,11 +119,12 @@ static ssize_t gnss_read(struct file *file, char __user *buf, return ret; } +FOPS_READ_ITER_HELPER(gnss_read); -static ssize_t gnss_write(struct file *file, const char __user *buf, - size_t count, loff_t *pos) +static ssize_t gnss_write(struct kiocb *iocb, struct iov_iter *from) { - struct gnss_device *gdev = file->private_data; + struct gnss_device *gdev = iocb->ki_filp->private_data; + size_t count = iov_iter_count(from); size_t written = 0; int ret; @@ -148,7 +149,7 @@ static ssize_t gnss_write(struct file *file, const char __user *buf, if (n > GNSS_WRITE_BUF_SIZE) n = GNSS_WRITE_BUF_SIZE; - if (copy_from_user(gdev->write_buf, buf, n)) { + if (!copy_from_iter_full(gdev->write_buf, n, from)) { ret = -EFAULT; goto out_unlock; } @@ -170,7 +171,6 @@ static ssize_t gnss_write(struct file *file, const char __user *buf, break; written += ret; - buf += ret; if (written == count) break; @@ -203,8 +203,8 @@ static const struct file_operations gnss_fops = { .owner = THIS_MODULE, .open = gnss_open, .release = gnss_release, - .read = gnss_read, - .write = gnss_write, + .read_iter = gnss_read_iter, + .write_iter = gnss_write, .poll = gnss_poll, .llseek = no_llseek, }; -- 2.43.0