2022-11-17 09:21:11

by ye.xingchen

[permalink] [raw]
Subject: [PATCH linux-next] soc: qcom: smem_state: Use device_match_of_node()

From: ye xingchen <[email protected]>

Replace the open-code with device_match_of_node().

Signed-off-by: ye xingchen <[email protected]>
---
drivers/soc/qcom/smem_state.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/smem_state.c b/drivers/soc/qcom/smem_state.c
index e848cc9a3cf8..a7844841a727 100644
--- a/drivers/soc/qcom/smem_state.c
+++ b/drivers/soc/qcom/smem_state.c
@@ -63,7 +63,7 @@ static struct qcom_smem_state *of_node_to_state(struct device_node *np)
mutex_lock(&list_lock);

list_for_each_entry(state, &smem_states, list) {
- if (state->of_node == np) {
+ if (device_match_of_node(state, np)) {
kref_get(&state->refcount);
goto unlock;
}
--
2.25.1


2022-11-18 01:12:50

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH linux-next] soc: qcom: smem_state: Use device_match_of_node()

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20221116]

url: https://github.com/intel-lab-lkp/linux/commits/ye-xingchen-zte-com-cn/soc-qcom-smem_state-Use-device_match_of_node/20221117-154927
patch link: https://lore.kernel.org/r/202211171548066327249%40zte.com.cn
patch subject: [PATCH linux-next] soc: qcom: smem_state: Use device_match_of_node()
config: ia64-randconfig-r001-20221117
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/4591339dd50eaf6b514f1994b2cc54d7ac3c5cd2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review ye-xingchen-zte-com-cn/soc-qcom-smem_state-Use-device_match_of_node/20221117-154927
git checkout 4591339dd50eaf6b514f1994b2cc54d7ac3c5cd2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/soc/qcom/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/soc/qcom/smem_state.c: In function 'of_node_to_state':
>> drivers/soc/qcom/smem_state.c:66:42: error: passing argument 1 of 'device_match_of_node' from incompatible pointer type [-Werror=incompatible-pointer-types]
66 | if (device_match_of_node(state, np)) {
| ^~~~~
| |
| struct qcom_smem_state *
In file included from include/linux/device.h:30,
from drivers/soc/qcom/smem_state.c:6:
include/linux/device/bus.h:145:41: note: expected 'struct device *' but argument is of type 'struct qcom_smem_state *'
145 | int device_match_of_node(struct device *dev, const void *np);
| ~~~~~~~~~~~~~~~^~~
cc1: some warnings being treated as errors


vim +/device_match_of_node +66 drivers/soc/qcom/smem_state.c

58
59 static struct qcom_smem_state *of_node_to_state(struct device_node *np)
60 {
61 struct qcom_smem_state *state;
62
63 mutex_lock(&list_lock);
64
65 list_for_each_entry(state, &smem_states, list) {
> 66 if (device_match_of_node(state, np)) {
67 kref_get(&state->refcount);
68 goto unlock;
69 }
70 }
71 state = ERR_PTR(-EPROBE_DEFER);
72
73 unlock:
74 mutex_unlock(&list_lock);
75
76 return state;
77 }
78

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (2.89 kB)
config (147.98 kB)
Download all attachments

2022-11-21 01:42:29

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH linux-next] soc: qcom: smem_state: Use device_match_of_node()

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20221116]

url: https://github.com/intel-lab-lkp/linux/commits/ye-xingchen-zte-com-cn/soc-qcom-smem_state-Use-device_match_of_node/20221117-154927
patch link: https://lore.kernel.org/r/202211171548066327249%40zte.com.cn
patch subject: [PATCH linux-next] soc: qcom: smem_state: Use device_match_of_node()
config: arm-defconfig
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project bbe6bd724a6335e497c7edaed191d37a828d0390)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/4591339dd50eaf6b514f1994b2cc54d7ac3c5cd2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review ye-xingchen-zte-com-cn/soc-qcom-smem_state-Use-device_match_of_node/20221117-154927
git checkout 4591339dd50eaf6b514f1994b2cc54d7ac3c5cd2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/soc/qcom/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/soc/qcom/smem_state.c:66:28: error: incompatible pointer types passing 'struct qcom_smem_state *' to parameter of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
if (device_match_of_node(state, np)) {
^~~~~
include/linux/device/bus.h:145:41: note: passing argument to parameter 'dev' here
int device_match_of_node(struct device *dev, const void *np);
^
1 error generated.


vim +66 drivers/soc/qcom/smem_state.c

58
59 static struct qcom_smem_state *of_node_to_state(struct device_node *np)
60 {
61 struct qcom_smem_state *state;
62
63 mutex_lock(&list_lock);
64
65 list_for_each_entry(state, &smem_states, list) {
> 66 if (device_match_of_node(state, np)) {
67 kref_get(&state->refcount);
68 goto unlock;
69 }
70 }
71 state = ERR_PTR(-EPROBE_DEFER);
72
73 unlock:
74 mutex_unlock(&list_lock);
75
76 return state;
77 }
78

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (2.66 kB)
config (266.83 kB)
Download all attachments

2022-12-05 22:19:20

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH linux-next] soc: qcom: smem_state: Use device_match_of_node()

On Thu, Nov 17, 2022 at 03:48:06PM +0800, [email protected] wrote:
> From: ye xingchen <[email protected]>
>
> Replace the open-code with device_match_of_node().
>
> Signed-off-by: ye xingchen <[email protected]>
> ---
> drivers/soc/qcom/smem_state.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/qcom/smem_state.c b/drivers/soc/qcom/smem_state.c
> index e848cc9a3cf8..a7844841a727 100644
> --- a/drivers/soc/qcom/smem_state.c
> +++ b/drivers/soc/qcom/smem_state.c
> @@ -63,7 +63,7 @@ static struct qcom_smem_state *of_node_to_state(struct device_node *np)
> mutex_lock(&list_lock);
>
> list_for_each_entry(state, &smem_states, list) {
> - if (state->of_node == np) {
> + if (device_match_of_node(state, np)) {

I don't find this form easier to read, nor is state a struct device *...

Regards,
Bjorn

> kref_get(&state->refcount);
> goto unlock;
> }
> --
> 2.25.1