[PATCH] doc: kcsan: add support info of gcc for kcsan

2020-08-02 Thread Wang Wenhu
KCSAN is also supported in GCC version 7.3.0 or later.
For Clang, the supported versions are 7.0.0 and later.

Signed-off-by: Wang Wenhu 
---
 Documentation/dev-tools/kcsan.rst | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/dev-tools/kcsan.rst 
b/Documentation/dev-tools/kcsan.rst
index b38379f06194..05a4578839cf 100644
--- a/Documentation/dev-tools/kcsan.rst
+++ b/Documentation/dev-tools/kcsan.rst
@@ -8,7 +8,8 @@ approach to detect races. KCSAN's primary purpose is to detect 
`data races`_.
 Usage
 -
 
-KCSAN requires Clang version 11 or later.
+KCSAN is supported in both GCC and Clang. With GCC it requires version 7.3.0
+or later. With Clang it requires version 7.0.0 or later.
 
 To enable KCSAN configure the kernel with::
 
-- 
2.17.1



[PATCH] sched: loadavg: delete useless param ticks for calc_global_load

2020-07-28 Thread Wang Wenhu
The only parameter "unsigned long ticks" for calc_global_load is
never used inside the function definition. Delete it now.

Signed-off-by: Wang Wenhu 
---
 include/linux/sched/loadavg.h | 2 +-
 kernel/sched/loadavg.c| 2 +-
 kernel/time/timekeeping.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/sched/loadavg.h b/include/linux/sched/loadavg.h
index 4859bea47a7b..83ec54b65e79 100644
--- a/include/linux/sched/loadavg.h
+++ b/include/linux/sched/loadavg.h
@@ -43,6 +43,6 @@ extern unsigned long calc_load_n(unsigned long load, unsigned 
long exp,
 #define LOAD_INT(x) ((x) >> FSHIFT)
 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
 
-extern void calc_global_load(unsigned long ticks);
+extern void calc_global_load(void);
 
 #endif /* _LINUX_SCHED_LOADAVG_H */
diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index de22da666ac7..d2a655643a02 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -347,7 +347,7 @@ static inline void calc_global_nohz(void) { }
  *
  * Called from the global timer code.
  */
-void calc_global_load(unsigned long ticks)
+void calc_global_load(void)
 {
unsigned long sample_window;
long active, delta;
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d20d489841c8..63a632f9896c 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2193,7 +2193,7 @@ EXPORT_SYMBOL(ktime_get_coarse_ts64);
 void do_timer(unsigned long ticks)
 {
jiffies_64 += ticks;
-   calc_global_load(ticks);
+   calc_global_load();
 }
 
 /**
-- 
2.17.1



[PATCH] drivers: ipa: remove discription of nonexistent element

2020-05-26 Thread Wang Wenhu
No element named "client" exists within "struct ipa_endpoint".
It might be a heritage forgotten to be removed. Delete it now.

Signed-off-by: Wang Wenhu 
---
 drivers/net/ipa/ipa_endpoint.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ipa/ipa_endpoint.h b/drivers/net/ipa/ipa_endpoint.h
index 4b336a1f759d..bbee9535d4b2 100644
--- a/drivers/net/ipa/ipa_endpoint.h
+++ b/drivers/net/ipa/ipa_endpoint.h
@@ -41,7 +41,6 @@ enum ipa_endpoint_name {
 
 /**
  * struct ipa_endpoint - IPA endpoint information
- * @client:Client associated with the endpoint
  * @channel_id:EP's GSI channel
  * @evt_ring_id: EP's GSI channel event ring
  */
-- 
2.17.1



[PATCH] drivers: ipa: fix typoes for ipa

2020-05-26 Thread Wang Wenhu
Change "transactio" -> "transaction". Also an alignment correction.

Signed-off-by: Wang Wenhu 
---
 drivers/net/ipa/gsi.c  | 2 +-
 drivers/net/ipa/ipa_endpoint.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
index b671bea0aa7c..688b99a606bf 100644
--- a/drivers/net/ipa/gsi.c
+++ b/drivers/net/ipa/gsi.c
@@ -1345,7 +1345,7 @@ static void gsi_channel_update(struct gsi_channel 
*channel)
  * gsi_channel_poll_one() - Return a single completed transaction on a channel
  * @channel:   Channel to be polled
  *
- * @Return: Transaction pointer, or null if none are available
+ * @Return:Transaction pointer, or null if none are available
  *
  * This function returns the first entry on a channel's completed transaction
  * list.  If that list is empty, the hardware is consulted to determine
diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c
index a21534f1462f..b247ae24c0e1 100644
--- a/drivers/net/ipa/ipa_endpoint.c
+++ b/drivers/net/ipa/ipa_endpoint.c
@@ -340,7 +340,7 @@ int ipa_endpoint_modem_exception_reset_all(struct ipa *ipa)
/* We need one command per modem TX endpoint.  We can get an upper
 * bound on that by assuming all initialized endpoints are modem->IPA.
 * That won't happen, and we could be more precise, but this is fine
-* for now.  We need to end the transactio with a "tag process."
+* for now.  We need to end the transaction with a "tag process."
 */
count = hweight32(initialized) + ipa_cmd_tag_process_count();
trans = ipa_cmd_trans_alloc(ipa, count);
-- 
2.17.1



[PATCH] drivers: ipa: print dev_err info accurately

2020-05-24 Thread Wang Wenhu
Print certain name string instead of hard-coded "memory" for dev_err
output, which would be more accurate and helpful for debugging.

Signed-off-by: Wang Wenhu 
Cc: Alex Elder 
---
 drivers/net/ipa/ipa_clock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c
index ddbd687fe64b..749ff5668e37 100644
--- a/drivers/net/ipa/ipa_clock.c
+++ b/drivers/net/ipa/ipa_clock.c
@@ -66,8 +66,8 @@ ipa_interconnect_init_one(struct device *dev, const char 
*name)
 
path = of_icc_get(dev, name);
if (IS_ERR(path))
-   dev_err(dev, "error %ld getting memory interconnect\n",
-   PTR_ERR(path));
+   dev_err(dev, "error %ld getting %s interconnect\n",
+   PTR_ERR(path), name);
 
return path;
 }
-- 
2.17.1



[PATCH] drivers: ipa: fix typos for ipa_smp2p structure doc

2020-05-14 Thread Wang Wenhu
Remove the duplicate "mutex", and change "Motex" to "Mutex". Also I
recommend it's easier for understanding to make the "ready-interrupt"
a bundle for it is a parallel description as "shutdown" which is appended
after the slash.

Signed-off-by: Wang Wenhu 
Cc: Alex Elder 
---
 drivers/net/ipa/ipa_smp2p.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ipa/ipa_smp2p.c b/drivers/net/ipa/ipa_smp2p.c
index 4d33aa7ebfbb..a5f7a79a1923 100644
--- a/drivers/net/ipa/ipa_smp2p.c
+++ b/drivers/net/ipa/ipa_smp2p.c
@@ -53,7 +53,7 @@
  * @clock_on:  Whether IPA clock is on
  * @notified:  Whether modem has been notified of clock state
  * @disabled:  Whether setup ready interrupt handling is disabled
- * @mutex mutex:   Motex protecting ready interrupt/shutdown interlock
+ * @mutex: Mutex protecting ready-interrupt/shutdown interlock
  * @panic_notifier:Panic notifier structure
 */
 struct ipa_smp2p {
-- 
2.17.1



[PATCH] drivers: ipa: use devm_kzalloc for simplicity

2020-05-13 Thread Wang Wenhu
Make a substitution of kzalloc with devm_kzalloc to simplify the
ipa_probe() process.

Signed-off-by: Wang Wenhu 
Cc: Alex Elder 
---
 drivers/net/ipa/ipa_clock.c | 7 ++-
 drivers/net/ipa/ipa_main.c  | 7 ++-
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c
index 374491ea11cf..ddbd687fe64b 100644
--- a/drivers/net/ipa/ipa_clock.c
+++ b/drivers/net/ipa/ipa_clock.c
@@ -276,7 +276,7 @@ struct ipa_clock *ipa_clock_init(struct device *dev)
goto err_clk_put;
}
 
-   clock = kzalloc(sizeof(*clock), GFP_KERNEL);
+   clock = devm_kzalloc(dev, sizeof(*clock), GFP_KERNEL);
if (!clock) {
ret = -ENOMEM;
goto err_clk_put;
@@ -285,15 +285,13 @@ struct ipa_clock *ipa_clock_init(struct device *dev)
 
ret = ipa_interconnect_init(clock, dev);
if (ret)
-   goto err_kfree;
+   goto err_clk_put;
 
mutex_init(&clock->mutex);
atomic_set(&clock->count, 0);
 
return clock;
 
-err_kfree:
-   kfree(clock);
 err_clk_put:
clk_put(clk);
 
@@ -308,6 +306,5 @@ void ipa_clock_exit(struct ipa_clock *clock)
WARN_ON(atomic_read(&clock->count) != 0);
mutex_destroy(&clock->mutex);
ipa_interconnect_exit(clock);
-   kfree(clock);
clk_put(clk);
 }
diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c
index 28998dcce3d2..b7b348b863f7 100644
--- a/drivers/net/ipa/ipa_main.c
+++ b/drivers/net/ipa/ipa_main.c
@@ -760,7 +760,7 @@ static int ipa_probe(struct platform_device *pdev)
}
 
/* Allocate and initialize the IPA structure */
-   ipa = kzalloc(sizeof(*ipa), GFP_KERNEL);
+   ipa = devm_kzalloc(dev, sizeof(*ipa), GFP_KERNEL);
if (!ipa) {
ret = -ENOMEM;
goto err_wakeup_source_unregister;
@@ -776,7 +776,7 @@ static int ipa_probe(struct platform_device *pdev)
 
ret = ipa_reg_init(ipa);
if (ret)
-   goto err_kfree_ipa;
+   goto err_wakeup_source_unregister;
 
ret = ipa_mem_init(ipa, data->mem_count, data->mem_data);
if (ret)
@@ -848,8 +848,6 @@ static int ipa_probe(struct platform_device *pdev)
ipa_mem_exit(ipa);
 err_reg_exit:
ipa_reg_exit(ipa);
-err_kfree_ipa:
-   kfree(ipa);
 err_wakeup_source_unregister:
wakeup_source_unregister(wakeup_source);
 err_clock_exit:
@@ -885,7 +883,6 @@ static int ipa_remove(struct platform_device *pdev)
gsi_exit(&ipa->gsi);
ipa_mem_exit(ipa);
ipa_reg_exit(ipa);
-   kfree(ipa);
wakeup_source_unregister(wakeup_source);
ipa_clock_exit(clock);
rproc_put(rproc);
-- 
2.17.1



[PATCH] cpufreq: fix a minor typo for cpufreq_driver doc

2020-05-13 Thread Wang Wenhu
Delete the duplicate "to" possibly double-typed.

Signed-off-by: Wang Wenhu 
Cc: Viresh Kumar 
---
 include/linux/cpufreq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index f7240251a949..67d5950bd878 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -330,7 +330,7 @@ struct cpufreq_driver {
 *
 * get_intermediate should return a stable intermediate frequency
 * platform wants to switch to and target_intermediate() should set CPU
-* to to that frequency, before jumping to the frequency corresponding
+* to that frequency, before jumping to the frequency corresponding
 * to 'index'. Core will take care of sending notifications and driver
 * doesn't have to handle them in target_intermediate() or
 * target_index().
-- 
2.17.1



[PATCH] doc: zh_CN: add translatation for debugfs.txt

2020-05-09 Thread Wang Wenhu
From: Chucheng Luo 

Translate Documentation/filesystems/debugfs.txt into Chinese.

Signed-off-by: Chucheng Luo 
Reviewed-by: Alex Shi 
Signed-off-by: Wang Wenhu 
[rebase for upstream conflict and minor change of subject]
Link: 
https://lore.kernel.org/linux-doc/20200408021528.14062-1-luochuch...@vivo.com/
---
Note:
 * Did rebase as asked by Jonathan for the conflict when applied.
 * Also ajusted the subject description.
 * For their is no modification of new translated file, I appended
   the "Reviewed-by" tag from Alex.
---
 .../zh_CN/filesystems/debugfs.rst | 221 ++
 .../translations/zh_CN/filesystems/index.rst  |   1 +
 2 files changed, 222 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/filesystems/debugfs.rst

diff --git a/Documentation/translations/zh_CN/filesystems/debugfs.rst 
b/Documentation/translations/zh_CN/filesystems/debugfs.rst
new file mode 100644
index ..f8a28793c277
--- /dev/null
+++ b/Documentation/translations/zh_CN/filesystems/debugfs.rst
@@ -0,0 +1,221 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :ref:`Documentation/filesystems/debugfs.txt `
+
+===
+Debugfs
+===
+
+译者
+::
+
+   中文版维护者: 罗楚成 Chucheng Luo 
+   中文版翻译者: 罗楚成 Chucheng Luo 
+   中文版校译者:  罗楚成 Chucheng Luo 
+
+
+
+版权所有2020 罗楚成 
+
+
+Debugfs是内核开发人员在用户空间获取信息的简单方法。与/proc不同,proc只提供进程
+信息。也不像sysfs,具有严格的“每个文件一个值“的规则。debugfs根本没有规则,开发
+人员可以在这里放置他们想要的任何信息。debugfs文件系统也不能用作稳定的ABI接口。
+从理论上讲,debugfs导出文件的时候没有任何约束。但是[1]实际情况并不总是那么
+简单。即使是debugfs接口,也最好根据需要进行设计,并尽量保持接口不变。
+
+
+Debugfs通常使用以下命令安装::
+
+mount -t debugfs none /sys/kernel/debug
+
+(或等效的/etc/fstab行)。
+debugfs根目录默认仅可由root用户访问。要更改对文件树的访问,请使用“ uid”,“ gid”
+和“ mode”挂载选项。请注意,debugfs API仅按照GPL协议导出到模块。
+
+使用debugfs的代码应包含。然后,首先是创建至少一个目录来保存
+一组debugfs文件::
+
+struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
+
+如果成功,此调用将在指定的父目录下创建一个名为name的目录。如果parent参数为空,
+则会在debugfs根目录中创建。创建目录成功时,返回值是一个指向dentry结构体的指针。
+该dentry结构体的指针可用于在目录中创建文件(以及最后将其清理干净)。ERR_PTR
+(-ERROR)返回值表明出错。如果返回ERR_PTR(-ENODEV),则表明内核是在没有debugfs
+支持的情况下构建的,并且下述函数都不会起作用。
+
+在debugfs目录中创建文件的最通用方法是::
+
+struct dentry *debugfs_create_file(const char *name, umode_t mode,
+  struct dentry *parent, void *data,
+  const struct file_operations *fops);
+
+在这里,name是要创建的文件的名称,mode描述了访问文件应具有的权限,parent指向
+应该保存文件的目录,data将存储在产生的inode结构体的i_private字段中,而fops是
+一组文件操作函数,这些函数中实现文件操作的具体行为。至少,read()和/或
+write()操作应提供;其他可以根据需要包括在内。同样的,返回值将是指向创建文件
+的dentry指针,错误时返回ERR_PTR(-ERROR),系统不支持debugfs时返回值为ERR_PTR
+(-ENODEV)。创建一个初始大小的文件,可以使用以下函数代替::
+
+struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
+   struct dentry *parent, void *data,
+   const struct file_operations *fops,
+   loff_t file_size);
+
+file_size是初始文件大小。其他参数跟函数debugfs_create_file的相同。
+
+在许多情况下,没必要自己去创建一组文件操作;对于一些简单的情况,debugfs代码提供
+了许多帮助函数。包含单个整数值的文件可以使用以下任何一项创建::
+
+void debugfs_create_u8(const char *name, umode_t mode,
+  struct dentry *parent, u8 *value);
+void debugfs_create_u16(const char *name, umode_t mode,
+   struct dentry *parent, u16 *value);
+struct dentry *debugfs_create_u32(const char *name, umode_t mode,
+ struct dentry *parent, u32 *value);
+void debugfs_create_u64(const char *name, umode_t mode,
+   struct dentry *parent, u64 *value);
+
+这些文件支持读取和写入给定值。如果某个文件不支持写入,只需根据需要设置mode
+参数位。这些文件中的值以十进制表示;如果需要使用十六进制,可以使用以下函数
+替代::
+
+void debugfs_create_x8(const char *name, umode_t mode,
+  struct dentry *parent, u8 *value);
+void debugfs_create_x16(const char *name, umode_t mode,
+   struct dentry *parent, u16 *value);
+void debugfs_create_x32(const char *name, umode_t mode,
+   struct dentry *parent, u32 *value);
+void debugfs_create_x64(const char *name, umode_t mode,
+   struct dentry *parent, u64 *value);
+
+这些功能只有在开发人员知道导出值的大小的时候才有用。某些数据类型在不同的架构上
+有不同的宽度,这样会使情况变得有些复杂。在这种特殊情况下可以使用以下函数::
+
+void debugfs_create_size_t(const char *name, umode_t mode,
+  struct dentry *parent, size_t *value);
+
+不出所料,此函数将创建一个debugfs文件来表示类型为size_t的变量。
+
+同样地,也有导出无符号长整型变量的函数,分别以十进制和十六进制表示如下::
+
+struct dentry *debugfs_create_ulong(const char *name, umode_t mode,
+   struct dentry *parent,
+   unsigned long *value);
+void debugfs_create_xul(const char *name, umode_t mode,
+   struct dentry *parent, unsigned long *value);
+
+布尔值可以通过以下方式放置在debugfs中::
+
+struct dentry *debugfs_create_bool(const char *name, umode_t mode,
+  struct dentry *parent, bool *value);
+
+
+读取结

[PATCH] doc: thermal: add cpu-idle-cooling to index tree

2020-04-29 Thread Wang Wenhu
Add cpu-idle-cooling.rst to the index list for user reference through
self-compiled htmldocs or online documentation tree of kernel.

Like: https://www.kernel.org/doc/html/latest/driver-api/thermal/index.html

Signed-off-by: Wang Wenhu 
Cc: Daniel Lezcano 
---
 Documentation/driver-api/thermal/cpu-idle-cooling.rst | 3 +++
 Documentation/driver-api/thermal/index.rst| 1 +
 2 files changed, 4 insertions(+)

diff --git a/Documentation/driver-api/thermal/cpu-idle-cooling.rst 
b/Documentation/driver-api/thermal/cpu-idle-cooling.rst
index a1c3edecae00..b9f34ceb2a38 100644
--- a/Documentation/driver-api/thermal/cpu-idle-cooling.rst
+++ b/Documentation/driver-api/thermal/cpu-idle-cooling.rst
@@ -1,3 +1,6 @@
+
+CPU Idle Cooling
+
 
 Situation:
 --
diff --git a/Documentation/driver-api/thermal/index.rst 
b/Documentation/driver-api/thermal/index.rst
index 5ba61d19c6ae..4cb0b9b6bfb8 100644
--- a/Documentation/driver-api/thermal/index.rst
+++ b/Documentation/driver-api/thermal/index.rst
@@ -8,6 +8,7 @@ Thermal
:maxdepth: 1
 
cpu-cooling-api
+   cpu-idle-cooling
sysfs-api
power_allocator
 
-- 
2.17.1