Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp74984lqj; Thu, 11 Apr 2024 10:10:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/4MYx37j3zEzStqzpW9IwMWVWhONC3S8Mb36G01D4CmJc7Tx1/F5ZC0zzoQksA5D/V2ymPVZyKZFB41kPDaQO+jjY4hkbVL8BXMpdog== X-Google-Smtp-Source: AGHT+IG51eY9yyNuM2MTCE1JP2tA5NBjOlc0wHu5CIGqn2YduXGmGKLLHNnD5OZtr4A7/BYD8wg0 X-Received: by 2002:a05:622a:1482:b0:431:4050:43a3 with SMTP id t2-20020a05622a148200b00431405043a3mr332475qtx.33.1712855426496; Thu, 11 Apr 2024 10:10:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712855426; cv=pass; d=google.com; s=arc-20160816; b=eUMi/l9QZfrt2+WuV6fAYz39X+RnGEMyFgyDJCzyy1sp+tA+Ma7mh9xQ/G6UHTk/Gl CKfE4U6NsM2MClTtKW+ew7UfkqYXW+W33OI4haQlIcUrxqtVtaujgK/lA4vCbT+NoeSV fhy9YOdHqA+2sQcNgO/WHUm0HLCwcNSysXBzr99qxYlxk7K07EwigUVsTy7yoVlECe5S L3hKc+430GVZEs8jDwYjdkVueDKrG4X1jiAy9+ruc+g9cGC67zyn4ENlfMRZWE9pw0ZC Bd5NeEqWILI7oCuqigY3K0Vke4GktZeJXjvy1tpVndRFNvRm+gOrg5ho0xieCdoUVUcw 6TMg== 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=mWOu08smcrzd/mJ5G2zeBk679SixjLGMg/kkuPWqYhs=; fh=2FInBIgEh7xt9W7JS1z2wQ7fUhvLHtwfAfkXluU3JoI=; b=aIwWlOCHdXTrRGzPLUghzaXVGbPOG/YkP7tXxcYJJ75rw+tYdNQ3hz1qLeXgX6yYLU MfS/i5j8idI3L+2DrEmgnDLm059sLL5CqqxcZ7gFW+M+WRmzyrKxcPw+i1c9qr6W8ihu Zln6QKxtvhslfAP4iAa2BPpA6TXsE3hmMI3wZ4FcncnRAnOIyohu09PrzCV0y6prnSMb +FyiQSm5CO99hh5yhNJjKmKVEGgRePC86B6bDdz6kmqplCoXbAbYsbCzekz/WgocXkoj csjyGfacnaTuatD9CRLAXxSnIKFMK8Z6qFCIk+ab4tKpLSn2X30B1dkTLnaqiiCmop2h AYXg==; 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="R6F/EN5N"; 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-141178-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141178-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p12-20020a05622a048c00b00436587ecb3fsi1973753qtx.259.2024.04.11.10.10.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 10:10:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141178-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20230601.gappssmtp.com header.s=20230601 header.b="R6F/EN5N"; 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-141178-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141178-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3A97F1C20FAE for ; Thu, 11 Apr 2024 17:10:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3EBF51F82D0; Thu, 11 Apr 2024 15:42:45 +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="R6F/EN5N" Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (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 201AC1F7874 for ; Thu, 11 Apr 2024 15:42:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712850164; cv=none; b=cuM+jPC6p2NCoIsEPgbRjFSNjm74tgXg7lGHAdBFPIpcH01vAW2oiPqk9g4/kT3aK9YIL22S4zf/YznDJNy48go3+zZIYs7l6UergEqKthc2rHP4Rxk09Ed7NDdg7FD/pkGeMKzprafhY3j92n3+SrHZ1KRG58jcttfifoV0++M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712850164; c=relaxed/simple; bh=gAk05EH19UAZRUTc19SOoBN9Gb3h0YStlhtozE7ap2c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MitAcivNkbQj5wjKbxqY0FQ6OjAzhMUWUV9wL611SsrgBH7FL8n9ZiGmZkJp/GAEyWV41Ssep8lAXGqTfcPkYnJqDAjbS7Yvg+OqUnNvMOMDHqmEnBFmsaVk82e8ey0mkM418uAmWW24V8BapCycYx1UekaGcNHDzxWe1A2LQBA= 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=R6F/EN5N; arc=none smtp.client-ip=209.85.166.46 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-f46.google.com with SMTP id ca18e2360f4ac-7d6112ba6baso58270239f.1 for ; Thu, 11 Apr 2024 08:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712850162; x=1713454962; 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=mWOu08smcrzd/mJ5G2zeBk679SixjLGMg/kkuPWqYhs=; b=R6F/EN5NLYc32NCpc2LcKUik/mFIo0OVlSeX5BbgA8JhZ8QIyNmddXvPXTJrhBDdDe lzpcvzU9Jz+zwB6wILKqp24DTBKIm8D3dVDwhz49qJ1bFhcIk8B788xwP5XCVQCmEG3s tfa7TJ7oQoNmmJzTe20iKDWyJ3su+f7hp9N8hA2ABkOvKUZ6nV4jKBnRKACZzmwWgawW 6TQWWJae8HfxOCIt7LbTbhQJiA28SFsNZnTF3CDaGCZbN6DDF/58G3i2/QavOqulg2co MFUHqONl7lOTkRrqmUrdH07JO9/siSPJqBjgXuoC5S1P0Xizy2HqW97Ykvz+xUSJ/FLk kKxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712850162; x=1713454962; 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=mWOu08smcrzd/mJ5G2zeBk679SixjLGMg/kkuPWqYhs=; b=eq59p39IIEqIBVFc5W6CfbH3sNpjvk3px4/nLrPEFrc/kuYXD471z5GJMrXlkTi/iD 0Vnq/pf/PH6KbTLO38o+jUfdKrxkC0sbIr1KLzEHNIOmmXvek2s+7y1nwcp+ACY9/hvb +q5L7OobAG6BuBLrlqtk7y/p0wnYVhBXxp/0wSYh3Rj4kaj2/Isra4e7pOjWAq4JFup2 ddBLTxytGxOa0wEwiGifNOo5/bwj+IiQ2jz/8ORNmSXdSmI/nV3IfaigUhn9myfksiaM QZt1W7vIgeEEXDMh2DwDWLZ6/sfKQXrtxHQQwasQ9j7SOuqyT6aQ5isfmeRbY5BqCkWk 6LCw== X-Gm-Message-State: AOJu0YxP5Llz0jGR4mKC9mD/J1cNUr3JhS+hn8EAdZ95rz38K6wYiFrk liDeV+nRIQ3/0zTmCQ+eO8OcHMjXlnR5NDLni3Lm3BM3R4oldv9rW1KwIRhBYX7S/8658rRLQ2O g X-Received: by 2002:a6b:f312:0:b0:7d5:de23:13a9 with SMTP id m18-20020a6bf312000000b007d5de2313a9mr179491ioh.1.1712850162060; Thu, 11 Apr 2024 08:42:42 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 08:42:40 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 394/437] drivers/hsi: convert to read/write iterators Date: Thu, 11 Apr 2024 09:18:54 -0600 Message-ID: <20240411153126.16201-395-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/hsi/clients/hsi_char.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/hsi/clients/hsi_char.c b/drivers/hsi/clients/hsi_char.c index 71ce7dbfe31d..47ddfe14459b 100644 --- a/drivers/hsi/clients/hsi_char.c +++ b/drivers/hsi/clients/hsi_char.c @@ -409,10 +409,10 @@ static inline void hsc_tx_get(struct hsi_client *cl, struct hsc_tx_config *txc) txc->arb_mode = cl->tx_cfg.arb_mode; } -static ssize_t hsc_read(struct file *file, char __user *buf, size_t len, - loff_t *ppos __maybe_unused) +static ssize_t hsc_read(struct kiocb *iocb, struct iov_iter *to) { - struct hsc_channel *channel = file->private_data; + struct hsc_channel *channel = iocb->ki_filp->private_data; + size_t len = iov_iter_count(to); struct hsi_msg *msg; ssize_t ret; @@ -451,8 +451,8 @@ static ssize_t hsc_read(struct file *file, char __user *buf, size_t len, msg = hsc_get_first_msg(channel, &channel->rx_msgs_queue); if (msg) { if (msg->status != HSI_STATUS_ERROR) { - ret = copy_to_user((void __user *)buf, - sg_virt(msg->sgt.sgl), hsc_msg_len_get(msg)); + ret = !copy_to_iter_full(sg_virt(msg->sgt.sgl), + hsc_msg_len_get(msg), to); if (ret) ret = -EFAULT; else @@ -468,10 +468,10 @@ static ssize_t hsc_read(struct file *file, char __user *buf, size_t len, return ret; } -static ssize_t hsc_write(struct file *file, const char __user *buf, size_t len, - loff_t *ppos __maybe_unused) +static ssize_t hsc_write(struct kiocb *iocb, struct iov_iter *from) { - struct hsc_channel *channel = file->private_data; + struct hsc_channel *channel = iocb->ki_filp->private_data; + size_t len = iov_iter_count(from); struct hsi_msg *msg; ssize_t ret; @@ -488,7 +488,7 @@ static ssize_t hsc_write(struct file *file, const char __user *buf, size_t len, clear_bit(HSC_CH_WRITE, &channel->flags); return -ENOSPC; } - if (copy_from_user(sg_virt(msg->sgt.sgl), (void __user *)buf, len)) { + if (!copy_from_iter_full(sg_virt(msg->sgt.sgl), len, from)) { ret = -EFAULT; goto out; } @@ -655,8 +655,8 @@ static int hsc_release(struct inode *inode __maybe_unused, struct file *file) static const struct file_operations hsc_fops = { .owner = THIS_MODULE, - .read = hsc_read, - .write = hsc_write, + .read_iter = hsc_read, + .write_iter = hsc_write, .unlocked_ioctl = hsc_ioctl, .open = hsc_open, .release = hsc_release, -- 2.43.0