From: peppe.cavallaro@st.com (Giuseppe CAVALLARO)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 6/9] net/stmmac: Remove conditional compilation of clk code
Date: Tue, 24 Apr 2012 08:33:32 +0200 [thread overview]
Message-ID: <4F96493C.7020309@st.com> (raw)
In-Reply-To: <4F964551.4050507@st.com>
On 4/24/2012 8:16 AM, Giuseppe CAVALLARO wrote:
> On 4/24/2012 7:56 AM, Viresh KUMAR wrote:
>> With addition of dummy clk_*() calls for non CONFIG_HAVE_CLK cases in clk.h,
>> there is no need to have clk code enclosed in #ifdef CONFIG_HAVE_CLK, #endif
>> macros.
>
> Hello Viresh
>
> patch only applies fine against the net-next repository so on top of the
> diver version: March_2012 and it builds fine on arch w/ w/o HAVE_CLK
> (just tested).
Oops, sorry but on a build I got:
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
drivers/built-in.o: In function `stmmac_release':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1134:
undefined reference to `clk_disable'
drivers/built-in.o: In function `stmmac_open':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:974:
undefined reference to `clk_enable'
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1079:
undefined reference to `clk_disable'
drivers/built-in.o: In function `stmmac_dvr_probe':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1931:
undefined reference to `clk_get'
drivers/built-in.o: In function `stmmac_clk_csr_set':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:174:
undefined reference to `clk_get_rate'
drivers/built-in.o: In function `stmmac_suspend':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2030:
undefined reference to `clk_disable'
drivers/built-in.o: In function `stmmac_resume':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2054:
undefined reference to `clk_enable'
make: *** [.tmp_vmlinux1] Error 1
Pls, can you verify?
Peppe
>
> Thanks a lot.
>
> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>
>> Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
>> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>> Cc: David S. Miller <davem@davemloft.net>
>> ---
>> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 41 ---------------------
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 31 ++++++++++------
>> 2 files changed, 19 insertions(+), 53 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> index db2de9a..7f85895 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> @@ -81,9 +81,7 @@ struct stmmac_priv {
>> struct stmmac_counters mmc;
>> struct dma_features dma_cap;
>> int hw_cap_support;
>> -#ifdef CONFIG_HAVE_CLK
>> struct clk *stmmac_clk;
>> -#endif
>> int clk_csr;
>> };
>>
>> @@ -103,42 +101,3 @@ int stmmac_dvr_remove(struct net_device *ndev);
>> struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>> struct plat_stmmacenet_data *plat_dat,
>> void __iomem *addr);
>> -
>> -#ifdef CONFIG_HAVE_CLK
>> -static inline int stmmac_clk_enable(struct stmmac_priv *priv)
>> -{
>> - if (!IS_ERR(priv->stmmac_clk))
>> - return clk_enable(priv->stmmac_clk);
>> -
>> - return 0;
>> -}
>> -
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> - if (IS_ERR(priv->stmmac_clk))
>> - return;
>> -
>> - clk_disable(priv->stmmac_clk);
>> -}
>> -static inline int stmmac_clk_get(struct stmmac_priv *priv)
>> -{
>> - priv->stmmac_clk = clk_get(priv->device, NULL);
>> -
>> - if (IS_ERR(priv->stmmac_clk))
>> - return PTR_ERR(priv->stmmac_clk);
>> -
>> - return 0;
>> -}
>> -#else
>> -static inline int stmmac_clk_enable(struct stmmac_priv *priv)
>> -{
>> - return 0;
>> -}
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> -}
>> -static inline int stmmac_clk_get(struct stmmac_priv *priv)
>> -{
>> - return 0;
>> -}
>> -#endif /* CONFIG_HAVE_CLK */
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index 1a4cf81..18ce287 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -28,6 +28,7 @@
>> https://bugzilla.stlinux.com/
>> *******************************************************************************/
>>
>> +#include <linux/clk.h>
>> #include <linux/kernel.h>
>> #include <linux/interrupt.h>
>> #include <linux/ip.h>
>> @@ -165,7 +166,6 @@ static void stmmac_verify_args(void)
>>
>> static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>> {
>> -#ifdef CONFIG_HAVE_CLK
>> u32 clk_rate;
>>
>> if (IS_ERR(priv->stmmac_clk))
>> @@ -192,7 +192,6 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>> * we can not estimate the proper divider as it is not known
>> * the frequency of clk_csr_i. So we do not change the default
>> * divider. */
>> -#endif
>> }
>>
>> #if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG)
>> @@ -971,7 +970,8 @@ static int stmmac_open(struct net_device *dev)
>> } else
>> priv->tm->enable = 1;
>> #endif
>> - stmmac_clk_enable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_enable(priv->stmmac_clk);
>>
>> stmmac_check_ether_addr(priv);
>>
>> @@ -1075,7 +1075,8 @@ open_error:
>> if (priv->phydev)
>> phy_disconnect(priv->phydev);
>>
>> - stmmac_clk_disable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>>
>> return ret;
>> }
>> @@ -1128,7 +1129,9 @@ static int stmmac_release(struct net_device *dev)
>> #ifdef CONFIG_STMMAC_DEBUG_FS
>> stmmac_exit_fs();
>> #endif
>> - stmmac_clk_disable(priv);
>> +
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>>
>> return 0;
>> }
>> @@ -1925,7 +1928,8 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>> goto error;
>> }
>>
>> - if (stmmac_clk_get(priv))
>> + priv->stmmac_clk = clk_get(priv->device, NULL);
>> + if (IS_ERR(priv->stmmac_clk))
>> pr_warning("%s: warning: cannot get CSR clock\n", __func__);
>>
>> /* If a specific clk_csr value is passed from the platform
>> @@ -1934,10 +1938,12 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>> * set the MDC clock dynamically according to the csr actual
>> * clock input.
>> */
>> - if (!priv->plat->clk_csr)
>> - stmmac_clk_csr_set(priv);
>> - else
>> + if (!priv->plat->clk_csr) {
>> + if (!IS_ERR(priv->stmmac_clk))
>> + stmmac_clk_csr_set(priv);
>> + } else {
>> priv->clk_csr = priv->plat->clk_csr;
>> + }
>>
>> /* MDIO bus Registration */
>> ret = stmmac_mdio_register(ndev);
>> @@ -2020,7 +2026,8 @@ int stmmac_suspend(struct net_device *ndev)
>> else {
>> stmmac_set_mac(priv->ioaddr, false);
>> /* Disable clock in case of PWM is off */
>> - stmmac_clk_disable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>> }
>> spin_unlock(&priv->lock);
>> return 0;
>> @@ -2042,9 +2049,9 @@ int stmmac_resume(struct net_device *ndev)
>> * from another devices (e.g. serial console). */
>> if (device_may_wakeup(priv->device))
>> priv->hw->mac->pmt(priv->ioaddr, 0);
>> - else
>> + else if (!IS_ERR(priv->stmmac_clk))
>> /* enable the clk prevously disabled */
>> - stmmac_clk_enable(priv);
>> + clk_enable(priv->stmmac_clk);
>>
>> netif_device_attach(ndev);
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
WARNING: multiple messages have this Message-ID (diff)
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
To: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Cc: Viresh KUMAR <viresh.kumar@st.com>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, mturquette@linaro.org,
sshtylyov@mvista.com, jgarzik@redhat.com, linux@arm.linux.org.uk,
spear-devel@list.st.com, viresh.linux@gmail.com,
"David S. Miller" <davem@davemloft.net>,
ML netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH V2 6/9] net/stmmac: Remove conditional compilation of clk code
Date: Tue, 24 Apr 2012 08:33:32 +0200 [thread overview]
Message-ID: <4F96493C.7020309@st.com> (raw)
In-Reply-To: <4F964551.4050507@st.com>
On 4/24/2012 8:16 AM, Giuseppe CAVALLARO wrote:
> On 4/24/2012 7:56 AM, Viresh KUMAR wrote:
>> With addition of dummy clk_*() calls for non CONFIG_HAVE_CLK cases in clk.h,
>> there is no need to have clk code enclosed in #ifdef CONFIG_HAVE_CLK, #endif
>> macros.
>
> Hello Viresh
>
> patch only applies fine against the net-next repository so on top of the
> diver version: March_2012 and it builds fine on arch w/ w/o HAVE_CLK
> (just tested).
Oops, sorry but on a build I got:
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
drivers/built-in.o: In function `stmmac_release':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1134:
undefined reference to `clk_disable'
drivers/built-in.o: In function `stmmac_open':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:974:
undefined reference to `clk_enable'
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1079:
undefined reference to `clk_disable'
drivers/built-in.o: In function `stmmac_dvr_probe':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1931:
undefined reference to `clk_get'
drivers/built-in.o: In function `stmmac_clk_csr_set':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:174:
undefined reference to `clk_get_rate'
drivers/built-in.o: In function `stmmac_suspend':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2030:
undefined reference to `clk_disable'
drivers/built-in.o: In function `stmmac_resume':
/stlinux/cavagiu/git/mirror/net-next.git/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:2054:
undefined reference to `clk_enable'
make: *** [.tmp_vmlinux1] Error 1
Pls, can you verify?
Peppe
>
> Thanks a lot.
>
> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>
>> Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
>> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>> Cc: David S. Miller <davem@davemloft.net>
>> ---
>> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 41 ---------------------
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 31 ++++++++++------
>> 2 files changed, 19 insertions(+), 53 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> index db2de9a..7f85895 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> @@ -81,9 +81,7 @@ struct stmmac_priv {
>> struct stmmac_counters mmc;
>> struct dma_features dma_cap;
>> int hw_cap_support;
>> -#ifdef CONFIG_HAVE_CLK
>> struct clk *stmmac_clk;
>> -#endif
>> int clk_csr;
>> };
>>
>> @@ -103,42 +101,3 @@ int stmmac_dvr_remove(struct net_device *ndev);
>> struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>> struct plat_stmmacenet_data *plat_dat,
>> void __iomem *addr);
>> -
>> -#ifdef CONFIG_HAVE_CLK
>> -static inline int stmmac_clk_enable(struct stmmac_priv *priv)
>> -{
>> - if (!IS_ERR(priv->stmmac_clk))
>> - return clk_enable(priv->stmmac_clk);
>> -
>> - return 0;
>> -}
>> -
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> - if (IS_ERR(priv->stmmac_clk))
>> - return;
>> -
>> - clk_disable(priv->stmmac_clk);
>> -}
>> -static inline int stmmac_clk_get(struct stmmac_priv *priv)
>> -{
>> - priv->stmmac_clk = clk_get(priv->device, NULL);
>> -
>> - if (IS_ERR(priv->stmmac_clk))
>> - return PTR_ERR(priv->stmmac_clk);
>> -
>> - return 0;
>> -}
>> -#else
>> -static inline int stmmac_clk_enable(struct stmmac_priv *priv)
>> -{
>> - return 0;
>> -}
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> -}
>> -static inline int stmmac_clk_get(struct stmmac_priv *priv)
>> -{
>> - return 0;
>> -}
>> -#endif /* CONFIG_HAVE_CLK */
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index 1a4cf81..18ce287 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -28,6 +28,7 @@
>> https://bugzilla.stlinux.com/
>> *******************************************************************************/
>>
>> +#include <linux/clk.h>
>> #include <linux/kernel.h>
>> #include <linux/interrupt.h>
>> #include <linux/ip.h>
>> @@ -165,7 +166,6 @@ static void stmmac_verify_args(void)
>>
>> static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>> {
>> -#ifdef CONFIG_HAVE_CLK
>> u32 clk_rate;
>>
>> if (IS_ERR(priv->stmmac_clk))
>> @@ -192,7 +192,6 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
>> * we can not estimate the proper divider as it is not known
>> * the frequency of clk_csr_i. So we do not change the default
>> * divider. */
>> -#endif
>> }
>>
>> #if defined(STMMAC_XMIT_DEBUG) || defined(STMMAC_RX_DEBUG)
>> @@ -971,7 +970,8 @@ static int stmmac_open(struct net_device *dev)
>> } else
>> priv->tm->enable = 1;
>> #endif
>> - stmmac_clk_enable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_enable(priv->stmmac_clk);
>>
>> stmmac_check_ether_addr(priv);
>>
>> @@ -1075,7 +1075,8 @@ open_error:
>> if (priv->phydev)
>> phy_disconnect(priv->phydev);
>>
>> - stmmac_clk_disable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>>
>> return ret;
>> }
>> @@ -1128,7 +1129,9 @@ static int stmmac_release(struct net_device *dev)
>> #ifdef CONFIG_STMMAC_DEBUG_FS
>> stmmac_exit_fs();
>> #endif
>> - stmmac_clk_disable(priv);
>> +
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>>
>> return 0;
>> }
>> @@ -1925,7 +1928,8 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>> goto error;
>> }
>>
>> - if (stmmac_clk_get(priv))
>> + priv->stmmac_clk = clk_get(priv->device, NULL);
>> + if (IS_ERR(priv->stmmac_clk))
>> pr_warning("%s: warning: cannot get CSR clock\n", __func__);
>>
>> /* If a specific clk_csr value is passed from the platform
>> @@ -1934,10 +1938,12 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>> * set the MDC clock dynamically according to the csr actual
>> * clock input.
>> */
>> - if (!priv->plat->clk_csr)
>> - stmmac_clk_csr_set(priv);
>> - else
>> + if (!priv->plat->clk_csr) {
>> + if (!IS_ERR(priv->stmmac_clk))
>> + stmmac_clk_csr_set(priv);
>> + } else {
>> priv->clk_csr = priv->plat->clk_csr;
>> + }
>>
>> /* MDIO bus Registration */
>> ret = stmmac_mdio_register(ndev);
>> @@ -2020,7 +2026,8 @@ int stmmac_suspend(struct net_device *ndev)
>> else {
>> stmmac_set_mac(priv->ioaddr, false);
>> /* Disable clock in case of PWM is off */
>> - stmmac_clk_disable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>> }
>> spin_unlock(&priv->lock);
>> return 0;
>> @@ -2042,9 +2049,9 @@ int stmmac_resume(struct net_device *ndev)
>> * from another devices (e.g. serial console). */
>> if (device_may_wakeup(priv->device))
>> priv->hw->mac->pmt(priv->ioaddr, 0);
>> - else
>> + else if (!IS_ERR(priv->stmmac_clk))
>> /* enable the clk prevously disabled */
>> - stmmac_clk_enable(priv);
>> + clk_enable(priv->stmmac_clk);
>>
>> netif_device_attach(ndev);
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2012-04-24 6:33 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 5:56 [PATCH V2 0/9] clk: Add non CONFIG_HAVE_CLK routines Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 5:56 ` [PATCH V2 1/9] " Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 5:56 ` [PATCH V2 2/9] clk: Remove redundant depends on from drivers/Kconfig Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 5:56 ` [PATCH V2 3/9] ata/pata_arasan: Remove conditional compilation of clk code Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 5:56 ` [PATCH V2 4/9] ata/sata_mv: " Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 5:56 ` [PATCH V2 5/9] net/c_can: " Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 5:56 ` [PATCH V2 6/9] net/stmmac: " Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 6:16 ` Giuseppe CAVALLARO
2012-04-24 6:16 ` Giuseppe CAVALLARO
2012-04-24 6:33 ` Giuseppe CAVALLARO [this message]
2012-04-24 6:33 ` Giuseppe CAVALLARO
2012-04-24 6:42 ` Viresh Kumar
2012-04-24 6:42 ` Viresh Kumar
2012-04-24 8:24 ` Giuseppe CAVALLARO
2012-04-24 8:24 ` Giuseppe CAVALLARO
2012-04-24 5:56 ` [PATCH V2 7/9] gadget/m66592: " Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 5:56 ` [PATCH V2 8/9] gadget/r8a66597: " Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
2012-04-24 5:56 ` [PATCH V2 9/9] usb/host/r8a66597: " Viresh Kumar
2012-04-24 5:56 ` Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F96493C.7020309@st.com \
--to=peppe.cavallaro@st.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.