public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/2] Bluetooth: Move scope of state_to_string
Date: Wed, 15 Feb 2012 14:53:15 +0200	[thread overview]
Message-ID: <20120215125313.GD920@aemeltch-MOBL1> (raw)
In-Reply-To: <1329308414.28848.80.camel@aeonflux>

Hi Marcel,

On Wed, Feb 15, 2012 at 01:20:14PM +0100, Marcel Holtmann wrote:
> Hi Andrei,
> 
> > Function state_to_string will be used in other files.
> > 
> > Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> > ---
> >  include/net/bluetooth/bluetooth.h |   27 +++++++++++++++++++++++++++
> >  net/bluetooth/l2cap_core.c        |   26 --------------------------
> >  2 files changed, 27 insertions(+), 26 deletions(-)
> > 
> > diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
> > index 4a82ca0..0a47c20 100644
> > --- a/include/net/bluetooth/bluetooth.h
> > +++ b/include/net/bluetooth/bluetooth.h
> > @@ -129,6 +129,33 @@ enum {
> >  	BT_CLOSED
> >  };
> >  
> > +/* If unused will be removed by compiler */
> > +static inline char *state_to_string(int state)
> > +{
> > +	switch (state) {
> > +	case BT_CONNECTED:
> > +		return "BT_CONNECTED";
> > +	case BT_OPEN:
> > +		return "BT_OPEN";
> > +	case BT_BOUND:
> > +		return "BT_BOUND";
> > +	case BT_LISTEN:
> > +		return "BT_LISTEN";
> > +	case BT_CONNECT:
> > +		return "BT_CONNECT";
> > +	case BT_CONNECT2:
> > +		return "BT_CONNECT2";
> > +	case BT_CONFIG:
> > +		return "BT_CONFIG";
> > +	case BT_DISCONN:
> > +		return "BT_DISCONN";
> > +	case BT_CLOSED:
> > +		return "BT_CLOSED";
> > +	}
> > +
> > +	return "invalid state";
> > +}
> > +
> 
> so long term, we need to keep socket states inside l2cap_sock.c and
> L2CAP states inside l2cap_core.c. Since L2CAP core engine should use the
> states from the specification and not try to fit into socket states.
> 
> I see a little bit of value here in having them in the debug log, but
> making them public like this seems a big overhead. Did you measure the
> size difference. And most likely some state lookup table is better.

If unused this shall be removed by compiler or what do you mean here?

Do you think l2cap.h is better place?

Best regards 
Andrei Emeltchenko 


  reply	other threads:[~2012-02-15 12:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15  9:50 [PATCH 1/2] Bluetooth: Move scope of state_to_string Emeltchenko Andrei
2012-02-15  9:50 ` [PATCH 2/2] Bluetooth: Use symbolic name for state in debug Emeltchenko Andrei
2012-02-15 12:20 ` [PATCH 1/2] Bluetooth: Move scope of state_to_string Marcel Holtmann
2012-02-15 12:53   ` Emeltchenko Andrei [this message]
2012-02-17  9:10   ` Emeltchenko Andrei
2012-02-17  9:12     ` Marcel Holtmann
2012-02-17  9:18       ` Emeltchenko Andrei
2012-02-17  9:30         ` Marcel Holtmann

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=20120215125313.GD920@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /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