STRUCT COUNTER_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

okay bestie, welcome to struct counter_ops(9) from the Kernel API Manual β€” this page is literally <pink>struct counter_ops</pink> - <purple>Callbacks from driver</purple>. it's the callback lineup a driver hands over, iykyk πŸ’…βœ¨


✨ SYNOPSIS ✨

here's the struct, copied exactly, no editing bestie 🫢

       struct counter_ops {
           int (*signal_read)(struct counter_device *counter, struct
       counter_signal *signal, enum counter_signal_level *level);
           int (*count_read)(struct counter_device *counter, struct
       counter_count *count, u64 *value);
           int (*count_write)(struct counter_device *counter, struct
       counter_count *count, u64 value);
           int (*function_read)(struct counter_device *counter, struct
       counter_count *count, enum counter_function *function);
           int (*function_write)(struct counter_device *counter, struct
       counter_count *count, enum counter_function function);
           int (*action_read)(struct counter_device *counter, struct
       counter_count *count, struct counter_synapse *synapse, enum
       counter_synapse_action *action);
           int (*action_write)(struct counter_device *counter, struct
       counter_count *count, struct counter_synapse *synapse, enum
       counter_synapse_action action);
           int (*events_configure)(struct counter_device *counter);
           int (*watch_validate)(struct counter_device *counter, const struct
       counter_watch *watch);
        };

πŸ’… Members πŸ’…

okay so each member is a callback slot, and here's the tea β˜•βœ¨

  • signal_read β€” optional read callback for Signals. The read level of the respective Signal should be passed back via the level parameter. πŸ’–
  • count_read β€” read callback for Counts. The read value of the respective Count should be passed back via the value parameter.
  • count_write β€” optional write callback for Counts. The write value for the respective Count is passed in via the value parameter.
  • function_read β€” read callback for the Count function modes. The read function mode of the respective Count should be passed back via the function parameter.
  • function_write β€” optional write callback for Count function modes. The function mode to write for the respective Count is passed in via the function parameter.
  • action_read β€” optional read callback for the Synapse action modes. The read action mode of the respective Synapse should be passed back via the action parameter.
  • action_write β€” optional write callback for Synapse action modes. The action mode to write for the respective Synapse is passed in via the action parameter.
  • events_configure β€” optional write callback to configure events. The list of struct counter_event_node may be accessed via the events_list member of the counter parameter.
  • watch_validate β€” optional callback to validate a watch. The Counter component watch configuration is passed in via the watch parameter. A return value of 0 indicates a valid Counter component watch configuration. βœ…

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./include/linux/counter.h β€” plus struct counter_comp(9), struct counter_signal(9), struct counter_synapse(9), struct counter_count(9), struct counter_event_node(9), and struct counter_device(9). go binge those next, bestie πŸ“šπŸ’–


okay that's the whole page 🫢 source/version: ./include/linux, date: October 2026, manual: struct counter_ops(9) β€” mwah, go make those callbacks iconic πŸ’…βœ¨

πŸ“¦ where this page comes from