Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3678169pxj; Tue, 15 Jun 2021 06:23:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlKasB9yCzlFPtMurr5UiBiR+POahFRpAUQQjV5PTAcpY0BfmtJ8eYTZZQF//1EWLL0gSn X-Received: by 2002:a17:907:70d3:: with SMTP id yk19mr14258867ejb.450.1623763433338; Tue, 15 Jun 2021 06:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623763433; cv=none; d=google.com; s=arc-20160816; b=RqLKV2DwTU7S+8Pl1dQNp8C9hRcMpwojMT9/IXoUAPMJmrOoCH/DNJnODfxhNqJUWw tDvtamHtB4fTC9xzGO4hxihtlLv1RGjVcncvRz3pSq3VD+cZqtoIZGNACFHrbNrdGDLn 5u6B3HSNoSMXQUNJ7hHEzPspEBtb6Crwe5qBPyZME7MY5gEnihgt96JLHd7TKu0i5/Zs ZtJ2FQloKVUxgeYPNeluIzkZgaDkpfQNhAMUP7YGikIDVE0FgrsO8LZrL3YxE9THnqpI 5bbgfXUYbIgpTdza3RN6LBpHwm6EtDVjclHVwTKj1d/7UkJ3v9C5Le2CTKENM018ZFoz l2NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zXlyHotzjJtLnNcbzrKGMHfjIr/iMzywd9YYd+7ZdcI=; b=mx+i59U6EtuM3eq4eOPcnjUlD07loYmXkveFBOYWlbbVnobqyncdvDpl5d55F2LiB4 uRzbJ1X0J7eu3INGV3nGipPX6W0A8iFDmi1LQvpaTIiC4YmnQgjEDpn1YiVbGQV1+gDG rMTijbEs3uY1zWqtC94/DxdWKWg4AFjXhhSqUDPyRZSNXgXRk+7Z5M5ftOG4jJ0UdY4I XAMTMdhUuDdBe1ZxuhqquqfYJUBaNdp6Z6hxCItSncoOOJR+KzcKxvlQyh5YlBk5uTma PkGliNj8P9yYaHXpS6IY5GtBFupuGgBhqex3/cRRd0DGDVe5a4LMv126UaqSR+Z2DVGd paxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AABeXVMv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si1596955edw.240.2021.06.15.06.23.30; Tue, 15 Jun 2021 06:23:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AABeXVMv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230450AbhFONVp (ORCPT + 99 others); Tue, 15 Jun 2021 09:21:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:39764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230012AbhFONVm (ORCPT ); Tue, 15 Jun 2021 09:21:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C6E186145D; Tue, 15 Jun 2021 13:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623763178; bh=QUjTO9qA9P0XSpHtk0ljNgiuHJvfQJgoZdIkwhL9kVk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AABeXVMvFm01gQQ4tEeRo70Ttojrt+hEBRyC0NqQk7OqaJvsZ8+YT7ytnzFr9xwus 358Hr6OOpRmOT4HQeYP45/NavjEX8UyhzYqE2YLJR3Z8YZ+IccNRJw4jYpakzzOB+D EgFRZZlKZk1YAFaOBtxCst6+hLobhIsAo+02IP4g= Date: Tue, 15 Jun 2021 15:19:35 +0200 From: Greg Kroah-Hartman To: "Maciej W. Rozycki" Cc: Jiri Slaby , Thomas Bogendoerfer , linux-mips@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/5] serial: core, 8250: Add a hook for extra port property reporting Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 10, 2021 at 08:38:44PM +0200, Maciej W. Rozycki wrote: > Add a hook for `uart_report_port' to let serial ports report extra > properties beyond `irq' and `base_baud'. Use it with the 8250 backend > to report extra baud rates supported above the base rate for ports with > the UPF_MAGIC_MULTIPLIER property, so that people have a way to find out > that they are supported with their system, e.g.: > > Serial: 8250/16550 driver, 5 ports, IRQ sharing enabled > printk: console [ttyS0] disabled > serial8250.0: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200 [+230400, 460800]) is a 16550A > printk: console [ttyS0] enabled > printk: console [ttyS0] enabled > printk: bootconsole [uart8250] disabled > printk: bootconsole [uart8250] disabled > serial8250.0: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200 [+230400, 460800]) is a 16550A > serial8250.0: ttyS2 at MMIO 0x1f000900 (irq = 20, base_baud = 230400) is a 16550A > > Otherwise there is no clear way to figure this out. > > Signed-off-by: Maciej W. Rozycki > --- > drivers/tty/serial/8250/8250_core.c | 10 ++++++++++ > drivers/tty/serial/serial_core.c | 11 +++++++++-- > include/linux/serial_core.h | 3 +++ > 3 files changed, 22 insertions(+), 2 deletions(-) > > linux-serial-core-baud-extra.diff > Index: linux-malta-cbus-uart/drivers/tty/serial/8250/8250_core.c > =================================================================== > --- linux-malta-cbus-uart.orig/drivers/tty/serial/8250/8250_core.c > +++ linux-malta-cbus-uart/drivers/tty/serial/8250/8250_core.c > @@ -952,6 +952,13 @@ static struct uart_8250_port *serial8250 > return NULL; > } > > +static void serial8250_report_magic(struct uart_port *port, > + char *report_buf, size_t report_size) > +{ > + snprintf(report_buf, report_size, > + " [+%d, %d]", port->uartclk / 8, port->uartclk / 4); > +} > + > static void serial_8250_overrun_backoff_work(struct work_struct *work) > { > struct uart_8250_port *up = > @@ -1048,6 +1055,9 @@ int serial8250_register_8250_port(struct > } > } > > + if (up->port.flags & UPF_MAGIC_MULTIPLIER) > + uart->port.report_extra = serial8250_report_magic; > + > serial8250_set_defaults(uart); > > /* Possibly override default I/O functions. */ > Index: linux-malta-cbus-uart/drivers/tty/serial/serial_core.c > =================================================================== > --- linux-malta-cbus-uart.orig/drivers/tty/serial/serial_core.c > +++ linux-malta-cbus-uart/drivers/tty/serial/serial_core.c > @@ -2309,6 +2309,7 @@ int uart_resume_port(struct uart_driver > static inline void > uart_report_port(struct uart_driver *drv, struct uart_port *port) > { > + char report_extra[64]; > char address[64]; > > switch (port->iotype) { > @@ -2333,11 +2334,17 @@ uart_report_port(struct uart_driver *drv > break; > } > > - pr_info("%s%s%s at %s (irq = %d, base_baud = %d) is a %s\n", > + if (port->report_extra) > + port->report_extra(port, report_extra, sizeof(report_extra)); > + else > + report_extra[0] = '\0'; > + > + pr_info("%s%s%s at %s (irq = %d, base_baud = %d%s) is a %s\n", > port->dev ? dev_name(port->dev) : "", > port->dev ? ": " : "", > port->name, > - address, port->irq, port->uartclk / 16, uart_type(port)); > + address, port->irq, port->uartclk / 16, report_extra, > + uart_type(port)); Ick, really? What relies on this print message? Why do we need a whole new uart port hook for this? Isn't there some other way for your specific variant to print out another message if you really want to do something "odd" like this? And you did not document what your new change did anywhere in the tree, so people are going to be confused. I've taken the other patches here, but not this one. thanks, greg k-h