lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 27 Oct 2020 09:19:37 +0800 (GMT+08:00)
From:   Bernard <bernard@...o.com>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:     Zhang Rui <rui.zhang@...el.com>, Amit Kucheria <amitk@...nel.org>,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        opensource.kernel@...o.com
Subject: Re:Re: [Resend][PATCH] drivers/thermal: optimize the for circle to run a bit fast


From: Daniel Lezcano <daniel.lezcano@...aro.org>
Date: 2020-10-27 02:35:18
To:  Bernard <bernard@...o.com>,Zhang Rui <rui.zhang@...el.com>,Amit Kucheria <amitk@...nel.org>,linux-pm@...r.kernel.org,linux-kernel@...r.kernel.org
Cc:  opensource.kernel@...o.com
Subject: Re: [Resend][PATCH] drivers/thermal: optimize the for circle to run a bit fast>On 26/10/2020 02:49, Bernard wrote:
>> Function thermal_zone_device_register, in the for circle, if the
>> first if branch set the count bit in tz->trips_disabled, there is
>> no need to set in the other if branch again.
>> This change is to make the code run a bit fast and readable.
>> 
>> Signed-off-by: Bernard Zhao <bernard@...o.com>
>> ---
>>  drivers/thermal/thermal_core.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
>> index c6d74bc1c90b..03577794eea3 100644
>> --- a/drivers/thermal/thermal_core.c
>> +++ b/drivers/thermal/thermal_core.c
>> @@ -1446,10 +1446,14 @@ thermal_zone_device_register(const char *type, int trips, int mask,
>>  		goto release_device;
>>  
>>  	for (count = 0; count < trips; count++) {
>> -		if (tz->ops->get_trip_type(tz, count, &trip_type))
>> +		if (tz->ops->get_trip_type(tz, count, &trip_type)) {
>>  			set_bit(count, &tz->trips_disabled);
>> -		if (tz->ops->get_trip_temp(tz, count, &trip_temp))
>> +			continue;
>> +		}
>> +		if (tz->ops->get_trip_temp(tz, count, &trip_temp)) {
>>  			set_bit(count, &tz->trips_disabled);
>> +			continue;
>> +		}
>>  		/* Check for bogus trip points */
>>  		if (trip_temp == 0)
>>  			set_bit(count, &tz->trips_disabled);
>
>
>What about ?
>	if (tz->ops->get_trip_type(tz, count, &trip_type) ||
>		tz->ops->get_trip_temp(tz, count, &trip_temp) ||
>		!trip_temp)
>		set_bit(count, &tz->trips_disabled);
>

Hi

  Sure, I will resubmit this patch, thanks!

BR//Bernard

>
>
>-- 
><http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
>
>Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
><http://twitter.com/#!/linaroorg> Twitter |
><http://www.linaro.org/linaro-blog/> Blog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ