STRUCT HWMON_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so bestie, welcome to struct hwmon_ops(9) β€” straight out of the Kernel API Manual β€” and it's literally the hwmon device operations struct, the whole vibe checklist for how your hardware-monitoring device behaves. periodt. 🌑️✨


✨ SYNOPSIS ✨

here's the exact shape of it, no cap, copy it character for character:

struct hwmon_ops {
    umode_t visible;
    umode_t (*is_visible)(const void *drvdata, enum hwmon_sensor_types
type, u32 attr, int channel);
    int (*read)(struct device *dev, enum hwmon_sensor_types type, u32
attr, int channel, long *val);
    int (*read_string)(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, const char **str);
    int (*write)(struct device *dev, enum hwmon_sensor_types type, u32
attr, int channel, long val);
 };

like, that's the whole struct. slay. πŸ’…


πŸŽ€ MEMBERS πŸŽ€

  • visible β€” the static visibility field, iykyk. if it's non-zero, then is_visible gets ignored. that's it, that's the rule. πŸ‘‘
  • is_visible β€” the callback that returns attribute visibility. it's mandatory unless... yeah. the parameters are: const void *drvdata: a pointer to the driver-private data structure that gets passed as an argument to hwmon_device_register_with_info. 🫢
  • read β€” the read callback for data attributes. mandatory if readable data attributes are present. the parameters are: πŸ‘€
  • read_string β€” the read callback for string attributes. mandatory if string attributes are present. the parameters are: πŸ“
  • write β€” the write callback for data attributes. mandatory if writeable data attributes are present. the parameters are: ✍️
ngl bestie, those last three all say "Parameters are:" and then the manpage just... moves on. so we're matching energy and not inventing anything extra. no cap, no made-up deets. πŸ™ˆ

πŸ’… SEE ALSO πŸ’…

  • the kernel file ./include/linux/hwmon.h
  • struct hwmon_channel_info(9)
  • struct hwmon_chip_info(9)
  • hwmon_is_bad_char(9)

go read those next, bestie, they're iconic. 🌈


and that's the whole page, fr fr β€” brought to you by the source at ./include/linux, dated October 2026, with the title struct hwmon_ops(9) up top where it belongs. mwah. πŸ’‹πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from