* [PATCH 00/13] clk: Add non CONFIG_HAVE_CLK routines
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
Many drivers are shared between architectures that may or may not have HAVE_CLK
selected for them. To remove compilation errors for them we enclose clk_*()
calls in these drivers within #ifdef CONFIG_HAVE_CLK, #endif.
This patchset removes the need of these CONFIG_HAVE_CLK statements, by
introducing dummy routines when HAVE_CLK is not selected by platforms. So,
definition of these routines will always be available. These calls will return
error for platforms that don't select HAVE_CLK.
Viresh Kumar (13):
clk: Add non CONFIG_HAVE_CLK routines
clk: Remove redundant depends on from drivers/Kconfig
clk: CLK_PREPARE must depend on HAVE_CLK
ata/pata_arasan: Remove conditional compilation of clk code
ata/sata_mv: Remove conditional compilation of clk code
i2c/i2c-pxa: Remove conditional compilation of clk code
net/c_can: Remove conditional compilation of clk code
net/stmmac: Remove conditional compilation of clk code
gadget/m66592: Remove conditional compilation of clk code
gadget/r8a66597: Remove conditional compilation of clk code
usb/host/r8a66597: Remove conditional compilation of clk code
usb/marvell: Remove conditional compilation of clk code
usb/musb: Remove conditional compilation of clk code
drivers/ata/pata_arasan_cf.c | 39 ++---
drivers/ata/sata_mv.c | 10 --
drivers/clk/Kconfig | 3 +-
drivers/i2c/busses/i2c-pxa.c | 7 -
drivers/net/can/c_can/c_can_platform.c | 28 ++---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 40 -----
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 34 +++--
drivers/usb/gadget/m66592-udc.c | 19 +--
drivers/usb/gadget/m66592-udc.h | 5 -
drivers/usb/gadget/r8a66597-udc.c | 21 +--
drivers/usb/gadget/r8a66597-udc.h | 5 -
drivers/usb/host/r8a66597-hcd.c | 28 ++---
drivers/usb/host/r8a66597.h | 5 -
drivers/usb/musb/musb_core.h | 8 -
include/linux/clk.h | 160 +++++++++++++--------
include/linux/platform_data/mv_usb.h | 9 --
16 files changed, 171 insertions(+), 250 deletions(-)
--
1.7.9
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 01/13] clk: Add non CONFIG_HAVE_CLK routines
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar
Many drivers are shared between architectures that may or may not have HAVE_CLK
selected for them. To remove compilation errors for them we enclose clk_*()
calls in these drivers within #ifdef CONFIG_HAVE_CLK, #endif.
This patch removes the need of these CONFIG_HAVE_CLK statements, by introducing
dummy routines when HAVE_CLK is not selected by platforms. So, definition of
these routines will always be available. These calls will return error for
platforms that don't select HAVE_CLK.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
include/linux/clk.h | 160 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 101 insertions(+), 59 deletions(-)
diff --git a/include/linux/clk.h b/include/linux/clk.h
index b025272..6e1c63e 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -84,23 +84,6 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
#endif /* !CONFIG_COMMON_CLK */
/**
- * clk_get - lookup and obtain a reference to a clock producer.
- * @dev: device for clock "consumer"
- * @id: clock comsumer ID
- *
- * Returns a struct clk corresponding to the clock producer, or
- * valid IS_ERR() condition containing errno. The implementation
- * uses @dev and @id to determine the clock consumer, and thereby
- * the clock producer. (IOW, @id may be identical strings, but
- * clk_get may return different clock producers depending on @dev.)
- *
- * Drivers must assume that the clock source is not enabled.
- *
- * clk_get should not be called from within interrupt context.
- */
-struct clk *clk_get(struct device *dev, const char *id);
-
-/**
* clk_prepare - prepare a clock source
* @clk: clock source
*
@@ -119,6 +102,42 @@ static inline int clk_prepare(struct clk *clk)
#endif
/**
+ * clk_unprepare - undo preparation of a clock source
+ * @clk: clock source
+ *
+ * This undoes a previously prepared clock. The caller must balance
+ * the number of prepare and unprepare calls.
+ *
+ * Must not be called from within atomic context.
+ */
+#ifdef CONFIG_HAVE_CLK_PREPARE
+void clk_unprepare(struct clk *clk);
+#else
+static inline void clk_unprepare(struct clk *clk)
+{
+ might_sleep();
+}
+#endif
+
+#ifdef CONFIG_HAVE_CLK
+/**
+ * clk_get - lookup and obtain a reference to a clock producer.
+ * @dev: device for clock "consumer"
+ * @id: clock comsumer ID
+ *
+ * Returns a struct clk corresponding to the clock producer, or
+ * valid IS_ERR() condition containing errno. The implementation
+ * uses @dev and @id to determine the clock consumer, and thereby
+ * the clock producer. (IOW, @id may be identical strings, but
+ * clk_get may return different clock producers depending on @dev.)
+ *
+ * Drivers must assume that the clock source is not enabled.
+ *
+ * clk_get should not be called from within interrupt context.
+ */
+struct clk *clk_get(struct device *dev, const char *id);
+
+/**
* clk_enable - inform the system when the clock source should be running.
* @clk: clock source
*
@@ -146,47 +165,6 @@ int clk_enable(struct clk *clk);
*/
void clk_disable(struct clk *clk);
-
-/**
- * clk_unprepare - undo preparation of a clock source
- * @clk: clock source
- *
- * This undoes a previously prepared clock. The caller must balance
- * the number of prepare and unprepare calls.
- *
- * Must not be called from within atomic context.
- */
-#ifdef CONFIG_HAVE_CLK_PREPARE
-void clk_unprepare(struct clk *clk);
-#else
-static inline void clk_unprepare(struct clk *clk)
-{
- might_sleep();
-}
-#endif
-
-/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
-static inline int clk_prepare_enable(struct clk *clk)
-{
- int ret;
-
- ret = clk_prepare(clk);
- if (ret)
- return ret;
- ret = clk_enable(clk);
- if (ret)
- clk_unprepare(clk);
-
- return ret;
-}
-
-/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */
-static inline void clk_disable_unprepare(struct clk *clk)
-{
- clk_disable(clk);
- clk_unprepare(clk);
-}
-
/**
* clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
* This is only valid once the clock source has been enabled.
@@ -206,7 +184,6 @@ unsigned long clk_get_rate(struct clk *clk);
*/
void clk_put(struct clk *clk);
-
/*
* The remaining APIs are optional for machine class support.
*/
@@ -265,6 +242,71 @@ struct clk *clk_get_parent(struct clk *clk);
*/
struct clk *clk_get_sys(const char *dev_id, const char *con_id);
+#else /* !CONFIG_HAVE_CLK */
+
+static inline struct clk *clk_get(struct device *dev, const char *id)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline void clk_put(struct clk *clk) {}
+
+static inline int clk_enable(struct clk *clk)
+{
+ return -ENODEV;
+}
+
+static inline void clk_disable(struct clk *clk) {}
+
+static inline unsigned long clk_get_rate(struct clk *clk)
+{
+ return -ENODEV;
+}
+
+static inline int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+ return -ENODEV;
+}
+
+static inline long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+ return -ENODEV;
+}
+
+static inline int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+ return -ENODEV;
+}
+
+static inline struct clk *clk_get_parent(struct clk *clk)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+#endif
+
+/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
+static inline int clk_prepare_enable(struct clk *clk)
+{
+ int ret;
+
+ ret = clk_prepare(clk);
+ if (ret)
+ return ret;
+ ret = clk_enable(clk);
+ if (ret)
+ clk_unprepare(clk);
+
+ return ret;
+}
+
+/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */
+static inline void clk_disable_unprepare(struct clk *clk)
+{
+ clk_disable(clk);
+ clk_unprepare(clk);
+}
+
/**
* clk_add_alias - add a new clock alias
* @alias: name for clock alias
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 01/13] clk: Add non CONFIG_HAVE_CLK routines
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
Many drivers are shared between architectures that may or may not have HAVE_CLK
selected for them. To remove compilation errors for them we enclose clk_*()
calls in these drivers within #ifdef CONFIG_HAVE_CLK, #endif.
This patch removes the need of these CONFIG_HAVE_CLK statements, by introducing
dummy routines when HAVE_CLK is not selected by platforms. So, definition of
these routines will always be available. These calls will return error for
platforms that don't select HAVE_CLK.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
include/linux/clk.h | 160 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 101 insertions(+), 59 deletions(-)
diff --git a/include/linux/clk.h b/include/linux/clk.h
index b025272..6e1c63e 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -84,23 +84,6 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
#endif /* !CONFIG_COMMON_CLK */
/**
- * clk_get - lookup and obtain a reference to a clock producer.
- * @dev: device for clock "consumer"
- * @id: clock comsumer ID
- *
- * Returns a struct clk corresponding to the clock producer, or
- * valid IS_ERR() condition containing errno. The implementation
- * uses @dev and @id to determine the clock consumer, and thereby
- * the clock producer. (IOW, @id may be identical strings, but
- * clk_get may return different clock producers depending on @dev.)
- *
- * Drivers must assume that the clock source is not enabled.
- *
- * clk_get should not be called from within interrupt context.
- */
-struct clk *clk_get(struct device *dev, const char *id);
-
-/**
* clk_prepare - prepare a clock source
* @clk: clock source
*
@@ -119,6 +102,42 @@ static inline int clk_prepare(struct clk *clk)
#endif
/**
+ * clk_unprepare - undo preparation of a clock source
+ * @clk: clock source
+ *
+ * This undoes a previously prepared clock. The caller must balance
+ * the number of prepare and unprepare calls.
+ *
+ * Must not be called from within atomic context.
+ */
+#ifdef CONFIG_HAVE_CLK_PREPARE
+void clk_unprepare(struct clk *clk);
+#else
+static inline void clk_unprepare(struct clk *clk)
+{
+ might_sleep();
+}
+#endif
+
+#ifdef CONFIG_HAVE_CLK
+/**
+ * clk_get - lookup and obtain a reference to a clock producer.
+ * @dev: device for clock "consumer"
+ * @id: clock comsumer ID
+ *
+ * Returns a struct clk corresponding to the clock producer, or
+ * valid IS_ERR() condition containing errno. The implementation
+ * uses @dev and @id to determine the clock consumer, and thereby
+ * the clock producer. (IOW, @id may be identical strings, but
+ * clk_get may return different clock producers depending on @dev.)
+ *
+ * Drivers must assume that the clock source is not enabled.
+ *
+ * clk_get should not be called from within interrupt context.
+ */
+struct clk *clk_get(struct device *dev, const char *id);
+
+/**
* clk_enable - inform the system when the clock source should be running.
* @clk: clock source
*
@@ -146,47 +165,6 @@ int clk_enable(struct clk *clk);
*/
void clk_disable(struct clk *clk);
-
-/**
- * clk_unprepare - undo preparation of a clock source
- * @clk: clock source
- *
- * This undoes a previously prepared clock. The caller must balance
- * the number of prepare and unprepare calls.
- *
- * Must not be called from within atomic context.
- */
-#ifdef CONFIG_HAVE_CLK_PREPARE
-void clk_unprepare(struct clk *clk);
-#else
-static inline void clk_unprepare(struct clk *clk)
-{
- might_sleep();
-}
-#endif
-
-/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
-static inline int clk_prepare_enable(struct clk *clk)
-{
- int ret;
-
- ret = clk_prepare(clk);
- if (ret)
- return ret;
- ret = clk_enable(clk);
- if (ret)
- clk_unprepare(clk);
-
- return ret;
-}
-
-/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */
-static inline void clk_disable_unprepare(struct clk *clk)
-{
- clk_disable(clk);
- clk_unprepare(clk);
-}
-
/**
* clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
* This is only valid once the clock source has been enabled.
@@ -206,7 +184,6 @@ unsigned long clk_get_rate(struct clk *clk);
*/
void clk_put(struct clk *clk);
-
/*
* The remaining APIs are optional for machine class support.
*/
@@ -265,6 +242,71 @@ struct clk *clk_get_parent(struct clk *clk);
*/
struct clk *clk_get_sys(const char *dev_id, const char *con_id);
+#else /* !CONFIG_HAVE_CLK */
+
+static inline struct clk *clk_get(struct device *dev, const char *id)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline void clk_put(struct clk *clk) {}
+
+static inline int clk_enable(struct clk *clk)
+{
+ return -ENODEV;
+}
+
+static inline void clk_disable(struct clk *clk) {}
+
+static inline unsigned long clk_get_rate(struct clk *clk)
+{
+ return -ENODEV;
+}
+
+static inline int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+ return -ENODEV;
+}
+
+static inline long clk_round_rate(struct clk *clk, unsigned long rate)
+{
+ return -ENODEV;
+}
+
+static inline int clk_set_parent(struct clk *clk, struct clk *parent)
+{
+ return -ENODEV;
+}
+
+static inline struct clk *clk_get_parent(struct clk *clk)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+#endif
+
+/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
+static inline int clk_prepare_enable(struct clk *clk)
+{
+ int ret;
+
+ ret = clk_prepare(clk);
+ if (ret)
+ return ret;
+ ret = clk_enable(clk);
+ if (ret)
+ clk_unprepare(clk);
+
+ return ret;
+}
+
+/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */
+static inline void clk_disable_unprepare(struct clk *clk)
+{
+ clk_disable(clk);
+ clk_unprepare(clk);
+}
+
/**
* clk_add_alias - add a new clock alias
* @alias: name for clock alias
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 01/13] clk: Add non CONFIG_HAVE_CLK routines
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 12:42 ` Russell King - ARM Linux
-1 siblings, 0 replies; 44+ messages in thread
From: Russell King - ARM Linux @ 2012-04-21 12:42 UTC (permalink / raw)
To: Viresh Kumar
Cc: akpm, mturquette, sshtylyov, spear-devel, linux-kernel, jgarzik,
linux-arm-kernel
On Sat, Apr 21, 2012 at 05:17:28PM +0530, Viresh Kumar wrote:
> Many drivers are shared between architectures that may or may not have HAVE_CLK
> selected for them. To remove compilation errors for them we enclose clk_*()
> calls in these drivers within #ifdef CONFIG_HAVE_CLK, #endif.
All you're doing is making drivers buildable. Drivers will not be usable
with this (they'll error out because clk_get() will fail.)
For example:
-#ifndef CONFIG_HAVE_CLK
-/* Dummy stub for clk framework */
-#define clk_get(dev, id) NULL
-#define clk_put(clock) do {} while (0)
-#define clk_enable(clock) do {} while (0)
-#define clk_disable(clock) do {} while (0)
-#endif
-
along with your change in this patch changes the drivers behaviour.
A better solution would be to assume that if HAVE_CLK is not set, then
that means there's no control over clocks, and therefore the clk API
should become totally transparent and non-failure inducing. So, having
clk_get() return NULL, and having all the other clk API functions ignore
their argument (just like the macros above) is the right solution here.
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 01/13] clk: Add non CONFIG_HAVE_CLK routines
@ 2012-04-21 12:42 ` Russell King - ARM Linux
0 siblings, 0 replies; 44+ messages in thread
From: Russell King - ARM Linux @ 2012-04-21 12:42 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Apr 21, 2012 at 05:17:28PM +0530, Viresh Kumar wrote:
> Many drivers are shared between architectures that may or may not have HAVE_CLK
> selected for them. To remove compilation errors for them we enclose clk_*()
> calls in these drivers within #ifdef CONFIG_HAVE_CLK, #endif.
All you're doing is making drivers buildable. Drivers will not be usable
with this (they'll error out because clk_get() will fail.)
For example:
-#ifndef CONFIG_HAVE_CLK
-/* Dummy stub for clk framework */
-#define clk_get(dev, id) NULL
-#define clk_put(clock) do {} while (0)
-#define clk_enable(clock) do {} while (0)
-#define clk_disable(clock) do {} while (0)
-#endif
-
along with your change in this patch changes the drivers behaviour.
A better solution would be to assume that if HAVE_CLK is not set, then
that means there's no control over clocks, and therefore the clk API
should become totally transparent and non-failure inducing. So, having
clk_get() return NULL, and having all the other clk API functions ignore
their argument (just like the macros above) is the right solution here.
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 01/13] clk: Add non CONFIG_HAVE_CLK routines
2012-04-21 12:42 ` Russell King - ARM Linux
@ 2012-04-21 13:47 ` viresh kumar
-1 siblings, 0 replies; 44+ messages in thread
From: viresh kumar @ 2012-04-21 13:47 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: akpm, mturquette, sshtylyov, spear-devel, linux-kernel, jgarzik,
linux-arm-kernel
On 4/21/12, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> On Sat, Apr 21, 2012 at 05:17:28PM +0530, Viresh Kumar wrote:
>> Many drivers are shared between architectures that may or may not have
>> HAVE_CLK
>> selected for them. To remove compilation errors for them we enclose
>> clk_*()
>> calls in these drivers within #ifdef CONFIG_HAVE_CLK, #endif.
>
> All you're doing is making drivers buildable. Drivers will not be usable
> with this (they'll error out because clk_get() will fail.)
>
> For example:
>
> -#ifndef CONFIG_HAVE_CLK
> -/* Dummy stub for clk framework */
> -#define clk_get(dev, id) NULL
> -#define clk_put(clock) do {} while (0)
> -#define clk_enable(clock) do {} while (0)
> -#define clk_disable(clock) do {} while (0)
> -#endif
> -
>
> along with your change in this patch changes the drivers behaviour.
I tried to take care of these issues, but unfortunately
i couldn't.
Patch numbers 6, 12 & 13 will actually break drivers. Will ask Andrew
to drop them.
> A better solution would be to assume that if HAVE_CLK is not set, then
> that means there's no control over clocks, and therefore the clk API
> should become totally transparent and non-failure inducing. So, having
> clk_get() return NULL, and having all the other clk API functions ignore
> their argument (just like the macros above) is the right solution here.
Will leave these macros as is for mentioned patches.
--
viresh
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 01/13] clk: Add non CONFIG_HAVE_CLK routines
@ 2012-04-21 13:47 ` viresh kumar
0 siblings, 0 replies; 44+ messages in thread
From: viresh kumar @ 2012-04-21 13:47 UTC (permalink / raw)
To: linux-arm-kernel
On 4/21/12, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
> On Sat, Apr 21, 2012 at 05:17:28PM +0530, Viresh Kumar wrote:
>> Many drivers are shared between architectures that may or may not have
>> HAVE_CLK
>> selected for them. To remove compilation errors for them we enclose
>> clk_*()
>> calls in these drivers within #ifdef CONFIG_HAVE_CLK, #endif.
>
> All you're doing is making drivers buildable. Drivers will not be usable
> with this (they'll error out because clk_get() will fail.)
>
> For example:
>
> -#ifndef CONFIG_HAVE_CLK
> -/* Dummy stub for clk framework */
> -#define clk_get(dev, id) NULL
> -#define clk_put(clock) do {} while (0)
> -#define clk_enable(clock) do {} while (0)
> -#define clk_disable(clock) do {} while (0)
> -#endif
> -
>
> along with your change in this patch changes the drivers behaviour.
I tried to take care of these issues, but unfortunately
i couldn't.
Patch numbers 6, 12 & 13 will actually break drivers. Will ask Andrew
to drop them.
> A better solution would be to assume that if HAVE_CLK is not set, then
> that means there's no control over clocks, and therefore the clk API
> should become totally transparent and non-failure inducing. So, having
> clk_get() return NULL, and having all the other clk API functions ignore
> their argument (just like the macros above) is the right solution here.
Will leave these macros as is for mentioned patches.
--
viresh
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 02/13] clk: Remove redundant depends on from drivers/Kconfig
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar
menu "Common Clock Framework" has "depends on COMMON_CLK" and so configs defined
within menu don't require these "depends on COMMON_CLK again".
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
drivers/clk/Kconfig | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 165e1fe..4f10a21 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -24,7 +24,6 @@ menu "Common Clock Framework"
config COMMON_CLK_DISABLE_UNUSED
bool "Disabled unused clocks at boot"
- depends on COMMON_CLK
---help---
Traverses the entire clock tree and disables any clocks that are
enabled in hardware but have not been enabled by any device drivers.
@@ -35,7 +34,6 @@ config COMMON_CLK_DISABLE_UNUSED
config COMMON_CLK_DEBUG
bool "DebugFS representation of clock tree"
- depends on COMMON_CLK
select DEBUG_FS
---help---
Creates a directory hierchy in debugfs for visualizing the clk
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 02/13] clk: Remove redundant depends on from drivers/Kconfig
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
menu "Common Clock Framework" has "depends on COMMON_CLK" and so configs defined
within menu don't require these "depends on COMMON_CLK again".
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
drivers/clk/Kconfig | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 165e1fe..4f10a21 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -24,7 +24,6 @@ menu "Common Clock Framework"
config COMMON_CLK_DISABLE_UNUSED
bool "Disabled unused clocks at boot"
- depends on COMMON_CLK
---help---
Traverses the entire clock tree and disables any clocks that are
enabled in hardware but have not been enabled by any device drivers.
@@ -35,7 +34,6 @@ config COMMON_CLK_DISABLE_UNUSED
config COMMON_CLK_DEBUG
bool "DebugFS representation of clock tree"
- depends on COMMON_CLK
select DEBUG_FS
---help---
Creates a directory hierchy in debugfs for visualizing the clk
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 03/13] clk: CLK_PREPARE must depend on HAVE_CLK
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar
CLK_PREPARE must have dependency on HAVE_CLK. Add it.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
drivers/clk/Kconfig | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 4f10a21..8281056 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -5,6 +5,7 @@ config CLKDEV_LOOKUP
config HAVE_CLK_PREPARE
bool
+ depends on HAVE_CLK
config HAVE_MACH_CLKDEV
bool
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 03/13] clk: CLK_PREPARE must depend on HAVE_CLK
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
CLK_PREPARE must have dependency on HAVE_CLK. Add it.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
drivers/clk/Kconfig | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 4f10a21..8281056 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -5,6 +5,7 @@ config CLKDEV_LOOKUP
config HAVE_CLK_PREPARE
bool
+ depends on HAVE_CLK
config HAVE_MACH_CLKDEV
bool
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 03/13] clk: CLK_PREPARE must depend on HAVE_CLK
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 12:40 ` Russell King - ARM Linux
-1 siblings, 0 replies; 44+ messages in thread
From: Russell King - ARM Linux @ 2012-04-21 12:40 UTC (permalink / raw)
To: Viresh Kumar
Cc: akpm, mturquette, sshtylyov, spear-devel, linux-kernel, jgarzik,
linux-arm-kernel
On Sat, Apr 21, 2012 at 05:17:30PM +0530, Viresh Kumar wrote:
> CLK_PREPARE must have dependency on HAVE_CLK. Add it.
No - its possible to have HAVE_CLK_PREPARE selected independently of
HAVE_CLK. Why do we want to end up having to add conditionals all
over the place for 'select HAVE_CLK_PREPARE' ?
The only time HAVE_CLK_PREPARE gets used is in a header file, where you're
already making it conditional on HAVE_CLK. Nothing else should know about
HAVE_CLK_PREPARE.
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 03/13] clk: CLK_PREPARE must depend on HAVE_CLK
@ 2012-04-21 12:40 ` Russell King - ARM Linux
0 siblings, 0 replies; 44+ messages in thread
From: Russell King - ARM Linux @ 2012-04-21 12:40 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Apr 21, 2012 at 05:17:30PM +0530, Viresh Kumar wrote:
> CLK_PREPARE must have dependency on HAVE_CLK. Add it.
No - its possible to have HAVE_CLK_PREPARE selected independently of
HAVE_CLK. Why do we want to end up having to add conditionals all
over the place for 'select HAVE_CLK_PREPARE' ?
The only time HAVE_CLK_PREPARE gets used is in a header file, where you're
already making it conditional on HAVE_CLK. Nothing else should know about
HAVE_CLK_PREPARE.
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 04/13] ata/pata_arasan: Remove conditional compilation of clk code
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, linux-ide
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: linux-ide@vger.kernel.org
---
drivers/ata/pata_arasan_cf.c | 39 ++++++++++++++++-----------------------
1 files changed, 16 insertions(+), 23 deletions(-)
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index fc2db2a..b370e35 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -184,10 +184,8 @@
struct arasan_cf_dev {
/* pointer to ata_host structure */
struct ata_host *host;
- /* clk structure, only if HAVE_CLK is defined */
-#ifdef CONFIG_HAVE_CLK
+ /* clk structure */
struct clk *clk;
-#endif
/* physical base address of controller */
dma_addr_t pbase;
@@ -312,13 +310,13 @@ static int cf_init(struct arasan_cf_dev *acdev)
unsigned long flags;
int ret = 0;
-#ifdef CONFIG_HAVE_CLK
- ret = clk_enable(acdev->clk);
- if (ret) {
- dev_dbg(acdev->host->dev, "clock enable failed");
- return ret;
+ if (!IS_ERR(acdev->clk)) {
+ ret = clk_enable(acdev->clk);
+ if (ret) {
+ dev_dbg(acdev->host->dev, "clock enable failed");
+ return ret;
+ }
}
-#endif
spin_lock_irqsave(&acdev->host->lock, flags);
/* configure CF interface clock */
@@ -344,9 +342,9 @@ static void cf_exit(struct arasan_cf_dev *acdev)
writel(readl(acdev->vbase + OP_MODE) & ~CFHOST_ENB,
acdev->vbase + OP_MODE);
spin_unlock_irqrestore(&acdev->host->lock, flags);
-#ifdef CONFIG_HAVE_CLK
- clk_disable(acdev->clk);
-#endif
+
+ if (!IS_ERR(acdev->clk))
+ clk_disable(acdev->clk);
}
static void dma_callback(void *dev)
@@ -828,13 +826,9 @@ static int __devinit arasan_cf_probe(struct platform_device *pdev)
return -ENOMEM;
}
-#ifdef CONFIG_HAVE_CLK
acdev->clk = clk_get(&pdev->dev, NULL);
- if (IS_ERR(acdev->clk)) {
+ if (IS_ERR(acdev->clk))
dev_warn(&pdev->dev, "Clock not found\n");
- return PTR_ERR(acdev->clk);
- }
-#endif
/* allocate host */
host = ata_host_alloc(&pdev->dev, 1);
@@ -899,9 +893,8 @@ static int __devinit arasan_cf_probe(struct platform_device *pdev)
&arasan_cf_sht);
free_clk:
-#ifdef CONFIG_HAVE_CLK
- clk_put(acdev->clk);
-#endif
+ if (!IS_ERR(acdev->clk))
+ clk_put(acdev->clk);
return ret;
}
@@ -912,9 +905,9 @@ static int __devexit arasan_cf_remove(struct platform_device *pdev)
ata_host_detach(host);
cf_exit(acdev);
-#ifdef CONFIG_HAVE_CLK
- clk_put(acdev->clk);
-#endif
+
+ if (!IS_ERR(acdev->clk))
+ clk_put(acdev->clk);
return 0;
}
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 04/13] ata/pata_arasan: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: linux-ide at vger.kernel.org
---
drivers/ata/pata_arasan_cf.c | 39 ++++++++++++++++-----------------------
1 files changed, 16 insertions(+), 23 deletions(-)
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index fc2db2a..b370e35 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -184,10 +184,8 @@
struct arasan_cf_dev {
/* pointer to ata_host structure */
struct ata_host *host;
- /* clk structure, only if HAVE_CLK is defined */
-#ifdef CONFIG_HAVE_CLK
+ /* clk structure */
struct clk *clk;
-#endif
/* physical base address of controller */
dma_addr_t pbase;
@@ -312,13 +310,13 @@ static int cf_init(struct arasan_cf_dev *acdev)
unsigned long flags;
int ret = 0;
-#ifdef CONFIG_HAVE_CLK
- ret = clk_enable(acdev->clk);
- if (ret) {
- dev_dbg(acdev->host->dev, "clock enable failed");
- return ret;
+ if (!IS_ERR(acdev->clk)) {
+ ret = clk_enable(acdev->clk);
+ if (ret) {
+ dev_dbg(acdev->host->dev, "clock enable failed");
+ return ret;
+ }
}
-#endif
spin_lock_irqsave(&acdev->host->lock, flags);
/* configure CF interface clock */
@@ -344,9 +342,9 @@ static void cf_exit(struct arasan_cf_dev *acdev)
writel(readl(acdev->vbase + OP_MODE) & ~CFHOST_ENB,
acdev->vbase + OP_MODE);
spin_unlock_irqrestore(&acdev->host->lock, flags);
-#ifdef CONFIG_HAVE_CLK
- clk_disable(acdev->clk);
-#endif
+
+ if (!IS_ERR(acdev->clk))
+ clk_disable(acdev->clk);
}
static void dma_callback(void *dev)
@@ -828,13 +826,9 @@ static int __devinit arasan_cf_probe(struct platform_device *pdev)
return -ENOMEM;
}
-#ifdef CONFIG_HAVE_CLK
acdev->clk = clk_get(&pdev->dev, NULL);
- if (IS_ERR(acdev->clk)) {
+ if (IS_ERR(acdev->clk))
dev_warn(&pdev->dev, "Clock not found\n");
- return PTR_ERR(acdev->clk);
- }
-#endif
/* allocate host */
host = ata_host_alloc(&pdev->dev, 1);
@@ -899,9 +893,8 @@ static int __devinit arasan_cf_probe(struct platform_device *pdev)
&arasan_cf_sht);
free_clk:
-#ifdef CONFIG_HAVE_CLK
- clk_put(acdev->clk);
-#endif
+ if (!IS_ERR(acdev->clk))
+ clk_put(acdev->clk);
return ret;
}
@@ -912,9 +905,9 @@ static int __devexit arasan_cf_remove(struct platform_device *pdev)
ata_host_detach(host);
cf_exit(acdev);
-#ifdef CONFIG_HAVE_CLK
- clk_put(acdev->clk);
-#endif
+
+ if (!IS_ERR(acdev->clk))
+ clk_put(acdev->clk);
return 0;
}
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 05/13] ata/sata_mv: Remove conditional compilation of clk code
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, linux-ide
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: linux-ide@vger.kernel.org
---
drivers/ata/sata_mv.c | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 38950ea..3bb9cb7 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -551,9 +551,7 @@ struct mv_host_priv {
u32 irq_mask_offset;
u32 unmask_all_irqs;
-#if defined(CONFIG_HAVE_CLK)
struct clk *clk;
-#endif
/*
* These consistent DMA memory pools give us guaranteed
* alignment for hardware-accessed data structures,
@@ -4062,13 +4060,11 @@ static int mv_platform_probe(struct platform_device *pdev)
resource_size(res));
hpriv->base -= SATAHC0_REG_BASE;
-#if defined(CONFIG_HAVE_CLK)
hpriv->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(hpriv->clk))
dev_notice(&pdev->dev, "cannot get clkdev\n");
else
clk_enable(hpriv->clk);
-#endif
/*
* (Re-)program MBUS remapping windows if we are asked to.
@@ -4095,12 +4091,10 @@ static int mv_platform_probe(struct platform_device *pdev)
return 0;
err:
-#if defined(CONFIG_HAVE_CLK)
if (!IS_ERR(hpriv->clk)) {
clk_disable(hpriv->clk);
clk_put(hpriv->clk);
}
-#endif
return rc;
}
@@ -4116,17 +4110,13 @@ err:
static int __devexit mv_platform_remove(struct platform_device *pdev)
{
struct ata_host *host = platform_get_drvdata(pdev);
-#if defined(CONFIG_HAVE_CLK)
struct mv_host_priv *hpriv = host->private_data;
-#endif
ata_host_detach(host);
-#if defined(CONFIG_HAVE_CLK)
if (!IS_ERR(hpriv->clk)) {
clk_disable(hpriv->clk);
clk_put(hpriv->clk);
}
-#endif
return 0;
}
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 05/13] ata/sata_mv: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: linux-ide at vger.kernel.org
---
drivers/ata/sata_mv.c | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 38950ea..3bb9cb7 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -551,9 +551,7 @@ struct mv_host_priv {
u32 irq_mask_offset;
u32 unmask_all_irqs;
-#if defined(CONFIG_HAVE_CLK)
struct clk *clk;
-#endif
/*
* These consistent DMA memory pools give us guaranteed
* alignment for hardware-accessed data structures,
@@ -4062,13 +4060,11 @@ static int mv_platform_probe(struct platform_device *pdev)
resource_size(res));
hpriv->base -= SATAHC0_REG_BASE;
-#if defined(CONFIG_HAVE_CLK)
hpriv->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(hpriv->clk))
dev_notice(&pdev->dev, "cannot get clkdev\n");
else
clk_enable(hpriv->clk);
-#endif
/*
* (Re-)program MBUS remapping windows if we are asked to.
@@ -4095,12 +4091,10 @@ static int mv_platform_probe(struct platform_device *pdev)
return 0;
err:
-#if defined(CONFIG_HAVE_CLK)
if (!IS_ERR(hpriv->clk)) {
clk_disable(hpriv->clk);
clk_put(hpriv->clk);
}
-#endif
return rc;
}
@@ -4116,17 +4110,13 @@ err:
static int __devexit mv_platform_remove(struct platform_device *pdev)
{
struct ata_host *host = platform_get_drvdata(pdev);
-#if defined(CONFIG_HAVE_CLK)
struct mv_host_priv *hpriv = host->private_data;
-#endif
ata_host_detach(host);
-#if defined(CONFIG_HAVE_CLK)
if (!IS_ERR(hpriv->clk)) {
clk_disable(hpriv->clk);
clk_put(hpriv->clk);
}
-#endif
return 0;
}
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 06/13] i2c/i2c-pxa: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, Wolfram Sang,
linux-i2c
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.
pxa i2c also has these dummy macros defined locally. Remove them as they aren't
required anymore.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: linux-i2c@vger.kernel.org
---
drivers/i2c/busses/i2c-pxa.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index f673326..5fab849 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -41,13 +41,6 @@
#include <asm/irq.h>
-#ifndef CONFIG_HAVE_CLK
-#define clk_get(dev, id) NULL
-#define clk_put(clk) do { } while (0)
-#define clk_disable(clk) do { } while (0)
-#define clk_enable(clk) do { } while (0)
-#endif
-
struct pxa_reg_layout {
u32 ibmr;
u32 idbr;
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 06/13] i2c/i2c-pxa: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
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.
pxa i2c also has these dummy macros defined locally. Remove them as they aren't
required anymore.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: linux-i2c at vger.kernel.org
---
drivers/i2c/busses/i2c-pxa.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index f673326..5fab849 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -41,13 +41,6 @@
#include <asm/irq.h>
-#ifndef CONFIG_HAVE_CLK
-#define clk_get(dev, id) NULL
-#define clk_put(clk) do { } while (0)
-#define clk_disable(clk) do { } while (0)
-#define clk_enable(clk) do { } while (0)
-#endif
-
struct pxa_reg_layout {
u32 ibmr;
u32 idbr;
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 06/13] i2c/i2c-pxa: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
Cc: spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
viresh.linux-Re5JQEeQqe8AvxtiuMwx3w,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
mturquette-QSEj5FYQhm4dnm+yROfE0A,
sshtylyov-Igf4POYTYCDQT0dZR+AlfA, jgarzik-H+wXaHxf7aLQT0dZR+AlfA,
Viresh Kumar, Wolfram Sang, linux-i2c-u79uwXL29TY76Z2rM5mHXA
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.
pxa i2c also has these dummy macros defined locally. Remove them as they aren't
required anymore.
Signed-off-by: Viresh Kumar <viresh.kumar-qxv4g6HH51o@public.gmane.org>
Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
drivers/i2c/busses/i2c-pxa.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index f673326..5fab849 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -41,13 +41,6 @@
#include <asm/irq.h>
-#ifndef CONFIG_HAVE_CLK
-#define clk_get(dev, id) NULL
-#define clk_put(clk) do { } while (0)
-#define clk_disable(clk) do { } while (0)
-#define clk_enable(clk) do { } while (0)
-#endif
-
struct pxa_reg_layout {
u32 ibmr;
u32 idbr;
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 07/13] net/c_can: Remove conditional compilation of clk code
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, David S. Miller,
Bhupesh Sharma
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Bhupesh Sharma <bhupesh.sharma@st.com>
---
drivers/net/can/c_can/c_can_platform.c | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index 5e1a5ff..d28904d 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -73,17 +73,12 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
struct c_can_priv *priv;
struct resource *mem;
int irq;
-#ifdef CONFIG_HAVE_CLK
struct clk *clk;
/* get the appropriate clk */
clk = clk_get(&pdev->dev, NULL);
- if (IS_ERR(clk)) {
+ if (IS_ERR(clk))
dev_err(&pdev->dev, "no clock defined\n");
- ret = -ENODEV;
- goto exit;
- }
-#endif
/* get the platform data */
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -118,10 +113,11 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
dev->irq = irq;
priv->regs = addr;
-#ifdef CONFIG_HAVE_CLK
- priv->can.clock.freq = clk_get_rate(clk);
- priv->priv = clk;
-#endif
+
+ if (!IS_ERR(clk)) {
+ priv->can.clock.freq = clk_get_rate(clk);
+ priv->priv = clk;
+ }
switch (mem->flags & IORESOURCE_MEM_TYPE_MASK) {
case IORESOURCE_MEM_32BIT:
@@ -157,10 +153,9 @@ exit_iounmap:
exit_release_mem:
release_mem_region(mem->start, resource_size(mem));
exit_free_clk:
-#ifdef CONFIG_HAVE_CLK
- clk_put(clk);
-exit:
-#endif
+ if (!IS_ERR(clk))
+ clk_put(clk);
+
dev_err(&pdev->dev, "probe failed\n");
return ret;
@@ -181,9 +176,8 @@ static int __devexit c_can_plat_remove(struct platform_device *pdev)
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, resource_size(mem));
-#ifdef CONFIG_HAVE_CLK
- clk_put(priv->priv);
-#endif
+ if (!IS_ERR(priv->priv))
+ clk_put(priv->priv);
return 0;
}
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 07/13] net/c_can: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Bhupesh Sharma <bhupesh.sharma@st.com>
---
drivers/net/can/c_can/c_can_platform.c | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index 5e1a5ff..d28904d 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -73,17 +73,12 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
struct c_can_priv *priv;
struct resource *mem;
int irq;
-#ifdef CONFIG_HAVE_CLK
struct clk *clk;
/* get the appropriate clk */
clk = clk_get(&pdev->dev, NULL);
- if (IS_ERR(clk)) {
+ if (IS_ERR(clk))
dev_err(&pdev->dev, "no clock defined\n");
- ret = -ENODEV;
- goto exit;
- }
-#endif
/* get the platform data */
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -118,10 +113,11 @@ static int __devinit c_can_plat_probe(struct platform_device *pdev)
dev->irq = irq;
priv->regs = addr;
-#ifdef CONFIG_HAVE_CLK
- priv->can.clock.freq = clk_get_rate(clk);
- priv->priv = clk;
-#endif
+
+ if (!IS_ERR(clk)) {
+ priv->can.clock.freq = clk_get_rate(clk);
+ priv->priv = clk;
+ }
switch (mem->flags & IORESOURCE_MEM_TYPE_MASK) {
case IORESOURCE_MEM_32BIT:
@@ -157,10 +153,9 @@ exit_iounmap:
exit_release_mem:
release_mem_region(mem->start, resource_size(mem));
exit_free_clk:
-#ifdef CONFIG_HAVE_CLK
- clk_put(clk);
-exit:
-#endif
+ if (!IS_ERR(clk))
+ clk_put(clk);
+
dev_err(&pdev->dev, "probe failed\n");
return ret;
@@ -181,9 +176,8 @@ static int __devexit c_can_plat_remove(struct platform_device *pdev)
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, resource_size(mem));
-#ifdef CONFIG_HAVE_CLK
- clk_put(priv->priv);
-#endif
+ if (!IS_ERR(priv->priv))
+ clk_put(priv->priv);
return 0;
}
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 08/13] net/stmmac: Remove conditional compilation of clk code
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, Giuseppe Cavallaro,
David S. Miller
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.
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 | 40 ---------------------
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 34 +++++++++++-------
2 files changed, 21 insertions(+), 53 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 9f2435c..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,41 +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 (priv->stmmac_clk)
- return clk_enable(priv->stmmac_clk);
-
- return 0;
-}
-
-static inline void stmmac_clk_disable(struct stmmac_priv *priv)
-{
- if (priv->stmmac_clk)
- 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)) {
- pr_err("%s: ERROR clk_get failed\n", __func__);
- 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 a64f0d4..28b8f30 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;
clk_rate = clk_get_rate(priv->stmmac_clk);
@@ -189,7 +189,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)
@@ -933,7 +932,8 @@ static int stmmac_open(struct net_device *dev)
struct stmmac_priv *priv = netdev_priv(dev);
int ret;
- stmmac_clk_enable(priv);
+ if (!IS_ERR(priv->stmmac_clk))
+ clk_enable(priv->stmmac_clk);
stmmac_check_ether_addr(priv);
@@ -1068,7 +1068,9 @@ open_error:
phy_disconnect(priv->phydev);
open_clk_dis:
- stmmac_clk_disable(priv);
+ if (!IS_ERR(priv->stmmac_clk))
+ clk_disable(priv->stmmac_clk);
+
return ret;
}
@@ -1121,7 +1123,9 @@ static int stmmac_release(struct net_device *dev)
stmmac_exit_fs();
#endif
stmmac_mdio_unregister(dev);
- stmmac_clk_disable(priv);
+
+ if (!IS_ERR(priv->stmmac_clk))
+ clk_disable(priv->stmmac_clk);
return 0;
}
@@ -1918,8 +1922,9 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
goto error;
}
- if (stmmac_clk_get(priv))
- goto error;
+ priv->stmmac_clk = clk_get(priv->device, NULL);
+ if (IS_ERR(priv->stmmac_clk))
+ pr_err("%s: No clock found\n", __func__);
/* If a specific clk_csr value is passed from the platform
* this means that the CSR Clock Range selection cannot be
@@ -1927,10 +1932,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;
+ }
return priv;
@@ -2004,7 +2011,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;
@@ -2026,9 +2034,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);
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 08/13] net/stmmac: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
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.
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 | 40 ---------------------
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 34 +++++++++++-------
2 files changed, 21 insertions(+), 53 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 9f2435c..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,41 +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 (priv->stmmac_clk)
- return clk_enable(priv->stmmac_clk);
-
- return 0;
-}
-
-static inline void stmmac_clk_disable(struct stmmac_priv *priv)
-{
- if (priv->stmmac_clk)
- 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)) {
- pr_err("%s: ERROR clk_get failed\n", __func__);
- 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 a64f0d4..28b8f30 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;
clk_rate = clk_get_rate(priv->stmmac_clk);
@@ -189,7 +189,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)
@@ -933,7 +932,8 @@ static int stmmac_open(struct net_device *dev)
struct stmmac_priv *priv = netdev_priv(dev);
int ret;
- stmmac_clk_enable(priv);
+ if (!IS_ERR(priv->stmmac_clk))
+ clk_enable(priv->stmmac_clk);
stmmac_check_ether_addr(priv);
@@ -1068,7 +1068,9 @@ open_error:
phy_disconnect(priv->phydev);
open_clk_dis:
- stmmac_clk_disable(priv);
+ if (!IS_ERR(priv->stmmac_clk))
+ clk_disable(priv->stmmac_clk);
+
return ret;
}
@@ -1121,7 +1123,9 @@ static int stmmac_release(struct net_device *dev)
stmmac_exit_fs();
#endif
stmmac_mdio_unregister(dev);
- stmmac_clk_disable(priv);
+
+ if (!IS_ERR(priv->stmmac_clk))
+ clk_disable(priv->stmmac_clk);
return 0;
}
@@ -1918,8 +1922,9 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
goto error;
}
- if (stmmac_clk_get(priv))
- goto error;
+ priv->stmmac_clk = clk_get(priv->device, NULL);
+ if (IS_ERR(priv->stmmac_clk))
+ pr_err("%s: No clock found\n", __func__);
/* If a specific clk_csr value is passed from the platform
* this means that the CSR Clock Range selection cannot be
@@ -1927,10 +1932,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;
+ }
return priv;
@@ -2004,7 +2011,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;
@@ -2026,9 +2034,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);
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 08/13] net/stmmac: Remove conditional compilation of clk code
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-24 5:56 ` Giuseppe CAVALLARO
-1 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-24 5:56 UTC (permalink / raw)
To: Viresh Kumar
Cc: akpm, spear-devel, linux-kernel, linux-arm-kernel, mturquette,
sshtylyov, jgarzik, Viresh Kumar, David S. Miller
Hello Viresh.
On 4/21/2012 1:47 PM, 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.
I like this patch also because reduces ifdef in the code :-)
Anyway this patch doesn't apply fine either in net-next and in net.git.
Also I wonder if you had already tested the driver build on arch w/o
HAVE_CLK ... just to avoid kernel build failures on other platforms.
Let me know if I can help you on that.
Peppe
>
> 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 | 40 ---------------------
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 34 +++++++++++-------
> 2 files changed, 21 insertions(+), 53 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index 9f2435c..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,41 +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 (priv->stmmac_clk)
> - return clk_enable(priv->stmmac_clk);
> -
> - return 0;
> -}
> -
> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
> -{
> - if (priv->stmmac_clk)
> - 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)) {
> - pr_err("%s: ERROR clk_get failed\n", __func__);
> - 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 a64f0d4..28b8f30 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;
>
> clk_rate = clk_get_rate(priv->stmmac_clk);
> @@ -189,7 +189,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)
> @@ -933,7 +932,8 @@ static int stmmac_open(struct net_device *dev)
> struct stmmac_priv *priv = netdev_priv(dev);
> int ret;
>
> - stmmac_clk_enable(priv);
> + if (!IS_ERR(priv->stmmac_clk))
> + clk_enable(priv->stmmac_clk);
>
> stmmac_check_ether_addr(priv);
>
> @@ -1068,7 +1068,9 @@ open_error:
> phy_disconnect(priv->phydev);
>
> open_clk_dis:
> - stmmac_clk_disable(priv);
> + if (!IS_ERR(priv->stmmac_clk))
> + clk_disable(priv->stmmac_clk);
> +
> return ret;
> }
>
> @@ -1121,7 +1123,9 @@ static int stmmac_release(struct net_device *dev)
> stmmac_exit_fs();
> #endif
> stmmac_mdio_unregister(dev);
> - stmmac_clk_disable(priv);
> +
> + if (!IS_ERR(priv->stmmac_clk))
> + clk_disable(priv->stmmac_clk);
>
> return 0;
> }
> @@ -1918,8 +1922,9 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
> goto error;
> }
>
> - if (stmmac_clk_get(priv))
> - goto error;
> + priv->stmmac_clk = clk_get(priv->device, NULL);
> + if (IS_ERR(priv->stmmac_clk))
> + pr_err("%s: No clock found\n", __func__);
>
> /* If a specific clk_csr value is passed from the platform
> * this means that the CSR Clock Range selection cannot be
> @@ -1927,10 +1932,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;
> + }
>
> return priv;
>
> @@ -2004,7 +2011,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;
> @@ -2026,9 +2034,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);
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 08/13] net/stmmac: Remove conditional compilation of clk code
@ 2012-04-24 5:56 ` Giuseppe CAVALLARO
0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-24 5:56 UTC (permalink / raw)
To: linux-arm-kernel
Hello Viresh.
On 4/21/2012 1:47 PM, 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.
I like this patch also because reduces ifdef in the code :-)
Anyway this patch doesn't apply fine either in net-next and in net.git.
Also I wonder if you had already tested the driver build on arch w/o
HAVE_CLK ... just to avoid kernel build failures on other platforms.
Let me know if I can help you on that.
Peppe
>
> 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 | 40 ---------------------
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 34 +++++++++++-------
> 2 files changed, 21 insertions(+), 53 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index 9f2435c..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,41 +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 (priv->stmmac_clk)
> - return clk_enable(priv->stmmac_clk);
> -
> - return 0;
> -}
> -
> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
> -{
> - if (priv->stmmac_clk)
> - 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)) {
> - pr_err("%s: ERROR clk_get failed\n", __func__);
> - 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 a64f0d4..28b8f30 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;
>
> clk_rate = clk_get_rate(priv->stmmac_clk);
> @@ -189,7 +189,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)
> @@ -933,7 +932,8 @@ static int stmmac_open(struct net_device *dev)
> struct stmmac_priv *priv = netdev_priv(dev);
> int ret;
>
> - stmmac_clk_enable(priv);
> + if (!IS_ERR(priv->stmmac_clk))
> + clk_enable(priv->stmmac_clk);
>
> stmmac_check_ether_addr(priv);
>
> @@ -1068,7 +1068,9 @@ open_error:
> phy_disconnect(priv->phydev);
>
> open_clk_dis:
> - stmmac_clk_disable(priv);
> + if (!IS_ERR(priv->stmmac_clk))
> + clk_disable(priv->stmmac_clk);
> +
> return ret;
> }
>
> @@ -1121,7 +1123,9 @@ static int stmmac_release(struct net_device *dev)
> stmmac_exit_fs();
> #endif
> stmmac_mdio_unregister(dev);
> - stmmac_clk_disable(priv);
> +
> + if (!IS_ERR(priv->stmmac_clk))
> + clk_disable(priv->stmmac_clk);
>
> return 0;
> }
> @@ -1918,8 +1922,9 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
> goto error;
> }
>
> - if (stmmac_clk_get(priv))
> - goto error;
> + priv->stmmac_clk = clk_get(priv->device, NULL);
> + if (IS_ERR(priv->stmmac_clk))
> + pr_err("%s: No clock found\n", __func__);
>
> /* If a specific clk_csr value is passed from the platform
> * this means that the CSR Clock Range selection cannot be
> @@ -1927,10 +1932,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;
> + }
>
> return priv;
>
> @@ -2004,7 +2011,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;
> @@ -2026,9 +2034,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);
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 08/13] net/stmmac: Remove conditional compilation of clk code
2012-04-24 5:56 ` Giuseppe CAVALLARO
(?)
@ 2012-04-24 5:57 ` Giuseppe CAVALLARO
-1 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-24 5:57 UTC (permalink / raw)
To: Viresh Kumar
Cc: akpm, spear-devel, linux-kernel, linux-arm-kernel, mturquette,
sshtylyov, jgarzik, Viresh Kumar, David S. Miller, ML netdev
+ netdev
On 4/24/2012 7:56 AM, Giuseppe CAVALLARO wrote:
> Hello Viresh.
>
> On 4/21/2012 1:47 PM, 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.
>
> I like this patch also because reduces ifdef in the code :-)
>
> Anyway this patch doesn't apply fine either in net-next and in net.git.
> Also I wonder if you had already tested the driver build on arch w/o
> HAVE_CLK ... just to avoid kernel build failures on other platforms.
>
> Let me know if I can help you on that.
>
> Peppe
>>
>> 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 | 40 ---------------------
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 34 +++++++++++-------
>> 2 files changed, 21 insertions(+), 53 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> index 9f2435c..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,41 +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 (priv->stmmac_clk)
>> - return clk_enable(priv->stmmac_clk);
>> -
>> - return 0;
>> -}
>> -
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> - if (priv->stmmac_clk)
>> - 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)) {
>> - pr_err("%s: ERROR clk_get failed\n", __func__);
>> - 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 a64f0d4..28b8f30 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;
>>
>> clk_rate = clk_get_rate(priv->stmmac_clk);
>> @@ -189,7 +189,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)
>> @@ -933,7 +932,8 @@ static int stmmac_open(struct net_device *dev)
>> struct stmmac_priv *priv = netdev_priv(dev);
>> int ret;
>>
>> - stmmac_clk_enable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_enable(priv->stmmac_clk);
>>
>> stmmac_check_ether_addr(priv);
>>
>> @@ -1068,7 +1068,9 @@ open_error:
>> phy_disconnect(priv->phydev);
>>
>> open_clk_dis:
>> - stmmac_clk_disable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>> +
>> return ret;
>> }
>>
>> @@ -1121,7 +1123,9 @@ static int stmmac_release(struct net_device *dev)
>> stmmac_exit_fs();
>> #endif
>> stmmac_mdio_unregister(dev);
>> - stmmac_clk_disable(priv);
>> +
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>>
>> return 0;
>> }
>> @@ -1918,8 +1922,9 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>> goto error;
>> }
>>
>> - if (stmmac_clk_get(priv))
>> - goto error;
>> + priv->stmmac_clk = clk_get(priv->device, NULL);
>> + if (IS_ERR(priv->stmmac_clk))
>> + pr_err("%s: No clock found\n", __func__);
>>
>> /* If a specific clk_csr value is passed from the platform
>> * this means that the CSR Clock Range selection cannot be
>> @@ -1927,10 +1932,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;
>> + }
>>
>> return priv;
>>
>> @@ -2004,7 +2011,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;
>> @@ -2026,9 +2034,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);
>>
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 08/13] net/stmmac: Remove conditional compilation of clk code
@ 2012-04-24 5:57 ` Giuseppe CAVALLARO
0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-24 5:57 UTC (permalink / raw)
To: linux-arm-kernel
+ netdev
On 4/24/2012 7:56 AM, Giuseppe CAVALLARO wrote:
> Hello Viresh.
>
> On 4/21/2012 1:47 PM, 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.
>
> I like this patch also because reduces ifdef in the code :-)
>
> Anyway this patch doesn't apply fine either in net-next and in net.git.
> Also I wonder if you had already tested the driver build on arch w/o
> HAVE_CLK ... just to avoid kernel build failures on other platforms.
>
> Let me know if I can help you on that.
>
> Peppe
>>
>> 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 | 40 ---------------------
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 34 +++++++++++-------
>> 2 files changed, 21 insertions(+), 53 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> index 9f2435c..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,41 +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 (priv->stmmac_clk)
>> - return clk_enable(priv->stmmac_clk);
>> -
>> - return 0;
>> -}
>> -
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> - if (priv->stmmac_clk)
>> - 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)) {
>> - pr_err("%s: ERROR clk_get failed\n", __func__);
>> - 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 a64f0d4..28b8f30 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;
>>
>> clk_rate = clk_get_rate(priv->stmmac_clk);
>> @@ -189,7 +189,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)
>> @@ -933,7 +932,8 @@ static int stmmac_open(struct net_device *dev)
>> struct stmmac_priv *priv = netdev_priv(dev);
>> int ret;
>>
>> - stmmac_clk_enable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_enable(priv->stmmac_clk);
>>
>> stmmac_check_ether_addr(priv);
>>
>> @@ -1068,7 +1068,9 @@ open_error:
>> phy_disconnect(priv->phydev);
>>
>> open_clk_dis:
>> - stmmac_clk_disable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>> +
>> return ret;
>> }
>>
>> @@ -1121,7 +1123,9 @@ static int stmmac_release(struct net_device *dev)
>> stmmac_exit_fs();
>> #endif
>> stmmac_mdio_unregister(dev);
>> - stmmac_clk_disable(priv);
>> +
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>>
>> return 0;
>> }
>> @@ -1918,8 +1922,9 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>> goto error;
>> }
>>
>> - if (stmmac_clk_get(priv))
>> - goto error;
>> + priv->stmmac_clk = clk_get(priv->device, NULL);
>> + if (IS_ERR(priv->stmmac_clk))
>> + pr_err("%s: No clock found\n", __func__);
>>
>> /* If a specific clk_csr value is passed from the platform
>> * this means that the CSR Clock Range selection cannot be
>> @@ -1927,10 +1932,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;
>> + }
>>
>> return priv;
>>
>> @@ -2004,7 +2011,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;
>> @@ -2026,9 +2034,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);
>>
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 08/13] net/stmmac: Remove conditional compilation of clk code
@ 2012-04-24 5:57 ` Giuseppe CAVALLARO
0 siblings, 0 replies; 44+ messages in thread
From: Giuseppe CAVALLARO @ 2012-04-24 5:57 UTC (permalink / raw)
To: Viresh Kumar
Cc: mturquette, sshtylyov, ML netdev, spear-devel, linux-kernel,
David S. Miller, akpm, jgarzik, linux-arm-kernel
+ netdev
On 4/24/2012 7:56 AM, Giuseppe CAVALLARO wrote:
> Hello Viresh.
>
> On 4/21/2012 1:47 PM, 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.
>
> I like this patch also because reduces ifdef in the code :-)
>
> Anyway this patch doesn't apply fine either in net-next and in net.git.
> Also I wonder if you had already tested the driver build on arch w/o
> HAVE_CLK ... just to avoid kernel build failures on other platforms.
>
> Let me know if I can help you on that.
>
> Peppe
>>
>> 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 | 40 ---------------------
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 34 +++++++++++-------
>> 2 files changed, 21 insertions(+), 53 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> index 9f2435c..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,41 +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 (priv->stmmac_clk)
>> - return clk_enable(priv->stmmac_clk);
>> -
>> - return 0;
>> -}
>> -
>> -static inline void stmmac_clk_disable(struct stmmac_priv *priv)
>> -{
>> - if (priv->stmmac_clk)
>> - 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)) {
>> - pr_err("%s: ERROR clk_get failed\n", __func__);
>> - 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 a64f0d4..28b8f30 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;
>>
>> clk_rate = clk_get_rate(priv->stmmac_clk);
>> @@ -189,7 +189,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)
>> @@ -933,7 +932,8 @@ static int stmmac_open(struct net_device *dev)
>> struct stmmac_priv *priv = netdev_priv(dev);
>> int ret;
>>
>> - stmmac_clk_enable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_enable(priv->stmmac_clk);
>>
>> stmmac_check_ether_addr(priv);
>>
>> @@ -1068,7 +1068,9 @@ open_error:
>> phy_disconnect(priv->phydev);
>>
>> open_clk_dis:
>> - stmmac_clk_disable(priv);
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>> +
>> return ret;
>> }
>>
>> @@ -1121,7 +1123,9 @@ static int stmmac_release(struct net_device *dev)
>> stmmac_exit_fs();
>> #endif
>> stmmac_mdio_unregister(dev);
>> - stmmac_clk_disable(priv);
>> +
>> + if (!IS_ERR(priv->stmmac_clk))
>> + clk_disable(priv->stmmac_clk);
>>
>> return 0;
>> }
>> @@ -1918,8 +1922,9 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
>> goto error;
>> }
>>
>> - if (stmmac_clk_get(priv))
>> - goto error;
>> + priv->stmmac_clk = clk_get(priv->device, NULL);
>> + if (IS_ERR(priv->stmmac_clk))
>> + pr_err("%s: No clock found\n", __func__);
>>
>> /* If a specific clk_csr value is passed from the platform
>> * this means that the CSR Clock Range selection cannot be
>> @@ -1927,10 +1932,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;
>> + }
>>
>> return priv;
>>
>> @@ -2004,7 +2011,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;
>> @@ -2026,9 +2034,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);
>>
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [PATCH 08/13] net/stmmac: Remove conditional compilation of clk code
2012-04-24 5:56 ` Giuseppe CAVALLARO
@ 2012-04-24 6:09 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-24 6:09 UTC (permalink / raw)
To: Giuseppe CAVALLARO
Cc: Viresh Kumar, akpm, spear-devel, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, David S. Miller
On 4/24/2012 11:26 AM, Giuseppe CAVALLARO wrote:
> I like this patch also because reduces ifdef in the code :-)
thanks.
> Anyway this patch doesn't apply fine either in net-next and in net.git.
> Also I wonder if you had already tested the driver build on arch w/o
> HAVE_CLK ... just to avoid kernel build failures on other platforms.
>
> Let me know if I can help you on that.
I already sent V2, before i saw this mail. V2 will get rebased cleanly.
Yes i have tried that.
BTW, this series must go through Andrew, instead of your tree as it
has dependency patches. Just for info.
--
viresh
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 08/13] net/stmmac: Remove conditional compilation of clk code
@ 2012-04-24 6:09 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-24 6:09 UTC (permalink / raw)
To: linux-arm-kernel
On 4/24/2012 11:26 AM, Giuseppe CAVALLARO wrote:
> I like this patch also because reduces ifdef in the code :-)
thanks.
> Anyway this patch doesn't apply fine either in net-next and in net.git.
> Also I wonder if you had already tested the driver build on arch w/o
> HAVE_CLK ... just to avoid kernel build failures on other platforms.
>
> Let me know if I can help you on that.
I already sent V2, before i saw this mail. V2 will get rebased cleanly.
Yes i have tried that.
BTW, this series must go through Andrew, instead of your tree as it
has dependency patches. Just for info.
--
viresh
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 09/13] gadget/m66592: Remove conditional compilation of clk code
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, Greg Kroah-Hartman,
linux-usb
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
---
drivers/usb/gadget/m66592-udc.c | 19 +++++--------------
drivers/usb/gadget/m66592-udc.h | 5 -----
2 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 3608b3b..34eee07 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1583,12 +1583,10 @@ static int __exit m66592_remove(struct platform_device *pdev)
iounmap(m66592->reg);
free_irq(platform_get_irq(pdev, 0), m66592);
m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req);
-#ifdef CONFIG_HAVE_CLK
- if (m66592->pdata->on_chip) {
+ if (m66592->pdata->on_chip && !IS_ERR(m66592->clk)) {
clk_disable(m66592->clk);
clk_put(m66592->clk);
}
-#endif
kfree(m66592);
return 0;
}
@@ -1602,9 +1600,7 @@ static int __init m66592_probe(struct platform_device *pdev)
struct resource *res, *ires;
void __iomem *reg = NULL;
struct m66592 *m66592 = NULL;
-#ifdef CONFIG_HAVE_CLK
char clk_name[8];
-#endif
int ret = 0;
int i;
@@ -1671,19 +1667,17 @@ static int __init m66592_probe(struct platform_device *pdev)
goto clean_up;
}
-#ifdef CONFIG_HAVE_CLK
if (m66592->pdata->on_chip) {
snprintf(clk_name, sizeof(clk_name), "usbf%d", pdev->id);
m66592->clk = clk_get(&pdev->dev, clk_name);
if (IS_ERR(m66592->clk)) {
dev_err(&pdev->dev, "cannot get clock \"%s\"\n",
clk_name);
- ret = PTR_ERR(m66592->clk);
- goto clean_up2;
+ } else {
+ clk_enable(m66592->clk);
}
- clk_enable(m66592->clk);
}
-#endif
+
INIT_LIST_HEAD(&m66592->gadget.ep_list);
m66592->gadget.ep0 = &m66592->ep[0].ep;
INIT_LIST_HEAD(&m66592->gadget.ep0->ep_list);
@@ -1731,13 +1725,10 @@ err_add_udc:
m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req);
clean_up3:
-#ifdef CONFIG_HAVE_CLK
- if (m66592->pdata->on_chip) {
+ if (m66592->pdata->on_chip && !IS_ERR(m66592->clk)) {
clk_disable(m66592->clk);
clk_put(m66592->clk);
}
-clean_up2:
-#endif
free_irq(ires->start, m66592);
clean_up:
if (m66592) {
diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h
index 9d9f7e3..a044ad3 100644
--- a/drivers/usb/gadget/m66592-udc.h
+++ b/drivers/usb/gadget/m66592-udc.h
@@ -13,10 +13,7 @@
#ifndef __M66592_UDC_H__
#define __M66592_UDC_H__
-#ifdef CONFIG_HAVE_CLK
#include <linux/clk.h>
-#endif
-
#include <linux/usb/m66592.h>
#define M66592_SYSCFG 0x00
@@ -468,9 +465,7 @@ struct m66592_ep {
struct m66592 {
spinlock_t lock;
void __iomem *reg;
-#ifdef CONFIG_HAVE_CLK
struct clk *clk;
-#endif
struct m66592_platdata *pdata;
unsigned long irq_trigger;
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 09/13] gadget/m66592: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb at vger.kernel.org
---
drivers/usb/gadget/m66592-udc.c | 19 +++++--------------
drivers/usb/gadget/m66592-udc.h | 5 -----
2 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 3608b3b..34eee07 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1583,12 +1583,10 @@ static int __exit m66592_remove(struct platform_device *pdev)
iounmap(m66592->reg);
free_irq(platform_get_irq(pdev, 0), m66592);
m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req);
-#ifdef CONFIG_HAVE_CLK
- if (m66592->pdata->on_chip) {
+ if (m66592->pdata->on_chip && !IS_ERR(m66592->clk)) {
clk_disable(m66592->clk);
clk_put(m66592->clk);
}
-#endif
kfree(m66592);
return 0;
}
@@ -1602,9 +1600,7 @@ static int __init m66592_probe(struct platform_device *pdev)
struct resource *res, *ires;
void __iomem *reg = NULL;
struct m66592 *m66592 = NULL;
-#ifdef CONFIG_HAVE_CLK
char clk_name[8];
-#endif
int ret = 0;
int i;
@@ -1671,19 +1667,17 @@ static int __init m66592_probe(struct platform_device *pdev)
goto clean_up;
}
-#ifdef CONFIG_HAVE_CLK
if (m66592->pdata->on_chip) {
snprintf(clk_name, sizeof(clk_name), "usbf%d", pdev->id);
m66592->clk = clk_get(&pdev->dev, clk_name);
if (IS_ERR(m66592->clk)) {
dev_err(&pdev->dev, "cannot get clock \"%s\"\n",
clk_name);
- ret = PTR_ERR(m66592->clk);
- goto clean_up2;
+ } else {
+ clk_enable(m66592->clk);
}
- clk_enable(m66592->clk);
}
-#endif
+
INIT_LIST_HEAD(&m66592->gadget.ep_list);
m66592->gadget.ep0 = &m66592->ep[0].ep;
INIT_LIST_HEAD(&m66592->gadget.ep0->ep_list);
@@ -1731,13 +1725,10 @@ err_add_udc:
m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req);
clean_up3:
-#ifdef CONFIG_HAVE_CLK
- if (m66592->pdata->on_chip) {
+ if (m66592->pdata->on_chip && !IS_ERR(m66592->clk)) {
clk_disable(m66592->clk);
clk_put(m66592->clk);
}
-clean_up2:
-#endif
free_irq(ires->start, m66592);
clean_up:
if (m66592) {
diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h
index 9d9f7e3..a044ad3 100644
--- a/drivers/usb/gadget/m66592-udc.h
+++ b/drivers/usb/gadget/m66592-udc.h
@@ -13,10 +13,7 @@
#ifndef __M66592_UDC_H__
#define __M66592_UDC_H__
-#ifdef CONFIG_HAVE_CLK
#include <linux/clk.h>
-#endif
-
#include <linux/usb/m66592.h>
#define M66592_SYSCFG 0x00
@@ -468,9 +465,7 @@ struct m66592_ep {
struct m66592 {
spinlock_t lock;
void __iomem *reg;
-#ifdef CONFIG_HAVE_CLK
struct clk *clk;
-#endif
struct m66592_platdata *pdata;
unsigned long irq_trigger;
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 10/13] gadget/r8a66597: Remove conditional compilation of clk code
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, Greg Kroah-Hartman,
linux-usb
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
---
drivers/usb/gadget/r8a66597-udc.c | 21 +++++++--------------
drivers/usb/gadget/r8a66597-udc.h | 5 -----
2 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index c4401e7..85aa56d 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1818,12 +1818,11 @@ static int __exit r8a66597_remove(struct platform_device *pdev)
iounmap(r8a66597->sudmac_reg);
free_irq(platform_get_irq(pdev, 0), r8a66597);
r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req);
-#ifdef CONFIG_HAVE_CLK
- if (r8a66597->pdata->on_chip) {
+
+ if (r8a66597->pdata->on_chip && !IS_ERR(r8a66597->clk)) {
clk_disable(r8a66597->clk);
clk_put(r8a66597->clk);
}
-#endif
device_unregister(&r8a66597->gadget.dev);
kfree(r8a66597);
return 0;
@@ -1855,9 +1854,7 @@ static int __init r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597,
static int __init r8a66597_probe(struct platform_device *pdev)
{
-#ifdef CONFIG_HAVE_CLK
char clk_name[8];
-#endif
struct resource *res, *ires;
int irq;
void __iomem *reg = NULL;
@@ -1921,19 +1918,17 @@ static int __init r8a66597_probe(struct platform_device *pdev)
r8a66597->timer.data = (unsigned long)r8a66597;
r8a66597->reg = reg;
-#ifdef CONFIG_HAVE_CLK
if (r8a66597->pdata->on_chip) {
snprintf(clk_name, sizeof(clk_name), "usb%d", pdev->id);
r8a66597->clk = clk_get(&pdev->dev, clk_name);
if (IS_ERR(r8a66597->clk)) {
dev_err(&pdev->dev, "cannot get clock \"%s\"\n",
clk_name);
- ret = PTR_ERR(r8a66597->clk);
- goto clean_up_dev;
+ } else {
+ clk_enable(r8a66597->clk);
}
- clk_enable(r8a66597->clk);
}
-#endif
+
if (r8a66597->pdata->sudmac) {
ret = r8a66597_sudmac_ioremap(r8a66597, pdev);
if (ret < 0)
@@ -1993,13 +1988,11 @@ err_add_udc:
clean_up3:
free_irq(irq, r8a66597);
clean_up2:
-#ifdef CONFIG_HAVE_CLK
- if (r8a66597->pdata->on_chip) {
+ if (r8a66597->pdata->on_chip && !IS_ERR(r8a66597->clk)) {
clk_disable(r8a66597->clk);
clk_put(r8a66597->clk);
}
-clean_up_dev:
-#endif
+
device_unregister(&r8a66597->gadget.dev);
clean_up:
if (r8a66597) {
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h
index 8e3de61..d2a5ad2 100644
--- a/drivers/usb/gadget/r8a66597-udc.h
+++ b/drivers/usb/gadget/r8a66597-udc.h
@@ -13,10 +13,7 @@
#ifndef __R8A66597_H__
#define __R8A66597_H__
-#ifdef CONFIG_HAVE_CLK
#include <linux/clk.h>
-#endif
-
#include <linux/usb/r8a66597.h>
#define R8A66597_MAX_SAMPLING 10
@@ -92,9 +89,7 @@ struct r8a66597 {
void __iomem *reg;
void __iomem *sudmac_reg;
-#ifdef CONFIG_HAVE_CLK
struct clk *clk;
-#endif
struct r8a66597_platdata *pdata;
struct usb_gadget gadget;
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 10/13] gadget/r8a66597: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb at vger.kernel.org
---
drivers/usb/gadget/r8a66597-udc.c | 21 +++++++--------------
drivers/usb/gadget/r8a66597-udc.h | 5 -----
2 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index c4401e7..85aa56d 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1818,12 +1818,11 @@ static int __exit r8a66597_remove(struct platform_device *pdev)
iounmap(r8a66597->sudmac_reg);
free_irq(platform_get_irq(pdev, 0), r8a66597);
r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req);
-#ifdef CONFIG_HAVE_CLK
- if (r8a66597->pdata->on_chip) {
+
+ if (r8a66597->pdata->on_chip && !IS_ERR(r8a66597->clk)) {
clk_disable(r8a66597->clk);
clk_put(r8a66597->clk);
}
-#endif
device_unregister(&r8a66597->gadget.dev);
kfree(r8a66597);
return 0;
@@ -1855,9 +1854,7 @@ static int __init r8a66597_sudmac_ioremap(struct r8a66597 *r8a66597,
static int __init r8a66597_probe(struct platform_device *pdev)
{
-#ifdef CONFIG_HAVE_CLK
char clk_name[8];
-#endif
struct resource *res, *ires;
int irq;
void __iomem *reg = NULL;
@@ -1921,19 +1918,17 @@ static int __init r8a66597_probe(struct platform_device *pdev)
r8a66597->timer.data = (unsigned long)r8a66597;
r8a66597->reg = reg;
-#ifdef CONFIG_HAVE_CLK
if (r8a66597->pdata->on_chip) {
snprintf(clk_name, sizeof(clk_name), "usb%d", pdev->id);
r8a66597->clk = clk_get(&pdev->dev, clk_name);
if (IS_ERR(r8a66597->clk)) {
dev_err(&pdev->dev, "cannot get clock \"%s\"\n",
clk_name);
- ret = PTR_ERR(r8a66597->clk);
- goto clean_up_dev;
+ } else {
+ clk_enable(r8a66597->clk);
}
- clk_enable(r8a66597->clk);
}
-#endif
+
if (r8a66597->pdata->sudmac) {
ret = r8a66597_sudmac_ioremap(r8a66597, pdev);
if (ret < 0)
@@ -1993,13 +1988,11 @@ err_add_udc:
clean_up3:
free_irq(irq, r8a66597);
clean_up2:
-#ifdef CONFIG_HAVE_CLK
- if (r8a66597->pdata->on_chip) {
+ if (r8a66597->pdata->on_chip && !IS_ERR(r8a66597->clk)) {
clk_disable(r8a66597->clk);
clk_put(r8a66597->clk);
}
-clean_up_dev:
-#endif
+
device_unregister(&r8a66597->gadget.dev);
clean_up:
if (r8a66597) {
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h
index 8e3de61..d2a5ad2 100644
--- a/drivers/usb/gadget/r8a66597-udc.h
+++ b/drivers/usb/gadget/r8a66597-udc.h
@@ -13,10 +13,7 @@
#ifndef __R8A66597_H__
#define __R8A66597_H__
-#ifdef CONFIG_HAVE_CLK
#include <linux/clk.h>
-#endif
-
#include <linux/usb/r8a66597.h>
#define R8A66597_MAX_SAMPLING 10
@@ -92,9 +89,7 @@ struct r8a66597 {
void __iomem *reg;
void __iomem *sudmac_reg;
-#ifdef CONFIG_HAVE_CLK
struct clk *clk;
-#endif
struct r8a66597_platdata *pdata;
struct usb_gadget gadget;
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 11/13] usb/host/r8a66597: Remove conditional compilation of clk code
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, Greg Kroah-Hartman,
linux-usb
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
---
drivers/usb/host/r8a66597-hcd.c | 28 +++++++++-------------------
drivers/usb/host/r8a66597.h | 5 -----
2 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 2bf1320..6d11553 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -95,9 +95,9 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597)
int i = 0;
if (r8a66597->pdata->on_chip) {
-#ifdef CONFIG_HAVE_CLK
- clk_enable(r8a66597->clk);
-#endif
+ if (!IS_ERR(r8a66597->clk))
+ clk_enable(r8a66597->clk);
+
do {
r8a66597_write(r8a66597, SCKE, SYSCFG0);
tmp = r8a66597_read(r8a66597, SYSCFG0);
@@ -141,9 +141,8 @@ static void r8a66597_clock_disable(struct r8a66597 *r8a66597)
udelay(1);
if (r8a66597->pdata->on_chip) {
-#ifdef CONFIG_HAVE_CLK
- clk_disable(r8a66597->clk);
-#endif
+ if (!IS_ERR(r8a66597->clk))
+ clk_disable(r8a66597->clk);
} else {
r8a66597_bclr(r8a66597, PLLC, SYSCFG0);
r8a66597_bclr(r8a66597, XCKE, SYSCFG0);
@@ -2406,19 +2405,16 @@ static int __devexit r8a66597_remove(struct platform_device *pdev)
del_timer_sync(&r8a66597->rh_timer);
usb_remove_hcd(hcd);
iounmap(r8a66597->reg);
-#ifdef CONFIG_HAVE_CLK
- if (r8a66597->pdata->on_chip)
+ if (r8a66597->pdata->on_chip && !IS_ERR(r8a66597->clk))
clk_put(r8a66597->clk);
-#endif
+
usb_put_hcd(hcd);
return 0;
}
static int __devinit r8a66597_probe(struct platform_device *pdev)
{
-#ifdef CONFIG_HAVE_CLK
char clk_name[8];
-#endif
struct resource *res = NULL, *ires;
int irq = -1;
void __iomem *reg = NULL;
@@ -2482,16 +2478,12 @@ static int __devinit r8a66597_probe(struct platform_device *pdev)
r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW;
if (r8a66597->pdata->on_chip) {
-#ifdef CONFIG_HAVE_CLK
snprintf(clk_name, sizeof(clk_name), "usb%d", pdev->id);
r8a66597->clk = clk_get(&pdev->dev, clk_name);
if (IS_ERR(r8a66597->clk)) {
dev_err(&pdev->dev, "cannot get clock \"%s\"\n",
clk_name);
- ret = PTR_ERR(r8a66597->clk);
- goto clean_up2;
}
-#endif
r8a66597->max_root_hub = 1;
} else
r8a66597->max_root_hub = 2;
@@ -2531,11 +2523,9 @@ static int __devinit r8a66597_probe(struct platform_device *pdev)
return 0;
clean_up3:
-#ifdef CONFIG_HAVE_CLK
- if (r8a66597->pdata->on_chip)
+ if (r8a66597->pdata->on_chip && !IS_ERR(r8a66597->clk))
clk_put(r8a66597->clk);
-clean_up2:
-#endif
+
usb_put_hcd(hcd);
clean_up:
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h
index f28782d..672cea3 100644
--- a/drivers/usb/host/r8a66597.h
+++ b/drivers/usb/host/r8a66597.h
@@ -26,10 +26,7 @@
#ifndef __R8A66597_H__
#define __R8A66597_H__
-#ifdef CONFIG_HAVE_CLK
#include <linux/clk.h>
-#endif
-
#include <linux/usb/r8a66597.h>
#define R8A66597_MAX_NUM_PIPE 10
@@ -113,9 +110,7 @@ struct r8a66597_root_hub {
struct r8a66597 {
spinlock_t lock;
void __iomem *reg;
-#ifdef CONFIG_HAVE_CLK
struct clk *clk;
-#endif
struct r8a66597_platdata *pdata;
struct r8a66597_device device0;
struct r8a66597_root_hub root_hub[R8A66597_MAX_ROOT_HUB];
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 11/13] usb/host/r8a66597: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb at vger.kernel.org
---
drivers/usb/host/r8a66597-hcd.c | 28 +++++++++-------------------
drivers/usb/host/r8a66597.h | 5 -----
2 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 2bf1320..6d11553 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -95,9 +95,9 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597)
int i = 0;
if (r8a66597->pdata->on_chip) {
-#ifdef CONFIG_HAVE_CLK
- clk_enable(r8a66597->clk);
-#endif
+ if (!IS_ERR(r8a66597->clk))
+ clk_enable(r8a66597->clk);
+
do {
r8a66597_write(r8a66597, SCKE, SYSCFG0);
tmp = r8a66597_read(r8a66597, SYSCFG0);
@@ -141,9 +141,8 @@ static void r8a66597_clock_disable(struct r8a66597 *r8a66597)
udelay(1);
if (r8a66597->pdata->on_chip) {
-#ifdef CONFIG_HAVE_CLK
- clk_disable(r8a66597->clk);
-#endif
+ if (!IS_ERR(r8a66597->clk))
+ clk_disable(r8a66597->clk);
} else {
r8a66597_bclr(r8a66597, PLLC, SYSCFG0);
r8a66597_bclr(r8a66597, XCKE, SYSCFG0);
@@ -2406,19 +2405,16 @@ static int __devexit r8a66597_remove(struct platform_device *pdev)
del_timer_sync(&r8a66597->rh_timer);
usb_remove_hcd(hcd);
iounmap(r8a66597->reg);
-#ifdef CONFIG_HAVE_CLK
- if (r8a66597->pdata->on_chip)
+ if (r8a66597->pdata->on_chip && !IS_ERR(r8a66597->clk))
clk_put(r8a66597->clk);
-#endif
+
usb_put_hcd(hcd);
return 0;
}
static int __devinit r8a66597_probe(struct platform_device *pdev)
{
-#ifdef CONFIG_HAVE_CLK
char clk_name[8];
-#endif
struct resource *res = NULL, *ires;
int irq = -1;
void __iomem *reg = NULL;
@@ -2482,16 +2478,12 @@ static int __devinit r8a66597_probe(struct platform_device *pdev)
r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW;
if (r8a66597->pdata->on_chip) {
-#ifdef CONFIG_HAVE_CLK
snprintf(clk_name, sizeof(clk_name), "usb%d", pdev->id);
r8a66597->clk = clk_get(&pdev->dev, clk_name);
if (IS_ERR(r8a66597->clk)) {
dev_err(&pdev->dev, "cannot get clock \"%s\"\n",
clk_name);
- ret = PTR_ERR(r8a66597->clk);
- goto clean_up2;
}
-#endif
r8a66597->max_root_hub = 1;
} else
r8a66597->max_root_hub = 2;
@@ -2531,11 +2523,9 @@ static int __devinit r8a66597_probe(struct platform_device *pdev)
return 0;
clean_up3:
-#ifdef CONFIG_HAVE_CLK
- if (r8a66597->pdata->on_chip)
+ if (r8a66597->pdata->on_chip && !IS_ERR(r8a66597->clk))
clk_put(r8a66597->clk);
-clean_up2:
-#endif
+
usb_put_hcd(hcd);
clean_up:
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h
index f28782d..672cea3 100644
--- a/drivers/usb/host/r8a66597.h
+++ b/drivers/usb/host/r8a66597.h
@@ -26,10 +26,7 @@
#ifndef __R8A66597_H__
#define __R8A66597_H__
-#ifdef CONFIG_HAVE_CLK
#include <linux/clk.h>
-#endif
-
#include <linux/usb/r8a66597.h>
#define R8A66597_MAX_NUM_PIPE 10
@@ -113,9 +110,7 @@ struct r8a66597_root_hub {
struct r8a66597 {
spinlock_t lock;
void __iomem *reg;
-#ifdef CONFIG_HAVE_CLK
struct clk *clk;
-#endif
struct r8a66597_platdata *pdata;
struct r8a66597_device device0;
struct r8a66597_root_hub root_hub[R8A66597_MAX_ROOT_HUB];
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 12/13] usb/marvell: Remove conditional compilation of clk code
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, Greg Kroah-Hartman,
linux-usb
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.
Marvell usb also has these dummy macros defined locally. Remove them as they
aren't required anymore.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
---
include/linux/platform_data/mv_usb.h | 9 ---------
1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h
index d94804a..944b01d 100644
--- a/include/linux/platform_data/mv_usb.h
+++ b/include/linux/platform_data/mv_usb.h
@@ -52,13 +52,4 @@ struct mv_usb_platform_data {
int (*set_vbus)(unsigned int vbus);
int (*private_init)(void __iomem *opregs, void __iomem *phyregs);
};
-
-#ifndef CONFIG_HAVE_CLK
-/* Dummy stub for clk framework */
-#define clk_get(dev, id) NULL
-#define clk_put(clock) do {} while (0)
-#define clk_enable(clock) do {} while (0)
-#define clk_disable(clock) do {} while (0)
-#endif
-
#endif
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 12/13] usb/marvell: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
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.
Marvell usb also has these dummy macros defined locally. Remove them as they
aren't required anymore.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb at vger.kernel.org
---
include/linux/platform_data/mv_usb.h | 9 ---------
1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h
index d94804a..944b01d 100644
--- a/include/linux/platform_data/mv_usb.h
+++ b/include/linux/platform_data/mv_usb.h
@@ -52,13 +52,4 @@ struct mv_usb_platform_data {
int (*set_vbus)(unsigned int vbus);
int (*private_init)(void __iomem *opregs, void __iomem *phyregs);
};
-
-#ifndef CONFIG_HAVE_CLK
-/* Dummy stub for clk framework */
-#define clk_get(dev, id) NULL
-#define clk_put(clock) do {} while (0)
-#define clk_enable(clock) do {} while (0)
-#define clk_disable(clock) do {} while (0)
-#endif
-
#endif
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 13/13] usb/musb: Remove conditional compilation of clk code
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 11:47 ` Viresh Kumar
-1 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, Greg Kroah-Hartman,
linux-usb
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.
musb also has these dummy macros defined locally. Remove them as they aren't
required anymore.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
---
drivers/usb/musb/musb_core.h | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 93de517..371a3a5 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -81,14 +81,6 @@ struct musb_ep;
#define is_peripheral_active(m) (!(m)->is_host)
#define is_host_active(m) ((m)->is_host)
-#ifndef CONFIG_HAVE_CLK
-/* Dummy stub for clk framework */
-#define clk_get(dev, id) NULL
-#define clk_put(clock) do {} while (0)
-#define clk_enable(clock) do {} while (0)
-#define clk_disable(clock) do {} while (0)
-#endif
-
#ifdef CONFIG_PROC_FS
#include <linux/fs.h>
#define MUSB_CONFIG_PROC_FS
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [PATCH 13/13] usb/musb: Remove conditional compilation of clk code
@ 2012-04-21 11:47 ` Viresh Kumar
0 siblings, 0 replies; 44+ messages in thread
From: Viresh Kumar @ 2012-04-21 11:47 UTC (permalink / raw)
To: linux-arm-kernel
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.
musb also has these dummy macros defined locally. Remove them as they aren't
required anymore.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb at vger.kernel.org
---
drivers/usb/musb/musb_core.h | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 93de517..371a3a5 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -81,14 +81,6 @@ struct musb_ep;
#define is_peripheral_active(m) (!(m)->is_host)
#define is_host_active(m) ((m)->is_host)
-#ifndef CONFIG_HAVE_CLK
-/* Dummy stub for clk framework */
-#define clk_get(dev, id) NULL
-#define clk_put(clock) do {} while (0)
-#define clk_enable(clock) do {} while (0)
-#define clk_disable(clock) do {} while (0)
-#endif
-
#ifdef CONFIG_PROC_FS
#include <linux/fs.h>
#define MUSB_CONFIG_PROC_FS
--
1.7.9
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [PATCH 00/13] clk: Add non CONFIG_HAVE_CLK routines
2012-04-21 11:47 ` Viresh Kumar
@ 2012-04-21 13:48 ` viresh kumar
-1 siblings, 0 replies; 44+ messages in thread
From: viresh kumar @ 2012-04-21 13:48 UTC (permalink / raw)
To: akpm
Cc: spear-devel, viresh.linux, linux-kernel, linux-arm-kernel,
mturquette, sshtylyov, jgarzik, Viresh Kumar, Russell King
On 4/21/12, Viresh Kumar <viresh.linux@gmail.com> wrote:
Hi Andrew,
Please drop following patches:
> clk: CLK_PREPARE must depend on HAVE_CLK
> i2c/i2c-pxa: Remove conditional compilation of clk code
> usb/marvell: Remove conditional compilation of clk code
> usb/musb: Remove conditional compilation of clk code
--
Viresh
^ permalink raw reply [flat|nested] 44+ messages in thread
* [PATCH 00/13] clk: Add non CONFIG_HAVE_CLK routines
@ 2012-04-21 13:48 ` viresh kumar
0 siblings, 0 replies; 44+ messages in thread
From: viresh kumar @ 2012-04-21 13:48 UTC (permalink / raw)
To: linux-arm-kernel
On 4/21/12, Viresh Kumar <viresh.linux@gmail.com> wrote:
Hi Andrew,
Please drop following patches:
> clk: CLK_PREPARE must depend on HAVE_CLK
> i2c/i2c-pxa: Remove conditional compilation of clk code
> usb/marvell: Remove conditional compilation of clk code
> usb/musb: Remove conditional compilation of clk code
--
Viresh
^ permalink raw reply [flat|nested] 44+ messages in thread