drivers/hwmon/peci/common.h

Source file repositories/reference/linux-study-clean/drivers/hwmon/peci/common.h

File Facts

System
Linux kernel
Corpus path
drivers/hwmon/peci/common.h
Extension
.h
Size
1308 bytes
Lines
56
Domain
Driver Families
Bucket
drivers/hwmon
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct peci_sensor_state {
	bool valid;
	unsigned long last_updated;
};

/**
 * struct peci_sensor_data - PECI sensor information
 * @value: sensor value in milli units
 * @state: sensor update state
 */

struct peci_sensor_data {
	s32 value;
	struct peci_sensor_state state;
};

/**
 * peci_sensor_need_update() - check whether sensor update is needed or not
 * @sensor: pointer to sensor data struct
 *
 * Return: true if update is needed, false if not.
 */

static inline bool peci_sensor_need_update(struct peci_sensor_state *state)
{
	return !state->valid ||
	       time_after(jiffies, state->last_updated + PECI_HWMON_UPDATE_INTERVAL);
}

/**
 * peci_sensor_mark_updated() - mark the sensor is updated
 * @sensor: pointer to sensor data struct
 */
static inline void peci_sensor_mark_updated(struct peci_sensor_state *state)
{
	state->valid = true;
	state->last_updated = jiffies;
}

#endif /* __PECI_HWMON_COMMON_H */

Annotation

Implementation Notes