Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Fri, 5 Apr 2002 20:00:14 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Fri, 5 Apr 2002 20:00:05 -0500 Received: from exchange.macrolink.com ([64.173.88.99]:3588 "EHLO exchange.macrolink.com") by vger.kernel.org with ESMTP id ; Fri, 5 Apr 2002 19:59:52 -0500 Message-ID: <11E89240C407D311958800A0C9ACF7D13A775E@EXCHANGE> From: Ed Vance To: "'linux-kernel'" Cc: "'linux-serial'" , "'Marcelo Tosatti'" Subject: [PATCH] serial driver procfs 2.4.19-pre6 Date: Fri, 5 Apr 2002 16:59:44 -0800 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org This patch changes text generated by the generic serial driver for the /proc/tty/driver/serial interface. Now generates correct address and port statistics fields for memory mapped devices. Displays only ports claimed by driver. Prevents kudzu crash at pciserial.c:78 when memory mapped serial ports are present, due to missing fields in text line and missing check of string search return value. Example - before: "1: uart:16550A port:02F8 irq:3 tx:0 rx:0 " (I/O space) "4: uart:16C950/954 port:0 irq:14" (memory space) "44: uart:unknown port:0 irq:0" (not claimed) Example - after: "1: uart:16550A port:02F8 irq:3 tx:0 rx:0 " (I/O port) "4: uart:16C950/954 port:C4800000 irq:14 tx:0 rx:0 " (memory space) Applies cleanly to 2.4.19-pre6. Has no dependencies on other patches. Please apply. Thanks, Ed Vance diff -urN -X dontdiff.txt linux-2.4.19-pre6/drivers/char/serial.c patched/drivers/char/serial.c --- linux-2.4.19-pre3/drivers/char/serial.c Fri Apr 5 10:38:11 2002 +++ patched/drivers/char/serial.c Fri Apr 5 15:05:52 2002 @@ -3258,14 +3258,17 @@ int ret; unsigned long flags; + /* + * Return zero characters for ports not claimed by driver. + */ + if (state->type == PORT_UNKNOWN) { + return 0; /* ignore unused ports */ + } + ret = sprintf(buf, "%d: uart:%s port:%lX irq:%d", state->line, uart_config[state->type].name, - state->port, state->irq); - - if (!state->port || (state->type == PORT_UNKNOWN)) { - ret += sprintf(buf+ret, "\n"); - return ret; - } + (state->port ? state->port : (long)state->iomem_base), + state->irq); /* * Figure out the current RS-232 lines - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/