m24lr_write(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ m24lr_write β€” the kernel API manual, bestie edition ✨

okay so this page is m24lr_write(9) from the Kernel API Manual β€” yes the section 9 one, kernel-internals girlies rise 🫢 β€” and it's literally all about pushing a buffer into an M24LR device while being polite about page alignment. let's get into it πŸ’…


🌸 NAME 🌸

m24lr_write β€” writes a buffer to the M24LR device, and it handles the page alignment stuff for you so you don't have to 😌


✨ SYNOPSIS ✨

ssize_t m24lr_write (struct m24lr *m24lr , const u8 *buf , size_t size ,
unsigned int offset , bool is_eeprom );

like, five args, one function, zero drama. well. mostly zero πŸ’€


πŸŽ€ ARGUMENTS πŸŽ€

  • m24lr β€” pointer to the driver context. it's the vibe, it's the main character, it's the thing that knows where everything lives πŸ‘‘
  • buf β€” the data buffer you're writing. the actual content, the payload, the ~material~ πŸ¦‹
  • size β€” how many bytes you want written. count 'em, bestie πŸ”’
  • offset β€” the target register address inside the device. where in the device we're dropping this ✨
  • is_eeprom β€” true if this write should target the EEPROM, false if it should target the system parameters sector. pick a lane, pick it correctly πŸ™ˆ

πŸ’– DESCRIPTION πŸ’–

so the function writes data to the M24LR device using regmap, and here's the iconic part: it splits the write into chunks that are no larger than page_size so it respects the device-specific write limitations (things like page size, or I2C hold-time concerns β€” real ones 😭). not me breaking a big write into cute lil bite-size pieces so the hardware doesn't get overwhelmed, we love a considerate queen.

and each one of those chunks is aligned to the page boundary defined by page_size. alignment slay. periodt πŸ’…


πŸ”₯ RETURN πŸ”₯

  • on success: the total number of bytes written βœ…
  • on failure: a negative error code if any write fails πŸ’€ like, any single one. no partial-credit energy here.

🧚 SEE ALSO 🧚

go read them, iykyk πŸ“šβœ¨


and that's the whole page, bestie πŸ“ this icon lives in ./drivers/nvmem, and the manual's dated October 2026 β€” so jot that down in your notes app and go write some aligned chunks πŸ’œπŸ¦‹πŸŒˆ

πŸ“¦ where this page comes from