* [PATCH] habanalabs: change unused extern decl of hdev to forward decl of hl_device
@ 2023-02-08 15:54 Tom Rix
2023-02-13 7:12 ` Stanislaw Gruszka
0 siblings, 1 reply; 3+ messages in thread
From: Tom Rix @ 2023-02-08 15:54 UTC (permalink / raw)
To: ogabbay, nathan, ndesaulniers, kelbaz
Cc: dri-devel, linux-kernel, llvm, Tom Rix
Building with clang W=2 has several similar warnings
drivers/accel/habanalabs/common/decoder.c:46:51: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
static void dec_error_intr_work(struct hl_device *hdev, u32 base_addr, u32 core_id)
^
drivers/accel/habanalabs/common/security.h:13:26: note: previous declaration is here
extern struct hl_device *hdev;
^
There is no global definition of hdev, so the extern is not needed.
Searched with
grep -r '^struct' . | grep hl_dev
Change to an forward decl to resolve these issues
drivers/accel/habanalabs/common/mmu/../security.h:133:40: error: ‘struct hl_device’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
133 | bool (*skip_block_hook)(struct hl_device *hdev,
| ^~~~~~~~~
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/accel/habanalabs/common/security.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/accel/habanalabs/common/security.h b/drivers/accel/habanalabs/common/security.h
index 234b4a6ed8bc..d7a3b3e82ea4 100644
--- a/drivers/accel/habanalabs/common/security.h
+++ b/drivers/accel/habanalabs/common/security.h
@@ -10,7 +10,7 @@
#include <linux/io-64-nonatomic-lo-hi.h>
-extern struct hl_device *hdev;
+struct hl_device;
/* special blocks */
#define HL_MAX_NUM_OF_GLBL_ERR_CAUSE 10
--
2.26.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] habanalabs: change unused extern decl of hdev to forward decl of hl_device
2023-02-08 15:54 [PATCH] habanalabs: change unused extern decl of hdev to forward decl of hl_device Tom Rix
@ 2023-02-13 7:12 ` Stanislaw Gruszka
2023-02-16 14:40 ` Oded Gabbay
0 siblings, 1 reply; 3+ messages in thread
From: Stanislaw Gruszka @ 2023-02-13 7:12 UTC (permalink / raw)
To: Tom Rix
Cc: ogabbay, nathan, ndesaulniers, kelbaz, llvm, linux-kernel,
dri-devel
On Wed, Feb 08, 2023 at 07:54:50AM -0800, Tom Rix wrote:
> Building with clang W=2 has several similar warnings
> drivers/accel/habanalabs/common/decoder.c:46:51: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
> static void dec_error_intr_work(struct hl_device *hdev, u32 base_addr, u32 core_id)
> ^
> drivers/accel/habanalabs/common/security.h:13:26: note: previous declaration is here
> extern struct hl_device *hdev;
> ^
>
> There is no global definition of hdev, so the extern is not needed.
> Searched with
> grep -r '^struct' . | grep hl_dev
>
> Change to an forward decl to resolve these issues
> drivers/accel/habanalabs/common/mmu/../security.h:133:40: error: ‘struct hl_device’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
> 133 | bool (*skip_block_hook)(struct hl_device *hdev,
> | ^~~~~~~~~
>
> Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
> ---
> drivers/accel/habanalabs/common/security.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/accel/habanalabs/common/security.h b/drivers/accel/habanalabs/common/security.h
> index 234b4a6ed8bc..d7a3b3e82ea4 100644
> --- a/drivers/accel/habanalabs/common/security.h
> +++ b/drivers/accel/habanalabs/common/security.h
> @@ -10,7 +10,7 @@
>
> #include <linux/io-64-nonatomic-lo-hi.h>
>
> -extern struct hl_device *hdev;
> +struct hl_device;
>
> /* special blocks */
> #define HL_MAX_NUM_OF_GLBL_ERR_CAUSE 10
> --
> 2.26.3
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] habanalabs: change unused extern decl of hdev to forward decl of hl_device
2023-02-13 7:12 ` Stanislaw Gruszka
@ 2023-02-16 14:40 ` Oded Gabbay
0 siblings, 0 replies; 3+ messages in thread
From: Oded Gabbay @ 2023-02-16 14:40 UTC (permalink / raw)
To: Stanislaw Gruszka
Cc: Tom Rix, nathan, ndesaulniers, kelbaz, llvm, linux-kernel,
dri-devel
On Mon, Feb 13, 2023 at 9:12 AM Stanislaw Gruszka
<stanislaw.gruszka@linux.intel.com> wrote:
>
> On Wed, Feb 08, 2023 at 07:54:50AM -0800, Tom Rix wrote:
> > Building with clang W=2 has several similar warnings
> > drivers/accel/habanalabs/common/decoder.c:46:51: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
> > static void dec_error_intr_work(struct hl_device *hdev, u32 base_addr, u32 core_id)
> > ^
> > drivers/accel/habanalabs/common/security.h:13:26: note: previous declaration is here
> > extern struct hl_device *hdev;
> > ^
> >
> > There is no global definition of hdev, so the extern is not needed.
> > Searched with
> > grep -r '^struct' . | grep hl_dev
> >
> > Change to an forward decl to resolve these issues
> > drivers/accel/habanalabs/common/mmu/../security.h:133:40: error: ‘struct hl_device’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
> > 133 | bool (*skip_block_hook)(struct hl_device *hdev,
> > | ^~~~~~~~~
> >
> > Signed-off-by: Tom Rix <trix@redhat.com>
> Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
>
> > ---
> > drivers/accel/habanalabs/common/security.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/accel/habanalabs/common/security.h b/drivers/accel/habanalabs/common/security.h
> > index 234b4a6ed8bc..d7a3b3e82ea4 100644
> > --- a/drivers/accel/habanalabs/common/security.h
> > +++ b/drivers/accel/habanalabs/common/security.h
> > @@ -10,7 +10,7 @@
> >
> > #include <linux/io-64-nonatomic-lo-hi.h>
> >
> > -extern struct hl_device *hdev;
> > +struct hl_device;
> >
> > /* special blocks */
> > #define HL_MAX_NUM_OF_GLBL_ERR_CAUSE 10
> > --
> > 2.26.3
> >
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Thanks, applied to -next.
Oded
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-16 14:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-08 15:54 [PATCH] habanalabs: change unused extern decl of hdev to forward decl of hl_device Tom Rix
2023-02-13 7:12 ` Stanislaw Gruszka
2023-02-16 14:40 ` Oded Gabbay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox