]> git.itanic.dy.fi Git - linux-stable/commitdiff
net: fman: Move struct dev to mac_device
authorSean Anderson <sean.anderson@seco.com>
Thu, 18 Aug 2022 16:16:32 +0000 (12:16 -0400)
committerJakub Kicinski <kuba@kernel.org>
Fri, 19 Aug 2022 23:35:54 +0000 (16:35 -0700)
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>
Acked-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/fman/mac.c
drivers/net/ethernet/freescale/fman/mac.h

index 8dd6a5b1292271398ec42e62455039dafa15fcf1..5b3a6ea2d0e205b4d06ea8e34f67e65cdc30778b 100644 (file)
@@ -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;
@@ -47,20 +46,16 @@ struct mac_address {
 
 static void mac_exception(void *handle, enum fman_mac_exceptions ex)
 {
-       struct mac_device       *mac_dev;
-       struct mac_priv_s       *priv;
-
-       mac_dev = handle;
-       priv = mac_dev->priv;
+       struct mac_device *mac_dev = handle;
 
        if (ex == FM_MAC_EX_10G_RX_FIFO_OVFL) {
                /* 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 +65,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 +239,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 +256,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);
 }
 
@@ -269,11 +264,9 @@ static int tgec_initialization(struct mac_device *mac_dev,
                               struct device_node *mac_node)
 {
        int err;
-       struct mac_priv_s       *priv;
        struct fman_mac_params  params;
        u32                     version;
 
-       priv = mac_dev->priv;
        mac_dev->set_promisc            = tgec_set_promiscuous;
        mac_dev->change_addr            = tgec_modify_mac_address;
        mac_dev->add_hash_mac_addr      = tgec_add_hash_mac_address;
@@ -316,7 +309,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;
 
@@ -331,11 +324,9 @@ static int dtsec_initialization(struct mac_device *mac_dev,
                                struct device_node *mac_node)
 {
        int                     err;
-       struct mac_priv_s       *priv;
        struct fman_mac_params  params;
        u32                     version;
 
-       priv = mac_dev->priv;
        mac_dev->set_promisc            = dtsec_set_promiscuous;
        mac_dev->change_addr            = dtsec_modify_mac_address;
        mac_dev->add_hash_mac_addr      = dtsec_add_hash_mac_address;
@@ -383,7 +374,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 +437,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 +498,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 +560,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);
 
index fed3835a84736e5453137b4cdadb7499f2352cab..05dbb8b5a7040ff60af08d81ccabba6be3f19423 100644 (file)
@@ -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];