Re: [PATCH] nvmem: ensure sysfs writes handle write-protect pin

From: Srinivas Kandagatla
Date: Tue Apr 28 2020 - 07:55:11 EST




On 27/04/2020 19:39, Michael Auchter wrote:
Commit 2a127da461a9d8d97782d6e82b227041393eb4d2 added support for
handling write-protect pins to the nvmem core, and commit
1c89074bf85068d1b86f2e0f0c2110fdd9b83c9f retrofitted the at24 driver to
use this support.

These changes broke write() on the nvmem sysfs attribute for eeproms
which utilize a write-protect pin, as the write callback invokes the
nvmem device's reg_write callback directly which no longer handles
changing the state of the write-protect pin.

Change the read and write callbacks for the sysfs attribute to invoke
nvmme_reg_read/nvmem_reg_write helpers which handle this, rather than
calling reg_read/reg_write directly.

Signed-off-by: Michael Auchter <michael.auchter@xxxxxx>
---
drivers/nvmem/core.c | 52 ++++++++++++++++++++++----------------------
1 file changed, 26 insertions(+), 26 deletions(-)


Applied fixes tag:
Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")


--srini