Re: [PATCH] Module argument to control whether intel-spi-pci attempts to turn the SPI flash chip writeable

Arnd Bergmann
2020-07-30T14:09:29Z

On Thu, Jul 30, 2020 at 2:21 PM Daniel Gutson <daniel@eclypsium.com> wrote:
> El jue., 30 jul. 2020 2:31 a. m., Greg Kroah-Hartman <gregkh@linuxfoundation.org> escribió:
>>
>> Again, module parameters are working on a per-chunk-of-code basis, while
>> you want to work on a per-device basis,
>
>
> I think there is a misunderstanding. What I want is to control (turn on or off) is a very specific code snippet that provides the "functionality" of trying to turn the chip writable. The rest of the device driver is fine.
> I assume that the one that doesn't understand is me.
>

I looked at the source code again and found that the existing module
parameter applies to both the platform and pci device front-ends, both
of which go through

/* Prevent writes if not explicitly enabled */
if (!ispi->writeable || !writeable)
ispi->nor.mtd.flags &= ~MTD_WRITEABLE;

Setting the PCI device writable in hardware makes it possible to
actually write to it *only* if the module parameter is also set to '1'.
One might disagree with that design, but I don't think your patch
would make it any better, it just means one would have to set
two module parameters instead of one.

Arnd