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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a480b846-bd5c-4a98-a1ee-9eacb53816b7@amd.com>
Date:   Thu, 10 Aug 2023 10:54:08 -0500
From:   "Limonciello, Mario" <mario.limonciello@....com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     "Rafael J . Wysocki" <rafael@...nel.org>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Bjorn Helgaas <helgaas@...nel.org>, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
        Kuppuswamy Sathyanarayanan 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>,
        Iain Lane <iain@...ngesquash.org.uk>,
        Shyam-sundar S-k <Shyam-sundar.S-k@....com>
Subject: Re: [PATCH v11 6/9] ACPI: x86: s2idle: Add a function to get
 constraints for a device



On 8/10/2023 10:47 AM, Andy Shevchenko wrote:
> On Wed, Aug 09, 2023 at 01:54:50PM -0500, Mario Limonciello wrote:
>> Other parts of the kernel may use constraints information to make
>> decisions on what power state to put a device into.
> 
> ...
> 
>> +int acpi_get_lps0_constraint(struct device *dev)
>> +{
> 
>> +	int i;
>> +
>> +	for (i = 0; i < lpi_constraints_table_size; ++i) {
>> +		static struct lpi_constraints *entry;
> 
> static?!

Whoops!  Good catch!

> 
> Seems to me with the code in lpi_check_constraints() this actually can be first
> (separate patch maybe with conversion of the mentioned user) transformed to
> 
> #define for_each_lpi_constraint(entry)
> 	for (int i = 0;
> 	     entry = &lpi_constraints_table[i], i < lpi_constraints_table_size;
> 	     i++)
> 
>> +		int val;
>> +
>> +		entry = &lpi_constraints_table[i];
>> +		if (!device_match_acpi_handle(dev, entry->handle))
>> +			continue;
>> +		val = entry->enabled ? entry->min_dstate : 0;
>> +		acpi_handle_debug(entry->handle,
>> +				  "ACPI device constraint: %d\n", val);
>> +		return val;
>> +	}
> 
> So will become
> 
> 	struct lpi_constraints *entry;
> 	int val;
> 
> 	for_each_lpi_constraint(entry) {
> 		if (!device_match_acpi_handle(dev, entry->handle))
> 			continue;
> 		val = entry->enabled ? entry->min_dstate : 0;
> 		acpi_handle_debug(entry->handle,
> 				  "ACPI device constraint: %d\n", val);
> 		return val;
> 	}
> 
>> +	return -ENODEV;
>> +}
> 

Much appreciated suggestion.  I'll incorporate this in the next version.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ