m24lr_write(9)
π 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βtrueif this write should target the EEPROM,falseif 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 π§
- Kernel file
./drivers/nvmem/m24lr.c struct m24lr_chip(9)struct m24lr(9)m24lr_regmap_read(9)m24lr_regmap_write(9)m24lr_write_pass(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms