[rmk-arm:zii 131/148] drivers/net/dsa/mt7530.c:2703:43: error: passing argument 3 of 'dsa_port_phylink_set_pcs' from incompatible pointer type
From: kernel test robot
Date: Mon Nov 22 2021 - 18:12:16 EST
tree: git://git.armlinux.org.uk/~rmk/linux-arm zii
head: 0beed941d41c6668ce945aeab374fc7e1ba652a8
commit: be290dbacc27ecb335b6317742d2230818f7c3f6 [131/148] net: dsa: mt7530: partially convert to phylink_pcs *EXPERIMENTAL*
config: i386-randconfig-r011-20211122 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
git remote add rmk-arm git://git.armlinux.org.uk/~rmk/linux-arm
git fetch --no-tags rmk-arm zii
git checkout be290dbacc27ecb335b6317742d2230818f7c3f6
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
drivers/net/dsa/mt7530.c: In function 'mt753x_phylink_mac_prepare':
>> drivers/net/dsa/mt7530.c:2703:43: error: passing argument 3 of 'dsa_port_phylink_set_pcs' from incompatible pointer type [-Werror=incompatible-pointer-types]
2703 | dsa_port_phylink_set_pcs(priv->ds, port, &priv->pcs[port]);
| ^~~~~~~~~~~~~~~~
| |
| struct mt753x_pcs *
In file included from drivers/net/dsa/mt7530.c:23:
include/net/dsa.h:1096:30: note: expected 'struct phylink_pcs *' but argument is of type 'struct mt753x_pcs *'
1096 | struct phylink_pcs *pcs);
| ~~~~~~~~~~~~~~~~~~~~^~~
drivers/net/dsa/mt7530.c: In function 'mt7531_cpu_port_config':
>> drivers/net/dsa/mt7530.c:2874:45: error: 'struct mt753x_pcs' has no member named 'phylink_pcs'
2874 | mt753x_phylink_pcs_link_up(&priv->pcs[port].phylink_pcs, MLO_AN_FIXED,
| ^
drivers/net/dsa/mt7530.c: At top level:
>> drivers/net/dsa/mt7530.c:3016:18: error: initialization of 'int (*)(struct phylink_pcs *, long unsigned int *, struct phylink_link_state *)' from incompatible pointer type 'void (*)(struct phylink_pcs *, long unsigned int *, struct phylink_link_state *)' [-Werror=incompatible-pointer-types]
3016 | .pcs_validate = mt753x_pcs_validate,
| ^~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mt7530.c:3016:18: note: (near initialization for 'mt7530_pcs_ops.pcs_validate')
drivers/net/dsa/mt7530.c:3023:18: error: initialization of 'int (*)(struct phylink_pcs *, long unsigned int *, struct phylink_link_state *)' from incompatible pointer type 'void (*)(struct phylink_pcs *, long unsigned int *, struct phylink_link_state *)' [-Werror=incompatible-pointer-types]
3023 | .pcs_validate = mt753x_pcs_validate,
| ^~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mt7530.c:3023:18: note: (near initialization for 'mt7531_pcs_ops.pcs_validate')
drivers/net/dsa/mt7530.c: In function 'mt753x_setup':
>> drivers/net/dsa/mt7530.c:3050:19: error: 'priv->pcs[i].pcs' is a pointer; did you mean to use '->'?
3050 | priv->pcs[i].pcs.ops = priv->pcs_ops;
| ^
| ->
>> drivers/net/dsa/mt7530.c:3050:30: error: 'struct mt7530_priv' has no member named 'pcs_ops'
3050 | priv->pcs[i].pcs.ops = priv->pcs_ops;
| ^~
drivers/net/dsa/mt7530.c: At top level:
>> drivers/net/dsa/mt7530.c:3116:25: error: initialization of 'int (*)(struct dsa_switch *, int, unsigned int, phy_interface_t)' {aka 'int (*)(struct dsa_switch *, int, unsigned int, enum <anonymous>)'} from incompatible pointer type 'void (*)(struct dsa_switch *, int, unsigned int, phy_interface_t)' {aka 'void (*)(struct dsa_switch *, int, unsigned int, enum <anonymous>)'} [-Werror=incompatible-pointer-types]
3116 | .phylink_mac_prepare = mt753x_phylink_mac_prepare,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/mt7530.c:3116:25: note: (near initialization for 'mt7530_switch_ops.phylink_mac_prepare')
cc1: some warnings being treated as errors
vim +/dsa_port_phylink_set_pcs +2703 drivers/net/dsa/mt7530.c
2695
2696 static void
2697 mt753x_phylink_mac_prepare(struct dsa_switch *ds, int port, unsigned int mode,
2698 phy_interface_t interface)
2699 {
2700 struct mt7530_priv *priv = ds->priv;
2701
2702 /* Attach our PCS */
> 2703 dsa_port_phylink_set_pcs(priv->ds, port, &priv->pcs[port]);
2704 }
2705
2706 static void
2707 mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
2708 const struct phylink_link_state *state)
2709 {
2710 struct mt7530_priv *priv = ds->priv;
2711 u32 mcr_cur, mcr_new;
2712
2713 switch (port) {
2714 case 0 ... 4: /* Internal phy */
2715 if (state->interface != PHY_INTERFACE_MODE_GMII)
2716 goto unsupported;
2717 break;
2718 case 5: /* 2nd cpu port with phy of port 0 or 4 / external phy */
2719 if (priv->p5_interface == state->interface)
2720 break;
2721
2722 if (mt753x_mac_config(ds, port, mode, state) < 0)
2723 goto unsupported;
2724
2725 if (priv->p5_intf_sel != P5_DISABLED)
2726 priv->p5_interface = state->interface;
2727 break;
2728 case 6: /* 1st cpu port */
2729 if (priv->p6_interface == state->interface)
2730 break;
2731
2732 mt753x_pad_setup(ds, state);
2733
2734 if (mt753x_mac_config(ds, port, mode, state) < 0)
2735 goto unsupported;
2736
2737 priv->p6_interface = state->interface;
2738 break;
2739 default:
2740 unsupported:
2741 dev_err(ds->dev, "%s: unsupported %s port: %i\n",
2742 __func__, phy_modes(state->interface), port);
2743 return;
2744 }
2745
2746 if (phylink_autoneg_inband(mode) &&
2747 state->interface != PHY_INTERFACE_MODE_SGMII) {
2748 dev_err(ds->dev, "%s: in-band negotiation unsupported\n",
2749 __func__);
2750 return;
2751 }
2752
2753 mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port));
2754 mcr_new = mcr_cur;
2755 mcr_new &= ~PMCR_LINK_SETTINGS_MASK;
2756 mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN |
2757 PMCR_BACKPR_EN | PMCR_FORCE_MODE_ID(priv->id);
2758
2759 /* Are we connected to external phy */
2760 if (port == 5 && dsa_is_user_port(ds, 5))
2761 mcr_new |= PMCR_EXT_PHY;
2762
2763 if (mcr_new != mcr_cur)
2764 mt7530_write(priv, MT7530_PMCR_P(port), mcr_new);
2765 }
2766
2767 static void mt753x_phylink_mac_link_down(struct dsa_switch *ds, int port,
2768 unsigned int mode,
2769 phy_interface_t interface)
2770 {
2771 struct mt7530_priv *priv = ds->priv;
2772
2773 mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK);
2774 }
2775
2776 static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port,
2777 unsigned int mode,
2778 phy_interface_t interface,
2779 struct phy_device *phydev,
2780 int speed, int duplex,
2781 bool tx_pause, bool rx_pause)
2782 {
2783 struct mt7530_priv *priv = ds->priv;
2784 u32 mcr;
2785
2786 mcr = PMCR_RX_EN | PMCR_TX_EN | PMCR_FORCE_LNK;
2787
2788 /* MT753x MAC works in 1G full duplex mode for all up-clocked
2789 * variants.
2790 */
2791 if (interface == PHY_INTERFACE_MODE_TRGMII ||
2792 (phy_interface_mode_is_8023z(interface))) {
2793 speed = SPEED_1000;
2794 duplex = DUPLEX_FULL;
2795 }
2796
2797 switch (speed) {
2798 case SPEED_1000:
2799 mcr |= PMCR_FORCE_SPEED_1000;
2800 break;
2801 case SPEED_100:
2802 mcr |= PMCR_FORCE_SPEED_100;
2803 break;
2804 }
2805 if (duplex == DUPLEX_FULL) {
2806 mcr |= PMCR_FORCE_FDX;
2807 if (tx_pause)
2808 mcr |= PMCR_TX_FC_EN;
2809 if (rx_pause)
2810 mcr |= PMCR_RX_FC_EN;
2811 }
2812
2813 if (mode == MLO_AN_PHY && phydev && phy_init_eee(phydev, 0) >= 0) {
2814 switch (speed) {
2815 case SPEED_1000:
2816 mcr |= PMCR_FORCE_EEE1G;
2817 break;
2818 case SPEED_100:
2819 mcr |= PMCR_FORCE_EEE100;
2820 break;
2821 }
2822 }
2823
2824 mt7530_set(priv, MT7530_PMCR_P(port), mcr);
2825 }
2826
2827 static void mt753x_phylink_pcs_link_up(struct phylink_pcs *pcs,
2828 unsigned int mode,
2829 phy_interface_t interface,
2830 int speed, int duplex)
2831 {
2832 if (pcs->ops->pcs_link_up)
2833 pcs->ops->pcs_link_up(pcs, mode, interface, speed, duplex);
2834 }
2835
2836 static int
2837 mt7531_cpu_port_config(struct dsa_switch *ds, int port)
2838 {
2839 struct mt7530_priv *priv = ds->priv;
2840 phy_interface_t interface;
2841 int speed;
2842 int ret;
2843
2844 switch (port) {
2845 case 5:
2846 if (mt7531_is_rgmii_port(priv, port))
2847 interface = PHY_INTERFACE_MODE_RGMII;
2848 else
2849 interface = PHY_INTERFACE_MODE_2500BASEX;
2850
2851 priv->p5_interface = interface;
2852 break;
2853 case 6:
2854 interface = PHY_INTERFACE_MODE_2500BASEX;
2855
2856 mt7531_pad_setup(ds, interface);
2857
2858 priv->p6_interface = interface;
2859 break;
2860 default:
2861 return -EINVAL;
2862 }
2863
2864 if (interface == PHY_INTERFACE_MODE_2500BASEX)
2865 speed = SPEED_2500;
2866 else
2867 speed = SPEED_1000;
2868
2869 ret = mt7531_mac_config(ds, port, MLO_AN_FIXED, interface);
2870 if (ret)
2871 return ret;
2872 mt7530_write(priv, MT7530_PMCR_P(port),
2873 PMCR_CPU_PORT_SETTING(priv->id));
> 2874 mt753x_phylink_pcs_link_up(&priv->pcs[port].phylink_pcs, MLO_AN_FIXED,
2875 interface, speed, DUPLEX_FULL);
2876 mt753x_phylink_mac_link_up(ds, port, MLO_AN_FIXED, interface, NULL,
2877 speed, DUPLEX_FULL, true, true);
2878
2879 return 0;
2880 }
2881
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip