spi_nor_otp_lock_sr2(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… spi_nor_otp_lock_sr2(9) β€” like, the lock the OTP region era πŸŽ€

okay so bestie, we're in the Kernel API Manual today and the main character is spi_nor_otp_lock_sr2. yes it's a mouthful, yes it ate, let's get into it πŸ’–


✨ SYNOPSIS ✨

int spi_nor_otp_lock_sr2 (struct spi_nor *nor , unsigned int region );

like… that's the whole vibe. two args, one int coming back at you πŸ¦‹


🌸 ARGUMENTS 🌸

  • nor β€” pointer to struct spi_nor. your flash friend, the whole reason we're here 🫢
  • region β€” the OTP region. the specific little zone we're about to lock up πŸ”’

πŸ’« DESCRIPTION πŸ’«

So what does it do? It locks the OTP region by writing the status register-2. that's it, that's the assignment, and it slays πŸ’…

It's the method used on GigaDevice and Winbond flashes β€” so if you're on one of those, this is literally your girl ✨


πŸ”₯ RETURN πŸ”₯

  • 0 on success β€” we love a win πŸ’–
  • -errno otherwise β€” tragic, but at least it tells you why 😭

🧚 SEE ALSO 🧚

Sibling functions, all iconic, all in the kernel file ./drivers/mtd/spi-nor/otp.c:

go read those too, iykyk πŸ‘‘


ngl bestie, this one's short and sweet β€” but it's doing exactly what it says on the tin, no cap πŸ“

and that's the tea β˜• β€” brought to you by the fine folks over at ./drivers/mtd/spi-nor, October 2026, mwah πŸ’‹πŸŒˆ

πŸ“¦ where this page comes from