Re: [PATCH v6 5/6] platform/x86: Add Lenovo WMI Gamezone Driver

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

 



On Tue, 29 Apr 2025, Derek J. Clark wrote:

> 
> 
> On April 28, 2025 9:39:55 PM PDT, ALOK TIWARI <alok.a.tiwari@xxxxxxxxxx> wrote:
> >
> >
> >On 28-04-2025 06:48, Derek J. Clark wrote:
> >> + * Determine if the extreme thermal mode is supported by the hardware.
> >> + * Anything version 5 or lower does not. For devices wuth a version 6 or
> >
> >typo wuth
> >
> >> + * greater do a DMI check, as some devices report a version that supports
> >> + * extreme mode but have an incomplete entry in the BIOS. To ensure this
> >> + * cannot be set, quirk them to prevent assignment.
> >> + *
> >> + * Return: int.
> >
> >The function returns int.
> >But logically it's returning boolean false, true
> 
> I may have overdone it by removing all bools after the v5 review as I 
> interpreted Ilpo's comment to mean I shouldn't return any bool c types. 
> I'll wait for them to weigh in before changing this back.

Hi Derek,

That is certainly a misinterpretation.

It's perfectly fine to return bool from a function. If there's no good 
reason e.g. because of some API that requires int return, booleans should 
be returned as bool.

I was trying to say your kerneldoc said "Return: bool" for a function that 
returns int. Both "bool" and "int" are C types so there was a contradition 
in that, which is what I tried to point out. Please write "boolean" if you 
refer to a boolean which is not "bool" typed (but consider what was said 
above and if the type too can be changed to bool in that case).

-- 
 i.

> >> + */
> >> +static int lwmi_gz_extreme_supported(int profile_support_ver)
> >> +{
> >> +	const struct dmi_system_id *dmi_id;
> >> +	struct quirk_entry *quirks;
> >> +
> >> +	if (profile_support_ver < 6)
> >> +		return false;
> >> +
> >> +	dmi_id = dmi_first_match(fwbug_list);
> >> +	if (!dmi_id)
> >> +		return true;
> >> +
> >> +	quirks = dmi_id->driver_data;
> >> +	return quirks->extreme_supported;
> >> +}
> >
> >Thank,
> >Alok
> 
> Thanks,
> - Derek
> 




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux