Re: [PATCH 1/2] serial: mps2-uart: move to dynamic port allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/30/19 8:27 AM, Greg KH wrote:
> 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@xxxxxxx>
>> ---
>>  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 :(

Hmm, but code doesn't unload since ce87122911f8 ("serial: mps2-uart: make driver explicitly non-modular")
or I'm missing something?

Cheers
Vladimir

> 
> Yeah, it's not an obvious design pattern, I think someone will fix it up
> someday...
> 
> thanks,
> 
> greg k-h
> 




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux