Re: [PATCH] mtd: intel-spi: add is_protected and is_bios_locked knobs
From: Joe Perches
Date: Tue Mar 30 2021 - 14:13:45 EST
On Tue, 2021-03-30 at 18:54 +0300, Tomas Winkler wrote:
> From: Tamar Mashiah <tamar.mashiah@xxxxxxxxx>
[]
> the region protection status is exposed via sysfs file
> as the manufacturing will need the both files in order to validate
> that the device is properly sealed.
[]
> diff --git a/drivers/mtd/spi-nor/controllers/intel-spi.c b/drivers/mtd/spi-nor/controllers/intel-spi.c
[]
> +static ssize_t intel_spi_is_protected_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct intel_spi *ispi = dev_get_drvdata(dev);
> +
> + return sysfs_emit(buf, "%d", ispi->is_protected);
These should also include a newline in the format. i.e.:
return sysfs_emit(buf, "%d\n", ispi->is_protected);
> +static ssize_t intel_spi_bios_lock_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct intel_spi *ispi = dev_get_drvdata(dev);
> +
> + return sysfs_emit(buf, "%d", ispi->is_bios_locked);
etc...