public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zram: include linux/err.h
@ 2014-03-15  9:40 Arnd Bergmann
  2014-03-15 14:18 ` Sergey Senozhatsky
       [not found] ` <20140319013946.GF13475@bbox>
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2014-03-15  9:40 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Nitin Gupta, linux-kernel, Andrew Morton, Sergey Senozhatsky

The zram driver uses the ERR_PTR macro defined in <linux/err.h>
and relies on this header to be included implicitly through
other headers, which is not (always) the case on the ARM architecture.

Adding an explicit #include allows us to build the driver in
all configurations.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index 92a83df..3507bef 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -7,6 +7,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/slab.h>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] zram: include linux/err.h
  2014-03-15  9:40 [PATCH] zram: include linux/err.h Arnd Bergmann
@ 2014-03-15 14:18 ` Sergey Senozhatsky
  2014-03-15 20:26   ` Arnd Bergmann
       [not found] ` <20140319013946.GF13475@bbox>
  1 sibling, 1 reply; 5+ messages in thread
From: Sergey Senozhatsky @ 2014-03-15 14:18 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Minchan Kim, Nitin Gupta, linux-kernel, Andrew Morton,
	Sergey Senozhatsky

Hello Arnd,

On (03/15/14 10:40), Arnd Bergmann wrote:
> The zram driver uses the ERR_PTR macro defined in <linux/err.h>
> and relies on this header to be included implicitly through
> other headers, which is not (always) the case on the ARM architecture.
> 

returned from zcomp ERR_PTR is checked and used in zram_drv.c, should
in this case there also be inclusion of err.h in zram_drv.h? if so, it
probably makes sense to move inclusion of err.h to zcomp.h, which is
included both in zcomp.c and zram_drv.c

> Adding an explicit #include allows us to build the driver in
> all configurations.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
> index 92a83df..3507bef 100644
> --- a/drivers/block/zram/zcomp.c
> +++ b/drivers/block/zram/zcomp.c
> @@ -7,6 +7,7 @@
>   * 2 of the License, or (at your option) any later version.
>   */
>  
> +#include <linux/err.h>
>  #include <linux/kernel.h>
>  #include <linux/string.h>
>  #include <linux/slab.h>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] zram: include linux/err.h
  2014-03-15 14:18 ` Sergey Senozhatsky
@ 2014-03-15 20:26   ` Arnd Bergmann
  2014-03-18 18:35     ` Sergey Senozhatsky
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2014-03-15 20:26 UTC (permalink / raw)
  To: Sergey Senozhatsky; +Cc: Minchan Kim, Nitin Gupta, linux-kernel, Andrew Morton

On Saturday 15 March 2014, Sergey Senozhatsky wrote:
> On (03/15/14 10:40), Arnd Bergmann wrote:
> > The zram driver uses the ERR_PTR macro defined in <linux/err.h>
> > and relies on this header to be included implicitly through
> > other headers, which is not (always) the case on the ARM architecture.
> > 
> 
> returned from zcomp ERR_PTR is checked and used in zram_drv.c, should
> in this case there also be inclusion of err.h in zram_drv.h? if so, it
> probably makes sense to move inclusion of err.h to zcomp.h, which is
> included both in zcomp.c and zram_drv.c
> 

The normal convention is to only include headers from other headers if
that is required by the contents of the header itself.

Following the common conventions, it's better to include linux/err.h
in both zram_drv.c and zcomp.c, but not in zram_drv.h.
I didn't do that in my patch, because I only got a build error in
one of the two files.

	Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] zram: include linux/err.h
  2014-03-15 20:26   ` Arnd Bergmann
@ 2014-03-18 18:35     ` Sergey Senozhatsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sergey Senozhatsky @ 2014-03-18 18:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Sergey Senozhatsky, Minchan Kim, Nitin Gupta, linux-kernel,
	Andrew Morton

Hello Arnd,

On (03/15/14 21:26), Arnd Bergmann wrote:
> On Saturday 15 March 2014, Sergey Senozhatsky wrote:
> > On (03/15/14 10:40), Arnd Bergmann wrote:
> > > The zram driver uses the ERR_PTR macro defined in <linux/err.h>
> > > and relies on this header to be included implicitly through
> > > other headers, which is not (always) the case on the ARM architecture.
> > > 
> > 
> > returned from zcomp ERR_PTR is checked and used in zram_drv.c, should
> > in this case there also be inclusion of err.h in zram_drv.h? if so, it
> > probably makes sense to move inclusion of err.h to zcomp.h, which is
> > included both in zcomp.c and zram_drv.c
> > 
> 
> The normal convention is to only include headers from other headers if
> that is required by the contents of the header itself.
> 
> Following the common conventions, it's better to include linux/err.h
> in both zram_drv.c and zcomp.c, but not in zram_drv.h.

thanks.

may I ask you to resend the patch with linux/err.h included
in both zram_drv.c and zcomp.c?

	-ss

> I didn't do that in my patch, because I only got a build error in
> one of the two files.
> 
> 	Arnd
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] zram: include linux/err.h
       [not found] ` <20140319013946.GF13475@bbox>
@ 2014-03-20 20:58   ` Sergey Senozhatsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sergey Senozhatsky @ 2014-03-20 20:58 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Arnd Bergmann, Minchan Kim, Nitin Gupta, linux-kernel,
	Andrew Morton, Sergey Senozhatsky

On (03/19/14 10:39), Minchan Kim wrote:
> On Sat, Mar 15, 2014 at 10:40:08AM +0100, Arnd Bergmann wrote:
> > The zram driver uses the ERR_PTR macro defined in <linux/err.h>
> > and relies on this header to be included implicitly through
> > other headers, which is not (always) the case on the ARM architecture.
> > 
> > Adding an explicit #include allows us to build the driver in
> > all configurations.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Regardless of resend fixing another part Sergey asked,
> 
> Acked-by: Minchan Kim <minchan@kernel.org>
> 

Andrew, could you please apply this one? I'll send a patch
to also include err.h in zram_drv shortly.

	-ss

> Thanks!
> 
> 
> -- 
> Kind regards,
> Minchan Kim
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-03-20 21:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-15  9:40 [PATCH] zram: include linux/err.h Arnd Bergmann
2014-03-15 14:18 ` Sergey Senozhatsky
2014-03-15 20:26   ` Arnd Bergmann
2014-03-18 18:35     ` Sergey Senozhatsky
     [not found] ` <20140319013946.GF13475@bbox>
2014-03-20 20:58   ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox