From 42b3ff7b237154d63893520a66d744eaf872b692 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Thu, 27 Nov 2025 08:46:52 +0000 Subject: [PATCH] tty: wch: Disable informational prints When loading the WCH driver on IGX platforms the various information is printed to the kernel log using printk. However, because no level is specified in printk statements, the prints appear as warnings even though they are informational. The WCH driver implements some definitions to enable/disable prints and so wrap these informational prints with WCH_DBG so that they are disabled by default. Bug 5699474 Change-Id: Ic1426ceab94cd457a1ebdfb57a55ff305ad58ff9 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3500555 (cherry picked from commit c3a03860ada48533d2f81bf33ada02c44d079d9f) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3502173 Reviewed-by: svcacv GVS: buildbot_gerritrpt Reviewed-by: Brad Griffis --- drivers/tty/serial/wch_35x/wch_main.c | 22 ++++++++++++++++++++++ drivers/tty/serial/wch_35x/wch_pre_main.c | 20 ++++++-------------- drivers/tty/serial/wch_35x/wch_serial.c | 2 ++ 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/drivers/tty/serial/wch_35x/wch_main.c b/drivers/tty/serial/wch_35x/wch_main.c index b3948678..4a4576f8 100644 --- a/drivers/tty/serial/wch_35x/wch_main.c +++ b/drivers/tty/serial/wch_35x/wch_main.c @@ -258,13 +258,19 @@ static int wch_pci_board_probe(void) for (i = 0; i < WCH_BOARDS_MAX; i++) { sb = &wch_board_table[i]; if (sb->board_enum > 0) { +#if WCH_DBG printk("\n"); +#endif if ((sb->pb_info.num_serport) > 0) { +#if WCH_DBG printk("WCH Info : Found WCH %s Series Board (%dS),\n", sb->pb_info.board_name, sb->pb_info.num_serport); +#endif } +#if WCH_DBG printk(" bus number:%d, device number:%d\n\n", sb->bus_number, sb->dev_number); +#endif } } } @@ -834,12 +840,14 @@ int wch_35x_init(void) { int status = 0; +#if WCH_DBG printk("\n\n"); printk("===================== WCH Device Driver Module Install =====================\n"); printk("\n"); printk("WCH Info : Loading WCH Multi-I/O Board Driver Module\n"); printk(" -- Date : %s\n", WCH_DRIVER_DATE); printk(" -- Version : %s\n\n", WCH_DRIVER_VERSION); +#endif wch_ser_port_total_cnt = 0; @@ -847,36 +855,48 @@ int wch_35x_init(void) if (status != 0) { goto step1_fail; } +#if WCH_DBG printk("------------------->pci board probe success\n"); +#endif status = wch_get_pci_board_conf(); if (status != 0) { goto step1_fail; } +#if WCH_DBG printk("------------------->pci board conf success\n"); +#endif status = wch_assign_resource(); if (status != 0) { goto step1_fail; } +#if WCH_DBG printk("------------------->pci assign success\n"); +#endif status = wch_ser_port_table_init(); if (status != 0) { goto step1_fail; } +#if WCH_DBG printk("------------------->ser port table init success\n"); +#endif status = wch_register_irq(); if (status != 0) { goto step1_fail; } +#if WCH_DBG printk("------------------->pci register irq success\n"); +#endif status = wch_ser_register_driver(&wch_ser_reg); if (status != 0) { goto step2_fail; } +#if WCH_DBG printk("------------------->ser register driver success\n"); +#endif status = wch_ser_register_ports(&wch_ser_reg); if (status != 0) { @@ -888,7 +908,9 @@ int wch_35x_init(void) // ch365_32s_test(); #endif +#if WCH_DBG printk("================================================================================\n"); +#endif return status; step3_fail: diff --git a/drivers/tty/serial/wch_35x/wch_pre_main.c b/drivers/tty/serial/wch_35x/wch_pre_main.c index c0b1e617..dbbf3342 100644 --- a/drivers/tty/serial/wch_35x/wch_pre_main.c +++ b/drivers/tty/serial/wch_35x/wch_pre_main.c @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2021-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. /* * PCI/PCIe to serial driver(pre) for ch351/352/353/355/356/357/358/359/382/384, etc. * This driver only needs to be used when the system does not assign an interrupt number for device. @@ -15,20 +17,6 @@ * V1.00 - initial version */ -/* - * Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - */ - - #include #include @@ -91,8 +79,10 @@ */ static int wch_probe(struct pci_dev *dev, const struct pci_device_id *ent) { +#if WCH_DBG printk("\n====================WCH Device Driver(pre) Module probe====================\n"); printk("Probe Device VID: %4x, PID: 0x%4x\n", dev->vendor, dev->device); +#endif wch_35x_init(); return 0; @@ -100,8 +90,10 @@ static int wch_probe(struct pci_dev *dev, const struct pci_device_id *ent) static void wch_remove(struct pci_dev *dev) { +#if WCH_DBG printk("\n====================WCH Device Driver(pre) Module exit====================\n"); printk("Remove Device VID: %4x, PID: 0x%4x\n", dev->vendor, dev->device); +#endif wch_35x_exit(); } diff --git a/drivers/tty/serial/wch_35x/wch_serial.c b/drivers/tty/serial/wch_35x/wch_serial.c index b868f255..b739490d 100644 --- a/drivers/tty/serial/wch_35x/wch_serial.c +++ b/drivers/tty/serial/wch_35x/wch_serial.c @@ -2539,8 +2539,10 @@ extern int wch_ser_register_ports(struct ser_driver *drv) return ret; } } +#if WCH_DBG printk("Setup ttyWCH%d - PCIe port: port %lx, irq %d, type %d\n", sp->port.line, sp->port.iobase, sp->port.irq, sp->port.iotype); +#endif } return 0;