From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Subject: Re: [PATCH 1/2] serial: mps2-uart: move to dynamic port allocation Date: Wed, 30 Jan 2019 09:27:53 +0100 Message-ID: <20190130082753.GA24317@kroah.com> References: <1548425597-38175-1-git-send-email-vladimir.murzin@arm.com> <1548425597-38175-2-git-send-email-vladimir.murzin@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1548425597-38175-2-git-send-email-vladimir.murzin@arm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Vladimir Murzin Cc: linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, sudeep.holla@arm.com List-Id: linux-serial@vger.kernel.org On Fri, Jan 25, 2019 at 02:13:16PM +0000, Vladimir Murzin wrote: > Some designs, like MPS3, expose number of virtual serial ports which > already close or exceeds MPS2_MAX_PORTS. Increasing MPS2_MAX_PORTS > would have negative impact (in terms of memory consumption) on tiny > MPS2 platform which, in fact, has only one physically populated UART. > > Start with converting existent static port array to idr. As a bonus it > make driver not to fail in case when no alias was specified in device > tree. > > Signed-off-by: Vladimir Murzin > --- > drivers/tty/serial/mps2-uart.c | 47 ++++++++++++++++++++++++++++-------------- > 1 file changed, 31 insertions(+), 16 deletions(-) > > diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c > index 9f8f637..6da0633 100644 > --- a/drivers/tty/serial/mps2-uart.c > +++ b/drivers/tty/serial/mps2-uart.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > > #define SERIAL_NAME "ttyMPS" > #define DRIVER_NAME "mps2-uart" > @@ -397,7 +398,7 @@ static const struct uart_ops mps2_uart_pops = { > .verify_port = mps2_uart_verify_port, > }; > > -static struct mps2_uart_port mps2_uart_ports[MPS2_MAX_PORTS]; > +static DEFINE_IDR(ports_idr); You forgot to call idr_destroy() when your code unloads :( Yeah, it's not an obvious design pattern, I think someone will fix it up someday... thanks, greg k-h