On Tue, 2023-04-25 at 09:33 +0200, Michael Walle wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you > know the content is safe > > Hi, > > > +static int pci1xxxx_otp_read(void *priv_t, unsigned int off, > > + void *buf_t, size_t count) > > +{ > > + struct pci1xxxx_otp_eeprom_device *priv = priv_t; > > + void __iomem *rb = priv->reg_base; > > + char *buf = buf_t; > > + u32 regval; > > + u32 byte; > > + int ret; > > + u8 data; > > + > > + if (off >= priv->nvmem_config_otp.size) > > + return -EFAULT; > > + > > + if ((off + count) > priv->nvmem_config_otp.size) > > + count = priv->nvmem_config_otp.size - off; > > + > > + ret = set_sys_lock(priv); > > + if (ret) > > + return ret; > > + > > + for (byte = 0; byte < count; byte++) { > > + otp_device_set_address(priv, (u16)(off + byte)); > > + data = readl(rb + > > MMAP_OTP_OFFSET(OTP_FUNC_CMD_OFFSET)); > > + writel(data | OTP_FUNC_RD_BIT, > > + rb + MMAP_OTP_OFFSET(OTP_FUNC_CMD_OFFSET)); > > + data = readl(rb + > > MMAP_OTP_OFFSET(OTP_CMD_GO_OFFSET)); > > + writel(data | OTP_CMD_GO_BIT, > > + rb + MMAP_OTP_OFFSET(OTP_CMD_GO_OFFSET)); > > + > > + ret = read_poll_timeout(readl, regval, > > + !(regval & > > OTP_STATUS_BUSY_BIT), > > + STATUS_READ_DELAY_US, > > + STATUS_READ_TIMEOUT_US, true, > > + rb + > > MMAP_OTP_OFFSET(OTP_STATUS_OFFSET)); > > + > > + data = readl(rb + > > MMAP_OTP_OFFSET(OTP_PASS_FAIL_OFFSET)); > > + if (ret < 0 || data & OTP_FAIL_BIT) > > + return -EIO; > > Don't you need to release the lock? Yes, release_sys_lock should be done. Will fix in next version of patch > > > + > > + buf[byte] = readl(rb + > > MMAP_OTP_OFFSET(OTP_RD_DATA_OFFSET)); > > + } > > + release_sys_lock(priv); > > + > > + return byte; > > +} >