Skip to contentSkip to conversation

net: pse-pd: tps23881: Fix the compiler error about implicit declaration of function ‘FIELD_GET’

PATCH In review 'Guanjun' 3 participants 3 messages Aug 7, 2024 – Aug 8, 2024

Subsystems (3)
lore
Share & tools
lore

'Guanjun'

author
#0 lore raw

PATCH 1/1 net: pse-pd: tps23881: Fix the compiler error about implicit declaration of function ‘FIELD_GET’

From: Guanjun <[email protected]>

bitfield.h is not explicitly included but it is required for FIELD_GET.
There will be a compiler error:
drivers/net/pse-pd/tps23881.c: In function ‘tps23881_i2c_probe’:
drivers/net/pse-pd/tps23881.c:755:6: error: implicit declaration of function ‘FIELD_GET’ [-Werror=implicit-function-declaration]

    755 |  if (FIELD_GET(TPS23881_REG_DEVID_MASK, ret) != TPS23881_DEVICE_ID) {
        |      ^~~~~~~~~

cc1: some warnings being treated as errors

Fixes 89108cb5c285 (net: pse-pd: tps23881: Fix the device ID check)
---
 drivers/net/pse-pd/tps23881.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/pse-pd/tps23881.c +1 -0
index f90db758554b..fa947e30e2ba 100644
@@ -10,6 +10,7 @@
 #include <linux/i2c.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/bitfield.h>
 #include <linux/platform_device.h>
 #include <linux/pse-pd/pse.h>
 
Signature · 1 line
2.43.5
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Guanjun

From: Guanjun <[email protected]>

bitfield.h is not explicitly included but it is required for FIELD_GET.
There will be a compiler error:
drivers/net/pse-pd/tps23881.c: In function ‘tps23881_i2c_probe’:
drivers/net/pse-pd/tps23881.c:755:6: error: implicit declaration of function ‘FIELD_GET’ [-Werror=implicit-function-declaration]

Quoted 6 lines
    755 |  if (FIELD_GET(TPS23881_REG_DEVID_MASK, ret) != TPS23881_DEVICE_ID) {
        |      ^~~~~~~~~

cc1: some warnings being treated as errors

Fixes 89108cb5c285 (net: pse-pd: tps23881: Fix the device ID check)

Thank you!

Regards,
Oleksij

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
maintainer
#2 lore raw
In reply to 'Guanjun'
Quoted 21 lines · On Wed, 7 Aug 2024 15:15:38 +0800 'Guanjun' wrote:

From: Guanjun <[email protected]>

bitfield.h is not explicitly included but it is required for FIELD_GET.
There will be a compiler error:
drivers/net/pse-pd/tps23881.c: In function ‘tps23881_i2c_probe’:
drivers/net/pse-pd/tps23881.c:755:6: error: implicit declaration of function ‘FIELD_GET’ [-Werror=implicit-function-declaration]

    755 |  if (FIELD_GET(TPS23881_REG_DEVID_MASK, ret) != TPS23881_DEVICE_ID) {
        |      ^~~~~~~~~

cc1: some warnings being treated as errors

Fixes 89108cb5c285 (net: pse-pd: tps23881: Fix the device ID check)
---
 drivers/net/pse-pd/tps23881.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/pse-pd/tps23881.c +0 -0
index f90db758554b..fa947e30e2ba 100644

drivers/net/pse-pd/tps23881.c line 16

Quoted 7 lines
drivers/net/pse-pd/tps23881.c +1 -0
@@ -10,6 +10,7 @@
 #include <linux/i2c.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/bitfield.h>
 #include <linux/platform_device.h>
 #include <linux/pse-pd/pse.h>
 

There was another fix posted shortly after which seems better:

https://lore.kernel.org/r/[email protected]/