mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool
@ 2023-11-30 16:00 Donald Robson
  2023-11-30 16:00 ` [PATCH v2 2/5] drm/imagination: Fixed missing header in pvr_fw_meta Donald Robson
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Donald Robson @ 2023-11-30 16:00 UTC (permalink / raw)
  To: dri-devel, linux-kernel
  Cc: donald.robson, matt.coster, frank.binns, boris.brezillon,
	maarten.lankhorst, mripard, tzimmermann, airlied, daniel,
	kernel test robot

This line appears to confuse the compiler and had been noticed previously in
clang-tidy output. There isn't anything fundamentally wrong that I can see.
I suspect that it just looks like a mistake - hence the first note.  By making
the second operand an actual bool result, const correctness can be preserved
while silencing the warning.

>> drivers/gpu/drm/imagination/pvr_device_info.c:230:47: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
     230 |         } else if (features_size == mapping_max_size && (mapping_max & 63)) {
         |                                                      ^  ~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/imagination/pvr_device_info.c:230:47: note: use '&' for a bitwise operation
     230 |         } else if (features_size == mapping_max_size && (mapping_max & 63)) {
         |                                                      ^~
         |                                                      &
   drivers/gpu/drm/imagination/pvr_device_info.c:230:47: note: remove constant to silence this warning
     230 |         } else if (features_size == mapping_max_size && (mapping_max & 63)) {
         |                                                     ~^~~~~~~~~~~~~~~~~~~~~
   1 warning generated.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311241752.3iLyyFcA-lkp@intel.com/
Fixes: 1ff76f7a5b45 ("drm/imagination: Add GPU ID parsing and firmware loading")
Signed-off-by: Donald Robson <donald.robson@imgtec.com>
---
 drivers/gpu/drm/imagination/pvr_device_info.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imagination/pvr_device_info.c b/drivers/gpu/drm/imagination/pvr_device_info.c
index 11e6bef52ecd..d3301cde7d11 100644
--- a/drivers/gpu/drm/imagination/pvr_device_info.c
+++ b/drivers/gpu/drm/imagination/pvr_device_info.c
@@ -227,7 +227,8 @@ int pvr_device_info_set_features(struct pvr_device *pvr_dev, const u64 *features
 	/* Verify no unsupported values in the bitmask. */
 	if (features_size > mapping_max_size) {
 		drm_warn(from_pvr_device(pvr_dev), "Unsupported features in firmware image");
-	} else if (features_size == mapping_max_size && (mapping_max & 63)) {
+	} else if (features_size == mapping_max_size &&
+		   ((mapping_max & 63) != 0)) {
 		u64 invalid_mask = ~0ull << (mapping_max & 63);
 
 		if (features[features_size - 1] & invalid_mask)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 2/5] drm/imagination: Fixed missing header in pvr_fw_meta
  2023-11-30 16:00 [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool Donald Robson
@ 2023-11-30 16:00 ` Donald Robson
  2023-12-01  8:37   ` (subset) " Maxime Ripard
  2023-11-30 16:00 ` [PATCH v2 3/5] drm/imagination: pvr_device_process_active_queues now static Donald Robson
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Donald Robson @ 2023-11-30 16:00 UTC (permalink / raw)
  To: dri-devel, linux-kernel
  Cc: donald.robson, matt.coster, frank.binns, boris.brezillon,
	maarten.lankhorst, mripard, tzimmermann, airlied, daniel,
	Arnd Bergmann, kernel test robot

A missing header causes the compiler to warn that the function below is not
forward declared.

>> drivers/gpu/drm/imagination/pvr_fw_meta.c:33:1: warning: no previous prototype for function 'pvr_meta_cr_read32' [-Wmissing-prototypes]
      33 | pvr_meta_cr_read32(struct pvr_device *pvr_dev, u32 reg_addr, u32 *reg_value_out)
         | ^
   drivers/gpu/drm/imagination/pvr_fw_meta.c:32:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
      32 | int
         | ^
         | static 
   1 warning generated.

Include the correct header.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311250226.Da2yiSKp-lkp@intel.com/
Fixes: bb52a8dc84f2 ("drm/imagination: Implement firmware infrastructure and META FW support")
Signed-off-by: Donald Robson <donald.robson@imgtec.com>
---
 drivers/gpu/drm/imagination/pvr_fw_meta.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/imagination/pvr_fw_meta.c b/drivers/gpu/drm/imagination/pvr_fw_meta.c
index 119934c36184..c39beb70c317 100644
--- a/drivers/gpu/drm/imagination/pvr_fw_meta.c
+++ b/drivers/gpu/drm/imagination/pvr_fw_meta.c
@@ -4,6 +4,7 @@
 #include "pvr_device.h"
 #include "pvr_fw.h"
 #include "pvr_fw_info.h"
+#include "pvr_fw_meta.h"
 #include "pvr_gem.h"
 #include "pvr_rogue_cr_defs.h"
 #include "pvr_rogue_meta.h"
-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 3/5] drm/imagination: pvr_device_process_active_queues now static
  2023-11-30 16:00 [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool Donald Robson
  2023-11-30 16:00 ` [PATCH v2 2/5] drm/imagination: Fixed missing header in pvr_fw_meta Donald Robson
@ 2023-11-30 16:00 ` Donald Robson
  2023-12-01  8:37   ` (subset) " Maxime Ripard
  2023-11-30 16:00 ` [PATCH v2 4/5] drm/imagination: pvr_gpuvm_free() " Donald Robson
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Donald Robson @ 2023-11-30 16:00 UTC (permalink / raw)
  To: dri-devel, linux-kernel
  Cc: donald.robson, matt.coster, frank.binns, boris.brezillon,
	maarten.lankhorst, mripard, tzimmermann, airlied, daniel,
	Arnd Bergmann, kernel test robot

The function below is used only within this source file, but is not static.

>> drivers/gpu/drm/imagination/pvr_device.c:129:6: warning: no previous prototype for function 'pvr_device_process_active_queues' [-Wmissing-prototypes]
     129 | void pvr_device_process_active_queues(struct pvr_device *pvr_dev)
         |      ^
   drivers/gpu/drm/imagination/pvr_device.c:129:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     129 | void pvr_device_process_active_queues(struct pvr_device *pvr_dev)
         | ^
         | static 
   1 warning generated.

Make it static.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311250632.giVEx7MU-lkp@intel.com/
Fixes: c98dab7a5f5f ("drm/imagination: Implement job submission and scheduling")
Signed-off-by: Donald Robson <donald.robson@imgtec.com>
---
 drivers/gpu/drm/imagination/pvr_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imagination/pvr_device.c b/drivers/gpu/drm/imagination/pvr_device.c
index 8499becf4fbb..048eba776cf2 100644
--- a/drivers/gpu/drm/imagination/pvr_device.c
+++ b/drivers/gpu/drm/imagination/pvr_device.c
@@ -127,7 +127,7 @@ static int pvr_device_clk_init(struct pvr_device *pvr_dev)
  * This is called any time we receive a FW event. It iterates over all
  * active queues and calls pvr_queue_process() on them.
  */
-void pvr_device_process_active_queues(struct pvr_device *pvr_dev)
+static void pvr_device_process_active_queues(struct pvr_device *pvr_dev)
 {
 	struct pvr_queue *queue, *tmp_queue;
 	LIST_HEAD(active_queues);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 4/5] drm/imagination: pvr_gpuvm_free() now static
  2023-11-30 16:00 [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool Donald Robson
  2023-11-30 16:00 ` [PATCH v2 2/5] drm/imagination: Fixed missing header in pvr_fw_meta Donald Robson
  2023-11-30 16:00 ` [PATCH v2 3/5] drm/imagination: pvr_device_process_active_queues now static Donald Robson
@ 2023-11-30 16:00 ` Donald Robson
  2023-12-01  8:37   ` (subset) " Maxime Ripard
  2023-11-30 16:00 ` [PATCH v2 5/5] drm/imagination: Removed unused function to_pvr_vm_gpuva() Donald Robson
  2023-12-01  8:37 ` (subset) [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool Maxime Ripard
  4 siblings, 1 reply; 10+ messages in thread
From: Donald Robson @ 2023-11-30 16:00 UTC (permalink / raw)
  To: dri-devel, linux-kernel
  Cc: donald.robson, matt.coster, frank.binns, boris.brezillon,
	maarten.lankhorst, mripard, tzimmermann, airlied, daniel,
	Arnd Bergmann, kernel test robot

The function below is used only within this source file, but is not static.

drivers/gpu/drm/imagination/pvr_vm.c:542:6: error: no previous prototype for 'pvr_gpuvm_free' [-Werror=missing-prototypes]
  542 | void pvr_gpuvm_free(struct drm_gpuvm *gpuvm)

Make it static.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311242159.hh8MWiAm-lkp@intel.com/
Fixes: 3c96dd170efe ("drm/imagination: Add GEM and VM related code")
Signed-off-by: Donald Robson <donald.robson@imgtec.com>
---
 drivers/gpu/drm/imagination/pvr_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagination/pvr_vm.c
index 04f7d0cf4188..89eb6ee1bbcf 100644
--- a/drivers/gpu/drm/imagination/pvr_vm.c
+++ b/drivers/gpu/drm/imagination/pvr_vm.c
@@ -528,7 +528,7 @@ pvr_device_addr_and_size_are_valid(u64 device_addr, u64 size)
 	       (device_addr + size <= PVR_PAGE_TABLE_ADDR_SPACE_SIZE);
 }
 
-void pvr_gpuvm_free(struct drm_gpuvm *gpuvm)
+static void pvr_gpuvm_free(struct drm_gpuvm *gpuvm)
 {
 
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 5/5] drm/imagination: Removed unused function to_pvr_vm_gpuva()
  2023-11-30 16:00 [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool Donald Robson
                   ` (2 preceding siblings ...)
  2023-11-30 16:00 ` [PATCH v2 4/5] drm/imagination: pvr_gpuvm_free() " Donald Robson
@ 2023-11-30 16:00 ` Donald Robson
  2023-12-01  8:37   ` (subset) " Maxime Ripard
  2023-12-01  8:37 ` (subset) [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool Maxime Ripard
  4 siblings, 1 reply; 10+ messages in thread
From: Donald Robson @ 2023-11-30 16:00 UTC (permalink / raw)
  To: dri-devel, linux-kernel
  Cc: donald.robson, matt.coster, frank.binns, boris.brezillon,
	maarten.lankhorst, mripard, tzimmermann, airlied, daniel,
	kernel test robot

This function is now unused, hence it causes a compiler warning.

   drivers/gpu/drm/imagination/pvr_vm.c:112:22: warning: unused function 'to_pvr_vm_gpuva' [-Wunused-function]
     112 | struct pvr_vm_gpuva *to_pvr_vm_gpuva(struct drm_gpuva *gpuva)
         |                      ^

Remove the function for now.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311242159.hh8MWiAm-lkp@intel.com/
Fixes: 3c96dd170efe ("drm/imagination: Add GEM and VM related code")
Signed-off-by: Donald Robson <donald.robson@imgtec.com>
---
 drivers/gpu/drm/imagination/pvr_vm.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagination/pvr_vm.c
index 89eb6ee1bbcf..375a03707f4e 100644
--- a/drivers/gpu/drm/imagination/pvr_vm.c
+++ b/drivers/gpu/drm/imagination/pvr_vm.c
@@ -108,12 +108,6 @@ struct pvr_vm_gpuva {
 	struct drm_gpuva base;
 };
 
-static __always_inline
-struct pvr_vm_gpuva *to_pvr_vm_gpuva(struct drm_gpuva *gpuva)
-{
-	return container_of(gpuva, struct pvr_vm_gpuva, base);
-}
-
 enum pvr_vm_bind_type {
 	PVR_VM_BIND_TYPE_MAP,
 	PVR_VM_BIND_TYPE_UNMAP,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (subset) [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool
  2023-11-30 16:00 [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool Donald Robson
                   ` (3 preceding siblings ...)
  2023-11-30 16:00 ` [PATCH v2 5/5] drm/imagination: Removed unused function to_pvr_vm_gpuva() Donald Robson
@ 2023-12-01  8:37 ` Maxime Ripard
  4 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2023-12-01  8:37 UTC (permalink / raw)
  To: dri-devel, linux-kernel, Donald Robson
  Cc: matt.coster, frank.binns, boris.brezillon, maarten.lankhorst,
	tzimmermann, airlied, daniel, kernel test robot

On Thu, 30 Nov 2023 16:00:13 +0000, Donald Robson wrote:
> This line appears to confuse the compiler and had been noticed previously in
> clang-tidy output. There isn't anything fundamentally wrong that I can see.
> I suspect that it just looks like a mistake - hence the first note.  By making
> the second operand an actual bool result, const correctness can be preserved
> while silencing the warning.
> 
> >> drivers/gpu/drm/imagination/pvr_device_info.c:230:47: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
>      230 |         } else if (features_size == mapping_max_size && (mapping_max & 63)) {
>          |                                                      ^  ~~~~~~~~~~~~~~~~~~
>    drivers/gpu/drm/imagination/pvr_device_info.c:230:47: note: use '&' for a bitwise operation
>      230 |         } else if (features_size == mapping_max_size && (mapping_max & 63)) {
>          |                                                      ^~
>          |                                                      &
>    drivers/gpu/drm/imagination/pvr_device_info.c:230:47: note: remove constant to silence this warning
>      230 |         } else if (features_size == mapping_max_size && (mapping_max & 63)) {
>          |                                                     ~^~~~~~~~~~~~~~~~~~~~~
>    1 warning generated.
> 
> [...]

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (subset) [PATCH v2 2/5] drm/imagination: Fixed missing header in pvr_fw_meta
  2023-11-30 16:00 ` [PATCH v2 2/5] drm/imagination: Fixed missing header in pvr_fw_meta Donald Robson
@ 2023-12-01  8:37   ` Maxime Ripard
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2023-12-01  8:37 UTC (permalink / raw)
  To: dri-devel, linux-kernel, Donald Robson
  Cc: matt.coster, frank.binns, boris.brezillon, maarten.lankhorst,
	tzimmermann, airlied, daniel, Arnd Bergmann, kernel test robot

On Thu, 30 Nov 2023 16:00:14 +0000, Donald Robson wrote:
> A missing header causes the compiler to warn that the function below is not
> forward declared.
> 
> >> drivers/gpu/drm/imagination/pvr_fw_meta.c:33:1: warning: no previous prototype for function 'pvr_meta_cr_read32' [-Wmissing-prototypes]
>       33 | pvr_meta_cr_read32(struct pvr_device *pvr_dev, u32 reg_addr, u32 *reg_value_out)
>          | ^
>    drivers/gpu/drm/imagination/pvr_fw_meta.c:32:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
>       32 | int
>          | ^
>          | static
>    1 warning generated.
> 
> [...]

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (subset) [PATCH v2 3/5] drm/imagination: pvr_device_process_active_queues now static
  2023-11-30 16:00 ` [PATCH v2 3/5] drm/imagination: pvr_device_process_active_queues now static Donald Robson
@ 2023-12-01  8:37   ` Maxime Ripard
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2023-12-01  8:37 UTC (permalink / raw)
  To: dri-devel, linux-kernel, Donald Robson
  Cc: matt.coster, frank.binns, boris.brezillon, maarten.lankhorst,
	tzimmermann, airlied, daniel, Arnd Bergmann, kernel test robot

On Thu, 30 Nov 2023 16:00:15 +0000, Donald Robson wrote:
> The function below is used only within this source file, but is not static.
> 
> >> drivers/gpu/drm/imagination/pvr_device.c:129:6: warning: no previous prototype for function 'pvr_device_process_active_queues' [-Wmissing-prototypes]
>      129 | void pvr_device_process_active_queues(struct pvr_device *pvr_dev)
>          |      ^
>    drivers/gpu/drm/imagination/pvr_device.c:129:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
>      129 | void pvr_device_process_active_queues(struct pvr_device *pvr_dev)
>          | ^
>          | static
>    1 warning generated.
> 
> [...]

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (subset) [PATCH v2 4/5] drm/imagination: pvr_gpuvm_free() now static
  2023-11-30 16:00 ` [PATCH v2 4/5] drm/imagination: pvr_gpuvm_free() " Donald Robson
@ 2023-12-01  8:37   ` Maxime Ripard
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2023-12-01  8:37 UTC (permalink / raw)
  To: dri-devel, linux-kernel, Donald Robson
  Cc: matt.coster, frank.binns, boris.brezillon, maarten.lankhorst,
	tzimmermann, airlied, daniel, Arnd Bergmann, kernel test robot

On Thu, 30 Nov 2023 16:00:16 +0000, Donald Robson wrote:
> The function below is used only within this source file, but is not static.
> 
> drivers/gpu/drm/imagination/pvr_vm.c:542:6: error: no previous prototype for 'pvr_gpuvm_free' [-Werror=missing-prototypes]
>   542 | void pvr_gpuvm_free(struct drm_gpuvm *gpuvm)
> 
> Make it static.
> 
> [...]

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (subset) [PATCH v2 5/5] drm/imagination: Removed unused function to_pvr_vm_gpuva()
  2023-11-30 16:00 ` [PATCH v2 5/5] drm/imagination: Removed unused function to_pvr_vm_gpuva() Donald Robson
@ 2023-12-01  8:37   ` Maxime Ripard
  0 siblings, 0 replies; 10+ messages in thread
From: Maxime Ripard @ 2023-12-01  8:37 UTC (permalink / raw)
  To: dri-devel, linux-kernel, Donald Robson
  Cc: matt.coster, frank.binns, boris.brezillon, maarten.lankhorst,
	tzimmermann, airlied, daniel, kernel test robot

On Thu, 30 Nov 2023 16:00:17 +0000, Donald Robson wrote:
> This function is now unused, hence it causes a compiler warning.
> 
>    drivers/gpu/drm/imagination/pvr_vm.c:112:22: warning: unused function 'to_pvr_vm_gpuva' [-Wunused-function]
>      112 | struct pvr_vm_gpuva *to_pvr_vm_gpuva(struct drm_gpuva *gpuva)
>          |                      ^
> 
> Remove the function for now.
> 
> [...]

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-12-01  8:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30 16:00 [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool Donald Robson
2023-11-30 16:00 ` [PATCH v2 2/5] drm/imagination: Fixed missing header in pvr_fw_meta Donald Robson
2023-12-01  8:37   ` (subset) " Maxime Ripard
2023-11-30 16:00 ` [PATCH v2 3/5] drm/imagination: pvr_device_process_active_queues now static Donald Robson
2023-12-01  8:37   ` (subset) " Maxime Ripard
2023-11-30 16:00 ` [PATCH v2 4/5] drm/imagination: pvr_gpuvm_free() " Donald Robson
2023-12-01  8:37   ` (subset) " Maxime Ripard
2023-11-30 16:00 ` [PATCH v2 5/5] drm/imagination: Removed unused function to_pvr_vm_gpuva() Donald Robson
2023-12-01  8:37   ` (subset) " Maxime Ripard
2023-12-01  8:37 ` (subset) [PATCH v2 1/5] drm/imagination: Fixed warning due to implicit cast to bool Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®