fs_enet: silence a build warning (unused variable)
Subsystems (3)
PATCH 1/2 fs_enet: silence a build warning (unused variable)
From: Gerhard Sittig <[email protected]>
Since commit 720a43efd30f04a0a492c85fb997361c44fbae05 (drivers:net: Remove unnecessary OOM messages after netdev_alloc_skb) there is a build warning:
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c: In function 'tx_skb_align_workaround':drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c:586:26: warning: unused variable 'fep'
Fix it.
--- .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +0 -1
@@ -583,7 +583,6 @@ static struct sk_buff *tx_skb_align_workaround(struct net_device *dev, struct sk_buff *skb) {struct sk_buff *new_skb; -struct fs_enet_private *fep =netdev_priv (dev);/* Alloc new skb */ new_skb =netdev_alloc_skb (dev, skb->len +4 );
Signature · 1 line
1.7.9.5
PATCH 2/2 fs_enet: cleanup clock API use
From: Gerhard Sittig <[email protected]>
make the Freescale ethernet driver get, prepare and enable the FEC clock during probe(); disable and unprepare the clock upon remove(), put is done by the devm approach; hold a reference to the clock over the period of use.
clock lookup is non-fatal as not all platforms provide clock specs in their device tree; failure to enable specified clocks is fatal.
--- .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 20 ++++++++++++++++++++ include/linux/fs_enet_pd.h | 3 +++ 2 files changed, 23 insertions(+)
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +20 -0
@@ -999,6 +999,8 @@ static int fs_enet_probe(struct platform_device *ofdev)struct fs_enet_private *fep;struct fs_platform_info *fpi;const u32 *data; +struct clk *clk; +int err;const u8 *mac_addr;const char *phy_connection_type;int privsize, len, ret = -ENODEV ;
@@ -1036,6 +1038,20 @@ static int fs_enet_probe(struct platform_device *ofdev) fpi->use_rmii =1 ; } +/* make clock lookup non-fatal (the driver is shared among platforms), +* but require enable to succeed when a clock was specified/found, +* keep a reference to the clock upon successful acquisition +*/ + clk =devm_clk_get (&ofdev->dev,"per" ); +if (!IS_ERR (clk)) { + err =clk_prepare_enable (clk); +if (err) { + ret = err; + goto out_free_fpi; + } + fpi->clk_per = clk; + } + privsize =sizeof (*fep) +sizeof (struct sk_buff **) * (fpi->rx_ring + fpi->tx_ring);
@@ -1107,6 +1123,8 @@ out_free_dev:free_netdev (ndev); out_put:of_node_put (fpi->phy_node); +if (fpi->clk_per) +clk_disable_unprepare (fpi->clk_per); out_free_fpi:kfree (fpi);return ret;
@@ -1123,6 +1141,8 @@ static int fs_enet_remove(struct platform_device *ofdev) fep->ops->cleanup_data (ndev);dev_set_drvdata (fep->dev,NULL );of_node_put (fep->fpi->phy_node); +if (fep->fpi->clk_per) +clk_disable_unprepare (fep->fpi->clk_per);free_netdev (ndev);return 0 ; }
include/linux/fs_enet_pd.h +3 -0
@@ -16,6 +16,7 @@#ifndef FS_ENET_PD_H #define FS_ENET_PD_H +#include <linux/clk.h> #include <linux/string.h> #include <linux/of_mdio.h> #include <linux/if_ether.h>
@@ -143,6 +144,8 @@ struct fs_platform_info {int use_rmii;/* use RMII mode */ int has_phy;/* if the network is phy container as well...*/ + +struct clk *clk_per;/* 'per' clock for register access */ };struct fs_mii_fec_platform_info {u32 irq[32 ];
Signature · 1 line
1.7.9.5
From: Anatolij Gustschin <[email protected]>
Date: Thu, 22 Aug 2013 21:55:12 +0200
Quoted 6 lines
From: Gerhard Sittig <[email protected]>
Since commit
720a43efd30f04a0a492c85fb997361c44fbae05(drivers:net: Remove unnecessary OOM messages afternetdev_alloc_skb) there is a build warning:
Quoted 7 lines
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c: In function 'tx_skb_align_workaround':drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c:586:26: warning: unused variable 'fep'Fix it.
Signed-off-by Gerhard Sittig <[email protected]>Signed-off-by Anatolij Gustschin <[email protected]>
Applied.
Re: [PATCH net-next 2/2] fs_enet: cleanup clock API use
In reply to Anatolij GustschinFrom: Anatolij Gustschin <[email protected]>
Date: Thu, 22 Aug 2013 21:55:13 +0200
Quoted 7 lines
From: Gerhard Sittig <[email protected]>
make the Freescale ethernet driver get, prepare and enable the FEC clock during
probe(); disable and unprepare the clock uponremove(), put is done by the devm approach; hold a reference to the clock over the period of use.
Quoted 5 lines
clock lookup is non-fatal as not all platforms provide clock specs in their device tree; failure to enable specified clocks is fatal.
Signed-off-by Gerhard Sittig <[email protected]>Signed-off-by Anatolij Gustschin <[email protected]>
Applied.