Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp718724yba; Fri, 26 Apr 2019 07:41:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8wjG5eW+/kgKJblHQbGGF8d/hdwhyj4flr8Peo87ZU9/eehfBvVGAH4X9Ztbg6naW+Lot X-Received: by 2002:a17:902:b095:: with SMTP id p21mr14449564plr.40.1556289676094; Fri, 26 Apr 2019 07:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556289676; cv=none; d=google.com; s=arc-20160816; b=zkaScCdB/LNsqWCUA2qKTlFdis5FXyTlT2CbV4P82zadl06UhLviMYRCqmJ02au3iP oLDCuLp53H72Xg8EQNT0FKDSBWCyEl1xXvzH87Jz5E1uTJa4DqSsauVxojwY3bP4KbHU ZMyIDm4rdEEa7sUzcNCj+0YlM9JqT+wYJrdOzl1JgZSBzgxKB9PVQG8gUWFwv9uZKuOH rR4IFkOKJ5aaBD/t39hVZ29R1cT6ItHypg9XG5OsP3BtFFMZpYXUCnvFU4tgiW0ot4VS LMf9868ouODfpw5Ctx70CIWNl8XGlfb0BaIulHnuquXHUCM1zBL3VC+KjbCKj+56eDwM qBvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=kHpvsK1aOP+V5mse0v/2GjQWJnnnmo9zN2img2BKzBo=; b=uKIYHP5+QQntOPFbLp8LoENbgmXObG0OWSjVX1fev53mm4eOgvKgufJNB/bBnR/4W6 iY5FylnbT00ndoGQ7hWoJ3Ls9LQay21Zbk2eA685KbjA1+ZWyUNZbIwUfXWEJqFJwx6o 4o4Ejq2phuSQe/bB7ZpbHdg54FhOT6+AL4gVLgi6ROkQWXqLqRx1ESYy7PR+hOTiJbew YlCvqKWxcXI4PEJfZxOj+sAUHBHKAV34m01OIaENMs/HQX5r667JPPMCqhdaT6xivjA1 54db//O7RB6uM8fX0ZQD+OLwuwdur8XEDQ0OhRcisaW9WBu0f/OcyNqYiyG8G3UpdLgX QSzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si25978378pfi.193.2019.04.26.07.41.00; Fri, 26 Apr 2019 07:41:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726310AbfDZOjw (ORCPT + 99 others); Fri, 26 Apr 2019 10:39:52 -0400 Received: from mga14.intel.com ([192.55.52.115]:36425 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726120AbfDZOjw (ORCPT ); Fri, 26 Apr 2019 10:39:52 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 26 Apr 2019 07:39:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,397,1549958400"; d="scan'208";a="165158929" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga002.fm.intel.com with ESMTP; 26 Apr 2019 07:39:47 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hK20w-0005Qc-3i; Fri, 26 Apr 2019 17:39:46 +0300 Date: Fri, 26 Apr 2019 17:39:46 +0300 From: Andy Shevchenko To: Esben Haabendal Cc: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Darwin Dingel , He Zhe , Jisheng Zhang , Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] serial: 8250: Allow port registration without UPF_BOOT_AUTOCONF Message-ID: <20190426143946.GX9224@smile.fi.intel.com> References: <20190426084038.6377-1-esben@geanix.com> <20190426084038.6377-2-esben@geanix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190426084038.6377-2-esben@geanix.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2019 at 10:40:37AM +0200, Esben Haabendal wrote: > With serial8250_register_8250_port() forcing UPF_BOOT_AUTOCONF bit on, it > is not possible to register a port without having > serial8250_request_std_resource() called. > > For adding a 8250 port to an MFD device, this is problematic, as the > request_mem_region() call will fail, as the MFD device (and rightly so) > has requested the region. For this case, the 8250 port should accept > having passed mapbase and membase, and just use that. You need to simple set port type and use UPF_FIXED_TYPE. No need for this patch. > > Signed-off-by: Esben Haabendal > --- > drivers/tty/serial/8250/8250_core.c | 36 +++++++++++++++++++++--------------- > include/linux/serial_8250.h | 2 ++ > 2 files changed, 23 insertions(+), 15 deletions(-) > > diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c > index e441221..ddbb0a0 100644 > --- a/drivers/tty/serial/8250/8250_core.c > +++ b/drivers/tty/serial/8250/8250_core.c > @@ -957,20 +957,8 @@ static void serial_8250_overrun_backoff_work(struct work_struct *work) > spin_unlock_irqrestore(&port->lock, flags); > } > > -/** > - * serial8250_register_8250_port - register a serial port > - * @up: serial port template > - * > - * Configure the serial port specified by the request. If the > - * port exists and is in use, it is hung up and unregistered > - * first. > - * > - * The port is then probed and if necessary the IRQ is autodetected > - * If this fails an error is returned. > - * > - * On success the port is ready to use and the line number is returned. > - */ > -int serial8250_register_8250_port(struct uart_8250_port *up) > +int __serial8250_register_8250_port(struct uart_8250_port *up, > + unsigned int extra_flags) > { > struct uart_8250_port *uart; > int ret = -ENOSPC; > @@ -993,7 +981,7 @@ int serial8250_register_8250_port(struct uart_8250_port *up) > uart->port.fifosize = up->port.fifosize; > uart->port.regshift = up->port.regshift; > uart->port.iotype = up->port.iotype; > - uart->port.flags = up->port.flags | UPF_BOOT_AUTOCONF; > + uart->port.flags = up->port.flags | extra_flags; > uart->bugs = up->bugs; > uart->port.mapbase = up->port.mapbase; > uart->port.mapsize = up->port.mapsize; > @@ -1086,6 +1074,24 @@ int serial8250_register_8250_port(struct uart_8250_port *up) > > return ret; > } > + > +/** > + * serial8250_register_8250_port - register a serial port > + * @up: serial port template > + * > + * Configure the serial port specified by the request. If the > + * port exists and is in use, it is hung up and unregistered > + * first. > + * > + * The port is then probed and if necessary the IRQ is autodetected > + * If this fails an error is returned. > + * > + * On success the port is ready to use and the line number is returned. > + */ > +int serial8250_register_8250_port(struct uart_8250_port *up) > +{ > + return __serial8250_register_8250_port(up, UPF_BOOT_AUTOCONF); > +} > EXPORT_SYMBOL(serial8250_register_8250_port); > > /** > diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h > index 5a655ba..9d1fe2e 100644 > --- a/include/linux/serial_8250.h > +++ b/include/linux/serial_8250.h > @@ -145,6 +145,8 @@ static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up) > return container_of(up, struct uart_8250_port, port); > } > > +extern int __serial8250_register_8250_port(struct uart_8250_port *, > + unsigned int); > int serial8250_register_8250_port(struct uart_8250_port *); > void serial8250_unregister_port(int line); > void serial8250_suspend_port(int line); > -- > 2.4.11 > -- With Best Regards, Andy Shevchenko