diff mbox series

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

Message ID 20240807071538.569784-1-guanjun@linux.alibaba.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next,1/1] net: pse-pd: tps23881: Fix the compiler error about implicit declaration of function ‘FIELD_GET’ | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 29 this patch: 29
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 29 this patch: 29
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes fail Problems with Fixes tag: 1
netdev/build_allmodconfig_warn success Errors and warnings before: 29 this patch: 29
netdev/checkpatch warning WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: ("net: pse-pd: tps23881: Fix the device ID check")' WARNING: Unknown commit id '89108cb5c285', maybe rebased or not pulled?
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-07--09-00 (tests: 707)

Commit Message

mapicccy Aug. 7, 2024, 7:15 a.m. UTC
From: Guanjun <guanjun@linux.alibaba.com>

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)
Signed-off-by: Guanjun <guanjun@linux.alibaba.com>
---
 drivers/net/pse-pd/tps23881.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Oleksij Rempel Aug. 7, 2024, 9:10 a.m. UTC | #1
On Wed, Aug 07, 2024 at 03:15:38PM +0800, 'Guanjun' wrote:
> From: Guanjun <guanjun@linux.alibaba.com>
> 
> 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)
> Signed-off-by: Guanjun <guanjun@linux.alibaba.com>

Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Thank you!

Regards,
Oleksij
Jakub Kicinski Aug. 8, 2024, 3:37 p.m. UTC | #2
On Wed,  7 Aug 2024 15:15:38 +0800 'Guanjun' wrote:
> From: Guanjun <guanjun@linux.alibaba.com>
> 
> 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)
> Signed-off-by: Guanjun <guanjun@linux.alibaba.com>
> ---
>  drivers/net/pse-pd/tps23881.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
> index f90db758554b..fa947e30e2ba 100644
> --- a/drivers/net/pse-pd/tps23881.c
> +++ b/drivers/net/pse-pd/tps23881.c
> @@ -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/20240807075455.2055224-1-arnd@kernel.org/
diff mbox series

Patch

diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
index f90db758554b..fa947e30e2ba 100644
--- a/drivers/net/pse-pd/tps23881.c
+++ b/drivers/net/pse-pd/tps23881.c
@@ -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>