Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4289917rwb; Sun, 7 Aug 2022 20:29:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR4xeGnGmh+o3cDUmdhpymgs+L+EH6hjhmP5jJkjebqPO77G1nnpFM3Z3/hStb8Nq7fENyky X-Received: by 2002:a17:907:6092:b0:731:59f0:49ac with SMTP id ht18-20020a170907609200b0073159f049acmr2467211ejc.383.1659929389869; Sun, 07 Aug 2022 20:29:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659929389; cv=none; d=google.com; s=arc-20160816; b=J13aMdWanfaBzWgiTzytRRE8zglZx+etD8dYdc5rxSFL7DRvvl/6fJykEGTwbY73O7 NipBVnzEkc3p8Ot7LQBN2wJNGH9s4vrKo9Fr5QpoccBTSg1bGK6HRE25euA5W3Ot2mhz 5omLBc+ZaNOMLLCOuFKp3NXLMFMIPh1FYaWTFnAuc5bwMx7WkNfQcJ4fLUcFwPEmfqyu Qd6jyouZUtMrnmKWgpiFReYqCI5p2Zgad2BKLzYRiZEwNtDRvl5vorzgN/p7J9Lzieub D97AnSSQStxm7Q7pbwdfTl0jF5lP2KbsK5CKH0w/5G1STltHu0CKuhJk1Al8YDBCCKXu Te5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lfQTXZiY1X35koMGsi465Yl9F2fwXfjrVq4gI2j3bhc=; b=et6MteTdVmECvYLTYcRZt1EN1o13shSIQz1PI+Kn4EUbgPcODmyVpiJycvMxGpI207 g4V+G38kvY4rWCHrA1ciLnAZVGircBVKUxDCWmGYD1cZ/5ZFB4sgIGSmHswVg9UXrCXp ucB5ykis0pGvnA7sHT9YGa/un9YAaARJPqI0QxKBqB0JE8u9af0wGHuogFgJNZXCO9ZV mXF8IHjqLipO/aqRcMdH4bnnXQ+93LrqWtLnNQ49u/NPHARC0UKhg4vXThJECbtkVd8f CqwzQj1WIfukLkK56UqKzMdvQhvKnf3kHe480CK3oLVPK9IkLmVK1wcUfAJdCYWJLxCg vLhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="mBXOn5/7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs40-20020a1709072d2800b00722e7756f3dsi8663742ejc.462.2022.08.07.20.29.25; Sun, 07 Aug 2022 20:29:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="mBXOn5/7"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243958AbiHHCm0 (ORCPT + 99 others); Sun, 7 Aug 2022 22:42:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241978AbiHHClk (ORCPT ); Sun, 7 Aug 2022 22:41:40 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24C4821B9 for ; Sun, 7 Aug 2022 19:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=lfQTXZiY1X35koMGsi465Yl9F2fwXfjrVq4gI2j3bhc=; b=mBXOn5/7/Ubjyu4VKJpvGkaoV/ uX179iuL1fclHsc+EFKeSlPqJ2ay/ncaHC08hxoBl/nEou6mAsT5+7pg5joTfv6kgNFQnHvZO5OV8 VVUJUrndxAfgMASgNOBK98cwxalRqWZeUeaPbl6C8VpuSZMnJBtqZuixTgRGqiLbbCcF2HJVARzmk m871dvFmhZ0zByM/ZNaCDN9aPVtPqWq/qS1GIMfy0bBuZ7e9pMU4wGFbrW0cP8596hOqlSnfV9Thl 7Q42W3dOY/46Hrrd8p8F3cJqcBmjuoCcRmAcSvmbpReOMKSCseS3klf6NZ8apH0BIxkyVpbVGPgfN d1ZDoavA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oKshy-00DVS6-9v; Mon, 08 Aug 2022 02:41:34 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org, pmladek@suse.com, Kent Overstreet Cc: Dmitry Torokhov Subject: [PATCH v5 21/32] Input/joystick/analog: Convert from seq_buf -> printbuf Date: Mon, 8 Aug 2022 03:41:17 +0100 Message-Id: <20220808024128.3219082-22-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220808024128.3219082-1-willy@infradead.org> References: <20220808024128.3219082-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kent Overstreet seq_buf is being deprecated, this converts to printbuf. Signed-off-by: Kent Overstreet Cc: Dmitry Torokhov --- 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 3088c5b829f0..a8c5f90e8208 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -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.35.1