Linux bluetooth development
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Szymon Janc <szymon.janc@tieto.com>
Cc: Mat Martineau <mathewm@codeaurora.org>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	"padovan@profusion.mobi" <padovan@profusion.mobi>,
	"pkrystad@codeaurora.org" <pkrystad@codeaurora.org>,
	"marcel@holtmann.org" <marcel@holtmann.org>
Subject: Re: [PATCHv3 1/2] Bluetooth: Add the l2cap_seq_list structure for tracking frames
Date: Wed, 4 Apr 2012 11:56:54 +0300	[thread overview]
Message-ID: <20120404085653.GB17251@aemeltch-MOBL1> (raw)
In-Reply-To: <201204041044.19530.szymon.janc@tieto.com>

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;
}



Best regards 
Andrei Emeltchenko 

  reply	other threads:[~2012-04-04  8:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-03 22:48 [PATCHv3 0/2] ERTM state machine changes, part 1 Mat Martineau
2012-04-03 22:48 ` [PATCHv3 1/2] Bluetooth: Add the l2cap_seq_list structure for tracking frames Mat Martineau
2012-04-04  8:44   ` Szymon Janc
2012-04-04  8:56     ` Andrei Emeltchenko [this message]
2012-04-04  9:07       ` Szymon Janc
2012-04-04 16:13     ` Mat Martineau
2012-04-03 22:48 ` [PATCHv3 2/2] Bluetooth: Functions for handling ERTM control fields Mat Martineau
2012-04-04  7:12   ` Andrei Emeltchenko

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=20120404085653.GB17251@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=mathewm@codeaurora.org \
    --cc=padovan@profusion.mobi \
    --cc=pkrystad@codeaurora.org \
    --cc=szymon.janc@tieto.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox