From nobody Fri Dec 19 17:14:52 2025 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 CE97B1D9FE9 for ; Thu, 11 Apr 2024 15:40:10 +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=1712850012; cv=none; b=s/PWN94aKPR0qmqR+P0xoRBvvp1U3OI05xN+LAvkRkFuJiym+0CapfdR8Lgi6WB0bwxz74AtSdndTPt4DfxfJnR4KxrM3SsWn+TaZ0liMUzrPNlHRYF2l3Waj3qPRatr0IPZI/3/iyujC+/eXbOM+gP1/v4WDPBk6tX64QSq0BI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712850012; c=relaxed/simple; bh=81o1xwCWI7QUW1NUuq50pKwEnOx+bczsgQ9nD2Ts4AE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tRkhmglFEfHKMW6LfriX6rkysJUVEsLZVPwJdby2aSWsVBDmR0cL2oZK8o0u5WK54KzB2QImvEZB8zbY7AjkoMGvirYjtngRoXnv5iLyLEIewWv4mYEc16GHAptEbwBIuWuE3auEJ+SSNc5J3iGAkwzCSMy2fIN4O2MCunVeoPs= 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=vWllT8Zg; 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 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="vWllT8Zg" Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-7d67d1073easo9873139f.0 for ; Thu, 11 Apr 2024 08:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1712850009; x=1713454809; 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=wuDxFagP4f8c7YjTC6jiq88QiKjLYnfBuV0irVWBJJc=; b=vWllT8ZgEssssroL1Bv/gqM0YyNkEO9kn/0LyQaBO9qUEtTXSdMcshdwltnjn6Bc+i dGllg9eoPauT92GhFoo79Vx1cVFt54ZPAONPi9Ki8BWjZy83sUW4Vf86M5YjmDc+D35v PWbAjHShnMEAxQ9ZH3Xq7oGX0Xq34mV3kSiSWVlSiZrDZJWya4mY3ZGm5xkqSVnjim86 swzmYFOwLXBGrr1on3crD0elkU/WOcAg7cM36fFHI1PSKJh/R74YGTKrLmIT1Nm2fMrG 83gyeW6nlHAKyfSWnk2NDcIzy1FpUzUyvl0RBegVtjQh205dDkVgzYigjw1BuI+W9dLz tSpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712850009; x=1713454809; 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=wuDxFagP4f8c7YjTC6jiq88QiKjLYnfBuV0irVWBJJc=; b=O0rirjHO2gGmQj6vEiOh2S2/wyhudL+YtYS4mmb5YnMP9vcrgNKOuzHViYrpCYT7M2 6n9/kz2/6fkPoBWL73oDthWuLTJmTjcFJW6snXd9frbsVKLsxU+fi+dvIV2IO0i6oypV vzn5cWvZUVaX4eVVoASbGZ3RdhDg2WbvI8RCOUn7q483iZuv3RXH3NKIT21elrflPDbk FVbzgag2EWS6z1Rbz8cztR9yi3Vch2jnNc3fOWxUSWE6ziZxdb9IVT8vyZRmEz5gOfAf 2cZ6lQ519PemQzEgChjFtGSuiQyzylVw2HDqW8/7tHlkMoQkxwcH9xrDga6peJdmkKzT Ww0g== X-Gm-Message-State: AOJu0YzyWjMYos+//WERXM9OaSB/OD0tTmyLxA0bOJXZaA8dOqLa0KMi Lrocv7j6OLYBh65J6PrPXRQPq1HOaGejDzYCuGKgYkiLsg3hJIR/JjVdeXtf0tOu0lNJLXpUT3v y X-Google-Smtp-Source: AGHT+IFPNVfBXRzQzx98zmJ5Pt44LWa+UlZ3eOHDpmIIQmaoBxTcBLh0IHeBoHo9WoLUxUjsaExnIw== X-Received: by 2002:a6b:c34e:0:b0:7d6:7b7c:8257 with SMTP id t75-20020a6bc34e000000b007d67b7c8257mr229498iof.0.1712850008720; Thu, 11 Apr 2024 08:40:08 -0700 (PDT) Received: from localhost.localdomain ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id jc25-20020a056638891900b0047f14b7f6c0sm457056jab.5.2024.04.11.08.40.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 08:40:07 -0700 (PDT) From: Jens Axboe To: linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 306/437] drivers/net/wireless/broadcom: convert to read/write iterators Date: Thu, 11 Apr 2024 09:17:26 -0600 Message-ID: <20240411153126.16201-307-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: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Jens Axboe --- drivers/net/wireless/broadcom/b43/debugfs.c | 30 +++++++++--------- .../net/wireless/broadcom/b43legacy/debugfs.c | 31 +++++++++---------- .../broadcom/brcm80211/brcmfmac/core.c | 10 +++--- .../broadcom/brcm80211/brcmsmac/debug.c | 2 +- 4 files changed, 35 insertions(+), 38 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43/debugfs.c b/drivers/net/wire= less/broadcom/b43/debugfs.c index efa98444e3fb..bd82fc337500 100644 --- a/drivers/net/wireless/broadcom/b43/debugfs.c +++ b/drivers/net/wireless/broadcom/b43/debugfs.c @@ -487,8 +487,7 @@ static ssize_t loctls_read_file(struct b43_wldev *dev, =20 #undef fappend =20 -static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t b43_debugfs_read(struct kiocb *iocb, struct iov_iter *to) { struct b43_wldev *dev; struct b43_debugfs_fops *dfops; @@ -497,11 +496,12 @@ static ssize_t b43_debugfs_read(struct file *file, ch= ar __user *userbuf, char *buf; const size_t bufsize =3D 1024 * 16; /* 16 kiB buffer */ const size_t buforder =3D get_order(bufsize); + size_t count =3D iov_iter_count(to); int err =3D 0; =20 if (!count) return 0; - dev =3D file->private_data; + dev =3D iocb->ki_filp->private_data; if (!dev) return -ENODEV; =20 @@ -511,7 +511,7 @@ static ssize_t b43_debugfs_read(struct file *file, char= __user *userbuf, goto out_unlock; } =20 - dfops =3D container_of(debugfs_real_fops(file), + dfops =3D container_of(debugfs_real_fops(iocb->ki_filp), struct b43_debugfs_fops, fops); if (!dfops->read) { err =3D -ENOSYS; @@ -536,10 +536,9 @@ static ssize_t b43_debugfs_read(struct file *file, cha= r __user *userbuf, dfile->buffer =3D buf; } =20 - ret =3D simple_read_from_buffer(userbuf, count, ppos, - dfile->buffer, - dfile->data_len); - if (*ppos >=3D dfile->data_len) { + ret =3D simple_copy_to_iter(dfile->buffer, &iocb->ki_pos, dfile->data_len, + to); + if (iocb->ki_pos >=3D dfile->data_len) { free_pages((unsigned long)dfile->buffer, buforder); dfile->buffer =3D NULL; dfile->data_len =3D 0; @@ -550,12 +549,11 @@ static ssize_t b43_debugfs_read(struct file *file, ch= ar __user *userbuf, return err ? err : ret; } =20 -static ssize_t b43_debugfs_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t b43_debugfs_write(struct kiocb *iocb, struct iov_iter *from) { struct b43_wldev *dev; struct b43_debugfs_fops *dfops; + size_t count =3D iov_iter_count(from); char *buf; int err =3D 0; =20 @@ -563,7 +561,7 @@ static ssize_t b43_debugfs_write(struct file *file, return 0; if (count > PAGE_SIZE) return -E2BIG; - dev =3D file->private_data; + dev =3D iocb->ki_filp->private_data; if (!dev) return -ENODEV; =20 @@ -573,7 +571,7 @@ static ssize_t b43_debugfs_write(struct file *file, goto out_unlock; } =20 - dfops =3D container_of(debugfs_real_fops(file), + dfops =3D container_of(debugfs_real_fops(iocb->ki_filp), struct b43_debugfs_fops, fops); if (!dfops->write) { err =3D -ENOSYS; @@ -585,7 +583,7 @@ static ssize_t b43_debugfs_write(struct file *file, err =3D -ENOMEM; goto out_unlock; } - if (copy_from_user(buf, userbuf, count)) { + if (!copy_from_iter_full(buf, count, from)) { err =3D -EFAULT; goto out_freepage; } @@ -608,8 +606,8 @@ static ssize_t b43_debugfs_write(struct file *file, .write =3D _write, \ .fops =3D { \ .open =3D simple_open, \ - .read =3D b43_debugfs_read, \ - .write =3D b43_debugfs_write, \ + .read_iter =3D b43_debugfs_read, \ + .write_iter =3D b43_debugfs_write, \ .llseek =3D generic_file_llseek, \ }, \ .file_struct_offset =3D offsetof(struct b43_dfsentry, \ diff --git a/drivers/net/wireless/broadcom/b43legacy/debugfs.c b/drivers/ne= t/wireless/broadcom/b43legacy/debugfs.c index 6b0e8d117061..3746e2fab874 100644 --- a/drivers/net/wireless/broadcom/b43legacy/debugfs.c +++ b/drivers/net/wireless/broadcom/b43legacy/debugfs.c @@ -184,8 +184,7 @@ static int restart_write_file(struct b43legacy_wldev *d= ev, const char *buf, size =20 #undef fappend =20 -static ssize_t b43legacy_debugfs_read(struct file *file, char __user *user= buf, - size_t count, loff_t *ppos) +static ssize_t b43legacy_debugfs_read(struct kiocb *iocb, struct iov_iter = *to) { struct b43legacy_wldev *dev; struct b43legacy_debugfs_fops *dfops; @@ -194,11 +193,12 @@ static ssize_t b43legacy_debugfs_read(struct file *fi= le, char __user *userbuf, char *buf; const size_t bufsize =3D 1024 * 16; /* 16 KiB buffer */ const size_t buforder =3D get_order(bufsize); + size_t count =3D iov_iter_count(to); int err =3D 0; =20 if (!count) return 0; - dev =3D file->private_data; + dev =3D iocb->ki_filp->private_data; if (!dev) return -ENODEV; =20 @@ -208,7 +208,7 @@ static ssize_t b43legacy_debugfs_read(struct file *file= , char __user *userbuf, goto out_unlock; } =20 - dfops =3D container_of(debugfs_real_fops(file), + dfops =3D container_of(debugfs_real_fops(iocb->ki_filp), struct b43legacy_debugfs_fops, fops); if (!dfops->read) { err =3D -ENOSYS; @@ -238,10 +238,9 @@ static ssize_t b43legacy_debugfs_read(struct file *fil= e, char __user *userbuf, dfile->buffer =3D buf; } =20 - ret =3D simple_read_from_buffer(userbuf, count, ppos, - dfile->buffer, - dfile->data_len); - if (*ppos >=3D dfile->data_len) { + ret =3D simple_copy_to_iter(dfile->buffer, &iocb->ki_pos, + dfile->data_len, to); + if (iocb->ki_pos >=3D dfile->data_len) { free_pages((unsigned long)dfile->buffer, buforder); dfile->buffer =3D NULL; dfile->data_len =3D 0; @@ -252,12 +251,12 @@ static ssize_t b43legacy_debugfs_read(struct file *fi= le, char __user *userbuf, return err ? err : ret; } =20 -static ssize_t b43legacy_debugfs_write(struct file *file, - const char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t b43legacy_debugfs_write(struct kiocb *iocb, + struct iov_iter *from) { struct b43legacy_wldev *dev; struct b43legacy_debugfs_fops *dfops; + size_t count =3D iov_iter_count(from); char *buf; int err =3D 0; =20 @@ -265,7 +264,7 @@ static ssize_t b43legacy_debugfs_write(struct file *fil= e, return 0; if (count > PAGE_SIZE) return -E2BIG; - dev =3D file->private_data; + dev =3D iocb->ki_filp->private_data; if (!dev) return -ENODEV; =20 @@ -275,7 +274,7 @@ static ssize_t b43legacy_debugfs_write(struct file *fil= e, goto out_unlock; } =20 - dfops =3D container_of(debugfs_real_fops(file), + dfops =3D container_of(debugfs_real_fops(iocb->ki_filp), struct b43legacy_debugfs_fops, fops); if (!dfops->write) { err =3D -ENOSYS; @@ -287,7 +286,7 @@ static ssize_t b43legacy_debugfs_write(struct file *fil= e, err =3D -ENOMEM; goto out_unlock; } - if (copy_from_user(buf, userbuf, count)) { + if (!copy_from_iter_full(buf, count, from)) { err =3D -EFAULT; goto out_freepage; } @@ -315,8 +314,8 @@ static ssize_t b43legacy_debugfs_write(struct file *fil= e, .write =3D _write, \ .fops =3D { \ .open =3D simple_open, \ - .read =3D b43legacy_debugfs_read, \ - .write =3D b43legacy_debugfs_write, \ + .read_iter =3D b43legacy_debugfs_read, \ + .write_iter =3D b43legacy_debugfs_write, \ .llseek =3D generic_file_llseek, \ }, \ .file_struct_offset =3D offsetof(struct b43legacy_dfsentry, \ diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/driv= ers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index bf91b1e1368f..d02dd7944bad 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -1165,13 +1165,13 @@ static void brcmf_core_bus_reset(struct work_struct= *work) brcmf_bus_reset(drvr->bus_if); } =20 -static ssize_t bus_reset_write(struct file *file, const char __user *user_= buf, - size_t count, loff_t *ppos) +static ssize_t bus_reset_write(struct kiocb *iocb, struct iov_iter *from) { - struct brcmf_pub *drvr =3D file->private_data; + struct brcmf_pub *drvr =3D iocb->ki_filp->private_data; + size_t count =3D iov_iter_count(from); u8 value; =20 - if (kstrtou8_from_user(user_buf, count, 0, &value)) + if (kstrtou8_from_iter(from, count, 0, &value)) return -EINVAL; =20 if (value !=3D 1) @@ -1185,7 +1185,7 @@ static ssize_t bus_reset_write(struct file *file, con= st char __user *user_buf, static const struct file_operations bus_reset_fops =3D { .open =3D simple_open, .llseek =3D no_llseek, - .write =3D bus_reset_write, + .write_iter =3D bus_reset_write, }; =20 static int brcmf_bus_started(struct brcmf_pub *drvr, struct cfg80211_ops *= ops) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c b/dri= vers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c index 6d776ef6ff54..cfc7ff6d3503 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/debug.c @@ -182,7 +182,7 @@ static const struct file_operations brcms_debugfs_def_o= ps =3D { .owner =3D THIS_MODULE, .open =3D brcms_debugfs_entry_open, .release =3D single_release, - .read =3D seq_read, + .read_iter =3D seq_read_iter, .llseek =3D seq_lseek }; =20 --=20 2.43.0