Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp44511lqj; Thu, 11 Apr 2024 09:23:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUqXH3xlAnDAJ9N++A+FR5CeEoj5luj76Nt62dENchnZ+xxFGlywHy0jNuc1HI90bKhNF66RbNEFv4Y0wnhs4MWkiVkZHvK7lODZf/LWA== X-Google-Smtp-Source: AGHT+IGxrbCySJbImm5f21c8Gr3e7OudsAVVLqfUaeQfeo5GoCXcj8o7FXi52oMieBg/41FLmCiI X-Received: by 2002:a17:903:2384:b0:1e4:24cc:e021 with SMTP id v4-20020a170903238400b001e424cce021mr5578599plh.50.1712852622801; Thu, 11 Apr 2024 09:23:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712852622; cv=pass; d=google.com; s=arc-20160816; b=FHVmXeh8V3pvWCyzERLXn9csB2XMrmaB9c6O1aCj/HeeLKemrsZkLWtHj356JiFslp +hcHfMV0x0u1RGnhWxSRkVf2QOx3w0Sh3g6QIaeSGOMhYxMmXWtHeoWCPAhkzVViB8BX 5AdEla16YCK0KMR2tCk8o3sjx+BEIv3KsPV55dg+enClY1w8o+FBM80bsv/VQxDyDZyw RuotdNeQvz1QqKP1XYyBN9C2JaUJu8eRfMCutr9NurHSHMSnPnvUmLYKuOappFgHi+sL yawEts2Caa+XmaEUiy2tyzEkKqlZpUm7uYyILEuyHrxkXMfN4kdph7a85KBXqFdobdj5 JDTg== 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=Lqcg6ZDAbIKmotLYf6+iLqPjbdjurOpU09d8FxULCvI=; fh=2FInBIgEh7xt9W7JS1z2wQ7fUhvLHtwfAfkXluU3JoI=; b=A0H8hGSLg2X+15MaNWm2iOTMaVWO2Vc+tUrAq8Z4a6oEngrHqvuYJTlL39lC6CYElK br/c+RWofGox+U0cDznFQG/PZU2c0zMZFjb34CXCRT3kKvgnIdv74wecViWJ0lQPrXwd /0SEz4cjofhQrVMcvYpGv/weUTjInmZO5igu5uYpsIldR1QPVg6IWyygh0RU8B3QrjV3 HKTjlvTyT7rrsDpHRqOaB+TnUc3IELKUQ/TkRDTpnqLPVBKrcbT61MwxGRrg7q3klJ/U cKGkZpr8GrRNJf6xguQ7NxyESvE4B7Z3dO8h2OqDzm8ZQmb+jHAvVdlGaG2vzaWxpCxI oOTg==; 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=YTu+tNEF; 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-140945-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140945-linux.lists.archive=gmail.com@vger.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 h15-20020a170902680f00b001e10a526a94si1460969plk.129.2024.04.11.09.23.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 09:23:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140945-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-dk.20230601.gappssmtp.com header.s=20230601 header.b=YTu+tNEF; 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-140945-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140945-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 67878282A10 for ; Thu, 11 Apr 2024 16:19:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 96B1F20FA92; Thu, 11 Apr 2024 15:36:40 +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="YTu+tNEF" Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (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 7525120FA95 for ; Thu, 11 Apr 2024 15:36:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849799; cv=none; b=ji9U7pJRHz72uWdyBcFml5lfZ7rtCPD6tdsW35UUzNkN080vIKdcMXM2ht5V11ise7+NxBXNSmlZ8usdd/ghfxIJhV7KL1L5REFhDMu+v/KxGDqc0Lck/hjRM7A+v2nIWKsBqgvNVb5mAY/AQA+ItPMHTNoistW3nb1hAIiMMJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849799; c=relaxed/simple; bh=dyBk2apMX/ifFP/+4yS2H6tcLaTw3coX+GcPJfP+YjU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hQ3s3AqMxKztSytLos1IzgpCeXWVSYpJPySsFxyAJ2i/Y7peY3y01jcCLBeto84Is71MlqjYgW1rknIADgOTmztNHgw1qwoyLuNgS8ntsJ9ez6prJZtQIciFIF0I+wq3bNMpZYAzA0Vqv4Gz7mFLQWWYHl59oNbtGhzzPVe0tsM= 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=YTu+tNEF; arc=none smtp.client-ip=209.85.166.43 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-f43.google.com with SMTP id ca18e2360f4ac-7c8e4c0412dso69578139f.1 for ; Thu, 11 Apr 2024 08:36:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712849797; x=1713454597; 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=Lqcg6ZDAbIKmotLYf6+iLqPjbdjurOpU09d8FxULCvI=; b=YTu+tNEFE2wsa1kp+JugsbhuddBlzoFDNUx0lQaQ/uM6Dpi4xEM4xqtAt1DUEa/Ir0 mWmxzBk/Ydg3tk1MggrfaCvDeNsuNhGVd80Pa85Un6l5pRu2PmkEVkseN/LFZoCrNeRN Xk88QMG257tfbnO+/yS6at0fNXWyI3qJanYde8ZonkmkkMMQN2WnblNWE2VwN41YtUed hh8IS9Fyq+6OzQ+IYCeymkS0CZxJtEFyIa8A3DNZjfrHdskYR64uMIJHa8rk8rTRfgE7 nqu+QkPvrD7BxO3yWX4w6eSghglnfPkPUzi6HrbGIl6kVC8vqlQ0M/MNKUi1EONvwt3b KPZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712849797; x=1713454597; 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=Lqcg6ZDAbIKmotLYf6+iLqPjbdjurOpU09d8FxULCvI=; b=p763CLrl7aDUNZjVQHajLSZ5YwSpqx+H5v3rvHUnmYj4xBDtqqaXAyCXcuPlFjOOfY uNvUjyFFSuk/k/u6UDKAXJL/OTTJEU1uyXaONs6wJWZ4y8l6AFuqQk570KNgmWvIUwa5 wVTvd0kp4FBxHAIUhDmbYbr1gvJyEuHE3Tq2iuk8/27EHFImPaLl8b+BbPj+X30XeKwH DyvETkE3WBZ1Pd8OiiCMRwlTWYKbnAaJYb+GzHtCtqAByN8a/7P/3udoWrYoT/9BGRgY v/rF9rRiTMfmy504vCJ+AUxLJ4Uly11uYc0Dee6CReekGSMJ3qh5UPvjSrE/x4ILRQpy Q1Ew== X-Gm-Message-State: AOJu0Yxf34CvwzrJ3Mv1TLSV23jWs5nSHavA2rhvrmad7OyqVgOsn/ip mbzsGiciJfaJAB65jc9xELGJJd+jDUuXjHvccKHLqg8OzdR0L56ETovuU1xTYzgCDjWoWWc2B/U 2 X-Received: by 2002:a6b:c34e:0:b0:7d6:7b7c:8257 with SMTP id t75-20020a6bc34e000000b007d67b7c8257mr218547iof.0.1712849797224; Thu, 11 Apr 2024 08:36:37 -0700 (PDT) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id jc25-20020a056638891900b0047f14b7f6c0sm457056jab.5.2024.04.11.08.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 08:36:35 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 176/437] soc: fsl: convert to read/write iterators Date: Thu, 11 Apr 2024 09:15:16 -0600 Message-ID: <20240411153126.16201-177-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/soc/fsl/dpaa2-console.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/soc/fsl/dpaa2-console.c b/drivers/soc/fsl/dpaa2-console.c index 6dbc77db7718..c0ababa17763 100644 --- a/drivers/soc/fsl/dpaa2-console.c +++ b/drivers/soc/fsl/dpaa2-console.c @@ -189,12 +189,12 @@ static int dpaa2_console_close(struct inode *node, struct file *fp) return 0; } -static ssize_t dpaa2_console_read(struct file *fp, char __user *buf, - size_t count, loff_t *f_pos) +static ssize_t dpaa2_console_read(struct kiocb *iocb, struct iov_iter *to) { - struct console_data *cd = fp->private_data; + struct console_data *cd = iocb->ki_filp->private_data; size_t bytes = dpaa2_console_size(cd); size_t bytes_end = cd->end_addr - cd->cur_ptr; + size_t count = iov_iter_count(to); size_t written = 0; void *kbuf; int err; @@ -214,18 +214,17 @@ static ssize_t dpaa2_console_read(struct file *fp, char __user *buf, if (bytes > bytes_end) { memcpy_fromio(kbuf, cd->cur_ptr, bytes_end); - if (copy_to_user(buf, kbuf, bytes_end)) { + if (!copy_to_iter_full(kbuf, bytes_end, to)) { err = -EFAULT; goto err_free_buf; } - buf += bytes_end; cd->cur_ptr = cd->start_addr; bytes -= bytes_end; written += bytes_end; } memcpy_fromio(kbuf, cd->cur_ptr, bytes); - if (copy_to_user(buf, kbuf, bytes)) { + if (!copy_to_iter_full(kbuf, bytes, to)) { err = -EFAULT; goto err_free_buf; } @@ -245,7 +244,7 @@ static const struct file_operations dpaa2_mc_console_fops = { .owner = THIS_MODULE, .open = dpaa2_mc_console_open, .release = dpaa2_console_close, - .read = dpaa2_console_read, + .read_iter = dpaa2_console_read, }; static struct miscdevice dpaa2_mc_console_dev = { @@ -258,7 +257,7 @@ static const struct file_operations dpaa2_aiop_console_fops = { .owner = THIS_MODULE, .open = dpaa2_aiop_console_open, .release = dpaa2_console_close, - .read = dpaa2_console_read, + .read_iter = dpaa2_console_read, }; static struct miscdevice dpaa2_aiop_console_dev = { -- 2.43.0