Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1027762iob; Fri, 13 May 2022 20:11:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyP7TsdEq3cgL4kyzh9gdOpdBK2RWFPBUs23VVYsbemQw/1sdt5hPX6vlBNazPgUTmr240A X-Received: by 2002:a1c:2682:0:b0:393:fcd2:7222 with SMTP id m124-20020a1c2682000000b00393fcd27222mr17418619wmm.186.1652497896028; Fri, 13 May 2022 20:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652497896; cv=none; d=google.com; s=arc-20160816; b=ut1WJaF/AccMJ1/osSTRJbYVoyQYWmSgH8kgs00EPBKTyYrkxqmSMAFwyr3vJqOoWU hq2vnPce4QTDqOUP4SCU4tYRGGiWPwQLgzkr6zulxzMHXMETKivpvOrBLIA1l77ja9Ha HlYu4lReQ6IPFqwJQd6gQx83PMGP5xNFIg0St9Z9ARQRcL5KjoeIFk1rHZUrwBtt2puz xKHSXxp2QbQOT6R+SHtrrn9n1YZk4uqq0F5Jc8TUBIeUaWpB3xjgPVZoVvWbVHDEvzsY sY8Y0Nc2dUbiEWlCK5CcfcFz2KEzTffkK1NVQ3DmP/pap22W8VbC98ztr6uCzPGVs5Rv c3xA== 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 :message-id:date:subject:cc:to:from; bh=3IHSX+kTxSkpB+Mxhh/ikwyaMjhvktUO6dm6Qm3ik2M=; b=KvMbepGr+fRa4hGxPq4oVhrsih6vJs8GzmGHxLaWRMk0akuU8s+SkGqv0LyfL77h9O NkpjILM7ZtqoebSLAtEnfQswF8vzkxNK6LyLsVL+z86SBaAJjLVpLtMw2PmhQcCWhcDd uwTvPthcoVHW/AZnSIl8JeV/jW0mcaIsI8UsOfbH+fNOXsssGvavLrI3NacR5gQNk0g4 vlxsJeAOCEbkX4nZqMRS7UnxFttjlWxXJp7IoT7fsKcBxPhlIk5VSh+9c0unSlH72n4F wsdBbhqN0tWMdFFDS8ak49D1lBNFwdSRN5GeqM9KdN+uRBPDfS9AR6ufHjs3v4WkU2d/ E5VQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o13-20020a05600002cd00b0020a792518f5si5070925wry.529.2022.05.13.20.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:11:35 -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; 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D6CAB3CDB08; Fri, 13 May 2022 16:51:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351089AbiELNPP (ORCPT + 99 others); Thu, 12 May 2022 09:15:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353288AbiELNPN (ORCPT ); Thu, 12 May 2022 09:15:13 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B619C223879; Thu, 12 May 2022 06:15:12 -0700 (PDT) Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id A184480B3; Thu, 12 May 2022 13:11:35 +0000 (UTC) From: Tony Lindgren To: Greg Kroah-Hartman Cc: Daniel Starke , Gregory CLEMENT , Jiri Slaby , Johan Hovold , Zhenguo Zhao , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Boyd Subject: [PATCH] tty: n_gsm: Fix packet data hex dump output Date: Thu, 12 May 2022 16:15:06 +0300 Message-Id: <20220512131506.1216-1-tony@atomide.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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 --- drivers/tty/n_gsm.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -443,6 +443,25 @@ static u8 gsm_encode_modem(const struct gsm_dlci *dlci) 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 @@ -507,7 +526,7 @@ static void gsm_print_packet(const char *hdr, int addr, int cr, else pr_cont("(F)"); - print_hex_dump_bytes("", DUMP_PREFIX_NONE, data, dlen); + gsm_hex_dump_bytes(NULL, data, dlen); } @@ -697,9 +716,7 @@ static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci) } 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 */ @@ -2442,8 +2459,7 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len) 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); } @@ -2519,8 +2535,7 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp, 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) -- 2.36.1