[1/2] locking/atomics: Change 'fold' to 'grep'

Message ID 20181210175035.45096-2-mark.rutland@arm.com
State Superseded
Headers show
Series
  • locking/atomics: fix and improvement
Related show

Commit Message

Mark Rutland Dec. 10, 2018, 5:50 p.m.
From: Anders Roxell <anders.roxell@linaro.org>


Some distibutions and build systems doesn't include 'fold' from
coreutils default.

.../scripts/atomic/atomic-tbl.sh: line 183: fold: command not found

Rework to use 'grep' instead of 'fold' to use a dependency that is
already used a lot in the kernel.

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Suggested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

[Mark: rework commit message]
Signed-off-by: Mark Rutland <mark.rutland@arm.com>

---
 scripts/atomic/atomic-tbl.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.11.0

Comments

Will Deacon Dec. 10, 2018, 7:01 p.m. | #1
On Mon, Dec 10, 2018 at 05:50:34PM +0000, Mark Rutland wrote:
> From: Anders Roxell <anders.roxell@linaro.org>

> 

> Some distibutions and build systems doesn't include 'fold' from

> coreutils default.

> 

> .../scripts/atomic/atomic-tbl.sh: line 183: fold: command not found

> 

> Rework to use 'grep' instead of 'fold' to use a dependency that is

> already used a lot in the kernel.

> 

> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>

> Suggested-by: Will Deacon <will.deacon@arm.com>

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

> [Mark: rework commit message]

> Signed-off-by: Mark Rutland <mark.rutland@arm.com>

> ---

>  scripts/atomic/atomic-tbl.sh | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/scripts/atomic/atomic-tbl.sh b/scripts/atomic/atomic-tbl.sh

> index 9d6be538a987..81d5c32039dd 100755

> --- a/scripts/atomic/atomic-tbl.sh

> +++ b/scripts/atomic/atomic-tbl.sh

> @@ -180,7 +180,7 @@ gen_proto_variants()

>  #gen_proto(meta, ...)

>  gen_proto() {

>  	local meta="$1"; shift

> -	for m in $(echo "${meta}" | fold -w1); do

> +	for m in $(echo "${meta}" | grep -o .); do

>  		gen_proto_variants "${m}" "$@"

>  	done

>  }


Acked-by: Will Deacon <will.deacon@arm.com>


Will

Patch

diff --git a/scripts/atomic/atomic-tbl.sh b/scripts/atomic/atomic-tbl.sh
index 9d6be538a987..81d5c32039dd 100755
--- a/scripts/atomic/atomic-tbl.sh
+++ b/scripts/atomic/atomic-tbl.sh
@@ -180,7 +180,7 @@  gen_proto_variants()
 #gen_proto(meta, ...)
 gen_proto() {
 	local meta="$1"; shift
-	for m in $(echo "${meta}" | fold -w1); do
+	for m in $(echo "${meta}" | grep -o .); do
 		gen_proto_variants "${m}" "$@"
 	done
 }