Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2250561iof; Wed, 8 Jun 2022 00:30:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyniTouuUhtLGtaqjfWH2eLnJqrYLvWd5erKsAkwEtYvdqHMDu3L6Fk2gXXJXrJ5UDySHVr X-Received: by 2002:a17:902:ecc9:b0:163:f779:f97a with SMTP id a9-20020a170902ecc900b00163f779f97amr32402958plh.167.1654673411019; Wed, 08 Jun 2022 00:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654673411; cv=none; d=google.com; s=arc-20160816; b=w0niNBGRDlPZITO6ombjjSfAE+55iWCLn95MUK+DQh9vqOywjCCYjfHpCuz8a4UJSI JRX4GnkP7TB+CVTmcuwtTdi5zSOPgtew9GfM/q/9a63bnqwQWN5KN5ipmBOkML3MG2Rg T2gYUJJocBeBaSb+AURujBARPB/NpugNL/Od+EvGH6540DobwINAN+YUa3dSyEGuXjaw m+Xa4doaM6PtDyahTtEGfzTrzOWIGDyG/G1YkaPSla0EJhg0sYRzvX43yEV0vi/7zqjU l2s75qIcK3xp5frw3mJHPhuB8frq9s1TKDRVybb9bkfAFRmcu0dxX+d+0ppW7RcEffon ECbg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lza/jM46xE9pNwJ+SXOyl17shBBVxQmkpnzjMC7ygJg=; b=byP4B8Lz8z23gmCCU7CpktN4pkfQMWHv2zap9Qh3FVEIgeI8Me4hfo/MQxWnQ/p5xu n7cfOp73iPOmPq4P5kWZVpxcNYCDreBInbZd4bKRnSIikK2LMjzojBg2wM9ZVEEn4sSH 0ZUXXmtSPE3GWaXoqSXThRm7XMbh9MPKMW8e4TnBACm8yryXjXqq6Pc3H0A8aY1bBKa/ QgwK8aZ9JbwkT4gixpOYcVd8EVrHH3MMJRylqkjwf1eFy0D7pLlziJXOaj0RxJaYMPd1 f+J6lUO6qCRDYS1Rxq4gM/Lu52Q7i8wXCEjyZa0WQaOgSGEAl9CYGF3zqbVqzGjTE0P+ bncQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j6RgJJIw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l15-20020a17090a384f00b001e87471611dsi12013881pjf.145.2022.06.08.00.30.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 00:30:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j6RgJJIw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B600C197984; Wed, 8 Jun 2022 00:02:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380508AbiFHCJC (ORCPT + 99 others); Tue, 7 Jun 2022 22:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387740AbiFHAzK (ORCPT ); Tue, 7 Jun 2022 20:55:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 954E319C38E; Tue, 7 Jun 2022 12:26:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2BCFFB8220B; Tue, 7 Jun 2022 19:26:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 925EAC385A5; Tue, 7 Jun 2022 19:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629962; bh=NrPlRNLy3VPCTlW9T90w4oVHwZBt8gL5yWLzuJeF2n0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j6RgJJIw8++rHFBtn3nsQD4tLRujjM12erLYFF+3Id9IGYFfADTa0ktqL3QF1asFg XwIaE/kZQE8q3eDduG7tv5k0b25/8ufuewA+EiBxzE9AEXykXegeDOOUl4tqYb7BQA PdxuePcUAMyfbe6M69QdP6he3FcXgrbuNmT0eNnk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Boyd , Tony Lindgren Subject: [PATCH 5.18 879/879] tty: n_gsm: Fix packet data hex dump output Date: Tue, 7 Jun 2022 19:06:37 +0200 Message-Id: <20220607165028.369214832@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Tony Lindgren commit 925ea0fa5277c1e6bb9e51955ef34eea9736c3d7 upstream. The module param debug for n_gsm uses KERN_INFO level, but the hexdump now uses KERN_DEBUG level. This started after commit 091cb0994edd ("lib/hexdump: make print_hex_dump_bytes() a nop on !DEBUG builds"). We now use dynamic_hex_dump() unless DEBUG is set. This causes no packets to be seen with modprobe n_gsm debug=0x1f unlike earlier. Let's fix this by adding gsm_hex_dump_bytes() that calls print_hex_dump() with KERN_INFO to match what n_gsm is doing with the other debug related output. Fixes: 091cb0994edd ("lib/hexdump: make print_hex_dump_bytes() a nop on !DEBUG builds") Cc: Stephen Boyd Signed-off-by: Tony Lindgren Link: https://lore.kernel.org/r/20220512131506.1216-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/n_gsm.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -444,6 +444,25 @@ static u8 gsm_encode_modem(const struct return modembits; } +static void gsm_hex_dump_bytes(const char *fname, const u8 *data, + unsigned long len) +{ + char *prefix; + + if (!fname) { + print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1, data, len, + true); + return; + } + + prefix = kasprintf(GFP_KERNEL, "%s: ", fname); + if (!prefix) + return; + print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 16, 1, data, len, + true); + kfree(prefix); +} + /** * gsm_print_packet - display a frame for debug * @hdr: header to print before decode @@ -508,7 +527,7 @@ static void gsm_print_packet(const char else pr_cont("(F)"); - print_hex_dump_bytes("", DUMP_PREFIX_NONE, data, dlen); + gsm_hex_dump_bytes(NULL, data, dlen); } @@ -698,9 +717,7 @@ static void gsm_data_kick(struct gsm_mux } if (debug & 4) - print_hex_dump_bytes("gsm_data_kick: ", - DUMP_PREFIX_OFFSET, - gsm->txframe, len); + gsm_hex_dump_bytes(__func__, gsm->txframe, len); if (gsmld_output(gsm, gsm->txframe, len) <= 0) break; /* FIXME: Can eliminate one SOF in many more cases */ @@ -2448,8 +2465,7 @@ static int gsmld_output(struct gsm_mux * return -ENOSPC; } if (debug & 4) - print_hex_dump_bytes("gsmld_output: ", DUMP_PREFIX_OFFSET, - data, len); + gsm_hex_dump_bytes(__func__, data, len); return gsm->tty->ops->write(gsm->tty, data, len); } @@ -2525,8 +2541,7 @@ static void gsmld_receive_buf(struct tty char flags = TTY_NORMAL; if (debug & 4) - print_hex_dump_bytes("gsmld_receive: ", DUMP_PREFIX_OFFSET, - cp, count); + gsm_hex_dump_bytes(__func__, cp, count); for (; count; count--, cp++) { if (fp)