Re: [PATCH 1/6] i2c: designware: Uniform initialization flow for polling mode

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

 



On Wed, Jan 31, 2024 at 04:16:47PM +0200, Jarkko Nikula wrote:
> Currently initialization flow in i2c_dw_probe_master() skips a few steps
> and has code duplication for polling mode implementation.
> 
> Simplify this by adding a new ACCESS_POLLING flag that is set for those
> two platforms that currently use polling mode and use it to skip
> interrupt handler setup.

...

>  #define ACCESS_INTR_MASK			BIT(0)
>  #define ACCESS_NO_IRQ_SUSPEND			BIT(1)
>  #define ARBITRATION_SEMAPHORE			BIT(2)
> +#define ACCESS_POLLING				BIT(3)

For the sake of consistency, you may incorporate internal patch from somebody
else to move to the same prefix  (namespace) for ARBITRATION_SEMAPHORE.

...

> +	if (!(dev->flags & ACCESS_POLLING)) {

Actually seems to me that is better to have in a separate helper and you
then can do here something like

	ret = i2c_dw_request_irq(...);
	if (ret)
		return ret;

> +		ret = devm_request_irq(dev->dev, dev->irq, i2c_dw_isr,
> +				       irq_flags, dev_name(dev->dev), dev);
> +		if (ret) {
> +			dev_err(dev->dev, "failure requesting irq %i: %d\n",
> +				dev->irq, ret);
> +			return ret;
> +		}

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux