Re: [PATCH v3 7/7] iio: pressure: bmp280: Add nvmem operations for BMP580

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

 



On Sun, Jan 29, 2023 at 02:33:09AM +0100, Angel Iglesias wrote:
> The pressure sensor BMP580 contains a non-volatile memory that stores
> trimming and configuration params. That memory provides an programmable
> user range of three 2-byte words.

...

> +#define NVM_READ	false
> +#define NVM_WRITE	true

How is it helpful and why it's not namespaced properly (can collide with
NVM framework)?

...

> +	/* Wait until NVM is ready again */
> +	do {
> +		ret = regmap_read(data->regmap, BMP580_REG_STATUS, &reg);
> +		if (ret) {
> +			dev_err(data->dev, "failed to check nvm status\n");
> +			reg &= ~BMP580_STATUS_NVM_RDY_MASK;
> +		}
> +	} while (time_before(jiffies, deadline) && !(reg & BMP580_STATUS_NVM_RDY_MASK));

regmap_read_poll_timeout()?

> +	if (!(reg & BMP580_STATUS_NVM_RDY_MASK)) {

	if (ret) {
		...
		return ret;
	}

> +		dev_err(data->dev,
> +			"reached timeout waiting for nvm operation completion\n");
> +		return -ETIMEDOUT;
> +	}

...

> +	while (bytes >= sizeof(u16)) {

sizeof(*dst) ?

Or sizeof(data->le16)?

> +		addr = bmp580_nvmem_addrs[offset / sizeof(u16)];

Ditto.

...

> +		bytes -= sizeof(u16);
> +		offset += sizeof(u16);

Ditto.

> +	}

...

> +static int bmp580_nvmem_write(void *priv, unsigned int offset, void *val,
> +			      size_t bytes)
> +{

Same comments as per above function.

>  }


-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux