All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Vladimir Murzin <vladimir.murzin@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org, sudeep.holla@arm.com
Subject: Re: [PATCH 1/2] serial: mps2-uart: move to dynamic port allocation
Date: Wed, 30 Jan 2019 09:27:53 +0100	[thread overview]
Message-ID: <20190130082753.GA24317@kroah.com> (raw)
In-Reply-To: <1548425597-38175-2-git-send-email-vladimir.murzin@arm.com>

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 <vladimir.murzin@arm.com>
> ---
>  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 <linux/serial_core.h>
>  #include <linux/tty_flip.h>
>  #include <linux/types.h>
> +#include <linux/idr.h>
>  
>  #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

WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: Vladimir Murzin <vladimir.murzin@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org, sudeep.holla@arm.com
Subject: Re: [PATCH 1/2] serial: mps2-uart: move to dynamic port allocation
Date: Wed, 30 Jan 2019 09:27:53 +0100	[thread overview]
Message-ID: <20190130082753.GA24317@kroah.com> (raw)
In-Reply-To: <1548425597-38175-2-git-send-email-vladimir.murzin@arm.com>

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 <vladimir.murzin@arm.com>
> ---
>  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 <linux/serial_core.h>
>  #include <linux/tty_flip.h>
>  #include <linux/types.h>
> +#include <linux/idr.h>
>  
>  #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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-01-30  8:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 14:13 [PATCH 0/2] serial: mps2-uart: minor improvements Vladimir Murzin
2019-01-25 14:13 ` Vladimir Murzin
2019-01-25 14:13 ` [PATCH 1/2] serial: mps2-uart: move to dynamic port allocation Vladimir Murzin
2019-01-25 14:13   ` Vladimir Murzin
2019-01-30  8:27   ` Greg KH [this message]
2019-01-30  8:27     ` Greg KH
2019-01-30  8:58     ` Vladimir Murzin
2019-01-30  8:58       ` Vladimir Murzin
2019-01-30  9:24       ` Greg KH
2019-01-30  9:24         ` Greg KH
2019-01-30  9:33         ` Vladimir Murzin
2019-01-30  9:33           ` Vladimir Murzin
2019-01-25 14:13 ` [PATCH 2/2] serial: mps2-uart: support combined tx and rx irq Vladimir Murzin
2019-01-25 14:13   ` Vladimir Murzin
2019-01-30  9:00   ` Vladimir Murzin
2019-01-30  9:00     ` Vladimir Murzin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190130082753.GA24317@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=vladimir.murzin@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.