drivers: net: xgene: constify xgene_mac_ops and xgene_port_ops structures
authorJulia Lawall <julia.lawall@lip6.fr>
Tue, 8 Dec 2015 20:18:25 +0000 (21:18 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Dec 2015 02:39:32 +0000 (21:39 -0500)
The xgene_mac_ops and xgene_port_ops structures are never modified, so
declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
drivers/net/ethernet/apm/xgene/xgene_enet_hw.h
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
drivers/net/ethernet/apm/xgene/xgene_enet_main.h
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.h
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h

index c31e691d11fc2eb5b786fc3769f700563f63a0da..db55c9f6e8e13006a012f096cc4259718a525351 100644 (file)
@@ -869,7 +869,7 @@ void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata)
        pdata->mdio_bus = NULL;
 }
 
-struct xgene_mac_ops xgene_gmac_ops = {
+const struct xgene_mac_ops xgene_gmac_ops = {
        .init = xgene_gmac_init,
        .reset = xgene_gmac_reset,
        .rx_enable = xgene_gmac_rx_enable,
@@ -879,7 +879,7 @@ struct xgene_mac_ops xgene_gmac_ops = {
        .set_mac_addr = xgene_gmac_set_mac_addr,
 };
 
-struct xgene_port_ops xgene_gport_ops = {
+const struct xgene_port_ops xgene_gport_ops = {
        .reset = xgene_enet_reset,
        .cle_bypass = xgene_enet_cle_bypass,
        .shutdown = xgene_gport_shutdown,
index c153a1dc5ff78136c4fc99d1ec60970d99e095a0..8a9091039ab4494f0be860c9016d064f65411ecb 100644 (file)
@@ -340,8 +340,8 @@ int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata);
 void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata);
 bool xgene_ring_mgr_init(struct xgene_enet_pdata *p);
 
-extern struct xgene_mac_ops xgene_gmac_ops;
-extern struct xgene_port_ops xgene_gport_ops;
+extern const struct xgene_mac_ops xgene_gmac_ops;
+extern const struct xgene_port_ops xgene_gport_ops;
 extern struct xgene_ring_ops xgene_ring1_ops;
 
 #endif /* __XGENE_ENET_HW_H__ */
index d21ee8767c2d8e61d035cb1725b161051cb08a26..2394191ad28e5e184794c6c04ed50d06dceef4a7 100644 (file)
@@ -682,7 +682,7 @@ static void xgene_enet_napi_disable(struct xgene_enet_pdata *pdata)
 static int xgene_enet_open(struct net_device *ndev)
 {
        struct xgene_enet_pdata *pdata = netdev_priv(ndev);
-       struct xgene_mac_ops *mac_ops = pdata->mac_ops;
+       const struct xgene_mac_ops *mac_ops = pdata->mac_ops;
        int ret;
 
        mac_ops->tx_enable(pdata);
@@ -706,7 +706,7 @@ static int xgene_enet_open(struct net_device *ndev)
 static int xgene_enet_close(struct net_device *ndev)
 {
        struct xgene_enet_pdata *pdata = netdev_priv(ndev);
-       struct xgene_mac_ops *mac_ops = pdata->mac_ops;
+       const struct xgene_mac_ops *mac_ops = pdata->mac_ops;
 
        netif_stop_queue(ndev);
 
@@ -1416,7 +1416,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
        struct net_device *ndev;
        struct xgene_enet_pdata *pdata;
        struct device *dev = &pdev->dev;
-       struct xgene_mac_ops *mac_ops;
+       const struct xgene_mac_ops *mac_ops;
        const struct of_device_id *of_id;
        int ret;
 
@@ -1503,7 +1503,7 @@ err:
 static int xgene_enet_remove(struct platform_device *pdev)
 {
        struct xgene_enet_pdata *pdata;
-       struct xgene_mac_ops *mac_ops;
+       const struct xgene_mac_ops *mac_ops;
        struct net_device *ndev;
 
        pdata = platform_get_drvdata(pdev);
index a6e56b88c0a07a6bee7a1f0e6a050db802e5e989..054caf055f0a0657604c1e050338f0666281a35e 100644 (file)
@@ -174,8 +174,8 @@ struct xgene_enet_pdata {
        int phy_mode;
        enum xgene_enet_rm rm;
        struct rtnl_link_stats64 stats;
-       struct xgene_mac_ops *mac_ops;
-       struct xgene_port_ops *port_ops;
+       const struct xgene_mac_ops *mac_ops;
+       const struct xgene_port_ops *port_ops;
        struct xgene_ring_ops *ring_ops;
        struct delayed_work link_work;
        u32 port_id;
index 05b817e56fdeb2637413b6ae199301c1797851aa..78475512b6839c7d0d9915c547964eb1a25f4220 100644 (file)
@@ -405,7 +405,7 @@ static void xgene_enet_link_state(struct work_struct *work)
        schedule_delayed_work(&p->link_work, poll_interval);
 }
 
-struct xgene_mac_ops xgene_sgmac_ops = {
+const struct xgene_mac_ops xgene_sgmac_ops = {
        .init           = xgene_sgmac_init,
        .reset          = xgene_sgmac_reset,
        .rx_enable      = xgene_sgmac_rx_enable,
@@ -416,7 +416,7 @@ struct xgene_mac_ops xgene_sgmac_ops = {
        .link_state     = xgene_enet_link_state
 };
 
-struct xgene_port_ops xgene_sgport_ops = {
+const struct xgene_port_ops xgene_sgport_ops = {
        .reset          = xgene_enet_reset,
        .cle_bypass     = xgene_enet_cle_bypass,
        .shutdown       = xgene_enet_shutdown
index de432465009c1f2a8ca48d0d64fca8432db47e18..29a71b4dcc44f361ef61c90bee1575984a5f47ea 100644 (file)
@@ -35,7 +35,7 @@
 #define MPA_IDLE_WITH_QMI_EMPTY                BIT(12)
 #define SG_RX_DV_GATE_REG_0_ADDR       0x0dfc
 
-extern struct xgene_mac_ops xgene_sgmac_ops;
-extern struct xgene_port_ops xgene_sgport_ops;
+extern const struct xgene_mac_ops xgene_sgmac_ops;
+extern const struct xgene_port_ops xgene_sgport_ops;
 
 #endif  /* __XGENE_ENET_SGMAC_H__ */
index 7a28a48cb2c779816ed92b8c3616c4000129cbc2..ba030dc1940b519e529857ef81876ac74a6cd2e6 100644 (file)
@@ -326,7 +326,7 @@ static void xgene_enet_link_state(struct work_struct *work)
        schedule_delayed_work(&pdata->link_work, poll_interval);
 }
 
-struct xgene_mac_ops xgene_xgmac_ops = {
+const struct xgene_mac_ops xgene_xgmac_ops = {
        .init = xgene_xgmac_init,
        .reset = xgene_xgmac_reset,
        .rx_enable = xgene_xgmac_rx_enable,
@@ -338,7 +338,7 @@ struct xgene_mac_ops xgene_xgmac_ops = {
        .link_state = xgene_enet_link_state
 };
 
-struct xgene_port_ops xgene_xgport_ops = {
+const struct xgene_port_ops xgene_xgport_ops = {
        .reset = xgene_enet_reset,
        .cle_bypass = xgene_enet_xgcle_bypass,
        .shutdown = xgene_enet_shutdown,
index f8f908dbf51c1b6da36a3c7a787ebe09189d862c..0a2dca8a1725ab07bd4797765cd7e7e439fc5fd9 100644 (file)
@@ -69,7 +69,7 @@
 #define XG_ENET_SPARE_CFG_REG_1_ADDR   0x0410
 #define XGENET_RX_DV_GATE_REG_0_ADDR   0x0804
 
-extern struct xgene_mac_ops xgene_xgmac_ops;
-extern struct xgene_port_ops xgene_xgport_ops;
+extern const struct xgene_mac_ops xgene_xgmac_ops;
+extern const struct xgene_port_ops xgene_xgport_ops;
 
 #endif /* __XGENE_ENET_XGMAC_H__ */
This page took 0.03165 seconds and 5 git commands to generate.