diff mbox series

[net-next] net: ibm/emac: Constify struct mii_phy_def

Message ID dfc7876d660d700a840e64c35de0a6519e117539.1723031352.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: ibm/emac: Constify struct mii_phy_def | 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: 7 this patch: 7
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 7 this patch: 7
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 success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 80 lines checked
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--18-00 (tests: 704)

Commit Message

Christophe JAILLET Aug. 7, 2024, 11:50 a.m. UTC
'struct mii_phy_def' are not modified in this driver.

Constifying these structures moves some data to a read-only section, so
increase overall security.


On a x86_64, with allmodconfig:
Before:
======
   4901	    464	      0	   5365	   14f5	drivers/net/ethernet/ibm/emac/phy.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
   5127	    240	      0	   5367	   14f7	drivers/net/ethernet/ibm/emac/phy.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only.
---
 drivers/net/ethernet/ibm/emac/phy.c | 18 +++++++++---------
 drivers/net/ethernet/ibm/emac/phy.h |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

Comments

Andrew Lunn Aug. 7, 2024, 1:57 p.m. UTC | #1
On Wed, Aug 07, 2024 at 01:50:31PM +0200, Christophe JAILLET wrote:
> 'struct mii_phy_def' are not modified in this driver.
> 
> Constifying these structures moves some data to a read-only section, so
> increase overall security.
> 
> 
> On a x86_64, with allmodconfig:
> Before:
> ======
>    4901	    464	      0	   5365	   14f5	drivers/net/ethernet/ibm/emac/phy.o
> 
> After:
> =====
>    text	   data	    bss	    dec	    hex	filename
>    5127	    240	      0	   5367	   14f7	drivers/net/ethernet/ibm/emac/phy.o
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
kernel test robot Aug. 7, 2024, 11 p.m. UTC | #2
Hi Christophe,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Christophe-JAILLET/net-ibm-emac-Constify-struct-mii_phy_def/20240807-195146
base:   net-next/main
patch link:    https://lore.kernel.org/r/dfc7876d660d700a840e64c35de0a6519e117539.1723031352.git.christophe.jaillet%40wanadoo.fr
patch subject: [PATCH net-next] net: ibm/emac: Constify struct mii_phy_def
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20240808/202408080631.rKnoa41D-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240808/202408080631.rKnoa41D-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408080631.rKnoa41D-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/net/ethernet/ibm/emac/core.c: In function 'emac_dt_phy_connect':
>> drivers/net/ethernet/ibm/emac/core.c:2648:30: error: assignment of member 'phy_id' in read-only object
    2648 |         dev->phy.def->phy_id = dev->phy_dev->drv->phy_id;
         |                              ^
>> drivers/net/ethernet/ibm/emac/core.c:2649:35: error: assignment of member 'phy_id_mask' in read-only object
    2649 |         dev->phy.def->phy_id_mask = dev->phy_dev->drv->phy_id_mask;
         |                                   ^
>> drivers/net/ethernet/ibm/emac/core.c:2650:28: error: assignment of member 'name' in read-only object
    2650 |         dev->phy.def->name = dev->phy_dev->drv->name;
         |                            ^
>> drivers/net/ethernet/ibm/emac/core.c:2651:27: error: assignment of member 'ops' in read-only object
    2651 |         dev->phy.def->ops = &emac_dt_mdio_phy_ops;
         |                           ^
   drivers/net/ethernet/ibm/emac/core.c: In function 'emac_init_phy':
>> drivers/net/ethernet/ibm/emac/core.c:2818:32: error: assignment of member 'features' in read-only object
    2818 |         dev->phy.def->features &= ~dev->phy_feat_exc;
         |                                ^~


vim +/phy_id +2648 drivers/net/ethernet/ibm/emac/core.c

a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2632  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2633  static int emac_dt_phy_connect(struct emac_instance *dev,
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2634  			       struct device_node *phy_handle)
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2635  {
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2636  	dev->phy.def = devm_kzalloc(&dev->ofdev->dev, sizeof(*dev->phy.def),
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2637  				    GFP_KERNEL);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2638  	if (!dev->phy.def)
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2639  		return -ENOMEM;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2640  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2641  	dev->phy_dev = of_phy_connect(dev->ndev, phy_handle, &emac_adjust_link,
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2642  				      0, dev->phy_mode);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2643  	if (!dev->phy_dev) {
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2644  		dev_err(&dev->ofdev->dev, "failed to connect to PHY.\n");
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2645  		return -ENODEV;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2646  	}
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2647  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20 @2648  	dev->phy.def->phy_id = dev->phy_dev->drv->phy_id;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20 @2649  	dev->phy.def->phy_id_mask = dev->phy_dev->drv->phy_id_mask;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20 @2650  	dev->phy.def->name = dev->phy_dev->drv->name;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20 @2651  	dev->phy.def->ops = &emac_dt_mdio_phy_ops;
3c1bcc8614db10 drivers/net/ethernet/ibm/emac/core.c Andrew Lunn         2018-11-10  2652  	ethtool_convert_link_mode_to_legacy_u32(&dev->phy.features,
3c1bcc8614db10 drivers/net/ethernet/ibm/emac/core.c Andrew Lunn         2018-11-10  2653  						dev->phy_dev->supported);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2654  	dev->phy.address = dev->phy_dev->mdio.addr;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2655  	dev->phy.mode = dev->phy_dev->interface;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2656  	return 0;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2657  }
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2658  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2659  static int emac_dt_phy_probe(struct emac_instance *dev)
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2660  {
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2661  	struct device_node *np = dev->ofdev->dev.of_node;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2662  	struct device_node *phy_handle;
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2663  	int res = 1;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2664  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2665  	phy_handle = of_parse_phandle(np, "phy-handle", 0);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2666  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2667  	if (phy_handle) {
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2668  		res = emac_dt_mdio_probe(dev);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2669  		if (!res) {
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2670  			res = emac_dt_phy_connect(dev, phy_handle);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2671  			if (res)
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2672  				mdiobus_unregister(dev->mii_bus);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2673  		}
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2674  	}
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2675  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2676  	of_node_put(phy_handle);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2677  	return res;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2678  }
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2679  
fe17dc1e2bae85 drivers/net/ethernet/ibm/emac/core.c Bill Pemberton      2012-12-03  2680  static int emac_init_phy(struct emac_instance *dev)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2681  {
61c7a080a5a061 drivers/net/ibm_newemac/core.c       Grant Likely        2010-04-13  2682  	struct device_node *np = dev->ofdev->dev.of_node;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2683  	struct net_device *ndev = dev->ndev;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2684  	u32 phy_map, adv;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2685  	int i;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2686  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2687  	dev->phy.dev = ndev;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2688  	dev->phy.mode = dev->phy_mode;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2689  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2690  	/* PHY-less configuration. */
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2691  	if ((dev->phy_address == 0xffffffff && dev->phy_map == 0xffffffff) ||
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2692  	    of_phy_is_fixed_link(np)) {
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2693  		emac_reset(dev);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2694  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2695  		/* PHY-less configuration. */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2696  		dev->phy.address = -1;
9e3cb29497561c drivers/net/ibm_newemac/core.c       Victor Gallardo     2008-10-01  2697  		dev->phy.features = SUPPORTED_MII;
9e3cb29497561c drivers/net/ibm_newemac/core.c       Victor Gallardo     2008-10-01  2698  		if (emac_phy_supports_gige(dev->phy_mode))
9e3cb29497561c drivers/net/ibm_newemac/core.c       Victor Gallardo     2008-10-01  2699  			dev->phy.features |= SUPPORTED_1000baseT_Full;
9e3cb29497561c drivers/net/ibm_newemac/core.c       Victor Gallardo     2008-10-01  2700  		else
9e3cb29497561c drivers/net/ibm_newemac/core.c       Victor Gallardo     2008-10-01  2701  			dev->phy.features |= SUPPORTED_100baseT_Full;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2702  		dev->phy.pause = 1;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2703  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2704  		if (of_phy_is_fixed_link(np)) {
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2705  			int res = emac_dt_mdio_probe(dev);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2706  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2707  			if (res)
08e39982ef64f8 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2018-09-17  2708  				return res;
08e39982ef64f8 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2018-09-17  2709  
08e39982ef64f8 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2018-09-17  2710  			res = of_phy_register_fixed_link(np);
08e39982ef64f8 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2018-09-17  2711  			dev->phy_dev = of_phy_find_device(np);
08e39982ef64f8 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2018-09-17  2712  			if (res || !dev->phy_dev) {
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2713  				mdiobus_unregister(dev->mii_bus);
08e39982ef64f8 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2018-09-17  2714  				return res ? res : -EINVAL;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2715  			}
08e39982ef64f8 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2018-09-17  2716  			emac_adjust_link(dev->ndev);
08e39982ef64f8 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2018-09-17  2717  			put_device(&dev->phy_dev->mdio.dev);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2718  		}
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2719  		return 0;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2720  	}
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2721  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2722  	mutex_lock(&emac_phy_map_lock);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2723  	phy_map = dev->phy_map | busy_phy_map;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2724  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2725  	DBG(dev, "PHY maps %08x %08x" NL, dev->phy_map, busy_phy_map);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2726  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2727  	dev->phy.mdio_read = emac_mdio_read;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2728  	dev->phy.mdio_write = emac_mdio_write;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2729  
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2730  	/* Enable internal clock source */
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2731  #ifdef CONFIG_PPC_DCR_NATIVE
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2732  	if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX))
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2733  		dcri_clrset(SDR0, SDR0_MFR, 0, SDR0_MFR_ECS);
11121e3008a928 drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2734  #endif
11121e3008a928 drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2735  	/* PHY clock workaround */
11121e3008a928 drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2736  	emac_rx_clk_tx(dev);
11121e3008a928 drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2737  
11121e3008a928 drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2738  	/* Enable internal clock source on 440GX*/
11121e3008a928 drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2739  #ifdef CONFIG_PPC_DCR_NATIVE
11121e3008a928 drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2740  	if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX))
11121e3008a928 drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2741  		dcri_clrset(SDR0, SDR0_MFR, 0, SDR0_MFR_ECS);
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2742  #endif
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2743  	/* Configure EMAC with defaults so we can at least use MDIO
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2744  	 * This is needed mostly for 440GX
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2745  	 */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2746  	if (emac_phy_gpcs(dev->phy.mode)) {
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2747  		/* XXX
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2748  		 * Make GPCS PHY address equal to EMAC index.
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2749  		 * We probably should take into account busy_phy_map
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2750  		 * and/or phy_map here.
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2751  		 *
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2752  		 * Note that the busy_phy_map is currently global
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2753  		 * while it should probably be per-ASIC...
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2754  		 */
9e3cb29497561c drivers/net/ibm_newemac/core.c       Victor Gallardo     2008-10-01  2755  		dev->phy.gpcs_address = dev->gpcs_address;
9e3cb29497561c drivers/net/ibm_newemac/core.c       Victor Gallardo     2008-10-01  2756  		if (dev->phy.gpcs_address == 0xffffffff)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2757  			dev->phy.address = dev->cell_index;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2758  	}
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2759  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2760  	emac_configure(dev);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2761  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2762  	if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII)) {
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2763  		int res = emac_dt_phy_probe(dev);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2764  
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2765  		switch (res) {
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2766  		case 1:
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2767  			/* No phy-handle property configured.
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2768  			 * Continue with the existing phy probe
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2769  			 * and setup code.
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2770  			 */
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2771  			break;
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2772  
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2773  		case 0:
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2774  			mutex_unlock(&emac_phy_map_lock);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2775  			goto init_phy;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2776  
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2777  		default:
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2778  			mutex_unlock(&emac_phy_map_lock);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2779  			dev_err(&dev->ofdev->dev, "failed to attach dt phy (%d).\n",
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2780  				res);
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2781  			return res;
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2782  		}
b793f081674e36 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-03-06  2783  	}
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2784  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2785  	if (dev->phy_address != 0xffffffff)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2786  		phy_map = ~(1 << dev->phy_address);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2787  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2788  	for (i = 0; i < 0x20; phy_map >>= 1, ++i)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2789  		if (!(phy_map & 1)) {
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2790  			int r;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2791  			busy_phy_map |= 1 << i;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2792  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2793  			/* Quick check if there is a PHY at the address */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2794  			r = emac_mdio_read(dev->ndev, i, MII_BMCR);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2795  			if (r == 0xffff || r < 0)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2796  				continue;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2797  			if (!emac_mii_phy_probe(&dev->phy, i))
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2798  				break;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2799  		}
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2800  
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2801  	/* Enable external clock source */
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2802  #ifdef CONFIG_PPC_DCR_NATIVE
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2803  	if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX))
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2804  		dcri_clrset(SDR0, SDR0_MFR, SDR0_MFR_ECS, 0);
0925ab5d385b6c drivers/net/ibm_newemac/core.c       Valentine Barshak   2008-04-22  2805  #endif
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2806  	mutex_unlock(&emac_phy_map_lock);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2807  	if (i == 0x20) {
f7ce91038d5278 drivers/net/ethernet/ibm/emac/core.c Rob Herring         2017-07-18  2808  		printk(KERN_WARNING "%pOF: can't find PHY!\n", np);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2809  		return -ENXIO;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2810  	}
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2811  
a577ca6badb526 drivers/net/ethernet/ibm/emac/core.c Christian Lamparter 2017-02-20  2812   init_phy:
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2813  	/* Init PHY */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2814  	if (dev->phy.def->ops->init)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2815  		dev->phy.def->ops->init(&dev->phy);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2816  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2817  	/* Disable any PHY features not supported by the platform */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23 @2818  	dev->phy.def->features &= ~dev->phy_feat_exc;
ae5d33723e3253 drivers/net/ethernet/ibm/emac/core.c Duc Dang            2012-03-05  2819  	dev->phy.features &= ~dev->phy_feat_exc;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2820  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2821  	/* Setup initial link parameters */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2822  	if (dev->phy.features & SUPPORTED_Autoneg) {
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2823  		adv = dev->phy.features;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2824  		if (!emac_has_feature(dev, EMAC_FTR_NO_FLOW_CONTROL_40x))
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2825  			adv |= ADVERTISED_Pause | ADVERTISED_Asym_Pause;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2826  		/* Restart autonegotiation */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2827  		dev->phy.def->ops->setup_aneg(&dev->phy, adv);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2828  	} else {
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2829  		u32 f = dev->phy.def->features;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2830  		int speed = SPEED_10, fd = DUPLEX_HALF;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2831  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2832  		/* Select highest supported speed/duplex */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2833  		if (f & SUPPORTED_1000baseT_Full) {
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2834  			speed = SPEED_1000;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2835  			fd = DUPLEX_FULL;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2836  		} else if (f & SUPPORTED_1000baseT_Half)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2837  			speed = SPEED_1000;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2838  		else if (f & SUPPORTED_100baseT_Full) {
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2839  			speed = SPEED_100;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2840  			fd = DUPLEX_FULL;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2841  		} else if (f & SUPPORTED_100baseT_Half)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2842  			speed = SPEED_100;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2843  		else if (f & SUPPORTED_10baseT_Full)
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2844  			fd = DUPLEX_FULL;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2845  
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2846  		/* Force link parameters */
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2847  		dev->phy.def->ops->setup_forced(&dev->phy, speed, fd);
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2848  	}
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2849  	return 0;
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2850  }
1d3bb996481e11 drivers/net/ibm_newemac/core.c       David Gibson        2007-08-23  2851
kernel test robot Aug. 8, 2024, 12:42 a.m. UTC | #3
Hi Christophe,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Christophe-JAILLET/net-ibm-emac-Constify-struct-mii_phy_def/20240807-195146
base:   net-next/main
patch link:    https://lore.kernel.org/r/dfc7876d660d700a840e64c35de0a6519e117539.1723031352.git.christophe.jaillet%40wanadoo.fr
patch subject: [PATCH net-next] net: ibm/emac: Constify struct mii_phy_def
config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20240808/202408080850.QKqTbf5o-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 423aec6573df4424f90555468128e17073ddc69e)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240808/202408080850.QKqTbf5o-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408080850.QKqTbf5o-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/net/ethernet/ibm/emac/core.c:28:
   In file included from include/linux/pci.h:38:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/powerpc/include/asm/hardirq.h:6:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/powerpc/include/asm/io.h:24:
   In file included from include/linux/mm.h:2228:
   include/linux/vmstat.h:500:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     500 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     501 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:507:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     507 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     508 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:519:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     519 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     520 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:528:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     528 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     529 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/ibm/emac/core.c:2648:23: error: cannot assign to non-static data member 'def' with const-qualified type 'const struct mii_phy_def *'
    2648 |         dev->phy.def->phy_id = dev->phy_dev->drv->phy_id;
         |         ~~~~~~~~~~~~~~~~~~~~ ^
   drivers/net/ethernet/ibm/emac/phy.h:50:28: note: non-static data member 'def' declared const here
      50 |         const struct mii_phy_def *def;
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/ibm/emac/core.c:2649:28: error: cannot assign to non-static data member 'def' with const-qualified type 'const struct mii_phy_def *'
    2649 |         dev->phy.def->phy_id_mask = dev->phy_dev->drv->phy_id_mask;
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~ ^
   drivers/net/ethernet/ibm/emac/phy.h:50:28: note: non-static data member 'def' declared const here
      50 |         const struct mii_phy_def *def;
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/ibm/emac/core.c:2650:21: error: cannot assign to non-static data member 'def' with const-qualified type 'const struct mii_phy_def *'
    2650 |         dev->phy.def->name = dev->phy_dev->drv->name;
         |         ~~~~~~~~~~~~~~~~~~ ^
   drivers/net/ethernet/ibm/emac/phy.h:50:28: note: non-static data member 'def' declared const here
      50 |         const struct mii_phy_def *def;
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/ibm/emac/core.c:2651:20: error: cannot assign to non-static data member 'def' with const-qualified type 'const struct mii_phy_def *'
    2651 |         dev->phy.def->ops = &emac_dt_mdio_phy_ops;
         |         ~~~~~~~~~~~~~~~~~ ^
   drivers/net/ethernet/ibm/emac/phy.h:50:28: note: non-static data member 'def' declared const here
      50 |         const struct mii_phy_def *def;
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/net/ethernet/ibm/emac/core.c:2818:25: error: cannot assign to non-static data member 'def' with const-qualified type 'const struct mii_phy_def *'
    2818 |         dev->phy.def->features &= ~dev->phy_feat_exc;
         |         ~~~~~~~~~~~~~~~~~~~~~~ ^
   drivers/net/ethernet/ibm/emac/phy.h:50:28: note: non-static data member 'def' declared const here
      50 |         const struct mii_phy_def *def;
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   5 warnings and 5 errors generated.


vim +2648 drivers/net/ethernet/ibm/emac/core.c

a577ca6badb526 Christian Lamparter 2017-02-20  2632  
a577ca6badb526 Christian Lamparter 2017-02-20  2633  static int emac_dt_phy_connect(struct emac_instance *dev,
a577ca6badb526 Christian Lamparter 2017-02-20  2634  			       struct device_node *phy_handle)
a577ca6badb526 Christian Lamparter 2017-02-20  2635  {
a577ca6badb526 Christian Lamparter 2017-02-20  2636  	dev->phy.def = devm_kzalloc(&dev->ofdev->dev, sizeof(*dev->phy.def),
a577ca6badb526 Christian Lamparter 2017-02-20  2637  				    GFP_KERNEL);
a577ca6badb526 Christian Lamparter 2017-02-20  2638  	if (!dev->phy.def)
a577ca6badb526 Christian Lamparter 2017-02-20  2639  		return -ENOMEM;
a577ca6badb526 Christian Lamparter 2017-02-20  2640  
a577ca6badb526 Christian Lamparter 2017-02-20  2641  	dev->phy_dev = of_phy_connect(dev->ndev, phy_handle, &emac_adjust_link,
a577ca6badb526 Christian Lamparter 2017-02-20  2642  				      0, dev->phy_mode);
a577ca6badb526 Christian Lamparter 2017-02-20  2643  	if (!dev->phy_dev) {
a577ca6badb526 Christian Lamparter 2017-02-20  2644  		dev_err(&dev->ofdev->dev, "failed to connect to PHY.\n");
a577ca6badb526 Christian Lamparter 2017-02-20  2645  		return -ENODEV;
a577ca6badb526 Christian Lamparter 2017-02-20  2646  	}
a577ca6badb526 Christian Lamparter 2017-02-20  2647  
a577ca6badb526 Christian Lamparter 2017-02-20 @2648  	dev->phy.def->phy_id = dev->phy_dev->drv->phy_id;
a577ca6badb526 Christian Lamparter 2017-02-20  2649  	dev->phy.def->phy_id_mask = dev->phy_dev->drv->phy_id_mask;
a577ca6badb526 Christian Lamparter 2017-02-20  2650  	dev->phy.def->name = dev->phy_dev->drv->name;
a577ca6badb526 Christian Lamparter 2017-02-20  2651  	dev->phy.def->ops = &emac_dt_mdio_phy_ops;
3c1bcc8614db10 Andrew Lunn         2018-11-10  2652  	ethtool_convert_link_mode_to_legacy_u32(&dev->phy.features,
3c1bcc8614db10 Andrew Lunn         2018-11-10  2653  						dev->phy_dev->supported);
a577ca6badb526 Christian Lamparter 2017-02-20  2654  	dev->phy.address = dev->phy_dev->mdio.addr;
a577ca6badb526 Christian Lamparter 2017-02-20  2655  	dev->phy.mode = dev->phy_dev->interface;
a577ca6badb526 Christian Lamparter 2017-02-20  2656  	return 0;
a577ca6badb526 Christian Lamparter 2017-02-20  2657  }
a577ca6badb526 Christian Lamparter 2017-02-20  2658
Christophe JAILLET Aug. 8, 2024, 6:32 a.m. UTC | #4
Le 08/08/2024 à 01:00, kernel test robot a écrit :
> Hi Christophe,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on net-next/main]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Christophe-JAILLET/net-ibm-emac-Constify-struct-mii_phy_def/20240807-195146
> base:   net-next/main
> patch link:    https://lore.kernel.org/r/dfc7876d660d700a840e64c35de0a6519e117539.1723031352.git.christophe.jaillet%40wanadoo.fr
> patch subject: [PATCH net-next] net: ibm/emac: Constify struct mii_phy_def
> config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20240808/202408080631.rKnoa41D-lkp@intel.com/config)
> compiler: powerpc64-linux-gcc (GCC) 14.1.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240808/202408080631.rKnoa41D-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202408080631.rKnoa41D-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
>     drivers/net/ethernet/ibm/emac/core.c: In function 'emac_dt_phy_connect':
>>> drivers/net/ethernet/ibm/emac/core.c:2648:30: error: assignment of member 'phy_id' in read-only object
>      2648 |         dev->phy.def->phy_id = dev->phy_dev->drv->phy_id;
>           |                              ^
>>> drivers/net/ethernet/ibm/emac/core.c:2649:35: error: assignment of member 'phy_id_mask' in read-only object
>      2649 |         dev->phy.def->phy_id_mask = dev->phy_dev->drv->phy_id_mask;
>           |                                   ^
>>> drivers/net/ethernet/ibm/emac/core.c:2650:28: error: assignment of member 'name' in read-only object
>      2650 |         dev->phy.def->name = dev->phy_dev->drv->name;
>           |                            ^
>>> drivers/net/ethernet/ibm/emac/core.c:2651:27: error: assignment of member 'ops' in read-only object
>      2651 |         dev->phy.def->ops = &emac_dt_mdio_phy_ops;
>           |                           ^
>     drivers/net/ethernet/ibm/emac/core.c: In function 'emac_init_phy':
>>> drivers/net/ethernet/ibm/emac/core.c:2818:32: error: assignment of member 'features' in read-only object
>      2818 |         dev->phy.def->features &= ~dev->phy_feat_exc;
>           |                                ^~
> 
> 

Ouch,

I missed the depends on PPC_DCR.

I did:
    - make -j8 drivers/net/ethernet/ibm/emac/phy.o
then
    - make -j8 drivers/net/ethernet/ibm/emac/

but the later does not build anything on x86, and I missed that.

CJ
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ibm/emac/phy.c b/drivers/net/ethernet/ibm/emac/phy.c
index 1e798cc9b6b8..f90abcfaf487 100644
--- a/drivers/net/ethernet/ibm/emac/phy.c
+++ b/drivers/net/ethernet/ibm/emac/phy.c
@@ -284,7 +284,7 @@  static const struct mii_phy_ops generic_phy_ops = {
 	.read_link	= genmii_read_link
 };
 
-static struct mii_phy_def genmii_phy_def = {
+static const struct mii_phy_def genmii_phy_def = {
 	.phy_id		= 0x00000000,
 	.phy_id_mask	= 0x00000000,
 	.name		= "Generic MII",
@@ -349,14 +349,14 @@  static const struct mii_phy_ops cis8201_phy_ops = {
 	.read_link	= genmii_read_link
 };
 
-static struct mii_phy_def cis8201_phy_def = {
+static const struct mii_phy_def cis8201_phy_def = {
 	.phy_id		= 0x000fc410,
 	.phy_id_mask	= 0x000ffff0,
 	.name		= "CIS8201 Gigabit Ethernet",
 	.ops		= &cis8201_phy_ops
 };
 
-static struct mii_phy_def bcm5248_phy_def = {
+static const struct mii_phy_def bcm5248_phy_def = {
 
 	.phy_id		= 0x0143bc00,
 	.phy_id_mask	= 0x0ffffff0,
@@ -429,7 +429,7 @@  static const struct mii_phy_ops et1011c_phy_ops = {
 	.read_link	= genmii_read_link
 };
 
-static struct mii_phy_def et1011c_phy_def = {
+static const struct mii_phy_def et1011c_phy_def = {
 	.phy_id		= 0x0282f000,
 	.phy_id_mask	= 0x0fffff00,
 	.name		= "ET1011C Gigabit Ethernet",
@@ -448,7 +448,7 @@  static const struct mii_phy_ops m88e1111_phy_ops = {
 	.read_link	= genmii_read_link
 };
 
-static struct mii_phy_def m88e1111_phy_def = {
+static const struct mii_phy_def m88e1111_phy_def = {
 
 	.phy_id		= 0x01410CC0,
 	.phy_id_mask	= 0x0ffffff0,
@@ -464,7 +464,7 @@  static const struct mii_phy_ops m88e1112_phy_ops = {
 	.read_link	= genmii_read_link
 };
 
-static struct mii_phy_def m88e1112_phy_def = {
+static const struct mii_phy_def m88e1112_phy_def = {
 	.phy_id		= 0x01410C90,
 	.phy_id_mask	= 0x0ffffff0,
 	.name		= "Marvell 88E1112 Ethernet",
@@ -489,14 +489,14 @@  static const struct mii_phy_ops ar8035_phy_ops = {
 	.read_link	= genmii_read_link,
 };
 
-static struct mii_phy_def ar8035_phy_def = {
+static const struct mii_phy_def ar8035_phy_def = {
 	.phy_id		= 0x004dd070,
 	.phy_id_mask	= 0xfffffff0,
 	.name		= "Atheros 8035 Gigabit Ethernet",
 	.ops		= &ar8035_phy_ops,
 };
 
-static struct mii_phy_def *mii_phy_table[] = {
+static const struct mii_phy_def *mii_phy_table[] = {
 	&et1011c_phy_def,
 	&cis8201_phy_def,
 	&bcm5248_phy_def,
@@ -509,7 +509,7 @@  static struct mii_phy_def *mii_phy_table[] = {
 
 int emac_mii_phy_probe(struct mii_phy *phy, int address)
 {
-	struct mii_phy_def *def;
+	const struct mii_phy_def *def;
 	int i;
 	u32 id;
 
diff --git a/drivers/net/ethernet/ibm/emac/phy.h b/drivers/net/ethernet/ibm/emac/phy.h
index 2184e8373ee5..b1ede47a540f 100644
--- a/drivers/net/ethernet/ibm/emac/phy.h
+++ b/drivers/net/ethernet/ibm/emac/phy.h
@@ -47,7 +47,7 @@  struct mii_phy_def {
 
 /* An instance of a PHY, partially borrowed from mii_if_info */
 struct mii_phy {
-	struct mii_phy_def *def;
+	const struct mii_phy_def *def;
 	u32 advertising;	/* Ethtool ADVERTISED_* defines */
 	u32 features;		/* Copied from mii_phy_def.features
 				   or determined automaticaly */