9
0
Fork 0

clk: provide static inline wrappers

So that drivers can use clk_* functions without having to ifdef
them away.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-07-23 07:14:52 +02:00
parent ed8e6f17a5
commit cdd1de46ff
3 changed files with 44 additions and 1 deletions

View File

@ -34,6 +34,7 @@ config ARCH_AT91
select CLKDEV_LOOKUP
select HAS_DEBUG_LL
select HAVE_MACH_ARM_HEAD
select HAVE_CLK
config ARCH_BCM2835
bool "Broadcom BCM2835 boards"
@ -99,6 +100,7 @@ config ARCH_NOMADIK
bool "STMicroelectronics Nomadik"
select CPU_ARM926T
select CLOCKSOURCE_NOMADIK
select HAVE_CLK
help
Support for the Nomadik platform by ST-Ericsson
@ -133,6 +135,7 @@ config ARCH_VERSATILE
bool "ARM Versatile boards (ARM926EJ-S)"
select CPU_ARM926T
select GPIOLIB
select HAVE_CLK
config ARCH_VEXPRESS
bool "ARM Vexpres boards"

View File

@ -1,8 +1,11 @@
config HAVE_CLK
bool
config CLKDEV_LOOKUP
bool
config COMMON_CLK
select HAVE_CLK
bool
config COMMON_CLK_OF_PROVIDER

View File

@ -19,12 +19,13 @@ struct device_d;
* The base API.
*/
/*
* struct clk - an machine class defined object / cookie.
*/
struct clk;
#ifdef CONFIG_HAVE_CLK
/**
* clk_get - lookup and obtain a reference to a clock producer.
* @dev: device for clock "consumer"
@ -157,6 +158,42 @@ struct clk *clk_get_sys(const char *dev_id, const char *con_id);
int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
struct device_d *dev);
#else
static inline struct clk *clk_get(struct device_d *dev, const char *id)
{
return NULL;
}
static inline int clk_enable(struct clk *clk)
{
return 0;
}
static inline void clk_disable(struct clk *clk)
{
}
static inline unsigned long clk_get_rate(struct clk *clk)
{
return 0;
}
static inline void clk_put(struct clk *clk)
{
}
static inline long clk_round_rate(struct clk *clk, unsigned long rate)
{
return 0;
}
static inline int clk_set_rate(struct clk *clk, unsigned long rate)
{
return 0;
}
#endif
#ifdef CONFIG_COMMON_CLK
struct clk_ops {
int (*enable)(struct clk *clk);