From: Christoph Hellwig Date: Tue, 10 Aug 2021 15:17:11 +0000 (+0200) Subject: RDMA/hfi1: Stop using seq_get_buf in _driver_stats_seq_show X-Git-Tag: accepted/tizen/unified/20230118.172025~6416^2~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b89451d2c3d488b304306f8b2d1afc7c28b4f78;p=platform%2Fkernel%2Flinux-rpi.git RDMA/hfi1: Stop using seq_get_buf in _driver_stats_seq_show Just use seq_write to copy the stats into the seq_file buffer instead of poking holes into the seq_file abstraction. Link: https://lore.kernel.org/r/20210810151711.1795374-1-hch@lst.de Signed-off-by: Christoph Hellwig Reviewed-by: Mike Marciniszyn Tested-by: Mike Marciniszyn Signed-off-by: Jason Gunthorpe --- diff --git a/drivers/infiniband/hw/hfi1/debugfs.c b/drivers/infiniband/hw/hfi1/debugfs.c index 2ced236..250079b 100644 --- a/drivers/infiniband/hw/hfi1/debugfs.c +++ b/drivers/infiniband/hw/hfi1/debugfs.c @@ -1358,7 +1358,7 @@ static void _driver_stats_seq_stop(struct seq_file *s, void *v) { } -static u64 hfi1_sps_ints(void) +static void hfi1_sps_show_ints(struct seq_file *s) { unsigned long index, flags; struct hfi1_devdata *dd; @@ -1369,24 +1369,19 @@ static u64 hfi1_sps_ints(void) sps_ints += get_all_cpu_total(dd->int_counter); } xa_unlock_irqrestore(&hfi1_dev_table, flags); - return sps_ints; + seq_write(s, &sps_ints, sizeof(u64)); } static int _driver_stats_seq_show(struct seq_file *s, void *v) { loff_t *spos = v; - char *buffer; u64 *stats = (u64 *)&hfi1_stats; - size_t sz = seq_get_buf(s, &buffer); - if (sz < sizeof(u64)) - return SEQ_SKIP; /* special case for interrupts */ if (*spos == 0) - *(u64 *)buffer = hfi1_sps_ints(); + hfi1_sps_show_ints(s); else - *(u64 *)buffer = stats[*spos]; - seq_commit(s, sizeof(u64)); + seq_write(s, stats + *spos, sizeof(u64)); return 0; }