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: <ZYxcEGz4yCJj0O5H@smile.fi.intel.com>
Date: Wed, 27 Dec 2023 19:17:04 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Mark Hasemeyer <markhas@...omium.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
	Rob Herring <robh@...nel.org>,
	Konrad Dybcio <konrad.dybcio@...aro.org>,
	Sudeep Holla <sudeep.holla@....com>,
	Raul Rangel <rrangel@...omium.org>,
	Tzung-Bi Shih <tzungbi@...nel.org>,
	Mika Westerberg <mika.westerberg@...ux.intel.com>,
	Wolfram Sang <wsa@...nel.org>, linux-acpi@...r.kernel.org,
	linux-i2c@...r.kernel.org
Subject: Re: [PATCH v3 03/24] i2c: acpi: Modify i2c_acpi_get_irq() to use
 resource

On Tue, Dec 26, 2023 at 12:21:07PM -0700, Mark Hasemeyer wrote:
> The i2c_acpi_irq_context structure provides redundant information that
> can be provided with struct resource.
> 
> Refactor i2c_acpi_get_irq() to use struct resource instead of struct
> i2c_acpi_irq_context.

...

> Suggested-by: Andy Shevchenko <andriy.shevchenko@...el.com>
> 
> Signed-off-by: Mark Hasemeyer <markhas@...omium.org>

No blank line.

...

>  	ret = acpi_dev_get_resources(adev, &resource_list,
> -				     i2c_acpi_add_irq_resource, &irq_ctx);
> +				     i2c_acpi_add_irq_resource, r);
>  	if (ret < 0)
>  		return ret;
>  
>  	acpi_dev_free_resource_list(&resource_list);
>  
> -	if (irq_ctx.irq == -ENOENT) {
> -		ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, &irqres);
> -		if (ret)
> -			return ret;
> -		irq_ctx.irq = irqres.start;
> -		irq_ctx.wake_capable = irqres.flags & IORESOURCE_IRQ_WAKECAPABLE;
> -	}
> -
> -	if (irq_ctx.irq < 0)
> -		return irq_ctx.irq;
> +	if (!r->flags)
> +		ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, r);
>  
> -	if (wake_capable)
> -		*wake_capable = irq_ctx.wake_capable;
> +	if (!r->flags)
> +		return ret;
>  
> -	return irq_ctx.irq;
> +	return r->start;

Wondering if we can refactor above as

	if (r->flags)
		return r->start;

	ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, r);
	if (ret)
		return ret;

	return r->start;

Note also the 'if (ret)' check, the check for flags to return ret seems
counter intuitive and possible prone to errors in the future.

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ