public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Greg KH <gregkh@suse.de>
Cc: Joe Perches <joe@perches.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	ohering@suse.com, linux-kernel@vger.kernel.org,
	virtualization@lists.osdl.org, devel@linuxdriverproject.org
Subject: Re: [PATCH 1/6] Staging: hv: mousevsc: Make  boolean states  boolean
Date: Wed, 26 Oct 2011 17:03:43 -0700	[thread overview]
Message-ID: <20111027000342.GA6804@core.coreip.homeip.net> (raw)
In-Reply-To: <20111026235054.GA31883@suse.de>

On Thu, Oct 27, 2011 at 01:50:54AM +0200, Greg KH wrote:
> On Wed, Oct 26, 2011 at 03:46:51PM -0700, Joe Perches wrote:
> > On Wed, 2011-10-26 at 08:07 +0200, Greg KH wrote:
> > > On Tue, Oct 25, 2011 at 05:03:47PM -0700, Joe Perches wrote:
> > > > On Tue, 2011-10-25 at 17:19 -0700, K. Y. Srinivasan wrote:
> > > > > Make some state that is boolean in nature, a boolean variable.
> > > > []
> > > > > diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
> > > > []
> > > > @@ -148,7 +148,7 @@ struct  mousevsc_prt_msg {
> > > > >   */
> > > > >  struct mousevsc_dev {
> > > > >  	struct hv_device	*device;
> > > > > -	unsigned char		init_complete;
> > > > > +	bool			init_complete;
> > > > >  	struct mousevsc_prt_msg	protocol_req;
> > > > >  	struct mousevsc_prt_msg	protocol_resp;
> > > > >  	/* Synchronize the request/response if needed */
> > > > > @@ -159,7 +159,7 @@ struct mousevsc_dev {
> > > > >  	unsigned char		*report_desc;
> > > > >  	u32			report_desc_size;
> > > > >  	struct hv_input_dev_info hid_dev_info;
> > > > > -	int			connected;
> > > > > +	bool			connected;
> > > > >  	struct hid_device       *hid_device;
> > > > >  };
> > > > 
> > > > One of the bools should be moved to be adjacent to the other.
> > > For a mouse driver, it really doesn't matter.
> > 
> > 'course it doesn't matter, just like whitespace
> > doesn't matter.  It's just done for form's sake.
> 
> Not at all.
> 
> Whitespace does matter, there is documented proof of that.
> 
> The fact that you want to move a bool to a different part of a structure
> really is only your personal choice.  It doesn't matter for size or
> layout to make this code work better at all to do this.

It is a good practice to try minimizing footprint though. While it might
not matter much in this particular driver we should still try to produce
best code we can as it is often taken as source for new drivers.

> 
> This is your personal opinion only, please don't construe it as anything
> else.

Same could be said about the email I am replying to.

-- 
Dmitry

  parent reply	other threads:[~2011-10-27  0:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26  0:18 [PATCH 0/6] Staging: hv: mousevsc: cleanup the mouse driver K. Y. Srinivasan
2011-10-26  0:19 ` [PATCH 1/6] Staging: hv: mousevsc: Make boolean states boolean K. Y. Srinivasan
2011-10-26  0:03   ` Joe Perches
2011-10-26  6:07     ` Greg KH
2011-10-26 22:46       ` Joe Perches
2011-10-26 23:50         ` Greg KH
2011-10-26 23:59           ` Joe Perches
2011-10-27  0:03           ` Dmitry Torokhov [this message]
2011-10-26  0:19   ` [PATCH 2/6] Staging: hv: mousevsc: Inline the code for mousevsc_on_device_add() K. Y. Srinivasan
2011-10-26  0:19   ` [PATCH 3/6] Staging: hv: mousevsc: Inline the code for reportdesc_callback() K. Y. Srinivasan
2011-10-26  0:19   ` [PATCH 4/6] Staging: hv: mousevsc: Cleanup mousevsc_on_channel_callback() K. Y. Srinivasan
2011-10-26  0:19   ` [PATCH 5/6] Staging: hv: mousevsc: Add a new line to a debug string K. Y. Srinivasan
2011-10-26  0:19   ` [PATCH 6/6] Staging: hv: mousevsc: Get rid of unnecessary include files K. Y. Srinivasan

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=20111027000342.GA6804@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@suse.de \
    --cc=haiyangz@microsoft.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ohering@suse.com \
    --cc=virtualization@lists.osdl.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