Re: [PATCH 3/4] zsmalloc use zs_handle instead of void *
From: Greg Kroah-Hartman
Date: Wed May 09 2012 - 16:19:21 EST
On Fri, May 04, 2012 at 11:24:54AM +0900, Minchan Kim wrote:
> On 05/04/2012 12:23 AM, Seth Jennings wrote:
> > On 05/03/2012 08:32 AM, Nitin Gupta wrote:
> >> On 5/3/12 2:40 AM, Minchan Kim wrote:
> >>> We should use zs_handle instead of void * to avoid any
> >>> confusion. Without this, users may just treat zs_malloc return value as
> >>> a pointer and try to deference it.
> >>> Cc: Dan Magenheimer<dan.magenheimer@xxxxxxxxxx>
> >>> Cc: Konrad Rzeszutek Wilk<konrad.wilk@xxxxxxxxxx>
> >>> Signed-off-by: Minchan Kim<minchan@xxxxxxxxxx>
> >>> ---
> >>> drivers/staging/zcache/zcache-main.c | 8 ++++----
> >>> drivers/staging/zram/zram_drv.c | 8 ++++----
> >>> drivers/staging/zram/zram_drv.h | 2 +-
> >>> drivers/staging/zsmalloc/zsmalloc-main.c | 28
> >>> ++++++++++++++--------------
> >>> drivers/staging/zsmalloc/zsmalloc.h | 15 +++++++++++----
> >>> 5 files changed, 34 insertions(+), 27 deletions(-)
> >> This was a long pending change. Thanks!
> > The reason I hadn't done it before is that it introduces a checkpatch
> > warning:
> > WARNING: do not add new typedefs
> > #303: FILE: drivers/staging/zsmalloc/zsmalloc.h:19:
> > +typedef void * zs_handle;
> Yes. I did it but I think we are (a) of chapter 5: Typedefs in Documentation/CodingStyle.
> (a) totally opaque objects (where the typedef is actively used to _hide_
> what the object is).
Don't add new typedefs to the kernel. Just use a structure if you need
Vague "handles" are almost never what you want to do in Linux, sorry, I
can't take this patch.
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/