Re: [PATCHv3 1/2] Bluetooth: Add the l2cap_seq_list structure for tracking frames

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

 



Hi,

> Hi Szymon,
> 
> On Wed, Apr 04, 2012 at 10:44:19AM +0200, Szymon Janc wrote:
> > > +	seq_list->list = kzalloc(sizeof(u16) * alloc_size, GFP_KERNEL);
> > > +	if (!seq_list->list)
> > > +		return -ENOMEM;
> > > +
> > > +	seq_list->mask = alloc_size - 1;
> > > +	seq_list->head = L2CAP_SEQ_LIST_CLEAR;
> > > +	seq_list->tail = L2CAP_SEQ_LIST_CLEAR;
> > > +	for (i = 0; i < alloc_size; i++)
> > > +		seq_list->list[i] = L2CAP_SEQ_LIST_CLEAR;
> > 
> > Could use memset for this instead of loop, and maybe use kcalloc instead of
> > kzalloc to allocate array?
> 
> memset is implemented trough the loop anyway and would take 2x more
> iterations.
> 
> void *memset(void *s, int c, size_t count)
> {
> 	char *xs = s;
> 	while (count--)
> 		*xs++ = c;
> 	return s;
> }

This is generic implementation, isn't it? There are some arch specific
implementation in arch/ as well and those should be a bit more efficient
comparing to loop...

-- 
Szymon Janc
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux