Re: [PATCH] UBI: rename free variable

2015-10-09 Thread Heiko Schocher

Hello Al,

Am 09.10.2015 um 07:39 schrieb Al Viro:

On Fri, Oct 09, 2015 at 06:39:52AM +0200, Heiko Schocher wrote:

Hello Al,
Sorry, I should have added this info immediately into the patch ...

We have in U-Boot a compat.h file, in which we collect all things
we need to make linux code running under U-Boot, and there we map
kfree() to free(), see:

http://git.denx.de/?p=u-boot.git;a=blob;f=include/linux/compat.h;h=fbebf910addd994d265d21c4fbaa0a2f48f4ccb1;hb=996ec1dcc58a34b53891acde0ec5df9141b5fcc2#l58

So, if we use a var name "free", this will conflict ... and I get
for example when compiling the UBI code:

   CC  drivers/mtd/ubi/fastmap.o
drivers/mtd/ubi/fastmap.c: In function 'scan_pool':
drivers/mtd/ubi/fastmap.c:475:3: error: called object 'free' is not a function

So with this patch, we have less differences to kernel files ...


Umm... wouldn't it be easier to replace that mix of #define and static inline
with uniform use of static inline, rather than playing whack-a-mole like
that?


Yes, fully correct, thanks for helping.

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] UBI: rename free variable

2015-10-09 Thread Heiko Schocher

Hello Al,

Am 09.10.2015 um 07:39 schrieb Al Viro:

On Fri, Oct 09, 2015 at 06:39:52AM +0200, Heiko Schocher wrote:

Hello Al,
Sorry, I should have added this info immediately into the patch ...

We have in U-Boot a compat.h file, in which we collect all things
we need to make linux code running under U-Boot, and there we map
kfree() to free(), see:

http://git.denx.de/?p=u-boot.git;a=blob;f=include/linux/compat.h;h=fbebf910addd994d265d21c4fbaa0a2f48f4ccb1;hb=996ec1dcc58a34b53891acde0ec5df9141b5fcc2#l58

So, if we use a var name "free", this will conflict ... and I get
for example when compiling the UBI code:

   CC  drivers/mtd/ubi/fastmap.o
drivers/mtd/ubi/fastmap.c: In function 'scan_pool':
drivers/mtd/ubi/fastmap.c:475:3: error: called object 'free' is not a function

So with this patch, we have less differences to kernel files ...


Umm... wouldn't it be easier to replace that mix of #define and static inline
with uniform use of static inline, rather than playing whack-a-mole like
that?


Yes, fully correct, thanks for helping.

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] UBI: rename free variable

2015-10-08 Thread Al Viro
On Fri, Oct 09, 2015 at 06:39:52AM +0200, Heiko Schocher wrote:
> Hello Al,
> Sorry, I should have added this info immediately into the patch ...
> 
> We have in U-Boot a compat.h file, in which we collect all things
> we need to make linux code running under U-Boot, and there we map
> kfree() to free(), see:
> 
> http://git.denx.de/?p=u-boot.git;a=blob;f=include/linux/compat.h;h=fbebf910addd994d265d21c4fbaa0a2f48f4ccb1;hb=996ec1dcc58a34b53891acde0ec5df9141b5fcc2#l58
> 
> So, if we use a var name "free", this will conflict ... and I get
> for example when compiling the UBI code:
> 
>   CC  drivers/mtd/ubi/fastmap.o
> drivers/mtd/ubi/fastmap.c: In function 'scan_pool':
> drivers/mtd/ubi/fastmap.c:475:3: error: called object 'free' is not a function
> 
> So with this patch, we have less differences to kernel files ...

Umm... wouldn't it be easier to replace that mix of #define and static inline
with uniform use of static inline, rather than playing whack-a-mole like
that?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] UBI: rename free variable

2015-10-08 Thread Heiko Schocher

Hello Al,

Am 09.10.2015 um 06:13 schrieb Al Viro:

On Fri, Oct 09, 2015 at 05:29:21AM +0200, Heiko Schocher wrote:

rename free variable into not "free", as "free" prevents
ubi sources compiling under U-Boot. So rename "free"
into "pfree" where it is a pointer, and into "freel",
where it is a free list.


Huh?  If U-Boot has free defined as an object-like macro, it's an outright bug
in U-Boot and it should be fixed there.  If it's something else, it looks like
a toolchain bug.   Details, please...


Sorry, I should have added this info immediately into the patch ...

We have in U-Boot a compat.h file, in which we collect all things
we need to make linux code running under U-Boot, and there we map
kfree() to free(), see:

http://git.denx.de/?p=u-boot.git;a=blob;f=include/linux/compat.h;h=fbebf910addd994d265d21c4fbaa0a2f48f4ccb1;hb=996ec1dcc58a34b53891acde0ec5df9141b5fcc2#l58

So, if we use a var name "free", this will conflict ... and I get
for example when compiling the UBI code:

  CC  drivers/mtd/ubi/fastmap.o
drivers/mtd/ubi/fastmap.c: In function 'scan_pool':
drivers/mtd/ubi/fastmap.c:475:3: error: called object 'free' is not a function

So with this patch, we have less differences to kernel files ...

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] UBI: rename free variable

2015-10-08 Thread Al Viro
On Fri, Oct 09, 2015 at 05:29:21AM +0200, Heiko Schocher wrote:
> rename free variable into not "free", as "free" prevents
> ubi sources compiling under U-Boot. So rename "free"
> into "pfree" where it is a pointer, and into "freel",
> where it is a free list.

Huh?  If U-Boot has free defined as an object-like macro, it's an outright bug
in U-Boot and it should be fixed there.  If it's something else, it looks like
a toolchain bug.   Details, please...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] UBI: rename free variable

2015-10-08 Thread Heiko Schocher
rename free variable into not "free", as "free" prevents
ubi sources compiling under U-Boot. So rename "free"
into "pfree" where it is a pointer, and into "freel",
where it is a free list.

Signed-off-by: Heiko Schocher 
---

 drivers/mtd/ubi/fastmap.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 4aa2fd8..80ac265 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -451,7 +451,7 @@ static void unmap_peb(struct ubi_attach_info *ai, int pnum)
  */
 static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
 int *pebs, int pool_size, unsigned long long *max_sqnum,
-struct list_head *free)
+struct list_head *pfree)
 {
struct ubi_vid_hdr *vh;
struct ubi_ec_hdr *ech;
@@ -514,9 +514,9 @@ static int scan_pool(struct ubi_device *ubi, struct 
ubi_attach_info *ai,
unmap_peb(ai, pnum);
dbg_bld("Adding PEB to free: %i", pnum);
if (err == UBI_IO_FF_BITFLIPS)
-   add_aeb(ai, free, pnum, ec, 1);
+   add_aeb(ai, pfree, pnum, ec, 1);
else
-   add_aeb(ai, free, pnum, ec, 0);
+   add_aeb(ai, pfree, pnum, ec, 0);
continue;
} else if (err == 0 || err == UBI_IO_BITFLIPS) {
dbg_bld("Found non empty PEB:%i in pool", pnum);
@@ -598,7 +598,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
  struct ubi_attach_info *ai,
  struct ubi_fastmap_layout *fm)
 {
-   struct list_head used, free;
+   struct list_head used, freel;
struct ubi_ainf_volume *av;
struct ubi_ainf_peb *aeb, *tmp_aeb, *_tmp_aeb;
struct ubi_fm_sb *fmsb;
@@ -613,7 +613,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
void *fm_raw = ubi->fm_buf;
 
INIT_LIST_HEAD();
-   INIT_LIST_HEAD();
+   INIT_LIST_HEAD();
ai->min_ec = UBI_MAX_ERASECOUNTER;
 
fmsb = (struct ubi_fm_sb *)(fm_raw);
@@ -803,24 +803,25 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
}
}
 
-   ret = scan_pool(ubi, ai, fmpl->pebs, pool_size, _sqnum, );
+   ret = scan_pool(ubi, ai, fmpl->pebs, pool_size, _sqnum, );
if (ret)
goto fail;
 
-   ret = scan_pool(ubi, ai, fmpl_wl->pebs, wl_pool_size, _sqnum, 
);
+   ret = scan_pool(ubi, ai, fmpl_wl->pebs, wl_pool_size, _sqnum,
+   );
if (ret)
goto fail;
 
if (max_sqnum > ai->max_sqnum)
ai->max_sqnum = max_sqnum;
 
-   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list)
+   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list)
list_move_tail(_aeb->u.list, >free);
 
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list)
list_move_tail(_aeb->u.list, >erase);
 
-   ubi_assert(list_empty());
+   ubi_assert(list_empty());
 
/*
 * If fastmap is leaking PEBs (must not happen), raise a
@@ -841,7 +842,7 @@ fail:
list_del(_aeb->u.list);
kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
}
-   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list) {
+   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list) {
list_del(_aeb->u.list);
kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
}
-- 
2.1.0

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


[PATCH] UBI: rename free variable

2015-10-08 Thread Heiko Schocher
rename free variable into not "free", as "free" prevents
ubi sources compiling under U-Boot. So rename "free"
into "pfree" where it is a pointer, and into "freel",
where it is a free list.

Signed-off-by: Heiko Schocher 
---

 drivers/mtd/ubi/fastmap.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 4aa2fd8..80ac265 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -451,7 +451,7 @@ static void unmap_peb(struct ubi_attach_info *ai, int pnum)
  */
 static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
 int *pebs, int pool_size, unsigned long long *max_sqnum,
-struct list_head *free)
+struct list_head *pfree)
 {
struct ubi_vid_hdr *vh;
struct ubi_ec_hdr *ech;
@@ -514,9 +514,9 @@ static int scan_pool(struct ubi_device *ubi, struct 
ubi_attach_info *ai,
unmap_peb(ai, pnum);
dbg_bld("Adding PEB to free: %i", pnum);
if (err == UBI_IO_FF_BITFLIPS)
-   add_aeb(ai, free, pnum, ec, 1);
+   add_aeb(ai, pfree, pnum, ec, 1);
else
-   add_aeb(ai, free, pnum, ec, 0);
+   add_aeb(ai, pfree, pnum, ec, 0);
continue;
} else if (err == 0 || err == UBI_IO_BITFLIPS) {
dbg_bld("Found non empty PEB:%i in pool", pnum);
@@ -598,7 +598,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
  struct ubi_attach_info *ai,
  struct ubi_fastmap_layout *fm)
 {
-   struct list_head used, free;
+   struct list_head used, freel;
struct ubi_ainf_volume *av;
struct ubi_ainf_peb *aeb, *tmp_aeb, *_tmp_aeb;
struct ubi_fm_sb *fmsb;
@@ -613,7 +613,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
void *fm_raw = ubi->fm_buf;
 
INIT_LIST_HEAD();
-   INIT_LIST_HEAD();
+   INIT_LIST_HEAD();
ai->min_ec = UBI_MAX_ERASECOUNTER;
 
fmsb = (struct ubi_fm_sb *)(fm_raw);
@@ -803,24 +803,25 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
}
}
 
-   ret = scan_pool(ubi, ai, fmpl->pebs, pool_size, _sqnum, );
+   ret = scan_pool(ubi, ai, fmpl->pebs, pool_size, _sqnum, );
if (ret)
goto fail;
 
-   ret = scan_pool(ubi, ai, fmpl_wl->pebs, wl_pool_size, _sqnum, 
);
+   ret = scan_pool(ubi, ai, fmpl_wl->pebs, wl_pool_size, _sqnum,
+   );
if (ret)
goto fail;
 
if (max_sqnum > ai->max_sqnum)
ai->max_sqnum = max_sqnum;
 
-   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list)
+   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list)
list_move_tail(_aeb->u.list, >free);
 
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list)
list_move_tail(_aeb->u.list, >erase);
 
-   ubi_assert(list_empty());
+   ubi_assert(list_empty());
 
/*
 * If fastmap is leaking PEBs (must not happen), raise a
@@ -841,7 +842,7 @@ fail:
list_del(_aeb->u.list);
kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
}
-   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list) {
+   list_for_each_entry_safe(tmp_aeb, _tmp_aeb, , u.list) {
list_del(_aeb->u.list);
kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
}
-- 
2.1.0

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


Re: [PATCH] UBI: rename free variable

2015-10-08 Thread Al Viro
On Fri, Oct 09, 2015 at 05:29:21AM +0200, Heiko Schocher wrote:
> rename free variable into not "free", as "free" prevents
> ubi sources compiling under U-Boot. So rename "free"
> into "pfree" where it is a pointer, and into "freel",
> where it is a free list.

Huh?  If U-Boot has free defined as an object-like macro, it's an outright bug
in U-Boot and it should be fixed there.  If it's something else, it looks like
a toolchain bug.   Details, please...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] UBI: rename free variable

2015-10-08 Thread Heiko Schocher

Hello Al,

Am 09.10.2015 um 06:13 schrieb Al Viro:

On Fri, Oct 09, 2015 at 05:29:21AM +0200, Heiko Schocher wrote:

rename free variable into not "free", as "free" prevents
ubi sources compiling under U-Boot. So rename "free"
into "pfree" where it is a pointer, and into "freel",
where it is a free list.


Huh?  If U-Boot has free defined as an object-like macro, it's an outright bug
in U-Boot and it should be fixed there.  If it's something else, it looks like
a toolchain bug.   Details, please...


Sorry, I should have added this info immediately into the patch ...

We have in U-Boot a compat.h file, in which we collect all things
we need to make linux code running under U-Boot, and there we map
kfree() to free(), see:

http://git.denx.de/?p=u-boot.git;a=blob;f=include/linux/compat.h;h=fbebf910addd994d265d21c4fbaa0a2f48f4ccb1;hb=996ec1dcc58a34b53891acde0ec5df9141b5fcc2#l58

So, if we use a var name "free", this will conflict ... and I get
for example when compiling the UBI code:

  CC  drivers/mtd/ubi/fastmap.o
drivers/mtd/ubi/fastmap.c: In function 'scan_pool':
drivers/mtd/ubi/fastmap.c:475:3: error: called object 'free' is not a function

So with this patch, we have less differences to kernel files ...

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] UBI: rename free variable

2015-10-08 Thread Al Viro
On Fri, Oct 09, 2015 at 06:39:52AM +0200, Heiko Schocher wrote:
> Hello Al,
> Sorry, I should have added this info immediately into the patch ...
> 
> We have in U-Boot a compat.h file, in which we collect all things
> we need to make linux code running under U-Boot, and there we map
> kfree() to free(), see:
> 
> http://git.denx.de/?p=u-boot.git;a=blob;f=include/linux/compat.h;h=fbebf910addd994d265d21c4fbaa0a2f48f4ccb1;hb=996ec1dcc58a34b53891acde0ec5df9141b5fcc2#l58
> 
> So, if we use a var name "free", this will conflict ... and I get
> for example when compiling the UBI code:
> 
>   CC  drivers/mtd/ubi/fastmap.o
> drivers/mtd/ubi/fastmap.c: In function 'scan_pool':
> drivers/mtd/ubi/fastmap.c:475:3: error: called object 'free' is not a function
> 
> So with this patch, we have less differences to kernel files ...

Umm... wouldn't it be easier to replace that mix of #define and static inline
with uniform use of static inline, rather than playing whack-a-mole like
that?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/