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 <jonathanh@nvidia.com>
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 <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
This commit is contained in:
Jon Hunter
2025-11-27 08:46:52 +00:00
committed by mobile promotions
parent f0d6883945
commit 42b3ff7b23
3 changed files with 30 additions and 14 deletions

View File

@@ -258,13 +258,19 @@ static int wch_pci_board_probe(void)
for (i = 0; i < WCH_BOARDS_MAX; i++) { for (i = 0; i < WCH_BOARDS_MAX; i++) {
sb = &wch_board_table[i]; sb = &wch_board_table[i];
if (sb->board_enum > 0) { if (sb->board_enum > 0) {
#if WCH_DBG
printk("\n"); printk("\n");
#endif
if ((sb->pb_info.num_serport) > 0) { 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, printk("WCH Info : Found WCH %s Series Board (%dS),\n", sb->pb_info.board_name,
sb->pb_info.num_serport); sb->pb_info.num_serport);
#endif
} }
#if WCH_DBG
printk(" bus number:%d, device number:%d\n\n", sb->bus_number, sb->dev_number); 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; int status = 0;
#if WCH_DBG
printk("\n\n"); printk("\n\n");
printk("===================== WCH Device Driver Module Install =====================\n"); printk("===================== WCH Device Driver Module Install =====================\n");
printk("\n"); printk("\n");
printk("WCH Info : Loading WCH Multi-I/O Board Driver Module\n"); printk("WCH Info : Loading WCH Multi-I/O Board Driver Module\n");
printk(" -- Date : %s\n", WCH_DRIVER_DATE); printk(" -- Date : %s\n", WCH_DRIVER_DATE);
printk(" -- Version : %s\n\n", WCH_DRIVER_VERSION); printk(" -- Version : %s\n\n", WCH_DRIVER_VERSION);
#endif
wch_ser_port_total_cnt = 0; wch_ser_port_total_cnt = 0;
@@ -847,36 +855,48 @@ int wch_35x_init(void)
if (status != 0) { if (status != 0) {
goto step1_fail; goto step1_fail;
} }
#if WCH_DBG
printk("------------------->pci board probe success\n"); printk("------------------->pci board probe success\n");
#endif
status = wch_get_pci_board_conf(); status = wch_get_pci_board_conf();
if (status != 0) { if (status != 0) {
goto step1_fail; goto step1_fail;
} }
#if WCH_DBG
printk("------------------->pci board conf success\n"); printk("------------------->pci board conf success\n");
#endif
status = wch_assign_resource(); status = wch_assign_resource();
if (status != 0) { if (status != 0) {
goto step1_fail; goto step1_fail;
} }
#if WCH_DBG
printk("------------------->pci assign success\n"); printk("------------------->pci assign success\n");
#endif
status = wch_ser_port_table_init(); status = wch_ser_port_table_init();
if (status != 0) { if (status != 0) {
goto step1_fail; goto step1_fail;
} }
#if WCH_DBG
printk("------------------->ser port table init success\n"); printk("------------------->ser port table init success\n");
#endif
status = wch_register_irq(); status = wch_register_irq();
if (status != 0) { if (status != 0) {
goto step1_fail; goto step1_fail;
} }
#if WCH_DBG
printk("------------------->pci register irq success\n"); printk("------------------->pci register irq success\n");
#endif
status = wch_ser_register_driver(&wch_ser_reg); status = wch_ser_register_driver(&wch_ser_reg);
if (status != 0) { if (status != 0) {
goto step2_fail; goto step2_fail;
} }
#if WCH_DBG
printk("------------------->ser register driver success\n"); printk("------------------->ser register driver success\n");
#endif
status = wch_ser_register_ports(&wch_ser_reg); status = wch_ser_register_ports(&wch_ser_reg);
if (status != 0) { if (status != 0) {
@@ -888,7 +908,9 @@ int wch_35x_init(void)
// ch365_32s_test(); // ch365_32s_test();
#endif #endif
#if WCH_DBG
printk("================================================================================\n"); printk("================================================================================\n");
#endif
return status; return status;
step3_fail: step3_fail:

View File

@@ -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. * 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. * 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 * 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 <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
@@ -91,8 +79,10 @@
*/ */
static int wch_probe(struct pci_dev *dev, const struct pci_device_id *ent) 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("\n====================WCH Device Driver(pre) Module probe====================\n");
printk("Probe Device VID: %4x, PID: 0x%4x\n", dev->vendor, dev->device); printk("Probe Device VID: %4x, PID: 0x%4x\n", dev->vendor, dev->device);
#endif
wch_35x_init(); wch_35x_init();
return 0; 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) static void wch_remove(struct pci_dev *dev)
{ {
#if WCH_DBG
printk("\n====================WCH Device Driver(pre) Module exit====================\n"); printk("\n====================WCH Device Driver(pre) Module exit====================\n");
printk("Remove Device VID: %4x, PID: 0x%4x\n", dev->vendor, dev->device); printk("Remove Device VID: %4x, PID: 0x%4x\n", dev->vendor, dev->device);
#endif
wch_35x_exit(); wch_35x_exit();
} }

View File

@@ -2539,8 +2539,10 @@ extern int wch_ser_register_ports(struct ser_driver *drv)
return ret; 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, 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); sp->port.iotype);
#endif
} }
return 0; return 0;