diff mbox series

[net-next,10/28] net: fman: Move struct dev to mac_device

Message ID 20220617203312.3799646-11-sean.anderson@seco.com (mailing list archive)
State New, archived
Headers show
Series net: dpaa: Convert to phylink | expand

Commit Message

Sean Anderson June 17, 2022, 8:32 p.m. UTC
Move the reference to our device to mac_device. This way, macs can use
it in their log messages.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

 drivers/net/ethernet/freescale/fman/mac.c | 21 ++++++++++-----------
 drivers/net/ethernet/freescale/fman/mac.h |  1 +
 2 files changed, 11 insertions(+), 11 deletions(-)

Comments

kernel test robot June 18, 2022, 3:57 a.m. UTC | #1
Hi Sean,

I love your patch! Perhaps something to improve:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Sean-Anderson/net-dpaa-Convert-to-phylink/20220618-044003
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 4875d94c69d5a4836c4225b51429d277c297aae8
config: m68k-randconfig-r036-20220617 (https://download.01.org/0day-ci/archive/20220618/202206181156.p7gQheg2-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.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/intel-lab-lkp/linux/commit/155c8f9a09b3f95f4804d306c2465ebc82fe608f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Sean-Anderson/net-dpaa-Convert-to-phylink/20220618-044003
        git checkout 155c8f9a09b3f95f4804d306c2465ebc82fe608f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/net/ethernet/freescale/fman/

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

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/freescale/fman/mac.c: In function 'mac_exception':
>> drivers/net/ethernet/freescale/fman/mac.c:50:34: warning: variable 'priv' set but not used [-Wunused-but-set-variable]
      50 |         struct mac_priv_s       *priv;
         |                                  ^~~~
   drivers/net/ethernet/freescale/fman/mac.c: In function 'tgec_initialization':
   drivers/net/ethernet/freescale/fman/mac.c:271:34: warning: variable 'priv' set but not used [-Wunused-but-set-variable]
     271 |         struct mac_priv_s       *priv;
         |                                  ^~~~
   drivers/net/ethernet/freescale/fman/mac.c: In function 'dtsec_initialization':
   drivers/net/ethernet/freescale/fman/mac.c:333:34: warning: variable 'priv' set but not used [-Wunused-but-set-variable]
     333 |         struct mac_priv_s       *priv;
         |                                  ^~~~


vim +/priv +50 drivers/net/ethernet/freescale/fman/mac.c

3933961682a30a Igal Liberman 2015-12-21  46  
3933961682a30a Igal Liberman 2015-12-21  47  static void mac_exception(void *handle, enum fman_mac_exceptions ex)
3933961682a30a Igal Liberman 2015-12-21  48  {
3933961682a30a Igal Liberman 2015-12-21  49  	struct mac_device	*mac_dev;
3933961682a30a Igal Liberman 2015-12-21 @50  	struct mac_priv_s	*priv;
3933961682a30a Igal Liberman 2015-12-21  51  
3933961682a30a Igal Liberman 2015-12-21  52  	mac_dev = handle;
3933961682a30a Igal Liberman 2015-12-21  53  	priv = mac_dev->priv;
3933961682a30a Igal Liberman 2015-12-21  54  
3933961682a30a Igal Liberman 2015-12-21  55  	if (ex == FM_MAC_EX_10G_RX_FIFO_OVFL) {
3933961682a30a Igal Liberman 2015-12-21  56  		/* don't flag RX FIFO after the first */
3933961682a30a Igal Liberman 2015-12-21  57  		mac_dev->set_exception(mac_dev->fman_mac,
3933961682a30a Igal Liberman 2015-12-21  58  				       FM_MAC_EX_10G_RX_FIFO_OVFL, false);
155c8f9a09b3f9 Sean Anderson 2022-06-17  59  		dev_err(mac_dev->dev, "10G MAC got RX FIFO Error = %x\n", ex);
3933961682a30a Igal Liberman 2015-12-21  60  	}
3933961682a30a Igal Liberman 2015-12-21  61  
155c8f9a09b3f9 Sean Anderson 2022-06-17  62  	dev_dbg(mac_dev->dev, "%s:%s() -> %d\n", KBUILD_BASENAME ".c",
3933961682a30a Igal Liberman 2015-12-21  63  		__func__, ex);
3933961682a30a Igal Liberman 2015-12-21  64  }
3933961682a30a Igal Liberman 2015-12-21  65
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 8dd6a5b12922..5d6159c0e1f0 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -28,7 +28,6 @@  MODULE_LICENSE("Dual BSD/GPL");
 MODULE_DESCRIPTION("FSL FMan MAC API based driver");
 
 struct mac_priv_s {
-	struct device			*dev;
 	void __iomem			*vaddr;
 	u8				cell_index;
 	struct fman			*fman;
@@ -57,10 +56,10 @@  static void mac_exception(void *handle, enum fman_mac_exceptions ex)
 		/* don't flag RX FIFO after the first */
 		mac_dev->set_exception(mac_dev->fman_mac,
 				       FM_MAC_EX_10G_RX_FIFO_OVFL, false);
-		dev_err(priv->dev, "10G MAC got RX FIFO Error = %x\n", ex);
+		dev_err(mac_dev->dev, "10G MAC got RX FIFO Error = %x\n", ex);
 	}
 
-	dev_dbg(priv->dev, "%s:%s() -> %d\n", KBUILD_BASENAME ".c",
+	dev_dbg(mac_dev->dev, "%s:%s() -> %d\n", KBUILD_BASENAME ".c",
 		__func__, ex);
 }
 
@@ -70,7 +69,7 @@  static int set_fman_mac_params(struct mac_device *mac_dev,
 	struct mac_priv_s *priv = mac_dev->priv;
 
 	params->base_addr = (typeof(params->base_addr))
-		devm_ioremap(priv->dev, mac_dev->res->start,
+		devm_ioremap(mac_dev->dev, mac_dev->res->start,
 			     resource_size(mac_dev->res));
 	if (!params->base_addr)
 		return -ENOMEM;
@@ -244,7 +243,7 @@  static void adjust_link_dtsec(struct mac_device *mac_dev)
 	fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause);
 	err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause);
 	if (err < 0)
-		dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n",
+		dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n",
 			err);
 }
 
@@ -261,7 +260,7 @@  static void adjust_link_memac(struct mac_device *mac_dev)
 	fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause);
 	err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause);
 	if (err < 0)
-		dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n",
+		dev_err(mac_dev->dev, "fman_set_mac_active_pause() = %d\n",
 			err);
 }
 
@@ -316,7 +315,7 @@  static int tgec_initialization(struct mac_device *mac_dev,
 	if (err < 0)
 		goto _return_fm_mac_free;
 
-	dev_info(priv->dev, "FMan XGEC version: 0x%08x\n", version);
+	dev_info(mac_dev->dev, "FMan XGEC version: 0x%08x\n", version);
 
 	goto _return;
 
@@ -383,7 +382,7 @@  static int dtsec_initialization(struct mac_device *mac_dev,
 	if (err < 0)
 		goto _return_fm_mac_free;
 
-	dev_info(priv->dev, "FMan dTSEC version: 0x%08x\n", version);
+	dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n", version);
 
 	goto _return;
 
@@ -446,7 +445,7 @@  static int memac_initialization(struct mac_device *mac_dev,
 	if (err < 0)
 		goto _return_fm_mac_free;
 
-	dev_info(priv->dev, "FMan MEMAC\n");
+	dev_info(mac_dev->dev, "FMan MEMAC\n");
 
 	goto _return;
 
@@ -507,7 +506,7 @@  static struct platform_device *dpaa_eth_add_device(int fman_id,
 		goto no_mem;
 	}
 
-	pdev->dev.parent = priv->dev;
+	pdev->dev.parent = mac_dev->dev;
 
 	ret = platform_device_add_data(pdev, &data, sizeof(data));
 	if (ret)
@@ -569,7 +568,7 @@  static int mac_probe(struct platform_device *_of_dev)
 
 	/* Save private information */
 	mac_dev->priv = priv;
-	priv->dev = dev;
+	mac_dev->dev = dev;
 
 	INIT_LIST_HEAD(&priv->mc_addr_list);
 
diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h
index fed3835a8473..05dbb8b5a704 100644
--- a/drivers/net/ethernet/freescale/fman/mac.h
+++ b/drivers/net/ethernet/freescale/fman/mac.h
@@ -19,6 +19,7 @@  struct fman_mac;
 struct mac_priv_s;
 
 struct mac_device {
+	struct device		*dev;
 	struct resource		*res;
 	u8			 addr[ETH_ALEN];
 	struct fman_port	*port[2];