Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp53818lqj; Thu, 11 Apr 2024 09:37:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWo79ecrQi4rezn4tGhmxNHL9hDRWEP5lJYtvTnjLpeM4qSW5nI4/VH5ePDSkozcZCQtXcahQ/6zaBRAUgwZYNCqKN6Te0DWOk/5WWAVg== X-Google-Smtp-Source: AGHT+IELRyAD6VGOGQgpfOzt0nXRMuk91gkKxlkOsel6VdlrmcRVpWMVIiShNxYeZKqT5oi9554P X-Received: by 2002:a50:c05e:0:b0:56b:dd7c:ac3d with SMTP id u30-20020a50c05e000000b0056bdd7cac3dmr136539edd.10.1712853472388; Thu, 11 Apr 2024 09:37:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712853472; cv=pass; d=google.com; s=arc-20160816; b=RQsrWeZS2zq0nI9kMnhDjHmLGT3A4s5PsBcoBQA1Cg8mJA+jyBlDUlQtrrKWpGOHf7 QZ1tFSYgF8R9oJXGv32I0CbYuedzfHepb44JlLRjfWMWECnwEy1shrBq8R/TXTzKwx9n FcvHFYx7Y3ogFyLnA0XHM4O3ExKqe/ml7QASEYl302/R2zh47/mH8qy2SzABsHRaSnCi VqEkoX1QTLXRRPdJny9QemO1z/6oK2eDJMfWHDeG9XEO85ybC8pytiZGxTePuqIcmmRi c4NSP1i4SNMH+g5WXo3+rzx9aCckZeIt245vi2s41AKryQ0jjlgIS+uq/X19aKdEtR23 cgeg== 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=bGKEb36ML3r27fIXcnvi5oJlug0A+w9Xl9vTN9Gmtag=; fh=2FInBIgEh7xt9W7JS1z2wQ7fUhvLHtwfAfkXluU3JoI=; b=iDeZrIuPY72AqexyvzGQUTXtADiF2pWh/FwXCJCvTUO5+sv2f/pHDlhxDQ6FUhJzjz e0b4/AJ13cZxV5nVBcWbr9UarONrSWc0mT1xnwuZlCB7/pgkTOuhe80AXQ6M4QvIKyUz WU0izg2SpKmINCbnDmYPmTnSprlYlpVBcuvQdhL7Fw7TddrkJ8dIBlXVqB1+5/L+/w0p v7M+UXKKFHxVieKKxoRJZfCwdECXjuTAyZQe/8IcYGlulMFX21GzxN2XG1mRJ2TZLMSO VDeLrhDHT7/w0MWimMqHhusuNn/i4Uv0sJxWtEWDBLi5cEX90H+3YH3SiB339G4e7ytH F+BQ==; 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="zHw/Aszq"; 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-140985-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140985-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 e9-20020a50a689000000b0056e04471e4bsi873854edc.221.2024.04.11.09.37.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 09:37:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140985-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="zHw/Aszq"; 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-140985-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140985-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 CF0221F27768 for ; Thu, 11 Apr 2024 16:27:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE01C824B0; Thu, 11 Apr 2024 15:37:42 +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="zHw/Aszq" Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) (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 BBC831BE402 for ; Thu, 11 Apr 2024 15:37:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849862; cv=none; b=Oo+bgmZA6kHGA2xZLTviBL/d6RUDeYiyb/1jVk691Tfu4g21BHnJFielPYw2W5YVSsIuNrHZW+d6bIHYhbw4u6slsYIdXtQ8NF+tSHyG6wvXih0OVoj3KrvxjOJ3DL3DbaNPugnM5gMPZVkfs2wskTHle1gIXmPXkjwEMjkg7kw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849862; c=relaxed/simple; bh=XLKt5eZDBTC++5sY/reTHPqBAamAX+Hj6woXPkidhOg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TPwY2pXVag46vE0jUdg+x9nSRyfPVrJUPOucFkAbGOrhRqUos/MjQ8gWid1TqTLm1fryxrHUvSPcyW3/nbMtABNgBOtUNhlQg3jeD7e8C2fgzmtxsVzbfuUsMTktEHJVSFFQL10gx7Wz5a844VyUO2R4dE9g5kwHdwM83v1JX+w= 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=zHw/Aszq; arc=none smtp.client-ip=209.85.166.41 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-f41.google.com with SMTP id ca18e2360f4ac-7d6812b37a6so8976839f.0 for ; Thu, 11 Apr 2024 08:37:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712849859; x=1713454659; 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=bGKEb36ML3r27fIXcnvi5oJlug0A+w9Xl9vTN9Gmtag=; b=zHw/Aszqtd+VKhT2B8BgPzyLBQNsLqMzorWOR9e1dGjgGS/5bBaxDsZf53P44tU4cm ek1H2Dx7L3uJ5m7/zbT9NKPV2zL8LmWDbPNMF+hKbaxjGCSFtm55cJDfU2aILN7Xkq0x 0CYDWrYTmUdSebxZI3MeGau5f4DhgzUBEaC98tWmtYM8sr9iipJGpki695rzpyErnyBK HcXRDQlZsxyKxb6Qry+aXWCOjsFJ/OPH7rwmSpW6MJ/fkir00eY3dNnzv4l54S1ZVmV+ 8uH3psAW9UXXe8ad+sRb8bPi59vmLxLVY+DQgxOu7f1UJSjWbAzsdhfxegXRk0+Pfi8W xwYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712849859; x=1713454659; 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=bGKEb36ML3r27fIXcnvi5oJlug0A+w9Xl9vTN9Gmtag=; b=LwogDigQbVo1Kcnv3cBJy5tzembiInkGFVGRqHZRuR5WJ/JWaZLn7qxYSTlfIjVt48 5I40jtE+G40yIj2yCdtHqhh2rdglhFmAGKZ4i5xdNc5qL2cyU+OPlpkB1RCDKm00IrnW 0uPolrSiog/iBWSkyOMwVSpP82m7obY0eDH7HLra8ADYZ/f6/CkJ1iXw7OJz36Izt3R8 hnxMSWoTOoF8KhT5jrg9GrVmtsORiL4KGDEZNn4TVAr433AHHOluOuGw1rvcpIu7u2gG qCjKm41lLuly/t03L9Zwi9XEemchATlEQ0cMf/qD7AYZB3PjHAcR72KXxn37rTCwDFng tiZA== X-Gm-Message-State: AOJu0YzphYEhDBFlmB+hr+5h1Pk3+Oz2MYb+lKvXtBlyNIAQB55+/AOB ccqnX4ZXwoa8F9fFTX0JYw4ojmg1gv+vba49rPQrfkSoIE8R5OlqRq2liubPLqLhqKU7aUFkc2M S X-Received: by 2002:a05:6602:21d7:b0:7d6:9ddf:5095 with SMTP id c23-20020a05660221d700b007d69ddf5095mr20294ioc.1.1712849859497; Thu, 11 Apr 2024 08:37:39 -0700 (PDT) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id jc25-20020a056638891900b0047f14b7f6c0sm457056jab.5.2024.04.11.08.37.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 08:37:38 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 215/437] misc: hpilo: convert to read/write iterators Date: Thu, 11 Apr 2024 09:15:55 -0600 Message-ID: <20240411153126.16201-216-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/misc/hpilo.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c index 04bd34c8c506..27282629e383 100644 --- a/drivers/misc/hpilo.c +++ b/drivers/misc/hpilo.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "hpilo.h" static const struct class ilo_class = { @@ -431,13 +432,13 @@ static void ilo_set_reset(struct ilo_hwinfo *hw) } } -static ssize_t ilo_read(struct file *fp, char __user *buf, - size_t len, loff_t *off) +static ssize_t ilo_read(struct kiocb *iocb, struct iov_iter *to) { int err, found, cnt, pkt_id, pkt_len; - struct ccb_data *data = fp->private_data; + struct ccb_data *data = iocb->ki_filp->private_data; struct ccb *driver_ccb = &data->driver_ccb; struct ilo_hwinfo *hw = data->ilo_hw; + size_t len = iov_iter_count(to); void *pkt; if (is_channel_reset(driver_ccb)) { @@ -473,7 +474,7 @@ static ssize_t ilo_read(struct file *fp, char __user *buf, if (pkt_len < len) len = pkt_len; - err = copy_to_user(buf, pkt, len); + err = !copy_to_iter_full(pkt, len, to); /* return the received packet to the queue */ ilo_pkt_enqueue(hw, driver_ccb, RECVQ, pkt_id, desc_mem_sz(1)); @@ -481,13 +482,13 @@ static ssize_t ilo_read(struct file *fp, char __user *buf, return err ? -EFAULT : len; } -static ssize_t ilo_write(struct file *fp, const char __user *buf, - size_t len, loff_t *off) +static ssize_t ilo_write(struct kiocb *iocb, struct iov_iter *from) { int err, pkt_id, pkt_len; - struct ccb_data *data = fp->private_data; + struct ccb_data *data = iocb->ki_filp->private_data; struct ccb *driver_ccb = &data->driver_ccb; struct ilo_hwinfo *hw = data->ilo_hw; + size_t len = iov_iter_count(from); void *pkt; if (is_channel_reset(driver_ccb)) @@ -502,7 +503,7 @@ static ssize_t ilo_write(struct file *fp, const char __user *buf, len = pkt_len; /* on failure, set the len to 0 to return empty packet to the device */ - err = copy_from_user(pkt, buf, len); + err = !copy_from_iter_full(pkt, len, from); if (err) len = 0; @@ -635,8 +636,8 @@ static int ilo_open(struct inode *ip, struct file *fp) static const struct file_operations ilo_fops = { .owner = THIS_MODULE, - .read = ilo_read, - .write = ilo_write, + .read_iter = ilo_read, + .write_iter = ilo_write, .poll = ilo_poll, .open = ilo_open, .release = ilo_close, -- 2.43.0