Re: [PATCH v8 1/2] thermal: loongson-2: add thermal management support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/10/2022 02:57, Yinbo Zhu wrote:
> 
> 
> 在 2022/10/28 下午1:55, kernel test robot 写道:
>> Hi Yinbo,
>>
>> I love your patch! Perhaps something to improve:
>>
>> [auto build test WARNING on rafael-pm/thermal]
>> [also build test WARNING on linus/master v6.1-rc2 next-20221027]
>> [If your patch is applied to the wrong git tree, kindly drop us a note.
>> And when submitting patch, we suggest to use '--base' as documented in
>> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>>
>> url:    https://github.com/intel-lab-lkp/linux/commits/Yinbo-Zhu/thermal-loongson-2-add-thermal-management-support/20221028-093603
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git thermal
>> patch link:    https://lore.kernel.org/r/20221028013532.10361-1-zhuyinbo%40loongson.cn
>> patch subject: [PATCH v8 1/2] thermal: loongson-2: add thermal management support
>> config: sparc-allyesconfig
>> compiler: sparc64-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/d94e01f4aefe4c0ab05babe101f0a0ce53165456
>>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>>          git fetch --no-tags linux-review Yinbo-Zhu/thermal-loongson-2-add-thermal-management-support/20221028-093603
>>          git checkout d94e01f4aefe4c0ab05babe101f0a0ce53165456
>>          # 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=sparc SHELL=/bin/bash drivers/thermal/
>>
>> If you fix the issue, kindly add following tag where applicable
>> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
>>
>> All warnings (new ones prefixed by >>):
>>
>>     drivers/thermal/loongson2_thermal.c:136:21: error: variable 'loongson2_of_thermal_ops' has initializer but incomplete type
>>       136 | static const struct thermal_zone_of_device_ops loongson2_of_thermal_ops = {
>>           |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
>>     drivers/thermal/loongson2_thermal.c:137:10: error: 'const struct thermal_zone_of_device_ops' has no member named 'get_temp'
>>       137 |         .get_temp = loongson2_thermal_get_temp,
>>           |          ^~~~~~~~
>>>> drivers/thermal/loongson2_thermal.c:137:21: warning: excess elements in struct initializer
>>       137 |         .get_temp = loongson2_thermal_get_temp,
>>           |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
>>     drivers/thermal/loongson2_thermal.c:137:21: note: (near initialization for 'loongson2_of_thermal_ops')
>>     drivers/thermal/loongson2_thermal.c:138:10: error: 'const struct thermal_zone_of_device_ops' has no member named 'set_trips'
>>       138 |         .set_trips = loongson2_thermal_set_trips,
>>           |          ^~~~~~~~~
>>     drivers/thermal/loongson2_thermal.c:138:22: warning: excess elements in struct initializer
>>       138 |         .set_trips = loongson2_thermal_set_trips,
>>           |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>     drivers/thermal/loongson2_thermal.c:138:22: note: (near initialization for 'loongson2_of_thermal_ops')
>>     drivers/thermal/loongson2_thermal.c: In function 'loongson2_thermal_probe':
>>     drivers/thermal/loongson2_thermal.c:177:21: error: implicit declaration of function 'devm_thermal_zone_of_sensor_register'; did you mean 'devm_thermal_of_zone_register'? [-Werror=implicit-function-declaration]
>>       177 |         data->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev,
>>           |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>           |                     devm_thermal_of_zone_register
>>>> drivers/thermal/loongson2_thermal.c:177:19: warning: assignment to 'struct thermal_zone_device *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
>>       177 |         data->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev,
>>           |                   ^
>>     drivers/thermal/loongson2_thermal.c: At top level:
>>     drivers/thermal/loongson2_thermal.c:136:48: error: storage size of 'loongson2_of_thermal_ops' isn't known
>>       136 | static const struct thermal_zone_of_device_ops loongson2_of_thermal_ops = {
>>           |                                                ^~~~~~~~~~~~~~~~~~~~~~~~
>>     cc1: some warnings being treated as errors
>>
>>
>> vim +137 drivers/thermal/loongson2_thermal.c
>>
>>     135	
>>     136	static const struct thermal_zone_of_device_ops loongson2_of_thermal_ops = {
>>   > 137		.get_temp = loongson2_thermal_get_temp,
>>     138		.set_trips = loongson2_thermal_set_trips,
>>     139	};
>>     140	
>>     141	static int loongson2_thermal_probe(struct platform_device *pdev)
>>     142	{
>>     143		struct device *dev = &pdev->dev;
>>     144		struct resource *res;
>>     145		struct loongson2_thermal_data *data;
>>     146		int ret;
>>     147	
>>     148		data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
>>     149		if (!data)
>>     150			return -ENOMEM;
>>     151	
>>     152		data->pdev = pdev;
>>     153		platform_set_drvdata(pdev, data);
>>     154	
>>     155		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>     156		data->regs = devm_ioremap(dev, res->start, resource_size(res));
>>     157		if (IS_ERR(data->regs))
>>     158			return PTR_ERR(data->regs);
>>     159	
>>     160		/* get irq */
>>     161		data->irq = platform_get_irq(pdev, 0);
>>     162		if (data->irq < 0)
>>     163			return data->irq;
>>     164	
>>     165		/* get id */
>>     166		data->id = loongson2_thermal_get_sensor_id();
>>     167		if (data->id > LOONGSON2_SOC_MAX_SENSOR_NUM - 1 || data->id < 0) {
>>     168			dev_err(dev, "sensor id error,must be in <0 ~ %d>\n",
>>     169					LOONGSON2_SOC_MAX_SENSOR_NUM - 1);
>>     170			return -EINVAL;
>>     171		}
>>     172	
>>     173		writeb(0xff, data->regs + LOONGSON2_TSENSOR_STATUS);
>>     174	
>>     175		loongson2_thermal_set(data, 0, 0, false);
>>     176	
>>   > 177		data->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev,
>>     178								   data->id, data,
>>     179								   &loongson2_of_thermal_ops);
>>     180		if (IS_ERR(data->tzd)) {
>>     181			ret = PTR_ERR(data->tzd);
>>     182			data->tzd = NULL;
>>     183			dev_err(&pdev->dev, "failed to register %d\n", ret);
>>     184			return ret;
>>     185		}
>>     186	
>>     187		ret = devm_request_threaded_irq(dev, data->irq,
>>     188				loongson2_thermal_alarm_irq, loongson2_thermal_irq_thread,
>>     189				IRQF_ONESHOT, "loongson2_thermal", data);
>>     190		if (ret < 0) {
>>     191			dev_err(dev, "failed to request alarm irq: %d\n", ret);
>>     192			return ret;
>>     193		}
>>     194	
>>     195		/*
>>     196		 * Thermal_zone doesn't enable hwmon as default,
>>     197		 * enable it here
>>     198		 */
>>     199		data->tzd->tzp->no_hwmon = false;
>>     200		ret = thermal_add_hwmon_sysfs(data->tzd);
>>     201		if (ret) {
>>     202			dev_err(dev, "failed to add hwmon sysfs interface %d\n", ret);
>>     203			return ret;
>>     204		}
>>     205	
>>     206		return 0;
>>     207	}Hi
> 
> I use W=1 to compile it and doesn't reproduce that warning, and I added
> the change that don't touch .c code. I think it shoud be error report.

More likely is your code is not correct.

Best regards,
Krzysztof




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux