Re: [PATCH 10/12] staging: lustre: Fix misplaced opening brace warnings

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

 



On Thu, 2014-08-07 at 19:01 +0300, Dan Carpenter wrote:
> On Thu, Aug 07, 2014 at 09:01:36PM +0530, Srikrishan Malik wrote:
> > On Wed, Aug 06, 2014 at 11:18:13PM +0300, Dan Carpenter wrote:
> > > That looks silly before and after.  Everything is indented in a funny
> > > way.
> > 
> > Is this better:
> > 
> > 	static const ldlm_policy_data_t lookup_policy = {
> > 				.l_inodebits = { MDS_INODELOCK_LOOKUP }
> > 	};
> > 
> 
> That is indented too far.
> 
> Honestly, I think it looks best on one line but in terms of real life we
> can't ignore checkpatch warnings because eventually someone else will
> try to "fix" it to not be on one line.
> 
> This function has the silly thing where the types are in one column and
> the variables are in another.  But then over time inevitably we add more
> variables and nothing is lined up any more.
> 
> I think it's best to move this const variable block to the very front of
> the list.
> 
> req doesn't need to be initialized.
> 
> rc is normally the last variable declared.
> 
> lvb_type should be initialized to LVB_T_NONE instead of zero.
> 
> __u64 should be u64.
> 
> All those changes could be done as one patch titled, "cleanup variable
> declarations in mdc_enqueue()".  There may be other cleanups you could
> do as well.  Look hard.

I think it looks odd to mix named and unnamed
initializers for the typedef and its members.

ldlm_policy_data_t is a union and it could be
explicit instead of a typedef.

Perhaps:
	static const union ldlm_policy_data lookup_policy = {
		.l_inodebits = {
			.bits = MDS_INODELOCK_LOOKUP,
		},
	};

or maybe use another DECLARE_<foo> macro indirection.


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux