Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp75405lqj; Thu, 11 Apr 2024 10:11:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVCL8QylYREA8onEP/Fm0OGCWlisUwi/bvVrowf+OFLihDGvrs1p1uKrgJaAbMq+hSFHTP1LzTu8k0VhpIcNZR+S0cVLxTNHjhYAS/ISQ== X-Google-Smtp-Source: AGHT+IEa5CZb8UHylUhtNrLo3kGSa3R6LDPzuaXCwjvvabTfDYsTY6Wv5MFOxaKttJmrjo7pLjzl X-Received: by 2002:a17:907:869e:b0:a52:10c4:edf4 with SMTP id qa30-20020a170907869e00b00a5210c4edf4mr327477ejc.4.1712855461720; Thu, 11 Apr 2024 10:11:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712855461; cv=pass; d=google.com; s=arc-20160816; b=AVqEdY33QdVDzMMVR7KcWebozzWoL/QP18fhHJZYgQb77HXZ8wf8f158C93mXIoTDb bIZUfw8/QNEsN3CB1f7U+/6hjPGHl3hTQqq2ZlWzTVWSWRs4ntPf7dzQeSxgn4Yo9Q69 RGs3vLPYWocael8urq5w52/JbXgOgywGrmDF9MVuYHtk3qPk9kbaaldOa55qLXU2oUO/ SYbqmRgRMVSCJpNRVPJV5jt9VWD4xAnds1AM2rGd+0Gl/3evG5luvi6jqtJhk1lZutxE 1IxIZ+N16rp3/hSgaZ/zMFwDvR0IpeHnx+qAQ9CHUc8OgL7NF7PxcvdXChx+cYXY9+Mc mm7w== 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=Td0z5rsJzO3TviM45pZjL/WQ8TqnLCOHJ/AeSZk7a3Q=; fh=2FInBIgEh7xt9W7JS1z2wQ7fUhvLHtwfAfkXluU3JoI=; b=ZZH7j7e1U/flLaXOIVyf1tdVnrTtNhgMuDU8jJq/Gin2FxRf8hui1P+1VUVUpGu9Mu 6/yt+ulNypS+qycCPOtEL487C1LDOa1OKQwLw3y8beQVABOPcCHZ+35CDu7BkgwlWLPW x7OTcI2SI56KGqZkZhIsLpxuZvis4Ki7WMCYu/EU2SCoBvKA5u0kCZda5rXYANu3dUL1 GiDyeqTO4P6sxOAajL5jj9PiwSGoRYlPcbYq2w6dhJgF9r53GvODdzGBDFzS9O7dpEtu QMjeOX2So1Gi1qfgc+sr/0IO+uTp+y1Xl/UkkiDtB8F5rhc/aU8JwPmbjNT+3AQ1hrtp Qh3g==; 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=SAC0jewo; 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-141180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141180-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k13-20020a170906a38d00b00a474fe51f14si887682ejz.696.2024.04.11.10.11.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 10:11:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b=SAC0jewo; 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-141180-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141180-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 6CD3E1F237E6 for ; Thu, 11 Apr 2024 17:11:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB8241F8C81; Thu, 11 Apr 2024 15:42:48 +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="SAC0jewo" Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (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 D041B1F82FB for ; Thu, 11 Apr 2024 15:42:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712850168; cv=none; b=SMD3DjFfxfzumU40OWhwP7JT0z6jZt2SL2d6jONsTD7R8EAdwNZTHMfjy6iESk+Bb4mzaT2AwjWvXcYma7ag/Fbf0oS4OMkLdiD77CviZHui++HEaXpHBZJ5kdAHK/ok6ctRkAkeUaLr53ntUA9X1HjIvEb+2Lfywo+X8lC+l1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712850168; c=relaxed/simple; bh=VPNd7BEodQPboB1rp43ShwVSi7YJUv8EW2Nk6q7xmw0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VGrVtQNEb2C2rU5iN535tte1B52y6P+TCKHST3KKTwzuXE/VHeUiGUWqOGNV2WOlthR70rtZZIA2T7l9CBN25NMktsvL//cNa7Yy0daRKpwJx07lssMJgbtpBtSWwJtUi0GhxdP7SG6vmkQusam/NodFdf+75xWLTX2UM7x8hss= 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=SAC0jewo; arc=none smtp.client-ip=209.85.166.52 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-io1-f52.google.com with SMTP id ca18e2360f4ac-7c8e4c0412dso69691639f.1 for ; Thu, 11 Apr 2024 08:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712850165; x=1713454965; 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=Td0z5rsJzO3TviM45pZjL/WQ8TqnLCOHJ/AeSZk7a3Q=; b=SAC0jewoNkjf0y2E9l7CD9wTE8+spTew3rviO9amQlZ2jrMRyoJ6yCqKf5LMARhHLt f/qJA6cKQ92Tt2FPmUJ9KWimQ3YA/gCpnVtgMU1uPWan0cIY+77OJkA5VaCZjD2+UAKj nDlaGP4XJ97j54oMXTS2XYEqMD0smXB/IVUDWZyXXWiNXBE2IePTsP3S9xot1C4iFAyW 5pFInDT/TaX9Wr5zmxvy3Fdwj73dFfm70Wn8ad2dMYrTqeNkRwFtCbu/+jwPadsvEBGO +32yvsblcelga6aH7esnE+yFLa6Ylq3Pebkd5kIM3b/GYDpMGkknp5VcZiKi+iCiOmv2 HzxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712850165; x=1713454965; 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=Td0z5rsJzO3TviM45pZjL/WQ8TqnLCOHJ/AeSZk7a3Q=; b=Eo6Vj2ea8Ibw32KAkp6BPyBM1zVelkUWcKWfbXf+gK8WEqcvc4EC7lJqC9FypNdo9g o4AnAUZ1k3sr48U9wx54IsXACnIrqkqmJwYcndQ2NQDyzw5IIiYF9NV5XOfQwcIu3Dce UxH89jlLKs/T0E3GSpyDZ5gu0NBfnprqE3hEIIL8afyV0wOo1yeYO+xYdsHJKikm7xzJ 3cGV6O9vdXYERpK7ShJ0B0C2QiilgAHeTEWK94dF2be7GtJor+5Y1DBPEZPLqNo+Wjk6 4miK3vOGHtN+hmmnTlhD3NMtMhFPEMycqrUFRx3K89HOQ3yEDvBK2TK95iRKhbhSXdTc YCOQ== X-Gm-Message-State: AOJu0YzGSfwAOxS7YospyDGmnCRENa1Kg/RAcDMay5Qx7shDsEBqA5gE 6onghTtRXUYRJtrhd56PYOZQhn2Ue2b3hUzCEYciFzemKGj0SCvaOI5Wq0GU1gcTGWuiFTXlgW9 R X-Received: by 2002:a6b:c34e:0:b0:7d6:7b7c:8257 with SMTP id t75-20020a6bc34e000000b007d67b7c8257mr237636iof.0.1712850165511; Thu, 11 Apr 2024 08:42:45 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 08:42:43 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 396/437] macintosh: adb: convert to read/write iterators Date: Thu, 11 Apr 2024 09:18:56 -0600 Message-ID: <20240411153126.16201-397-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/macintosh/adb.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index b0407c5fadb2..1b95911ded5d 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c @@ -713,11 +713,11 @@ static int adb_release(struct inode *inode, struct file *file) return 0; } -static ssize_t adb_read(struct file *file, char __user *buf, - size_t count, loff_t *ppos) +static ssize_t adb_read(struct kiocb *iocb, struct iov_iter *to) { int ret = 0; - struct adbdev_state *state = file->private_data; + struct adbdev_state *state = iocb->ki_filp->private_data; + size_t count = iov_iter_count(to); struct adb_request *req; DECLARE_WAITQUEUE(wait, current); unsigned long flags; @@ -741,7 +741,7 @@ static ssize_t adb_read(struct file *file, char __user *buf, if (req != NULL || ret != 0) break; - if (file->f_flags & O_NONBLOCK) { + if (iocb->ki_filp->f_flags & O_NONBLOCK) { ret = -EAGAIN; break; } @@ -764,18 +764,18 @@ static ssize_t adb_read(struct file *file, char __user *buf, ret = req->reply_len; if (ret > count) ret = count; - if (ret > 0 && copy_to_user(buf, req->reply, ret)) + if (ret > 0 && !copy_to_iter_full(req->reply, ret, to)) ret = -EFAULT; kfree(req); return ret; } -static ssize_t adb_write(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) +static ssize_t adb_write(struct kiocb *iocb, struct iov_iter *from) { int ret/*, i*/; - struct adbdev_state *state = file->private_data; + struct adbdev_state *state = iocb->ki_filp->private_data; + size_t count = iov_iter_count(from); struct adb_request *req; if (count < 2 || count > sizeof(req->data)) @@ -794,7 +794,7 @@ static ssize_t adb_write(struct file *file, const char __user *buf, req->complete = 0; ret = -EFAULT; - if (copy_from_user(req->data, buf, count)) + if (!copy_from_iter_full(req->data, count, from)) goto out; atomic_inc(&state->n_pending); @@ -843,8 +843,8 @@ static ssize_t adb_write(struct file *file, const char __user *buf, static const struct file_operations adb_fops = { .owner = THIS_MODULE, .llseek = no_llseek, - .read = adb_read, - .write = adb_write, + .read_iter = adb_read, + .write_iter = adb_write, .open = adb_open, .release = adb_release, }; -- 2.43.0