[PATCH] mm: fix gfp-translate for changes in gfp.h

From: Charan Teja Kalla
Date: Tue Jun 13 2023 - 01:14:27 EST


The commit cb5a065b4ea9 ("headers/deps: mm: Split <linux/gfp_types.h>
out of <linux/gfp.h>") made all the gfp flags that the gfp-translate
script needed to move from gfp.h to gfp_types.h. Made changes
accordingly in the gfp-translate scipt.

w/o this patch:
$./scripts/gfp-translate 0xc2cc0
Source: /local/mnt/workspace/linux_next/linux
Parsing: 0xc2cc0

with this patch:
Source: /local/mnt/workspace/linux_next/linux
Parsing: 0xc2cc0
#define ___GFP_IO 0x40
#define ___GFP_FS 0x80
#define ___GFP_DIRECT_RECLAIM 0x400
#define ___GFP_KSWAPD_RECLAIM 0x800
#define ___GFP_NOWARN 0x2000
#define ___GFP_COMP 0x40000
#define ___GFP_NOMEMALLOC 0x80000

Fixes: cb5a065b4ea9 ("headers/deps: mm: Split <linux/gfp_types.h> out of <linux/gfp.h>")
Signed-off-by: Charan Teja Kalla <quic_charante@xxxxxxxxxxx>
---
scripts/gfp-translate | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/gfp-translate b/scripts/gfp-translate
index b2ce416..6c9aed1 100755
--- a/scripts/gfp-translate
+++ b/scripts/gfp-translate
@@ -63,11 +63,11 @@ fi

# Extract GFP flags from the kernel source
TMPFILE=`mktemp -t gfptranslate-XXXXXX` || exit 1
-grep -q ___GFP $SOURCE/include/linux/gfp.h
+grep -q ___GFP $SOURCE/include/linux/gfp_types.h
if [ $? -eq 0 ]; then
- grep "^#define ___GFP" $SOURCE/include/linux/gfp.h | sed -e 's/u$//' | grep -v GFP_BITS > $TMPFILE
+ grep "^#define ___GFP" $SOURCE/include/linux/gfp_types.h | sed -e 's/u$//' | grep -v GFP_BITS > $TMPFILE
else
- grep "^#define __GFP" $SOURCE/include/linux/gfp.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE
+ grep "^#define __GFP" $SOURCE/include/linux/gfp_types.h | sed -e 's/(__force gfp_t)//' | sed -e 's/u)/)/' | grep -v GFP_BITS | sed -e 's/)\//) \//' > $TMPFILE
fi

# Parse the flags
--
2.7.4