[PATCH 21/32] Input/joystick/analog: Convert from seq_buf -> printbuf
From: Kent Overstreet
Date: Sun Aug 14 2022 - 17:22:50 EST
From: Kent Overstreet <kent.overstreet@xxxxxxxxx>
seq_buf is being deprecated, this converts to printbuf.
Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx>
Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/input/joystick/analog.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 3088c5b829..a8c5f90e82 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -19,7 +19,7 @@
#include <linux/input.h>
#include <linux/gameport.h>
#include <linux/jiffies.h>
-#include <linux/seq_buf.h>
+#include <linux/printbuf.h>
#include <linux/timex.h>
#include <linux/timekeeping.h>
@@ -339,24 +339,21 @@ static void analog_calibrate_timer(struct analog_port *port)
static void analog_name(struct analog *analog)
{
- struct seq_buf s;
+ struct printbuf buf = PRINTBUF_EXTERN(analog->name, sizeof(analog->name));
- seq_buf_init(&s, analog->name, sizeof(analog->name));
- seq_buf_printf(&s, "Analog %d-axis %d-button",
- hweight8(analog->mask & ANALOG_AXES_STD),
- hweight8(analog->mask & ANALOG_BTNS_STD) + !!(analog->mask & ANALOG_BTNS_CHF) * 2 +
- hweight16(analog->mask & ANALOG_BTNS_GAMEPAD) + !!(analog->mask & ANALOG_HBTN_CHF) * 4);
+ prt_printf(&buf, "Analog %d-axis %d-button",
+ hweight8(analog->mask & ANALOG_AXES_STD),
+ hweight8(analog->mask & ANALOG_BTNS_STD) + !!(analog->mask & ANALOG_BTNS_CHF) * 2 +
+ hweight16(analog->mask & ANALOG_BTNS_GAMEPAD) + !!(analog->mask & ANALOG_HBTN_CHF) * 4);
if (analog->mask & ANALOG_HATS_ALL)
- seq_buf_printf(&s, " %d-hat",
- hweight16(analog->mask & ANALOG_HATS_ALL));
-
+ prt_printf(&buf, " %d-hat", hweight16(analog->mask & ANALOG_HATS_ALL));
if (analog->mask & ANALOG_HAT_FCS)
- seq_buf_printf(&s, " FCS");
+ prt_printf(&buf, " FCS");
if (analog->mask & ANALOG_ANY_CHF)
- seq_buf_printf(&s, (analog->mask & ANALOG_SAITEK) ? " Saitek" : " CHF");
+ prt_printf(&buf, (analog->mask & ANALOG_SAITEK) ? " Saitek" : " CHF");
- seq_buf_printf(&s, (analog->mask & ANALOG_GAMEPAD) ? " gamepad" : " joystick");
+ prt_printf(&buf, (analog->mask & ANALOG_GAMEPAD) ? " gamepad" : " joystick");
}
/*
--
2.36.1