[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-394-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:18:53 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 393/437] EDAC/debugfs: convert to read/write iterators
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
drivers/edac/altera_edac.c | 37 +++++++++++++++++--------------------
drivers/edac/debugfs.c | 9 ++++-----
2 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
index 889722751163..45536199e9b0 100644
--- a/drivers/edac/altera_edac.c
+++ b/drivers/edac/altera_edac.c
@@ -571,20 +571,20 @@ static irqreturn_t altr_edac_device_handler(int irq, void *dev_id)
}
static ssize_t __maybe_unused
-altr_edac_device_trig(struct file *file, const char __user *user_buf,
- size_t count, loff_t *ppos)
+altr_edac_device_trig(struct kiocb *iocb, struct iov_iter *from)
{
u32 *ptemp, i, error_mask;
int result = 0;
u8 trig_type;
unsigned long flags;
- struct edac_device_ctl_info *edac_dci = file->private_data;
+ struct edac_device_ctl_info *edac_dci = iocb->ki_filp->private_data;
struct altr_edac_device_dev *drvdata = edac_dci->pvt_info;
const struct edac_device_prv_data *priv = drvdata->data;
+ size_t count = iov_iter_count(from);
void *generic_ptr = edac_dci->dev;
- if (!user_buf || get_user(trig_type, user_buf))
+ if (get_iter(trig_type, from))
return -EFAULT;
if (!priv->alloc_mem)
@@ -640,29 +640,28 @@ altr_edac_device_trig(struct file *file, const char __user *user_buf,
return count;
}
-FOPS_WRITE_ITER_HELPER(altr_edac_device_trig);
static const struct file_operations altr_edac_device_inject_fops __maybe_unused = {
.open = simple_open,
- .write_iter = altr_edac_device_trig_iter,
+ .write_iter = altr_edac_device_trig,
.llseek = generic_file_llseek,
};
static ssize_t __maybe_unused
-altr_edac_a10_device_trig_iter(struct kiocb *iocb, struct iov_iter *from);
+altr_edac_a10_device_trig(struct kiocb *iocb, struct iov_iter *from);
static const struct file_operations altr_edac_a10_device_inject_fops __maybe_unused = {
.open = simple_open,
- .write_iter = altr_edac_a10_device_trig_iter,
+ .write_iter = altr_edac_a10_device_trig,
.llseek = generic_file_llseek,
};
static ssize_t __maybe_unused
-altr_edac_a10_device_trig2_iter(struct kiocb *iocb, struct iov_iter *from);
+altr_edac_a10_device_trig2(struct kiocb *iocb, struct iov_iter *from);
static const struct file_operations altr_edac_a10_device_inject2_fops __maybe_unused = {
.open = simple_open,
- .write_iter = altr_edac_a10_device_trig2_iter,
+ .write_iter = altr_edac_a10_device_trig2,
.llseek = generic_file_llseek,
};
@@ -1734,17 +1733,17 @@ MODULE_DEVICE_TABLE(of, altr_edac_a10_device_of_match);
*/
static ssize_t __maybe_unused
-altr_edac_a10_device_trig(struct file *file, const char __user *user_buf,
- size_t count, loff_t *ppos)
+altr_edac_a10_device_trig(struct kiocb *iocb, struct iov_iter *from)
{
- struct edac_device_ctl_info *edac_dci = file->private_data;
+ struct edac_device_ctl_info *edac_dci = iocb->ki_filp->private_data;
struct altr_edac_device_dev *drvdata = edac_dci->pvt_info;
const struct edac_device_prv_data *priv = drvdata->data;
void __iomem *set_addr = (drvdata->base + priv->set_err_ofst);
+ size_t count = iov_iter_count(from);
unsigned long flags;
u8 trig_type;
- if (!user_buf || get_user(trig_type, user_buf))
+ if (get_iter(trig_type, from))
return -EFAULT;
local_irq_save(flags);
@@ -1759,7 +1758,6 @@ altr_edac_a10_device_trig(struct file *file, const char __user *user_buf,
return count;
}
-FOPS_WRITE_ITER_HELPER(altr_edac_a10_device_trig);
/*
* The Stratix10 EDAC Error Injection Functions differ from Arria10
@@ -1767,17 +1765,17 @@ FOPS_WRITE_ITER_HELPER(altr_edac_a10_device_trig);
* Inject the error into the memory and then readback to trigger the IRQ.
*/
static ssize_t __maybe_unused
-altr_edac_a10_device_trig2(struct file *file, const char __user *user_buf,
- size_t count, loff_t *ppos)
+altr_edac_a10_device_trig2(struct kiocb *iocb, struct iov_iter *from)
{
- struct edac_device_ctl_info *edac_dci = file->private_data;
+ struct edac_device_ctl_info *edac_dci = iocb->ki_filp->private_data;
struct altr_edac_device_dev *drvdata = edac_dci->pvt_info;
const struct edac_device_prv_data *priv = drvdata->data;
void __iomem *set_addr = (drvdata->base + priv->set_err_ofst);
+ size_t count = iov_iter_count(from);
unsigned long flags;
u8 trig_type;
- if (!user_buf || get_user(trig_type, user_buf))
+ if (get_iter(trig_type, from))
return -EFAULT;
local_irq_save(flags);
@@ -1823,7 +1821,6 @@ altr_edac_a10_device_trig2(struct file *file, const char __user *user_buf,
return count;
}
-FOPS_WRITE_ITER_HELPER(altr_edac_a10_device_trig2);
static void altr_edac_a10_irq_handler(struct irq_desc *desc)
{
diff --git a/drivers/edac/debugfs.c b/drivers/edac/debugfs.c
index 4804332d9946..a2b8458a4c1a 100644
--- a/drivers/edac/debugfs.c
+++ b/drivers/edac/debugfs.c
@@ -3,14 +3,13 @@
static struct dentry *edac_debugfs;
-static ssize_t edac_fake_inject_write(struct file *file,
- const char __user *data,
- size_t count, loff_t *ppos)
+static ssize_t edac_fake_inject_write(struct kiocb *iocb, struct iov_iter *from)
{
- struct device *dev = file->private_data;
+ struct device *dev = iocb->ki_filp->private_data;
struct mem_ctl_info *mci = to_mci(dev);
static enum hw_event_mc_err_type type;
u16 errcount = mci->fake_inject_count;
+ size_t count = iov_iter_count(from);
if (!errcount)
errcount = 1;
@@ -38,7 +37,7 @@ static ssize_t edac_fake_inject_write(struct file *file,
static const struct file_operations debug_fake_inject_fops = {
.open = simple_open,
- .write = edac_fake_inject_write,
+ .write_iter = edac_fake_inject_write,
.llseek = generic_file_llseek,
};
--
2.43.0
Powered by blists - more mailing lists