lkml.org 
[lkml]   [2014]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] tty/n_gsm.c: do not clear gsm_mux entry when the gsm is not closed
On Mon, Jul 28, 2014 at 03:16:25PM +0800, xinhui.pan wrote:
> > Why can't you do dynamic reference counting of your structure, that
> > would allow you to get rid of your global array, right?
> >
>
> Thanks for your nice comments.
> Struct gsm has a ref-count already. :)

Then you should be fine, no need to keep it in an array.

> And also adding a ref-count is a little hard to me. :(
> This global array is used to keep tracking the gsms that stands for the gsmttyXX.

You shouldn't need that at all, just use a list, you don't care what the
XX number is within the driver, just allocate a new one with the next
available number and you should be fine.

> and it can tell us if we can create a new gsm. :)

You should always be able to create a new gsm if you need to :)

> In gsm_init we set *gsm_tty_driver = alloc_tty_driver(256);*

Why limit to 256? Just use a list, and a idr structure to allocate the
minor number, and all should be good.

thanks,

greg k-h


\
 
 \ /
  Last update: 2014-07-28 20:01    [W:0.068 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site