diff mbox series

[net-next,3/3] net: phy: mscc: use new PTP_MSGTYPE_* defines

Message ID 20201122082636.12451-4-ceggers@arri.de (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: ptp: use common defines for PTP message types in further drivers | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit fail Errors and warnings before: 16 this patch: 8
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: Christian Eggers <ceggers@arri.de>' != 'Signed-off-by: Christian Eggers <ceggers@gmx.de>'
netdev/build_allmodconfig_warn fail Errors and warnings before: 8 this patch: 8
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Christian Eggers Nov. 22, 2020, 8:26 a.m. UTC
Use recently introduced PTP_MSGTYPE_SYNC and PTP_MSGTYPE_DELAY_REQ
defines instead of a driver internal enumeration.

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Cc: Quentin Schulz <quentin.schulz@bootlin.com>
Cc: Antoine Tenart <atenart@kernel.org>
Cc: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/phy/mscc/mscc_ptp.c | 14 +++++++-------
 drivers/net/phy/mscc/mscc_ptp.h |  5 -----
 2 files changed, 7 insertions(+), 12 deletions(-)

Comments

kernel test robot Nov. 22, 2020, 9:42 a.m. UTC | #1
Hi Christian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Christian-Eggers/net-ptp-use-common-defines-for-PTP-message-types-in-further-drivers/20201122-163319
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git f9e425e99b0756c1479042afe761073779df2a30
config: sparc-randconfig-r012-20201122 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/78cc4b0e1739511ed9712c9466a48ddc6885d153
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Christian-Eggers/net-ptp-use-common-defines-for-PTP-message-types-in-further-drivers/20201122-163319
        git checkout 78cc4b0e1739511ed9712c9466a48ddc6885d153
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/net/phy/mscc/mscc_ptp.c: In function 'vsc85xx_ptp_cmp_init':
   drivers/net/phy/mscc/mscc_ptp.c:510:3: error: 'PTP_MSGTYPE_SYNC' undeclared (first use in this function); did you mean 'CSD_TYPE_SYNC'?
     510 |   PTP_MSGTYPE_SYNC,
         |   ^~~~~~~~~~~~~~~~
         |   CSD_TYPE_SYNC
   drivers/net/phy/mscc/mscc_ptp.c:510:3: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/phy/mscc/mscc_ptp.c:511:3: error: 'PTP_MSGTYPE_DELAY_REQ' undeclared (first use in this function)
     511 |   PTP_MSGTYPE_DELAY_REQ
         |   ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/mscc/mscc_ptp.c: In function 'vsc85xx_ptp_conf':
   drivers/net/phy/mscc/mscc_ptp.c:851:3: error: 'PTP_MSGTYPE_SYNC' undeclared (first use in this function); did you mean 'CSD_TYPE_SYNC'?
     851 |   PTP_MSGTYPE_SYNC,
         |   ^~~~~~~~~~~~~~~~
         |   CSD_TYPE_SYNC
>> drivers/net/phy/mscc/mscc_ptp.c:851:3: warning: initialization of 'unsigned char' from 'u8 *' {aka 'unsigned char *'} makes integer from pointer without a cast [-Wint-conversion]
   drivers/net/phy/mscc/mscc_ptp.c:851:3: note: (near initialization for 'msgs[0]')
   drivers/net/phy/mscc/mscc_ptp.c:852:3: error: 'PTP_MSGTYPE_DELAY_REQ' undeclared (first use in this function)
     852 |   PTP_MSGTYPE_DELAY_REQ
         |   ^~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/mscc/mscc_ptp.c:852:3: warning: initialization of 'unsigned char' from 'u8 *' {aka 'unsigned char *'} makes integer from pointer without a cast [-Wint-conversion]
   drivers/net/phy/mscc/mscc_ptp.c:852:3: note: (near initialization for 'msgs[1]')
>> drivers/net/phy/mscc/mscc_ptp.c:861:20: warning: comparison between pointer and integer
     861 |   else if (msgs[i] == PTP_MSGTYPE_SYNC && one_step)
         |                    ^~

vim +851 drivers/net/phy/mscc/mscc_ptp.c

   846	
   847	static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk,
   848				    bool one_step, bool enable)
   849	{
   850		u8 msgs[] = {
 > 851			PTP_MSGTYPE_SYNC,
   852			PTP_MSGTYPE_DELAY_REQ
   853		};
   854		u32 val;
   855		u8 i;
   856	
   857		for (i = 0; i < ARRAY_SIZE(msgs); i++) {
   858			if (blk == INGRESS)
   859				vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
   860							   PTP_WRITE_NS);
 > 861			else if (msgs[i] == PTP_MSGTYPE_SYNC && one_step)
   862				/* no need to know Sync t when sending in one_step */
   863				vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
   864							   PTP_WRITE_1588);
   865			else
   866				vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
   867							   PTP_SAVE_IN_TS_FIFO);
   868	
   869			val = vsc85xx_ts_read_csr(phydev, blk,
   870						  MSCC_ANA_PTP_FLOW_ENA(i));
   871			val &= ~PTP_FLOW_ENA;
   872			if (enable)
   873				val |= PTP_FLOW_ENA;
   874			vsc85xx_ts_write_csr(phydev, blk, MSCC_ANA_PTP_FLOW_ENA(i),
   875					     val);
   876		}
   877	
   878		return 0;
   879	}
   880	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Antoine Tenart Nov. 23, 2020, 9:05 a.m. UTC | #2
Hello Christian,

Quoting Christian Eggers (2020-11-22 09:26:36)
> Use recently introduced PTP_MSGTYPE_SYNC and PTP_MSGTYPE_DELAY_REQ
> defines instead of a driver internal enumeration.
> 
> Signed-off-by: Christian Eggers <ceggers@gmx.de>

Reviewed-by: Antoine Tenart <atenart@kernel.org>

Thanks!
Antoine

> Cc: Quentin Schulz <quentin.schulz@bootlin.com>
> Cc: Antoine Tenart <atenart@kernel.org>
> Cc: Antoine Tenart <antoine.tenart@bootlin.com>
> ---
>  drivers/net/phy/mscc/mscc_ptp.c | 14 +++++++-------
>  drivers/net/phy/mscc/mscc_ptp.h |  5 -----
>  2 files changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/phy/mscc/mscc_ptp.c b/drivers/net/phy/mscc/mscc_ptp.c
> index d8a61456d1ce..924ed5b034a4 100644
> --- a/drivers/net/phy/mscc/mscc_ptp.c
> +++ b/drivers/net/phy/mscc/mscc_ptp.c
> @@ -506,9 +506,9 @@ static int vsc85xx_ptp_cmp_init(struct phy_device *phydev, enum ts_blk blk)
>  {
>         struct vsc8531_private *vsc8531 = phydev->priv;
>         bool base = phydev->mdio.addr == vsc8531->ts_base_addr;
> -       enum vsc85xx_ptp_msg_type msgs[] = {
> -               PTP_MSG_TYPE_SYNC,
> -               PTP_MSG_TYPE_DELAY_REQ
> +       u8 msgs[] = {
> +               PTP_MSGTYPE_SYNC,
> +               PTP_MSGTYPE_DELAY_REQ
>         };
>         u32 val;
>         u8 i;
> @@ -847,9 +847,9 @@ static int vsc85xx_ts_ptp_action_flow(struct phy_device *phydev, enum ts_blk blk
>  static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk,
>                             bool one_step, bool enable)
>  {
> -       enum vsc85xx_ptp_msg_type msgs[] = {
> -               PTP_MSG_TYPE_SYNC,
> -               PTP_MSG_TYPE_DELAY_REQ
> +       u8 msgs[] = {
> +               PTP_MSGTYPE_SYNC,
> +               PTP_MSGTYPE_DELAY_REQ
>         };
>         u32 val;
>         u8 i;
> @@ -858,7 +858,7 @@ static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk,
>                 if (blk == INGRESS)
>                         vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
>                                                    PTP_WRITE_NS);
> -               else if (msgs[i] == PTP_MSG_TYPE_SYNC && one_step)
> +               else if (msgs[i] == PTP_MSGTYPE_SYNC && one_step)
>                         /* no need to know Sync t when sending in one_step */
>                         vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
>                                                    PTP_WRITE_1588);
> diff --git a/drivers/net/phy/mscc/mscc_ptp.h b/drivers/net/phy/mscc/mscc_ptp.h
> index 3ea163af0f4f..da3465360e90 100644
> --- a/drivers/net/phy/mscc/mscc_ptp.h
> +++ b/drivers/net/phy/mscc/mscc_ptp.h
> @@ -436,11 +436,6 @@ enum ptp_cmd {
>         PTP_SAVE_IN_TS_FIFO = 11, /* invalid when writing in reg */
>  };
>  
> -enum vsc85xx_ptp_msg_type {
> -       PTP_MSG_TYPE_SYNC,
> -       PTP_MSG_TYPE_DELAY_REQ,
> -};
> -
>  struct vsc85xx_ptphdr {
>         u8 tsmt; /* transportSpecific | messageType */
>         u8 ver;  /* reserved0 | versionPTP */
> -- 
> Christian Eggers
> Embedded software developer
>
diff mbox series

Patch

diff --git a/drivers/net/phy/mscc/mscc_ptp.c b/drivers/net/phy/mscc/mscc_ptp.c
index d8a61456d1ce..924ed5b034a4 100644
--- a/drivers/net/phy/mscc/mscc_ptp.c
+++ b/drivers/net/phy/mscc/mscc_ptp.c
@@ -506,9 +506,9 @@  static int vsc85xx_ptp_cmp_init(struct phy_device *phydev, enum ts_blk blk)
 {
 	struct vsc8531_private *vsc8531 = phydev->priv;
 	bool base = phydev->mdio.addr == vsc8531->ts_base_addr;
-	enum vsc85xx_ptp_msg_type msgs[] = {
-		PTP_MSG_TYPE_SYNC,
-		PTP_MSG_TYPE_DELAY_REQ
+	u8 msgs[] = {
+		PTP_MSGTYPE_SYNC,
+		PTP_MSGTYPE_DELAY_REQ
 	};
 	u32 val;
 	u8 i;
@@ -847,9 +847,9 @@  static int vsc85xx_ts_ptp_action_flow(struct phy_device *phydev, enum ts_blk blk
 static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk,
 			    bool one_step, bool enable)
 {
-	enum vsc85xx_ptp_msg_type msgs[] = {
-		PTP_MSG_TYPE_SYNC,
-		PTP_MSG_TYPE_DELAY_REQ
+	u8 msgs[] = {
+		PTP_MSGTYPE_SYNC,
+		PTP_MSGTYPE_DELAY_REQ
 	};
 	u32 val;
 	u8 i;
@@ -858,7 +858,7 @@  static int vsc85xx_ptp_conf(struct phy_device *phydev, enum ts_blk blk,
 		if (blk == INGRESS)
 			vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
 						   PTP_WRITE_NS);
-		else if (msgs[i] == PTP_MSG_TYPE_SYNC && one_step)
+		else if (msgs[i] == PTP_MSGTYPE_SYNC && one_step)
 			/* no need to know Sync t when sending in one_step */
 			vsc85xx_ts_ptp_action_flow(phydev, blk, msgs[i],
 						   PTP_WRITE_1588);
diff --git a/drivers/net/phy/mscc/mscc_ptp.h b/drivers/net/phy/mscc/mscc_ptp.h
index 3ea163af0f4f..da3465360e90 100644
--- a/drivers/net/phy/mscc/mscc_ptp.h
+++ b/drivers/net/phy/mscc/mscc_ptp.h
@@ -436,11 +436,6 @@  enum ptp_cmd {
 	PTP_SAVE_IN_TS_FIFO = 11, /* invalid when writing in reg */
 };
 
-enum vsc85xx_ptp_msg_type {
-	PTP_MSG_TYPE_SYNC,
-	PTP_MSG_TYPE_DELAY_REQ,
-};
-
 struct vsc85xx_ptphdr {
 	u8 tsmt; /* transportSpecific | messageType */
 	u8 ver;  /* reserved0 | versionPTP */