Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-28 Thread Pavel Machek
On Thu 2017-05-25 12:46:04, Bernd Petrovitsch wrote: > On Thu, 2017-05-25 at 03:35 -0700, Joe Perches wrote: > > On Wed, 2017-05-24 at 13:18 +0300, Alexey Dobriyan wrote: > > > Proper fix is to introduce typed allocation macros with the following > > > signatures: > > > > > > T* lmalloc(T, gfp);

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-28 Thread Pavel Machek
On Thu 2017-05-25 12:46:04, Bernd Petrovitsch wrote: > On Thu, 2017-05-25 at 03:35 -0700, Joe Perches wrote: > > On Wed, 2017-05-24 at 13:18 +0300, Alexey Dobriyan wrote: > > > Proper fix is to introduce typed allocation macros with the following > > > signatures: > > > > > > T* lmalloc(T, gfp);

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-25 Thread Bernd Petrovitsch
On Thu, 2017-05-25 at 03:35 -0700, Joe Perches wrote: > On Wed, 2017-05-24 at 13:18 +0300, Alexey Dobriyan wrote: > > Proper fix is to introduce typed allocation macros with the following > > signatures: > > > > T* lmalloc(T, gfp); Ack (FWIW). [...] > > struct foo *x; > > x =

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-25 Thread Bernd Petrovitsch
On Thu, 2017-05-25 at 03:35 -0700, Joe Perches wrote: > On Wed, 2017-05-24 at 13:18 +0300, Alexey Dobriyan wrote: > > Proper fix is to introduce typed allocation macros with the following > > signatures: > > > > T* lmalloc(T, gfp); Ack (FWIW). [...] > > struct foo *x; > > x =

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-25 Thread Joe Perches
On Wed, 2017-05-24 at 13:18 +0300, Alexey Dobriyan wrote: > Proper fix is to introduce typed allocation macros with the following > signatures: > > T* lmalloc(T, gfp); [] > struct foo *x; > x = lmalloc(struct foo, GFP_KERNEL); Then code would be written x = lmalloc(typeof(*x),

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-25 Thread Joe Perches
On Wed, 2017-05-24 at 13:18 +0300, Alexey Dobriyan wrote: > Proper fix is to introduce typed allocation macros with the following > signatures: > > T* lmalloc(T, gfp); [] > struct foo *x; > x = lmalloc(struct foo, GFP_KERNEL); Then code would be written x = lmalloc(typeof(*x),

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-24 Thread Alexey Dobriyan
On Tue, May 23, 2017 at 1:22 AM, Andrew Morton wrote: > On Mon, 22 May 2017 14:43:18 -0700 Joe Perches wrote: > >> On Tue, 2017-05-23 at 00:38 +0300, Alexey Dobriyan wrote: >> > -The preferred form for passing a size of a struct is the following: >>

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-24 Thread Alexey Dobriyan
On Tue, May 23, 2017 at 1:22 AM, Andrew Morton wrote: > On Mon, 22 May 2017 14:43:18 -0700 Joe Perches wrote: > >> On Tue, 2017-05-23 at 00:38 +0300, Alexey Dobriyan wrote: >> > -The preferred form for passing a size of a struct is the following: >> > - >> > -.. code-block:: c >> > - >> > - p

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-22 Thread Joe Perches
On Mon, 2017-05-22 at 15:22 -0700, Andrew Morton wrote: > On Mon, 22 May 2017 14:43:18 -0700 Joe Perches wrote: > > On Tue, 2017-05-23 at 00:38 +0300, Alexey Dobriyan wrote: > > > * ratio of allocation styles is ~6400:12000 which is about 1:2 > > > so the amount of churn to

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-22 Thread Joe Perches
On Mon, 2017-05-22 at 15:22 -0700, Andrew Morton wrote: > On Mon, 22 May 2017 14:43:18 -0700 Joe Perches wrote: > > On Tue, 2017-05-23 at 00:38 +0300, Alexey Dobriyan wrote: > > > * ratio of allocation styles is ~6400:12000 which is about 1:2 > > > so the amount of churn to maintain this rule

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-22 Thread Andrew Morton
On Mon, 22 May 2017 14:43:18 -0700 Joe Perches wrote: > On Tue, 2017-05-23 at 00:38 +0300, Alexey Dobriyan wrote: > > There are valid reasons for > > > > malloc(sizeof(struct S)) > > > > form: > > > > * struct S acts as an anchor for ctags quickly reminding which type is

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-22 Thread Andrew Morton
On Mon, 22 May 2017 14:43:18 -0700 Joe Perches wrote: > On Tue, 2017-05-23 at 00:38 +0300, Alexey Dobriyan wrote: > > There are valid reasons for > > > > malloc(sizeof(struct S)) > > > > form: > > > > * struct S acts as an anchor for ctags quickly reminding which type is > > in focus >

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-22 Thread Randy Dunlap
On 05/22/17 14:43, Joe Perches wrote: > On Tue, 2017-05-23 at 00:38 +0300, Alexey Dobriyan wrote: >> There are valid reasons for >> >> malloc(sizeof(struct S)) >> >> form: >> >> * struct S acts as an anchor for ctags quickly reminding which type is >> in focus >> >> * argument re changing

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-22 Thread Randy Dunlap
On 05/22/17 14:43, Joe Perches wrote: > On Tue, 2017-05-23 at 00:38 +0300, Alexey Dobriyan wrote: >> There are valid reasons for >> >> malloc(sizeof(struct S)) >> >> form: >> >> * struct S acts as an anchor for ctags quickly reminding which type is >> in focus >> >> * argument re changing

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-22 Thread Joe Perches
On Tue, 2017-05-23 at 00:38 +0300, Alexey Dobriyan wrote: > There are valid reasons for > > malloc(sizeof(struct S)) > > form: > > * struct S acts as an anchor for ctags quickly reminding which type is > in focus > > * argument re changing name prevents bugs is semi bogus: > such

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-22 Thread Joe Perches
On Tue, 2017-05-23 at 00:38 +0300, Alexey Dobriyan wrote: > There are valid reasons for > > malloc(sizeof(struct S)) > > form: > > * struct S acts as an anchor for ctags quickly reminding which type is > in focus > > * argument re changing name prevents bugs is semi bogus: > such

[PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-22 Thread Alexey Dobriyan
There are valid reasons for malloc(sizeof(struct S)) form: * struct S acts as an anchor for ctags quickly reminding which type is in focus * argument re changing name prevents bugs is semi bogus: such changes are rare, "void *" cast gives both forms equal opportunity to be

[PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

2017-05-22 Thread Alexey Dobriyan
There are valid reasons for malloc(sizeof(struct S)) form: * struct S acts as an anchor for ctags quickly reminding which type is in focus * argument re changing name prevents bugs is semi bogus: such changes are rare, "void *" cast gives both forms equal opportunity to be