diff mbox

[V2,4/8] clk: core: support clocks which requires parents enable (part 2)

Message ID 1467212351-16626-5-git-send-email-aisheng.dong@nxp.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Aisheng Dong June 29, 2016, 2:59 p.m. UTC
On Freescale i.MX7D platform, all clocks operations, including
enable/disable, rate change and re-parent, requires its parent clock on.
Current clock core can not support it well.
This patch adding flag CLK_OPS_PARENT_ENABLE to handle this special case in
clock core that enable its parent clock firstly for each operation and
disable it later after operation complete.

The patch part 2 fixes set clock rate and set parent while its parent
is off. The most special case is for set_parent() operation which requires
all parents including both old and new one to be enabled at the same time
during the operation.

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 drivers/clk/clk.c | 52 +++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 35 insertions(+), 17 deletions(-)

Comments

kernel test robot June 29, 2016, 4:42 p.m. UTC | #1
Hi,

[auto build test ERROR on clk/clk-next]
[also build test ERROR on v4.7-rc5 next-20160629]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dong-Aisheng/clk-core-support-clocks-which-requires-parents-enable/20160629-231445
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: x86_64-randconfig-i0-201626 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^~~~~~~~~~~~~~~~
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^~~~~~~~~~~~~~~
   drivers/clk/clk.c:1957:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_get_phase);
    ^~~~~~~~~~~~~~~~~
   include/linux/export.h:62:36: note: previous declaration of '__ksymtab_clk_get_phase' was here
     extern const struct kernel_symbol __ksymtab_##sym; \
                                       ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^~~~~~~~~~~~~~~~
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^~~~~~~~~~~~~~~
   drivers/clk/clk.c:1957:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_get_phase);
    ^~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1983:19: error: non-static declaration of 'clk_is_match' follows static declaration
    EXPORT_SYMBOL_GPL(clk_is_match);
                      ^
   include/linux/export.h:57:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;     \
                        ^~~
   drivers/clk/clk.c:1983:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_is_match);
    ^~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1970:6: note: previous definition of 'clk_is_match' was here
    bool clk_is_match(const struct clk *p, const struct clk *q)
         ^~~~~~~~~~~~
   In file included from include/linux/linkage.h:6:0,
                    from include/linux/kernel.h:6,
                    from include/linux/clk.h:16,
                    from drivers/clk/clk.c:12:
   include/linux/export.h:63:25: warning: '__used__' attribute ignored [-Wattributes]
     __visible const struct kernel_symbol __ksymtab_##sym \
                            ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^~~~~~~~~~~~~~~~
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^~~~~~~~~~~~~~~
   drivers/clk/clk.c:1983:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_is_match);
    ^~~~~~~~~~~~~~~~~
   include/linux/export.h:63:39: error: section attribute cannot be specified for local variables
     __visible const struct kernel_symbol __ksymtab_##sym \
                                          ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^~~~~~~~~~~~~~~~
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^~~~~~~~~~~~~~~
   drivers/clk/clk.c:1983:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_is_match);
    ^~~~~~~~~~~~~~~~~
   include/linux/export.h:63:25: warning: 'externally_visible' attribute have effect only on public objects [-Wattributes]
     __visible const struct kernel_symbol __ksymtab_##sym \
                            ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^~~~~~~~~~~~~~~~
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^~~~~~~~~~~~~~~
   drivers/clk/clk.c:1983:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_is_match);
    ^~~~~~~~~~~~~~~~~
   include/linux/export.h:63:39: error: declaration of '__ksymtab_clk_is_match' with no linkage follows extern declaration
     __visible const struct kernel_symbol __ksymtab_##sym \
                                          ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^~~~~~~~~~~~~~~~
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^~~~~~~~~~~~~~~
   drivers/clk/clk.c:1983:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_is_match);
    ^~~~~~~~~~~~~~~~~
   include/linux/export.h:62:36: note: previous declaration of '__ksymtab_clk_is_match' was here
     extern const struct kernel_symbol __ksymtab_##sym; \
                                       ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^~~~~~~~~~~~~~~~
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^~~~~~~~~~~~~~~
   drivers/clk/clk.c:1983:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_is_match);
    ^~~~~~~~~~~~~~~~~
   In file included from include/linux/fs.h:6:0,
                    from include/linux/debugfs.h:18,
                    from drivers/clk/clk.c:1988:
>> include/linux/kdev_t.h:23:20: error: invalid storage class for function 'old_valid_dev'
    static inline bool old_valid_dev(dev_t dev)
                       ^~~~~~~~~~~~~
>> include/linux/kdev_t.h:28:19: error: invalid storage class for function 'old_encode_dev'
    static inline u16 old_encode_dev(dev_t dev)
                      ^~~~~~~~~~~~~~
>> include/linux/kdev_t.h:33:21: error: invalid storage class for function 'old_decode_dev'
    static inline dev_t old_decode_dev(u16 val)
                        ^~~~~~~~~~~~~~
>> include/linux/kdev_t.h:38:19: error: invalid storage class for function 'new_encode_dev'
    static inline u32 new_encode_dev(dev_t dev)
                      ^~~~~~~~~~~~~~
>> include/linux/kdev_t.h:45:21: error: invalid storage class for function 'new_decode_dev'
    static inline dev_t new_decode_dev(u32 dev)
                        ^~~~~~~~~~~~~~
>> include/linux/kdev_t.h:52:19: error: invalid storage class for function 'huge_encode_dev'
    static inline u64 huge_encode_dev(dev_t dev)
                      ^~~~~~~~~~~~~~~
>> include/linux/kdev_t.h:57:21: error: invalid storage class for function 'huge_decode_dev'
    static inline dev_t huge_decode_dev(u64 dev)
                        ^~~~~~~~~~~~~~~
>> include/linux/kdev_t.h:62:19: error: invalid storage class for function 'sysv_valid_dev'
    static inline int sysv_valid_dev(dev_t dev)
                      ^~~~~~~~~~~~~~
>> include/linux/kdev_t.h:67:19: error: invalid storage class for function 'sysv_encode_dev'
    static inline u32 sysv_encode_dev(dev_t dev)
                      ^~~~~~~~~~~~~~~
>> include/linux/kdev_t.h:72:24: error: invalid storage class for function 'sysv_major'
    static inline unsigned sysv_major(u32 dev)
                           ^~~~~~~~~~
>> include/linux/kdev_t.h:77:24: error: invalid storage class for function 'sysv_minor'
    static inline unsigned sysv_minor(u32 dev)
                           ^~~~~~~~~~
   In file included from include/linux/list_bl.h:5:0,
                    from include/linux/rculist_bl.h:7,
                    from include/linux/dcache.h:7,
                    from include/linux/fs.h:7,
                    from include/linux/debugfs.h:18,
                    from drivers/clk/clk.c:1988:
>> include/linux/bit_spinlock.h:15:20: error: invalid storage class for function 'bit_spin_lock'
    static inline void bit_spin_lock(int bitnum, unsigned long *addr)
                       ^~~~~~~~~~~~~
>> include/linux/bit_spinlock.h:40:19: error: invalid storage class for function 'bit_spin_trylock'
    static inline int bit_spin_trylock(int bitnum, unsigned long *addr)
                      ^~~~~~~~~~~~~~~~
>> include/linux/bit_spinlock.h:56:20: error: invalid storage class for function 'bit_spin_unlock'
    static inline void bit_spin_unlock(int bitnum, unsigned long *addr)
                       ^~~~~~~~~~~~~~~
>> include/linux/bit_spinlock.h:73:20: error: invalid storage class for function '__bit_spin_unlock'
    static inline void __bit_spin_unlock(int bitnum, unsigned long *addr)
                       ^~~~~~~~~~~~~~~~~
>> include/linux/bit_spinlock.h:88:19: error: invalid storage class for function 'bit_spin_is_locked'
    static inline int bit_spin_is_locked(int bitnum, unsigned long *addr)
                      ^~~~~~~~~~~~~~~~~~
   In file included from include/linux/rculist_bl.h:7:0,
                    from include/linux/dcache.h:7,
                    from include/linux/fs.h:7,
                    from include/linux/debugfs.h:18,
                    from drivers/clk/clk.c:1988:
>> include/linux/list_bl.h:43:20: error: invalid storage class for function 'INIT_HLIST_BL_NODE'
    static inline void INIT_HLIST_BL_NODE(struct hlist_bl_node *h)
                       ^~~~~~~~~~~~~~~~~~
>> include/linux/list_bl.h:51:21: error: invalid storage class for function 'hlist_bl_unhashed'
    static inline bool  hlist_bl_unhashed(const struct hlist_bl_node *h)
                        ^~~~~~~~~~~~~~~~~
>> include/linux/list_bl.h:56:37: error: invalid storage class for function 'hlist_bl_first'
    static inline struct hlist_bl_node *hlist_bl_first(struct hlist_bl_head *h)
                                        ^~~~~~~~~~~~~~
>> include/linux/list_bl.h:62:20: error: invalid storage class for function 'hlist_bl_set_first'
    static inline void hlist_bl_set_first(struct hlist_bl_head *h,
                       ^~~~~~~~~~~~~~~~~~

vim +2148 drivers/clk/clk.c

4dff95dc9 Stephen Boyd   2015-04-30  2122  static int clk_dump_open(struct inode *inode, struct file *file)
b33d212f4 Ulf Hansson    2013-04-02  2123  {
4dff95dc9 Stephen Boyd   2015-04-30  2124  	return single_open(file, clk_dump, inode->i_private);
b2476490e Mike Turquette 2012-03-15  2125  }
b2476490e Mike Turquette 2012-03-15  2126  
4dff95dc9 Stephen Boyd   2015-04-30  2127  static const struct file_operations clk_dump_fops = {
4dff95dc9 Stephen Boyd   2015-04-30 @2128  	.open		= clk_dump_open,
4dff95dc9 Stephen Boyd   2015-04-30  2129  	.read		= seq_read,
4dff95dc9 Stephen Boyd   2015-04-30  2130  	.llseek		= seq_lseek,
4dff95dc9 Stephen Boyd   2015-04-30  2131  	.release	= single_release,
4dff95dc9 Stephen Boyd   2015-04-30  2132  };
4dff95dc9 Stephen Boyd   2015-04-30  2133  
4dff95dc9 Stephen Boyd   2015-04-30  2134  static int clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
4e88f3de8 Thierry Reding 2015-01-21  2135  {
4dff95dc9 Stephen Boyd   2015-04-30  2136  	struct dentry *d;
4dff95dc9 Stephen Boyd   2015-04-30  2137  	int ret = -ENOMEM;
4e88f3de8 Thierry Reding 2015-01-21  2138  
4dff95dc9 Stephen Boyd   2015-04-30  2139  	if (!core || !pdentry) {
4dff95dc9 Stephen Boyd   2015-04-30  2140  		ret = -EINVAL;
4dff95dc9 Stephen Boyd   2015-04-30  2141  		goto out;
4dff95dc9 Stephen Boyd   2015-04-30  2142  	}
4e88f3de8 Thierry Reding 2015-01-21  2143  
4dff95dc9 Stephen Boyd   2015-04-30  2144  	d = debugfs_create_dir(core->name, pdentry);
4dff95dc9 Stephen Boyd   2015-04-30  2145  	if (!d)
4dff95dc9 Stephen Boyd   2015-04-30  2146  		goto out;
035a61c31 Tomeu Vizoso   2015-01-23  2147  
4dff95dc9 Stephen Boyd   2015-04-30 @2148  	core->dentry = d;
4e88f3de8 Thierry Reding 2015-01-21  2149  
4dff95dc9 Stephen Boyd   2015-04-30 @2150  	d = debugfs_create_u32("clk_rate", S_IRUGO, core->dentry,
4dff95dc9 Stephen Boyd   2015-04-30  2151  			(u32 *)&core->rate);
4dff95dc9 Stephen Boyd   2015-04-30  2152  	if (!d)
4dff95dc9 Stephen Boyd   2015-04-30  2153  		goto err_out;
4e88f3de8 Thierry Reding 2015-01-21  2154  
4dff95dc9 Stephen Boyd   2015-04-30  2155  	d = debugfs_create_u32("clk_accuracy", S_IRUGO, core->dentry,
4dff95dc9 Stephen Boyd   2015-04-30  2156  			(u32 *)&core->accuracy);
4dff95dc9 Stephen Boyd   2015-04-30  2157  	if (!d)
4dff95dc9 Stephen Boyd   2015-04-30  2158  		goto err_out;
4e88f3de8 Thierry Reding 2015-01-21  2159  
4dff95dc9 Stephen Boyd   2015-04-30 @2160  	d = debugfs_create_u32("clk_phase", S_IRUGO, core->dentry,
4dff95dc9 Stephen Boyd   2015-04-30  2161  			(u32 *)&core->phase);
4dff95dc9 Stephen Boyd   2015-04-30  2162  	if (!d)
4dff95dc9 Stephen Boyd   2015-04-30  2163  		goto err_out;
b2476490e Mike Turquette 2012-03-15  2164  
4dff95dc9 Stephen Boyd   2015-04-30 @2165  	d = debugfs_create_x32("clk_flags", S_IRUGO, core->dentry,
4dff95dc9 Stephen Boyd   2015-04-30  2166  			(u32 *)&core->flags);
4dff95dc9 Stephen Boyd   2015-04-30  2167  	if (!d)
4dff95dc9 Stephen Boyd   2015-04-30  2168  		goto err_out;
89ac8d7ae Mike Turquette 2013-08-21  2169  
4dff95dc9 Stephen Boyd   2015-04-30  2170  	d = debugfs_create_u32("clk_prepare_count", S_IRUGO, core->dentry,
4dff95dc9 Stephen Boyd   2015-04-30  2171  			(u32 *)&core->prepare_count);
4dff95dc9 Stephen Boyd   2015-04-30  2172  	if (!d)
4dff95dc9 Stephen Boyd   2015-04-30  2173  		goto err_out;
b2476490e Mike Turquette 2012-03-15  2174  
4dff95dc9 Stephen Boyd   2015-04-30  2175  	d = debugfs_create_u32("clk_enable_count", S_IRUGO, core->dentry,
4dff95dc9 Stephen Boyd   2015-04-30  2176  			(u32 *)&core->enable_count);
4dff95dc9 Stephen Boyd   2015-04-30  2177  	if (!d)
4dff95dc9 Stephen Boyd   2015-04-30  2178  		goto err_out;
b2476490e Mike Turquette 2012-03-15  2179  
4dff95dc9 Stephen Boyd   2015-04-30 @2180  	d = debugfs_create_u32("clk_notifier_count", S_IRUGO, core->dentry,
4dff95dc9 Stephen Boyd   2015-04-30  2181  			(u32 *)&core->notifier_count);
4dff95dc9 Stephen Boyd   2015-04-30  2182  	if (!d)
4dff95dc9 Stephen Boyd   2015-04-30  2183  		goto err_out;
b61c43c09 Stephen Boyd   2015-02-02  2184  
4dff95dc9 Stephen Boyd   2015-04-30  2185  	if (core->ops->debug_init) {
4dff95dc9 Stephen Boyd   2015-04-30  2186  		ret = core->ops->debug_init(core->hw, core->dentry);
4dff95dc9 Stephen Boyd   2015-04-30  2187  		if (ret)
4dff95dc9 Stephen Boyd   2015-04-30  2188  			goto err_out;
031dcc9bd Ulf Hansson    2013-04-02  2189  	}
031dcc9bd Ulf Hansson    2013-04-02  2190  
4dff95dc9 Stephen Boyd   2015-04-30  2191  	ret = 0;
031dcc9bd Ulf Hansson    2013-04-02  2192  	goto out;
031dcc9bd Ulf Hansson    2013-04-02  2193  
4dff95dc9 Stephen Boyd   2015-04-30  2194  err_out:
4dff95dc9 Stephen Boyd   2015-04-30 @2195  	debugfs_remove_recursive(core->dentry);
4dff95dc9 Stephen Boyd   2015-04-30  2196  	core->dentry = NULL;
4dff95dc9 Stephen Boyd   2015-04-30  2197  out:
4dff95dc9 Stephen Boyd   2015-04-30  2198  	return ret;
4dff95dc9 Stephen Boyd   2015-04-30  2199  }
b2476490e Mike Turquette 2012-03-15  2200  
4dff95dc9 Stephen Boyd   2015-04-30  2201  /**
6e5ab41b1 Stephen Boyd   2015-04-30  2202   * clk_debug_register - add a clk node to the debugfs clk directory
6e5ab41b1 Stephen Boyd   2015-04-30  2203   * @core: the clk being added to the debugfs clk directory
4dff95dc9 Stephen Boyd   2015-04-30  2204   *
6e5ab41b1 Stephen Boyd   2015-04-30  2205   * Dynamically adds a clk to the debugfs clk directory if debugfs has been
6e5ab41b1 Stephen Boyd   2015-04-30  2206   * initialized.  Otherwise it bails out early since the debugfs clk directory
4dff95dc9 Stephen Boyd   2015-04-30  2207   * will be created lazily by clk_debug_init as part of a late_initcall.
4dff95dc9 Stephen Boyd   2015-04-30  2208   */
4dff95dc9 Stephen Boyd   2015-04-30  2209  static int clk_debug_register(struct clk_core *core)
4dff95dc9 Stephen Boyd   2015-04-30  2210  {
4dff95dc9 Stephen Boyd   2015-04-30  2211  	int ret = 0;
b2476490e Mike Turquette 2012-03-15  2212  
4dff95dc9 Stephen Boyd   2015-04-30  2213  	mutex_lock(&clk_debug_lock);
4dff95dc9 Stephen Boyd   2015-04-30  2214  	hlist_add_head(&core->debug_node, &clk_debug_list);
b2476490e Mike Turquette 2012-03-15  2215  
4dff95dc9 Stephen Boyd   2015-04-30  2216  	if (!inited)
4dff95dc9 Stephen Boyd   2015-04-30  2217  		goto unlock;
b2476490e Mike Turquette 2012-03-15  2218  
4dff95dc9 Stephen Boyd   2015-04-30  2219  	ret = clk_debug_create_one(core, rootdir);
4dff95dc9 Stephen Boyd   2015-04-30  2220  unlock:
4dff95dc9 Stephen Boyd   2015-04-30  2221  	mutex_unlock(&clk_debug_lock);
b2476490e Mike Turquette 2012-03-15  2222  
b2476490e Mike Turquette 2012-03-15  2223  	return ret;
b2476490e Mike Turquette 2012-03-15  2224  }
035a61c31 Tomeu Vizoso   2015-01-23  2225  
035a61c31 Tomeu Vizoso   2015-01-23  2226   /**
6e5ab41b1 Stephen Boyd   2015-04-30  2227   * clk_debug_unregister - remove a clk node from the debugfs clk directory
6e5ab41b1 Stephen Boyd   2015-04-30  2228   * @core: the clk being removed from the debugfs clk directory
035a61c31 Tomeu Vizoso   2015-01-23  2229   *
6e5ab41b1 Stephen Boyd   2015-04-30  2230   * Dynamically removes a clk and all its child nodes from the
6e5ab41b1 Stephen Boyd   2015-04-30  2231   * debugfs clk directory if clk->dentry points to debugfs created by
706d5c73e Stephen Boyd   2016-02-22  2232   * clk_debug_register in __clk_core_init.
035a61c31 Tomeu Vizoso   2015-01-23  2233   */
4dff95dc9 Stephen Boyd   2015-04-30  2234  static void clk_debug_unregister(struct clk_core *core)
035a61c31 Tomeu Vizoso   2015-01-23  2235  {
4dff95dc9 Stephen Boyd   2015-04-30  2236  	mutex_lock(&clk_debug_lock);
4dff95dc9 Stephen Boyd   2015-04-30  2237  	hlist_del_init(&core->debug_node);
4dff95dc9 Stephen Boyd   2015-04-30 @2238  	debugfs_remove_recursive(core->dentry);
4dff95dc9 Stephen Boyd   2015-04-30  2239  	core->dentry = NULL;
4dff95dc9 Stephen Boyd   2015-04-30  2240  	mutex_unlock(&clk_debug_lock);
4dff95dc9 Stephen Boyd   2015-04-30  2241  }
035a61c31 Tomeu Vizoso   2015-01-23  2242  
4dff95dc9 Stephen Boyd   2015-04-30  2243  struct dentry *clk_debugfs_add_file(struct clk_hw *hw, char *name, umode_t mode,
4dff95dc9 Stephen Boyd   2015-04-30  2244  				void *data, const struct file_operations *fops)
4dff95dc9 Stephen Boyd   2015-04-30  2245  {
4dff95dc9 Stephen Boyd   2015-04-30  2246  	struct dentry *d = NULL;
4dff95dc9 Stephen Boyd   2015-04-30  2247  
4dff95dc9 Stephen Boyd   2015-04-30  2248  	if (hw->core->dentry)
4dff95dc9 Stephen Boyd   2015-04-30 @2249  		d = debugfs_create_file(name, mode, hw->core->dentry, data,
4dff95dc9 Stephen Boyd   2015-04-30  2250  					fops);
4dff95dc9 Stephen Boyd   2015-04-30  2251  
4dff95dc9 Stephen Boyd   2015-04-30  2252  	return d;

:::::: The code at line 2148 was first introduced by commit
:::::: 4dff95dc9477a34de77d24c59dcf1dc593687fcf clk: Remove forward declared function prototypes

:::::: TO: Stephen Boyd <sboyd@codeaurora.org>
:::::: CC: Stephen Boyd <sboyd@codeaurora.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot June 29, 2016, 4:46 p.m. UTC | #2
Hi,

[auto build test ERROR on clk/clk-next]
[also build test ERROR on v4.7-rc5 next-20160629]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dong-Aisheng/clk-core-support-clocks-which-requires-parents-enable/20160629-231445
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: arm-viper_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   include/linux/export.h:63:39: error: declaration of '__ksymtab_clk_notifier_register' with no linkage follows extern declaration
     __visible const struct kernel_symbol __ksymtab_##sym \
                                          ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^
   drivers/clk/clk.c:2958:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_notifier_register);
    ^
   include/linux/export.h:62:36: note: previous declaration of '__ksymtab_clk_notifier_register' was here
     extern const struct kernel_symbol __ksymtab_##sym; \
                                       ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^
   drivers/clk/clk.c:2958:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_notifier_register);
    ^
   drivers/clk/clk.c:3005:19: error: non-static declaration of 'clk_notifier_unregister' follows static declaration
    EXPORT_SYMBOL_GPL(clk_notifier_unregister);
                      ^
   include/linux/export.h:57:21: note: in definition of macro '___EXPORT_SYMBOL'
     extern typeof(sym) sym;     \
                        ^
   drivers/clk/clk.c:3005:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_notifier_unregister);
    ^
   drivers/clk/clk.c:2971:5: note: previous definition of 'clk_notifier_unregister' was here
    int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb)
        ^
   In file included from include/linux/linkage.h:6:0,
                    from include/linux/kernel.h:6,
                    from include/linux/clk.h:16,
                    from drivers/clk/clk.c:12:
   include/linux/export.h:63:25: warning: '__used__' attribute ignored [-Wattributes]
     __visible const struct kernel_symbol __ksymtab_##sym \
                            ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^
   drivers/clk/clk.c:3005:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_notifier_unregister);
    ^
   include/linux/export.h:63:39: error: section attribute cannot be specified for local variables
     __visible const struct kernel_symbol __ksymtab_##sym \
                                          ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^
   drivers/clk/clk.c:3005:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_notifier_unregister);
    ^
   include/linux/export.h:63:25: warning: 'externally_visible' attribute have effect only on public objects [-Wattributes]
     __visible const struct kernel_symbol __ksymtab_##sym \
                            ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^
   drivers/clk/clk.c:3005:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_notifier_unregister);
    ^
   include/linux/export.h:63:39: error: declaration of '__ksymtab_clk_notifier_unregister' with no linkage follows extern declaration
     __visible const struct kernel_symbol __ksymtab_##sym \
                                          ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^
   drivers/clk/clk.c:3005:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_notifier_unregister);
    ^
   include/linux/export.h:62:36: note: previous declaration of '__ksymtab_clk_notifier_unregister' was here
     extern const struct kernel_symbol __ksymtab_##sym; \
                                       ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^
   drivers/clk/clk.c:3005:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_notifier_unregister);
    ^
>> include/linux/export.h:63:25: error: expected declaration or statement at end of input
     __visible const struct kernel_symbol __ksymtab_##sym \
                            ^
   include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
    #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
                            ^
   include/linux/export.h:101:2: note: in expansion of macro '__EXPORT_SYMBOL'
     __EXPORT_SYMBOL(sym, "_gpl")
     ^
   drivers/clk/clk.c:3005:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL'
    EXPORT_SYMBOL_GPL(clk_notifier_unregister);
    ^

vim +63 include/linux/export.h

f5016932 Paul Gortmaker 2011-05-23  57  	extern typeof(sym) sym;					\
f5016932 Paul Gortmaker 2011-05-23  58  	__CRC_SYMBOL(sym, sec)					\
f5016932 Paul Gortmaker 2011-05-23  59  	static const char __kstrtab_##sym[]			\
f5016932 Paul Gortmaker 2011-05-23  60  	__attribute__((section("__ksymtab_strings"), aligned(1))) \
b92021b0 Rusty Russell  2013-03-15  61  	= VMLINUX_SYMBOL_STR(sym);				\
7b4ec8dd Johannes Berg  2014-01-16  62  	extern const struct kernel_symbol __ksymtab_##sym;	\
e0f244c6 Andi Kleen     2013-10-23 @63  	__visible const struct kernel_symbol __ksymtab_##sym	\
f5016932 Paul Gortmaker 2011-05-23  64  	__used							\
f5016932 Paul Gortmaker 2011-05-23  65  	__attribute__((section("___ksymtab" sec "+" #sym), unused))	\
f5016932 Paul Gortmaker 2011-05-23  66  	= { (unsigned long)&sym, __kstrtab_##sym }
f5016932 Paul Gortmaker 2011-05-23  67  
c1a95fda Nicolas Pitre  2016-01-22  68  #if defined(__KSYM_DEPS__)
c1a95fda Nicolas Pitre  2016-01-22  69  
c1a95fda Nicolas Pitre  2016-01-22  70  /*
c1a95fda Nicolas Pitre  2016-01-22  71   * For fine grained build dependencies, we want to tell the build system
c1a95fda Nicolas Pitre  2016-01-22  72   * about each possible exported symbol even if they're not actually exported.
c1a95fda Nicolas Pitre  2016-01-22  73   * We use a string pattern that is unlikely to be valid code that the build
c1a95fda Nicolas Pitre  2016-01-22  74   * system filters out from the preprocessor output (see ksym_dep_filter
c1a95fda Nicolas Pitre  2016-01-22  75   * in scripts/Kbuild.include).
c1a95fda Nicolas Pitre  2016-01-22  76   */
c1a95fda Nicolas Pitre  2016-01-22  77  #define __EXPORT_SYMBOL(sym, sec)	=== __KSYM_##sym ===
c1a95fda Nicolas Pitre  2016-01-22  78  
c1a95fda Nicolas Pitre  2016-01-22  79  #elif defined(CONFIG_TRIM_UNUSED_KSYMS)
f2355416 Nicolas Pitre  2016-01-22  80  
f2355416 Nicolas Pitre  2016-01-22  81  #include <linux/kconfig.h>
f2355416 Nicolas Pitre  2016-01-22  82  #include <generated/autoksyms.h>
f2355416 Nicolas Pitre  2016-01-22  83  
f2355416 Nicolas Pitre  2016-01-22  84  #define __EXPORT_SYMBOL(sym, sec)				\
f2355416 Nicolas Pitre  2016-01-22  85  	__cond_export_sym(sym, sec, config_enabled(__KSYM_##sym))
f2355416 Nicolas Pitre  2016-01-22  86  #define __cond_export_sym(sym, sec, conf)			\
f2355416 Nicolas Pitre  2016-01-22  87  	___cond_export_sym(sym, sec, conf)
f2355416 Nicolas Pitre  2016-01-22  88  #define ___cond_export_sym(sym, sec, enabled)			\
f2355416 Nicolas Pitre  2016-01-22  89  	__cond_export_sym_##enabled(sym, sec)
f2355416 Nicolas Pitre  2016-01-22  90  #define __cond_export_sym_1(sym, sec) ___EXPORT_SYMBOL(sym, sec)
f2355416 Nicolas Pitre  2016-01-22  91  #define __cond_export_sym_0(sym, sec) /* nothing */
f2355416 Nicolas Pitre  2016-01-22  92  
f2355416 Nicolas Pitre  2016-01-22  93  #else
f2355416 Nicolas Pitre  2016-01-22 @94  #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
f2355416 Nicolas Pitre  2016-01-22  95  #endif
f2355416 Nicolas Pitre  2016-01-22  96  
f5016932 Paul Gortmaker 2011-05-23  97  #define EXPORT_SYMBOL(sym)					\

:::::: The code at line 63 was first introduced by commit
:::::: e0f244c63fc9d192dfd399cc2677bbdca61994b1 asmlinkage, module: Make ksymtab and kcrctab symbols and __this_module __visible

:::::: TO: Andi Kleen <ak@linux.intel.com>
:::::: CC: Rusty Russell <rusty@rustcorp.com.au>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot June 29, 2016, 4:47 p.m. UTC | #3
Hi,

[auto build test WARNING on clk/clk-next]
[also build test WARNING on v4.7-rc5 next-20160629]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dong-Aisheng/clk-core-support-clocks-which-requires-parents-enable/20160629-231445
base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
config: x86_64-randconfig-s4-06300001 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/clk/clk.c: In function '__clk_set_parent_after':
   drivers/clk/clk.c:1234:12: error: invalid storage class for function '__clk_set_parent'
    static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
               ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1234:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
    ^~~~~~
   drivers/clk/clk.c:1279:12: error: invalid storage class for function '__clk_speculate_rates'
    static int __clk_speculate_rates(struct clk_core *core,
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1310:13: error: invalid storage class for function 'clk_calc_subtree'
    static void clk_calc_subtree(struct clk_core *core, unsigned long new_rate,
                ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1333:25: error: invalid storage class for function 'clk_calc_new_rates'
    static struct clk_core *clk_calc_new_rates(struct clk_core *core,
                            ^~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1431:25: error: invalid storage class for function 'clk_propagate_rate_change'
    static struct clk_core *clk_propagate_rate_change(struct clk_core *core,
                            ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1469:13: error: invalid storage class for function 'clk_change_rate'
    static void clk_change_rate(struct clk_core *core)
                ^~~~~~~~~~~~~~~
   In file included from include/linux/err.h:4:0,
                    from include/linux/clk.h:15,
                    from drivers/clk/clk.c:12:
   drivers/clk/clk.c: In function 'clk_change_rate':
   drivers/clk/clk.c:1517:20: error: 'CLK_OPS_PARENT_ON' undeclared (first use in this function)
     if (core->flags & CLK_OPS_PARENT_ON)
                       ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/clk/clk.c:1517:2: note: in expansion of macro 'if'
     if (core->flags & CLK_OPS_PARENT_ON)
     ^~
   drivers/clk/clk.c:1517:20: note: each undeclared identifier is reported only once for each function it appears in
     if (core->flags & CLK_OPS_PARENT_ON)
                       ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/clk/clk.c:1517:2: note: in expansion of macro 'if'
     if (core->flags & CLK_OPS_PARENT_ON)
     ^~
   drivers/clk/clk.c: In function '__clk_set_parent_after':
   drivers/clk/clk.c:1561:12: error: invalid storage class for function 'clk_core_set_rate_nolock'
    static int clk_core_set_rate_nolock(struct clk_core *core,
               ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1646:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    int clk_set_rate_range(struct clk *clk, unsigned long min, unsigned long max)
    ^~~
   drivers/clk/clk.c:1681:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    int clk_set_min_rate(struct clk *clk, unsigned long rate)
    ^~~
   drivers/clk/clk.c:1697:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    int clk_set_max_rate(struct clk *clk, unsigned long rate)
    ^~~
   drivers/clk/clk.c:1712:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    struct clk *clk_get_parent(struct clk *clk)
    ^~~~~~
   drivers/clk/clk.c:1728:25: error: invalid storage class for function '__clk_init_parent'
    static struct clk_core *__clk_init_parent(struct clk_core *core)
                            ^~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1728:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static struct clk_core *__clk_init_parent(struct clk_core *core)
    ^~~~~~
   drivers/clk/clk.c:1738:13: error: invalid storage class for function 'clk_core_reparent'
    static void clk_core_reparent(struct clk_core *core,
                ^~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1788:12: error: invalid storage class for function 'clk_core_set_parent'
    static int clk_core_set_parent(struct clk_core *core, struct clk_core *parent)
               ^~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1788:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static int clk_core_set_parent(struct clk_core *core, struct clk_core *parent)
    ^~~~~~
   drivers/clk/clk.c:1897:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    int clk_set_phase(struct clk *clk, int degrees)
    ^~~
   drivers/clk/clk.c:1932:12: error: invalid storage class for function 'clk_core_get_phase'
    static int clk_core_get_phase(struct clk_core *core)
               ^~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:1932:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    static int clk_core_get_phase(struct clk_core *core)
    ^~~~~~
   drivers/clk/clk.c:1970:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    bool clk_is_match(const struct clk *p, const struct clk *q)
    ^~~~
   In file included from drivers/clk/clk.c:1988:0:
>> include/linux/debugfs.h:24:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    struct device;
    ^~~~~~
   drivers/clk/clk.c:2006:13: error: invalid storage class for function 'clk_summary_show_one'
    static void clk_summary_show_one(struct seq_file *s, struct clk_core *c,
                ^~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2019:13: error: invalid storage class for function 'clk_summary_show_subtree'
    static void clk_summary_show_subtree(struct seq_file *s, struct clk_core *c,
                ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2033:12: error: invalid storage class for function 'clk_summary_show'
    static int clk_summary_show(struct seq_file *s, void *data)
               ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2053:12: error: invalid storage class for function 'clk_summary_open'
    static int clk_summary_open(struct inode *inode, struct file *file)
               ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2058:21: error: variable 'clk_summary_fops' has initializer but incomplete type
    static const struct file_operations clk_summary_fops = {
                        ^~~~~~~~~~~~~~~
   drivers/clk/clk.c:2059:2: error: unknown field 'open' specified in initializer
     .open  = clk_summary_open,
     ^
   drivers/clk/clk.c:2059:11: warning: excess elements in struct initializer
     .open  = clk_summary_open,
              ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2059:11: note: (near initialization for 'clk_summary_fops')
   drivers/clk/clk.c:2060:2: error: unknown field 'read' specified in initializer
     .read  = seq_read,
     ^
   drivers/clk/clk.c:2060:11: warning: excess elements in struct initializer
     .read  = seq_read,
              ^~~~~~~~
   drivers/clk/clk.c:2060:11: note: (near initialization for 'clk_summary_fops')
   drivers/clk/clk.c:2061:2: error: unknown field 'llseek' specified in initializer
     .llseek  = seq_lseek,
     ^
   drivers/clk/clk.c:2061:13: warning: excess elements in struct initializer
     .llseek  = seq_lseek,
                ^~~~~~~~~
   drivers/clk/clk.c:2061:13: note: (near initialization for 'clk_summary_fops')
   drivers/clk/clk.c:2062:2: error: unknown field 'release' specified in initializer
     .release = single_release,
     ^
   drivers/clk/clk.c:2062:13: warning: excess elements in struct initializer
     .release = single_release,
                ^~~~~~~~~~~~~~
   drivers/clk/clk.c:2062:13: note: (near initialization for 'clk_summary_fops')
   drivers/clk/clk.c:2058:37: error: storage size of 'clk_summary_fops' isn't known
    static const struct file_operations clk_summary_fops = {
                                        ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2065:13: error: invalid storage class for function 'clk_dump_one'
    static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level)
                ^~~~~~~~~~~~
   drivers/clk/clk.c:2079:13: error: invalid storage class for function 'clk_dump_subtree'
    static void clk_dump_subtree(struct seq_file *s, struct clk_core *c, int level)
                ^~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2096:12: error: invalid storage class for function 'clk_dump'
    static int clk_dump(struct seq_file *s, void *data)
               ^~~~~~~~
   drivers/clk/clk.c:2122:12: error: invalid storage class for function 'clk_dump_open'
    static int clk_dump_open(struct inode *inode, struct file *file)
               ^~~~~~~~~~~~~
   drivers/clk/clk.c:2127:21: error: variable 'clk_dump_fops' has initializer but incomplete type
    static const struct file_operations clk_dump_fops = {
                        ^~~~~~~~~~~~~~~
   drivers/clk/clk.c:2128:2: error: unknown field 'open' specified in initializer
     .open  = clk_dump_open,
     ^
   drivers/clk/clk.c:2128:11: warning: excess elements in struct initializer
     .open  = clk_dump_open,
              ^~~~~~~~~~~~~
   drivers/clk/clk.c:2128:11: note: (near initialization for 'clk_dump_fops')
   drivers/clk/clk.c:2129:2: error: unknown field 'read' specified in initializer
     .read  = seq_read,
     ^
   drivers/clk/clk.c:2129:11: warning: excess elements in struct initializer
     .read  = seq_read,
              ^~~~~~~~
   drivers/clk/clk.c:2129:11: note: (near initialization for 'clk_dump_fops')
   drivers/clk/clk.c:2130:2: error: unknown field 'llseek' specified in initializer
     .llseek  = seq_lseek,
     ^
   drivers/clk/clk.c:2130:13: warning: excess elements in struct initializer
     .llseek  = seq_lseek,
                ^~~~~~~~~
   drivers/clk/clk.c:2130:13: note: (near initialization for 'clk_dump_fops')
   drivers/clk/clk.c:2131:2: error: unknown field 'release' specified in initializer
     .release = single_release,
     ^
   drivers/clk/clk.c:2131:13: warning: excess elements in struct initializer
     .release = single_release,
                ^~~~~~~~~~~~~~
   drivers/clk/clk.c:2131:13: note: (near initialization for 'clk_dump_fops')
   drivers/clk/clk.c:2127:37: error: storage size of 'clk_dump_fops' isn't known
    static const struct file_operations clk_dump_fops = {
                                        ^~~~~~~~~~~~~
   drivers/clk/clk.c:2134:12: error: invalid storage class for function 'clk_debug_create_one'
    static int clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
               ^~~~~~~~~~~~~~~~~~~~
   drivers/clk/clk.c:2209:12: error: invalid storage class for function 'clk_debug_register'
    static int clk_debug_register(struct clk_core *core)
               ^~~~~~~~~~~~~~~~~~

vim +/if +1517 drivers/clk/clk.c

  1501	
  1502			if (core->ops->set_rate_and_parent) {
  1503				skip_set_rate = true;
  1504				core->ops->set_rate_and_parent(core->hw, core->new_rate,
  1505						best_parent_rate,
  1506						core->new_parent_index);
  1507			} else if (core->ops->set_parent) {
  1508				core->ops->set_parent(core->hw, core->new_parent_index);
  1509			}
  1510	
  1511			trace_clk_set_parent_complete(core, core->new_parent);
  1512			__clk_set_parent_after(core, core->new_parent, old_parent);
  1513		}
  1514	
  1515		trace_clk_set_rate(core, core->new_rate);
  1516	
> 1517		if (core->flags & CLK_OPS_PARENT_ON)
  1518			clk_core_prepare_enable(parent);
  1519	
  1520		if (!skip_set_rate && core->ops->set_rate)
  1521			core->ops->set_rate(core->hw, core->new_rate, best_parent_rate);
  1522	
  1523		trace_clk_set_rate_complete(core, core->new_rate);
  1524	
  1525		core->rate = clk_recalc(core, best_parent_rate);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Dong Aisheng June 30, 2016, 7:04 a.m. UTC | #4
On Thu, Jun 30, 2016 at 12:42:21AM +0800, kbuild test robot wrote:
> Hi,
> 
> [auto build test ERROR on clk/clk-next]
> [also build test ERROR on v4.7-rc5 next-20160629]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Dong-Aisheng/clk-core-support-clocks-which-requires-parents-enable/20160629-231445
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next
> config: x86_64-randconfig-i0-201626 (attached as .config)
> compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> All error/warnings (new ones prefixed by >>):
> 
>    include/linux/export.h:94:25: note: in expansion of macro '___EXPORT_SYMBOL'
>     #define __EXPORT_SYMBOL ___EXPORT_SYMBOL
>                             ^~~~~~~~~~~~~~~~

Sorry, i somehow sent out a wrong re-based version.
Will send out V3 to fix it.

Regards
Dong Aisheng
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index e3bd28c9ef28..f1f56158b8c7 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1172,7 +1172,7 @@  static struct clk_core *__clk_set_parent_before(struct clk_core *core,
 	struct clk_core *old_parent = core->parent;
 
 	/*
-	 * Migrate prepare state between parents and prevent race with
+	 * 1. Migrate prepare state between parents and prevent race with
 	 * clk_enable().
 	 *
 	 * If the clock is not prepared, then a race with
@@ -1187,13 +1187,20 @@  static struct clk_core *__clk_set_parent_before(struct clk_core *core,
 	 * hardware and software states.
 	 *
 	 * See also: Comment for clk_set_parent() below.
+	 *
+	 * 2. enable parent clocks for CLK_OPS_PARENT_ENABLE clock
 	 */
+
+	/* enable old_parent & parent if CLK_OPS_PARENT_ENABLE is set */
+	if (core->flags & CLK_OPS_PARENT_ENABLE) {
+		clk_core_prepare_enable(old_parent);
+		clk_core_prepare_enable(parent);
+	}
+
+	/* migrate prepare count if > 0 */
 	if (core->prepare_count) {
-		clk_core_prepare(parent);
-		flags = clk_enable_lock();
-		clk_core_enable(parent);
-		clk_core_enable(core);
-		clk_enable_unlock(flags);
+		clk_core_prepare_enable(parent);
+		clk_core_enable_lock(core);
 	}
 
 	/* update the clk tree topology */
@@ -1208,19 +1215,20 @@  static void __clk_set_parent_after(struct clk_core *core,
 				   struct clk_core *parent,
 				   struct clk_core *old_parent)
 {
-	unsigned long flags;
-
 	/*
 	 * Finish the migration of prepare state and undo the changes done
 	 * for preventing a race with clk_enable().
 	 */
-	if (core->prepare_count) {
-		flags = clk_enable_lock();
-		clk_core_disable(core);
-		clk_core_disable(old_parent);
-		clk_enable_unlock(flags);
-		clk_core_unprepare(old_parent);
-	}
+        if (core->prepare_count) {
+                clk_core_disable_lock(core);
+                clk_core_disable_unprepare(old_parent);
+
+        /* re-balance ref counting if CLK_OPS_PARENT_ENABLE is set */
+        if (core->flags & CLK_OPS_PARENT_ENABLE) {
+                clk_core_disable_unprepare(parent);
+                clk_core_disable_unprepare(old_parent);
+        }
+
 }
 
 static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
@@ -1466,13 +1474,17 @@  static void clk_change_rate(struct clk_core *core)
 	unsigned long best_parent_rate = 0;
 	bool skip_set_rate = false;
 	struct clk_core *old_parent;
+	struct clk_core *parent = NULL;
 
 	old_rate = core->rate;
 
-	if (core->new_parent)
+	if (core->new_parent) {
+		parent = core->new_parent;
 		best_parent_rate = core->new_parent->rate;
-	else if (core->parent)
+	} else if (core->parent) {
+		parent = core->parent;
 		best_parent_rate = core->parent->rate;
+	}
 
 	if (core->flags & CLK_SET_RATE_UNGATE) {
 		unsigned long flags;
@@ -1502,6 +1514,9 @@  static void clk_change_rate(struct clk_core *core)
 
 	trace_clk_set_rate(core, core->new_rate);
 
+	if (core->flags & CLK_OPS_PARENT_ON)
+		clk_core_prepare_enable(parent);
+
 	if (!skip_set_rate && core->ops->set_rate)
 		core->ops->set_rate(core->hw, core->new_rate, best_parent_rate);
 
@@ -1518,6 +1533,9 @@  static void clk_change_rate(struct clk_core *core)
 		clk_core_unprepare(core);
 	}
 
+	if (core->flags & CLK_OPS_PARENT_ON)
+		clk_core_disable_unprepare(parent);
+
 	if (core->notifier_count && old_rate != core->rate)
 		__clk_notify(core, POST_RATE_CHANGE, old_rate, core->rate);