Merge branch 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-3.x
* 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-3.x: (39 commits) SH: static should be at beginning of declaration sh: move CLKDEV_xxx_ID macro to sh_clk.h sh: clock-shx3: add CLKDEV_ICK_ID for cleanup sh: clock-sh7786: add CLKDEV_ICK_ID for cleanup sh: clock-sh7785: add CLKDEV_ICK_ID for cleanup sh: clock-sh7757: add CLKDEV_ICK_ID for cleanup sh: clock-sh7366: add CLKDEV_ICK_ID for cleanup sh: clock-sh7343: add CLKDEV_ICK_ID for cleanup sh: clock-sh7722: add CLKDEV_ICK_ID for cleanup sh: clock-sh7724: add CLKDEV_ICK_ID for cleanup sh: clock-sh7366: modify I2C clock settings sh: clock-sh7343: modify I2C clock settings sh: clock-sh7723: modify I2C clock settings sh: clock-sh7722: modify I2C clock settings sh: clock-sh7724: modify I2C clock settings serial: sh-sci: Fix up pretty name printing for port IRQs. serial: sh-sci: Kill off per-port enable/disable callbacks. serial: sh-sci: Add missing module description/author bits. serial: sh-sci: Regtype probing doesn't need to be fatal. sh: Tidy up pre-clkdev clk_get() error handling. ...
This commit is contained in:
@@ -34,6 +34,9 @@ static LIST_HEAD(clock_list);
|
||||
static DEFINE_SPINLOCK(clock_lock);
|
||||
static DEFINE_MUTEX(clock_list_sem);
|
||||
|
||||
/* clock disable operations are not passed on to hardware during boot */
|
||||
static int allow_disable;
|
||||
|
||||
void clk_rate_table_build(struct clk *clk,
|
||||
struct cpufreq_frequency_table *freq_table,
|
||||
int nr_freqs,
|
||||
@@ -228,7 +231,7 @@ static void __clk_disable(struct clk *clk)
|
||||
return;
|
||||
|
||||
if (!(--clk->usecount)) {
|
||||
if (likely(clk->ops && clk->ops->disable))
|
||||
if (likely(allow_disable && clk->ops && clk->ops->disable))
|
||||
clk->ops->disable(clk);
|
||||
if (likely(clk->parent))
|
||||
__clk_disable(clk->parent);
|
||||
@@ -393,7 +396,7 @@ int clk_register(struct clk *clk)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (clk == NULL || IS_ERR(clk))
|
||||
if (IS_ERR_OR_NULL(clk))
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
@@ -744,3 +747,25 @@ err_out:
|
||||
return err;
|
||||
}
|
||||
late_initcall(clk_debugfs_init);
|
||||
|
||||
static int __init clk_late_init(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct clk *clk;
|
||||
|
||||
/* disable all clocks with zero use count */
|
||||
mutex_lock(&clock_list_sem);
|
||||
spin_lock_irqsave(&clock_lock, flags);
|
||||
|
||||
list_for_each_entry(clk, &clock_list, node)
|
||||
if (!clk->usecount && clk->ops && clk->ops->disable)
|
||||
clk->ops->disable(clk);
|
||||
|
||||
/* from now on allow clock disable operations */
|
||||
allow_disable = 1;
|
||||
|
||||
spin_unlock_irqrestore(&clock_lock, flags);
|
||||
mutex_unlock(&clock_list_sem);
|
||||
return 0;
|
||||
}
|
||||
late_initcall(clk_late_init);
|
||||
|
Reference in New Issue
Block a user