Re: [PATCH v2 26/40] arch/sparc: uaccess_64 macro whitespace fixes

From: Michael S. Tsirkin
Date: Tue Jan 06 2015 - 15:24:01 EST


On Tue, Jan 06, 2015 at 07:27:49PM +0100, Sam Ravnborg wrote:
> On Tue, Jan 06, 2015 at 07:19:02PM +0200, Michael S. Tsirkin wrote:
> > On Tue, Jan 06, 2015 at 05:53:39PM +0100, Sam Ravnborg wrote:
> > > On Tue, Jan 06, 2015 at 05:44:56PM +0200, Michael S. Tsirkin wrote:
> > > > Macros within arch/sparc/include/asm/uaccess_64.h are made harder to
> > > > read because they violate a bunch of coding style rules.
> > > >
> > > > Fix it up.
> > > As per Davem's earlier mail please prefix using sparc32/sparc64.
> >
> > I did put in uaccess_64 - insufficient?
> sparc32: bla bla
> For sparc32 specific changes.
>
> sparc64: bla bla
> For sparc64 specific changes
>
> sparc: bla bla
> For general sparce changes
>
>
> In this case you could have used:
> sparc64: fix coding style in uaccess_64.h

OK.
I see David reviewed and sent acks, so I won't bother
reposting, but I'll tweak this in my tree.

> >
> > > > -#define __put_user_nocheck(data,addr,size) ({ \
> > > > -register int __pu_ret; \
> > > > -switch (size) { \
> > > > -case 1: __put_user_asm(data,b,addr,__pu_ret); break; \
> > > > -case 2: __put_user_asm(data,h,addr,__pu_ret); break; \
> > > > -case 4: __put_user_asm(data,w,addr,__pu_ret); break; \
> > > > -case 8: __put_user_asm(data,x,addr,__pu_ret); break; \
> > > > -default: __pu_ret = __put_user_bad(); break; \
> > > > -} __pu_ret; })
> > > > -
> > > > -#define __put_user_asm(x,size,addr,ret) \
> > > > +#define __put_user_nocheck(data, addr, size) ({ \
> > > > + register int __pu_ret; \
> > > > + switch (size) { \
> > > > + case 1: \
> > > > + __put_user_asm(data, b, addr, __pu_ret); \
> > > > + break; \
> > > > + case 2: \
> > > > + __put_user_asm(data, h, addr, __pu_ret); \
> > > > + break; \
> > > > + case 4: \
> > > > + __put_user_asm(data, w, addr, __pu_ret); \
> > > > + break; \
> > > > + case 8: \
> > > > + __put_user_asm(data, x, addr, __pu_ret); \
> > > > + break; \
> > > > + default: \
> > > > + __pu_ret = __put_user_bad(); \
> > > > + break; \
> > > > + } \
> > > > + __pu_ret; \
> > > > +})
> > >
> > > No matter what coding style says - the above is much less readable than the
> > > original version.
> > >
> > >
> > I guess you approve the rest of the changes then?
> I did not look to carefully - but what I saw looked good.
>
> >
> >
> > I get it you like it that
> > case 1: __get_user_asm(__gu_val,ub,addr,__gu_ret); break;
> > has the whole case on the same line?
> > Is that the issue?
> Exactly - much easier to read this way.
> That the "\" was not aligned in these parts of the code did not help either.
>
> Sam

I see David acked this already - I'll do a patch on top to tweak just
these two places to your liking?
No sense making everyone re-read the whole pile of changes.

--
MST
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/