drm/panfrost: fix -Wmissing-prototypes warnings
Subsystems (3)
PATCH v3 1/1 drm/panfrost: fix -Wmissing-prototypes warnings
We get these warnings when build kernel W=1:drivers/gpu/drm/panfrost/panfrost_perfcnt.c:35:6: warning: no previous prototype for ‘panfrost_perfcnt_clean_cache_done’ [-Wmissing-prototypes] drivers/gpu/drm/panfrost/panfrost_perfcnt.c:40:6: warning: no previous prototype for ‘panfrost_perfcnt_sample_done’ [-Wmissing-prototypes] drivers/gpu/drm/panfrost/panfrost_perfcnt.c:190:5: warning: no previous prototype for ‘panfrost_ioctl_perfcnt_enable’ [-Wmissing-prototypes] drivers/gpu/drm/panfrost/panfrost_perfcnt.c:218:5: warning: no previous prototype for ‘panfrost_ioctl_perfcnt_dump’ [-Wmissing-prototypes] drivers/gpu/drm/panfrost/panfrost_perfcnt.c:250:6: warning: no previous prototype for ‘panfrost_perfcnt_close’ [-Wmissing-prototypes] drivers/gpu/drm/panfrost/panfrost_perfcnt.c:264:5: warning: no previous prototype for ‘panfrost_perfcnt_init’ [-Wmissing-prototypes] drivers/gpu/drm/panfrost/panfrost_perfcnt.c:320:6: warning: no previous prototype for ‘panfrost_perfcnt_fini’ [-Wmissing-prototypes] drivers/gpu/drm/panfrost/panfrost_mmu.c:227:6: warning: no previous prototype for ‘panfrost_mmu_flush_range’ [-Wmissing-prototypes] drivers/gpu/drm/panfrost/panfrost_mmu.c:435:5: warning: no previous prototype for ‘panfrost_mmu_map_fault_addr’ [-Wmissing-prototypes]
For file panfrost_mmu.c, make functions static to fix this. For file panfrost_perfcnt.c, include header file can fix this.
---
v3: using tab size of 8 other than 4.
v2: align parameter line and modify comment. Thanks to Steve.
--- drivers/gpu/drm/panfrost/panfrost_mmu.c | 9 +++++---- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 1 + 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/panfrost/panfrost_mmu.c +5 -4
@@ -224,9 +224,9 @@ static size_t get_pgsize(u64 addr, size_t size)return SZ_2M ; } -void panfrost_mmu_flush_range (struct panfrost_device *pfdev, -struct panfrost_mmu *mmu, -u64 iova,size_t size) +static void panfrost_mmu_flush_range (struct panfrost_device *pfdev, +struct panfrost_mmu *mmu, +u64 iova,size_t size) {if (mmu->as <0 )return ;
@@ -432,7 +432,8 @@ void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv)#define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE) -int panfrost_mmu_map_fault_addr (struct panfrost_device *pfdev,int as,u64 addr) +static int panfrost_mmu_map_fault_addr (struct panfrost_device *pfdev,int as, +u64 addr) {int ret, i;struct panfrost_gem_object *bo;
drivers/gpu/drm/panfrost/panfrost_perfcnt.c +1 -0
@@ -16,6 +16,7 @@#include "panfrost_issues.h" #include "panfrost_job.h" #include "panfrost_mmu.h" +#include "panfrost_perfcnt.h" #include "panfrost_regs.h" #define COUNTERS_PER_BLOCK 64
Signature · 1 line
1.8.3.1
Steven Price
maintainerQuoted 31 lines · Yi Wang
We get these warnings when build kernel W=1:
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:35:6: warning: no previous prototype for ‘panfrost_perfcnt_clean_cache_done’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:40:6: warning: no previous prototype for ‘panfrost_perfcnt_sample_done’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:190:5: warning: no previous prototype for ‘panfrost_ioctl_perfcnt_enable’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:218:5: warning: no previous prototype for ‘panfrost_ioctl_perfcnt_dump’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:250:6: warning: no previous prototype for ‘panfrost_perfcnt_close’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:264:5: warning: no previous prototype for ‘panfrost_perfcnt_init’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:320:6: warning: no previous prototype for ‘panfrost_perfcnt_fini’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_mmu.c:227:6: warning: no previous prototype for ‘panfrost_mmu_flush_range’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_mmu.c:435:5: warning: no previous prototype for ‘panfrost_mmu_map_fault_addr’ [-Wmissing-prototypes]For file
panfrost_mmu.c, make functions static to fix this. For filepanfrost_perfcnt.c, include header file can fix this.Signed-off-by Yi Wang <[email protected]>Reviewed-by Steven Price <[email protected]>---
v3: using tab size of 8 other than 4.
v2: align parameter line and modify comment. Thanks to Steve.
--- drivers/gpu/drm/panfrost/panfrost_mmu.c | 9 +++++---- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 1 + 2 files changed, 6 insertions(+), 4 deletions(-)drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-0
drivers/gpu/drm/panfrost/panfrost_mmu.c static size_t get_pgsize(u64 addr, size_t size) · line 229
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +3
-3@@ -224,9 +224,9 @@ static size_t get_pgsize(u64 addr, size_t size)return SZ_2M ; } -void panfrost_mmu_flush_range (struct panfrost_device *pfdev, -struct panfrost_mmu *mmu, -u64 iova,size_t size) +static void panfrost_mmu_flush_range (struct panfrost_device *pfdev, +struct panfrost_mmu *mmu, +u64 iova,size_t size)
Ok, I'll admit I wouldn't have spotted this unless I'd double checked by applying the patch, but you still seem to have something misconfigured in your editor. This is out by one character:
static void panfrost_mmu_flush_range(struct panfrost_device *pfdev,
drivers/gpu/drm/panfrost/panfrost_mmu.c static size_t get_pgsize(u64 addr, size_t size) · line 231
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-2------->------->------->------- struct panfrost_mmu *mmu, ------->------->------->------- u64 iova, size_t size)
There should be an extra space to align correctly.
drivers/gpu/drm/panfrost/panfrost_mmu.c void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv) · line 436
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +2
-1{if (mmu->as <0 )return ;@@ -432,7 +432,8 @@ void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv)#define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE) -int panfrost_mmu_map_fault_addr (struct panfrost_device *pfdev,int as,u64 addr) +static int panfrost_mmu_map_fault_addr (struct panfrost_device *pfdev,int as, +u64 addr)
Here you're off-by-one in the other direction - you need to replace the final tab with 7 spaces:
static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as,
drivers/gpu/drm/panfrost/panfrost_mmu.c void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv) · line 436
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-1------->------->------->------->-------u64 addr)
Sorry to nit-pick over this, but it's good to get your editor setup correctly to ensure your formatting is correct.
Thanks,
Steve
Quoted 16 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-0{int ret, i;struct panfrost_gem_object *bo;drivers/gpu/drm/panfrost/panfrost_perfcnt.c +1
-0@@ -16,6 +16,7 @@#include "panfrost_issues.h" #include "panfrost_job.h" #include "panfrost_mmu.h" +#include "panfrost_perfcnt.h" #include "panfrost_regs.h" #define COUNTERS_PER_BLOCK 64
Hi Steve,
Thanks a lot for your time and patience :)
Quoted 46 lines · Yi Wang
Quoted 31 lines
We get these warnings when build kernel W=1:
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:35:6: warning: no previous prototype for ‘panfrost_perfcnt_clean_cache_done’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:40:6: warning: no previous prototype for ‘panfrost_perfcnt_sample_done’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:190:5: warning: no previous prototype for ‘panfrost_ioctl_perfcnt_enable’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:218:5: warning: no previous prototype for ‘panfrost_ioctl_perfcnt_dump’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:250:6: warning: no previous prototype for ‘panfrost_perfcnt_close’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:264:5: warning: no previous prototype for ‘panfrost_perfcnt_init’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:320:6: warning: no previous prototype for ‘panfrost_perfcnt_fini’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_mmu.c:227:6: warning: no previous prototype for ‘panfrost_mmu_flush_range’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_mmu.c:435:5: warning: no previous prototype for ‘panfrost_mmu_map_fault_addr’ [-Wmissing-prototypes]For file
panfrost_mmu.c, make functions static to fix this. For filepanfrost_perfcnt.c, include header file can fix this.Signed-off-by Yi Wang <[email protected]>Reviewed-by Steven Price <[email protected]>---
v3: using tab size of 8 other than 4.
v2: align parameter line and modify comment. Thanks to Steve.
--- drivers/gpu/drm/panfrost/panfrost_mmu.c | 9 +++++---- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 1 + 2 files changed, 6 insertions(+), 4 deletions(-)drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-0drivers/gpu/drm/panfrost/panfrost_mmu.c static size_t get_pgsize(u64 addr, size_t size) · line 229
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +3
-3@@ -224,9 +224,9 @@ static size_t get_pgsize(u64 addr, size_t size)return SZ_2M ; } -void panfrost_mmu_flush_range (struct panfrost_device *pfdev, -struct panfrost_mmu *mmu, -u64 iova,size_t size) +static void panfrost_mmu_flush_range (struct panfrost_device *pfdev, +struct panfrost_mmu *mmu, +u64 iova,size_t size)Ok, I'll admit I wouldn't have spotted this unless I'd double checked by applying the patch, but you still seem to have something misconfigured in your editor. This is out by one character:
Quoted 5 lines
static void panfrost_mmu_flush_range(struct
panfrost_device*pfdev,drivers/gpu/drm/panfrost/panfrost_mmu.c static size_t get_pgsize(u64 addr, size_t size) · line 231
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-2------->------->------->------- struct panfrost_mmu *mmu, ------->------->------->------- u64 iova, size_t size)There should be an extra space to align correctly.
According to [Linux kernel coding style](https://www.kernel.org/doc/html/v4.10/process/coding-style.html):
Quoted 2 lines
Outside of comments, documentation and except in
Kconfig, spaces are never used for indentation, and the above example is deliberately broken.
If I understand corretly, the tab is enough for indentation :-)
Quoted 15 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv) · line 436
Quoted 11 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +2
-1{if (mmu->as <0 )return ;@@ -432,7 +432,8 @@ void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv)#define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE) -int panfrost_mmu_map_fault_addr (struct panfrost_device *pfdev,int as,u64 addr) +static int panfrost_mmu_map_fault_addr (struct panfrost_device *pfdev,int as, +u64 addr)Here you're off-by-one in the other direction - you need to replace the final tab with 7 spaces:
Quoted 5 lines
static int panfrost_mmu_map_fault_addr(struct
panfrost_device*pfdev, int as,drivers/gpu/drm/panfrost/panfrost_mmu.c void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv) · line 436
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-1------->------->------->------->-------u64 addr)Sorry to nit-pick over this, but it's good to get your editor setup correctly to ensure your formatting is correct.
Yeah, it worth time on the editor setup, and thanks again.
Quoted 4 lines
Thanks,
Steve
---
Best wishes
Yi Wang
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Steven Price
maintainerQuoted 54 lines · On Mon, Oct 28, 2019 at 09:27:33AM +0000, [email protected] wrote:
Hi Steve,
Thanks a lot for your time and patience :)
Quoted 50 lines · Yi Wang
Quoted 31 lines
We get these warnings when build kernel W=1:
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:35:6: warning: no previous prototype for ‘panfrost_perfcnt_clean_cache_done’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:40:6: warning: no previous prototype for ‘panfrost_perfcnt_sample_done’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:190:5: warning: no previous prototype for ‘panfrost_ioctl_perfcnt_enable’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:218:5: warning: no previous prototype for ‘panfrost_ioctl_perfcnt_dump’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:250:6: warning: no previous prototype for ‘panfrost_perfcnt_close’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:264:5: warning: no previous prototype for ‘panfrost_perfcnt_init’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:320:6: warning: no previous prototype for ‘panfrost_perfcnt_fini’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_mmu.c:227:6: warning: no previous prototype for ‘panfrost_mmu_flush_range’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_mmu.c:435:5: warning: no previous prototype for ‘panfrost_mmu_map_fault_addr’ [-Wmissing-prototypes]For file
panfrost_mmu.c, make functions static to fix this. For filepanfrost_perfcnt.c, include header file can fix this.Signed-off-by Yi Wang <[email protected]>Reviewed-by Steven Price <[email protected]>---
v3: using tab size of 8 other than 4.
v2: align parameter line and modify comment. Thanks to Steve.
--- drivers/gpu/drm/panfrost/panfrost_mmu.c | 9 +++++---- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 1 + 2 files changed, 6 insertions(+), 4 deletions(-)drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-0drivers/gpu/drm/panfrost/panfrost_mmu.c static size_t get_pgsize(u64 addr, size_t size) · line 229
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +3
-3@@ -224,9 +224,9 @@ static size_t get_pgsize(u64 addr, size_t size)return SZ_2M ; } -void panfrost_mmu_flush_range (struct panfrost_device *pfdev, -struct panfrost_mmu *mmu, -u64 iova,size_t size) +static void panfrost_mmu_flush_range (struct panfrost_device *pfdev, +struct panfrost_mmu *mmu, +u64 iova,size_t size)Ok, I'll admit I wouldn't have spotted this unless I'd double checked by applying the patch, but you still seem to have something misconfigured in your editor. This is out by one character:
static void panfrost_mmu_flush_range(struct
panfrost_device*pfdev,Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-2------->------->------->------- struct panfrost_mmu *mmu, ------->------->------->------- u64 iova, size_t size)
Quoted 7 lines
Quoted 1 line
There should be an extra space to align correctly.
According to [Linux kernel coding style](https://www.kernel.org/doc/html/v4.10/process/coding-style.html):
Quoted 2 lines
Outside of comments, documentation and except in
Kconfig, spaces are never used for indentation, and the above example is deliberately broken.If I understand corretly, the tab is enough for indentation :-)
There's a (subtle) difference between indentation and alignment. Indentation is where the code is moved over because it is contained within an outer statement (e.g. an 'if' or 'while'). The Linux coding style is that this should be done with only tabs as you quote.
However when the line is a continuation of the previous line, like in the example here, then we often need a combination of tabs/spaces to align correctly. The desire here is that the continuation lines all start straight after the "(" on the first line. Since that is 37 characters from the start we need 4 tabs + 5 spaces (4*8+5=37), whereas you had 4 tabs + 4 spaces. My guess is this is because you've got the following vim configuration:
tabstop = 8
softtabstop = 4
noexpandtab
This means that pressing <tab> moves you along only 4 columns (i.e. inserts 4 spaces), a second <tab> will then replace the spaces with a real tab character (i.e. move another 4 columns for a total of 8).
It's probably best to set "softtabstop = 0" so that <tab> always inserts a real tab character. You might also find it useful to make tabs visible:
set list
set listchars=tab:>-
That way you can easily see where you have tab characters and spaces (like in the example I quoted above).
Steve
Quoted 32 lines
Quoted 15 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv) · line 436
Quoted 11 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +2
-1{if (mmu->as <0 )return ;@@ -432,7 +432,8 @@ void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv)#define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE) -int panfrost_mmu_map_fault_addr (struct panfrost_device *pfdev,int as,u64 addr) +static int panfrost_mmu_map_fault_addr (struct panfrost_device *pfdev,int as, +u64 addr)Here you're off-by-one in the other direction - you need to replace the final tab with 7 spaces:
Quoted 5 lines
static int panfrost_mmu_map_fault_addr(struct
panfrost_device*pfdev, int as,drivers/gpu/drm/panfrost/panfrost_mmu.c void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv) · line 436
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-1------->------->------->------->-------u64 addr)Sorry to nit-pick over this, but it's good to get your editor setup correctly to ensure your formatting is correct.
Yeah, it worth time on the editor setup, and thanks again.
Quoted 4 lines
Thanks,
Steve
---
Best wishes
Yi Wang
Quoted 61 lines · On Mon, Oct 28, 2019 at 09:27:33AM +0000, [email protected] wrote:
Quoted 60 lines
Hi Steve,
Thanks a lot for your time and patience :)
Quoted 46 lines · Yi Wang
Quoted 31 lines
We get these warnings when build kernel W=1:
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:35:6: warning: no previous prototype for ‘panfrost_perfcnt_clean_cache_done’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:40:6: warning: no previous prototype for ‘panfrost_perfcnt_sample_done’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:190:5: warning: no previous prototype for ‘panfrost_ioctl_perfcnt_enable’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:218:5: warning: no previous prototype for ‘panfrost_ioctl_perfcnt_dump’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:250:6: warning: no previous prototype for ‘panfrost_perfcnt_close’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:264:5: warning: no previous prototype for ‘panfrost_perfcnt_init’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_perfcnt.c:320:6: warning: no previous prototype for ‘panfrost_perfcnt_fini’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_mmu.c:227:6: warning: no previous prototype for ‘panfrost_mmu_flush_range’ [-Wmissing-prototypes]drivers/gpu/drm/panfrost/panfrost_mmu.c:435:5: warning: no previous prototype for ‘panfrost_mmu_map_fault_addr’ [-Wmissing-prototypes]For file
panfrost_mmu.c, make functions static to fix this. For filepanfrost_perfcnt.c, include header file can fix this.Signed-off-by Yi Wang <[email protected]>Reviewed-by Steven Price <[email protected]>---
v3: using tab size of 8 other than 4.
v2: align parameter line and modify comment. Thanks to Steve.
--- drivers/gpu/drm/panfrost/panfrost_mmu.c | 9 +++++---- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 1 + 2 files changed, 6 insertions(+), 4 deletions(-)drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-0drivers/gpu/drm/panfrost/panfrost_mmu.c static size_t get_pgsize(u64 addr, size_t size) · line 229
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +3
-3@@ -224,9 +224,9 @@ static size_t get_pgsize(u64 addr, size_t size)return SZ_2M ; } -void panfrost_mmu_flush_range (struct panfrost_device *pfdev, -struct panfrost_mmu *mmu, -u64 iova,size_t size) +static void panfrost_mmu_flush_range (struct panfrost_device *pfdev, +struct panfrost_mmu *mmu, +u64 iova,size_t size)Ok, I'll admit I wouldn't have spotted this unless I'd double checked by applying the patch, but you still seem to have something misconfigured in your editor. This is out by one character:
Quoted 5 lines
static void panfrost_mmu_flush_range(struct
panfrost_device*pfdev,drivers/gpu/drm/panfrost/panfrost_mmu.c static size_t get_pgsize(u64 addr, size_t size) · line 231
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-2------->------->------->------- struct panfrost_mmu *mmu, ------->------->------->------- u64 iova, size_t size)There should be an extra space to align correctly.
According to [Linux kernel coding style](https://www.kernel.org/doc/html/v4.10/process/coding-style.html):
Quoted 2 lines
Outside of comments, documentation and except in
Kconfig, spaces are never used for indentation, and the above example is deliberately broken.
Quoted 6 lines
Quoted 1 line
If I understand corretly, the tab is enough for indentation :-)
There's a (subtle) difference between indentation and alignment. Indentation is where the code is moved over because it is contained within an outer statement (e.g. an 'if' or 'while'). The Linux coding style is that this should be done with only tabs as you quote.
Ok, I got it.
Quoted 21 lines
However when the line is a continuation of the previous line, like in the example here, then we often need a combination of tabs/spaces to align correctly. The desire here is that the continuation lines all start straight after the "(" on the first line. Since that is 37 characters from the start we need 4 tabs + 5 spaces (4*8+5=37), whereas you had 4 tabs + 4 spaces. My guess is this is because you've got the following vim configuration:
tabstop = 8
softtabstop = 4
noexpandtabThis means that pressing <tab> moves you along only 4 columns (i.e. inserts 4 spaces), a second <tab> will then replace the spaces with a real tab character (i.e. move another 4 columns for a total of 8).
It's probably best to set "softtabstop = 0" so that <tab> always inserts a real tab character. You might also find it useful to make tabs visible:
Quoted 5 lines
set list
set listchars=tab:>-That way you can easily see where you have tab characters and spaces (like in the example I quoted above).
That's really useful. Thank you, Steve.
I will send a new patch soon.
Quoted 35 lines
Steve
Quoted 32 lines
Quoted 15 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv) · line 436
Quoted 11 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c +2
-1{if (mmu->as <0 )return ;@@ -432,7 +432,8 @@ void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv)#define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE) -int panfrost_mmu_map_fault_addr (struct panfrost_device *pfdev,int as,u64 addr) +static int panfrost_mmu_map_fault_addr (struct panfrost_device *pfdev,int as, +u64 addr)Here you're off-by-one in the other direction - you need to replace the final tab with 7 spaces:
Quoted 5 lines
static int panfrost_mmu_map_fault_addr(struct
panfrost_device*pfdev, int as,drivers/gpu/drm/panfrost/panfrost_mmu.c void panfrost_mmu_pgtable_free(struct panfrost_file_priv *priv) · line 436
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_mmu.c +0
-1------->------->------->------->-------u64 addr)Sorry to nit-pick over this, but it's good to get your editor setup correctly to ensure your formatting is correct.
Yeah, it worth time on the editor setup, and thanks again.
Quoted 4 lines
Thanks,
Steve
---
Best wishes
Yi Wang
---
Best wishes
Yi Wang
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel