Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp49220lqj; Thu, 11 Apr 2024 09:30:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX7KNkoGsStZj6Fha171OSW59+6o7S0mdrMn/GSgP/R8CSFcF0HDD9rWb6CFd6zOqUNzxibQ03ifYejj8u+ZdS1GNH3fmkvLYzpexFxug== X-Google-Smtp-Source: AGHT+IGgRIDg8K0FknRbGdcYnwNinojAsJRyOnn4MCmNMtiRu88sqmyX9BRdtFAsFC6jwFbSEVzs X-Received: by 2002:a17:903:11c3:b0:1e4:9bce:9d75 with SMTP id q3-20020a17090311c300b001e49bce9d75mr6676836plh.65.1712853056876; Thu, 11 Apr 2024 09:30:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712853056; cv=pass; d=google.com; s=arc-20160816; b=tio7LMbVf2pyaTWLRx6EeuoKYt8eFOT3y4603gkmqMVgdAEOKORXvvp8ijxAXoH+aY ADAsAe9DCcb9bDBNrHCTQgFoHPOo5CfJyiF5otHHx6xqFQ7xCe/vcpwuX1DXPoSGTOiE VZ3uXQpQGzTa6meZPm3t3GHyFJ/QR6yH8e1lxaghUn7qDnB6RtJD0YqJ7C51EiNwwyMw IJg2SZKX98nQJZaS/vRursXdG0FJArDrZrKzY/Fh7tnOGokePG6SzM7Ld0KkF5XDv5I3 ayD94h+nYqlpoxWXJX044oLmGn7HuVM9ZzETRshbkLBR5wDcbDTinTpL/95Ea2hnwTEI tzcg== 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=0KCAzXLIsOopEV86W9ZOhnzNKs/kN2+Z3mGkecdfZBk=; fh=2FInBIgEh7xt9W7JS1z2wQ7fUhvLHtwfAfkXluU3JoI=; b=QZF1n2OsnlAYaizItcbWsHmF6+Si20a/XsApprKXxJcC4NSSjuHdzEIe8thuFfeLxW gvFhYc2ut2tLehGJjg9d6DQtB1+0MlgdX/QVT/AET4B5my1Ks2qgd7uF7QHTTMHaWqW5 ybaykY4gfCsbCyt47a3LqVM+FeMSUAhhWamM1yYG8el22ejRQ4J82N0uTF0X5Eb7SQNa dg2v3YvwGlt9KTyDSRP7bHPDXH3daOc8XXvexaTAx0Q2dFW0QOKJxunNw29WHKhGXd/R fgiQY4UxTeBmQSx5sC9C1jnrLS1rZ1tmDmGamrQA9+sdzOlNL1oyNULN50undc+yZn7l +jlw==; 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=x1SO5Z60; 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-140988-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140988-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 l22-20020a637016000000b005d47866f376si1445231pgc.854.2024.04.11.09.30.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 09:30:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140988-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=x1SO5Z60; 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-140988-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140988-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 D0CFA28795F for ; Thu, 11 Apr 2024 16:28:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E70F41BF6CE; Thu, 11 Apr 2024 15:37: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="x1SO5Z60" Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) (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 B16211BED97 for ; Thu, 11 Apr 2024 15:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849868; cv=none; b=Mtuq1vO0qpode7IJsc6/K2A+PFXR3+jhNW1zcsVnlIzcJJse18Ej7SUSjZmS1vXIvO9eb8jjXUP1PGrX4PzTI0RCGbpJYMAwIhv0YGljWU/kdeXYCa52kYaJYSV3dvDV64gckxOaUk7iq7w3dTuWke49FlnkQa+Aku6fw4F2rLo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712849868; c=relaxed/simple; bh=1UdNv5U1emH9JAurW/QvLJxO9pAOFAvRC5+gJWMaXCI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qaxdmb3YcARlaX3OVYkQSsTZRj6t+u40L4lluTP/v7AlNPMVmP5woKO44P5DT/FnoMv9rXdfhKb62SATaBcuSG1nbGzbpNFdZFlUNIdGCg0bawhAyEGqUWM4a2cFn3LTAc5aKYlrhACRUk88pHOa6clEweK1eUb2k1HxUoHOhZg= 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=x1SO5Z60; arc=none smtp.client-ip=209.85.166.42 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-f42.google.com with SMTP id ca18e2360f4ac-7d6812b37a6so8978439f.0 for ; Thu, 11 Apr 2024 08:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712849865; x=1713454665; 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=0KCAzXLIsOopEV86W9ZOhnzNKs/kN2+Z3mGkecdfZBk=; b=x1SO5Z60yZY5HEB/19D3PfCntgbs88e1a2wpBvnxfme1Rji5TMldqK6OvywpQBawvK Fhi4vS3aU5bB4S+2YphDdSDSw5VHFXCdiQdp+4BpOe/xx+QLlozEbPX45cIcg8RXyiw2 schRiDV49ZCh8wXEs+glwGAumfmDqLxS7jENhvr/Rr9pl+MZJMHODCVoD0mpvejrq027 2QD0CEuTMA6GOnPV0oc+Gt1jUqDPfITEvBS/OebyToE2BlHf6YQiyeC7AfwlNxva1bl9 2lWQwxEBQ7ywupiilMYD8sbXylbhBw5zP52v3LStlh00fe37ngj6LuoC2I4r6fsDH61b Mc/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712849865; x=1713454665; 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=0KCAzXLIsOopEV86W9ZOhnzNKs/kN2+Z3mGkecdfZBk=; b=GFrM+IJIY9rmNZbx7rrP673Lcpppxh+c+5pVDj+x5ZrgoN1dAFF3A4rW6Chi05Usbq yy8zIpyHg6Enno+gukYYzEyRLmHqYrYChJwN2bVsc8v4sueS1QjgPb1L5Bjcs1n4yZiN XYi9SWOYsCCQqxy7yU9NvH5a8ZAcAmC2o5sjSE33lp5oAqDJXT6xaK9Wi52wbUKYU5iX b1XxOP4S+YeW2VHIxqiPFsBOYJyuk/umBsg6hHoyVqOuXCPoaIDbFZ5pebGwTMHJWQTz 26XJwn2VZDZ59lEUCnLxx3zim3nFUq7zL6OH6GixR/ieOIex2ZEURtXm/YXiZCC1rWtI 8BeA== X-Gm-Message-State: AOJu0Yybog6bztyrA32YENG+0Yy8IL/cZytbOiqrGN9cxFfYqgOBBnCJ 5SL1lBCb+04djoqyxGEzzEh5pczQlm6n3Wtl7ApvTWb7Z/S6AQ/ne5EkN4eGcixMPK9+6LoUykS 7 X-Received: by 2002:a92:2912:0:b0:36a:f9aa:5757 with SMTP id l18-20020a922912000000b0036af9aa5757mr3586963ilg.2.1712849865528; Thu, 11 Apr 2024 08:37: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.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 08:37:43 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 218/437] misc: tps6594-pfsm: convert to read/write iterators Date: Thu, 11 Apr 2024 09:15:58 -0600 Message-ID: <20240411153126.16201-219-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/tps6594-pfsm.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/drivers/misc/tps6594-pfsm.c b/drivers/misc/tps6594-pfsm.c index 88dcac814892..3e3da7b4bb7e 100644 --- a/drivers/misc/tps6594-pfsm.c +++ b/drivers/misc/tps6594-pfsm.c @@ -45,11 +45,11 @@ struct tps6594_pfsm { struct regmap *regmap; }; -static ssize_t tps6594_pfsm_read(struct file *f, char __user *buf, - size_t count, loff_t *ppos) +static ssize_t tps6594_pfsm_read(struct kiocb *iocb, struct iov_iter *to) { - struct tps6594_pfsm *pfsm = TPS6594_FILE_TO_PFSM(f); - loff_t pos = *ppos; + struct tps6594_pfsm *pfsm = TPS6594_FILE_TO_PFSM(iocb->ki_filp); + size_t count = iov_iter_count(to); + loff_t pos = iocb->ki_pos; unsigned int val; int ret; int i; @@ -66,20 +66,19 @@ static ssize_t tps6594_pfsm_read(struct file *f, char __user *buf, if (ret) return ret; - if (put_user(val, buf + i)) + if (put_iter(val, to)) return -EFAULT; } - *ppos = pos + count; - + iocb->ki_pos = pos + count; return count; } -static ssize_t tps6594_pfsm_write(struct file *f, const char __user *buf, - size_t count, loff_t *ppos) +static ssize_t tps6594_pfsm_write(struct kiocb *iocb, struct iov_iter *from) { - struct tps6594_pfsm *pfsm = TPS6594_FILE_TO_PFSM(f); - loff_t pos = *ppos; + struct tps6594_pfsm *pfsm = TPS6594_FILE_TO_PFSM(iocb->ki_filp); + size_t count = iov_iter_count(from); + loff_t pos = iocb->ki_pos; char val; int ret; int i; @@ -92,7 +91,7 @@ static ssize_t tps6594_pfsm_write(struct file *f, const char __user *buf, count = TPS6594_PMIC_MAX_POS - pos; for (i = 0 ; i < count ; i++) { - if (get_user(val, buf + i)) + if (get_iter(val, from)) return -EFAULT; ret = regmap_write(pfsm->regmap, pos + i, val); @@ -100,8 +99,7 @@ static ssize_t tps6594_pfsm_write(struct file *f, const char __user *buf, return ret; } - *ppos = pos + count; - + iocb->ki_pos = pos + count; return count; } @@ -221,8 +219,8 @@ static long tps6594_pfsm_ioctl(struct file *f, unsigned int cmd, unsigned long a static const struct file_operations tps6594_pfsm_fops = { .owner = THIS_MODULE, .llseek = generic_file_llseek, - .read = tps6594_pfsm_read, - .write = tps6594_pfsm_write, + .read_iter = tps6594_pfsm_read, + .write_iter = tps6594_pfsm_write, .unlocked_ioctl = tps6594_pfsm_ioctl, .compat_ioctl = compat_ptr_ioctl, }; -- 2.43.0