#define pr_fmt(fmt) …
#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gfp.h>
#include <linux/hwmon.h>
#include <linux/i2c.h>
#include <linux/idr.h>
#include <linux/kstrtox.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/property.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/thermal.h>
#define CREATE_TRACE_POINTS
#include <trace/events/hwmon.h>
#define HWMON_ID_PREFIX …
#define HWMON_ID_FORMAT …
struct hwmon_device { … };
#define to_hwmon_device(d) …
#define MAX_SYSFS_ATTR_NAME_LENGTH …
struct hwmon_device_attribute { … };
#define to_hwmon_attr(d) …
#define to_dev_attr(a) …
struct hwmon_thermal_data { … };
static ssize_t
name_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(name);
static ssize_t
label_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(label);
static struct attribute *hwmon_dev_attrs[] = …;
static umode_t hwmon_dev_attr_is_visible(struct kobject *kobj,
struct attribute *attr, int n)
{ … }
static const struct attribute_group hwmon_dev_attr_group = …;
static const struct attribute_group *hwmon_dev_attr_groups[] = …;
static void hwmon_free_attrs(struct attribute **attrs)
{ … }
static void hwmon_dev_release(struct device *dev)
{ … }
static const struct class hwmon_class = …;
static DEFINE_IDA(hwmon_ida);
#ifdef CONFIG_THERMAL_OF
static int hwmon_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{ … }
static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
{ … }
static const struct thermal_zone_device_ops hwmon_thermal_ops = …;
static void hwmon_thermal_remove_sensor(void *data)
{ … }
static int hwmon_thermal_add_sensor(struct device *dev, int index)
{ … }
static int hwmon_thermal_register_sensors(struct device *dev)
{ … }
static void hwmon_thermal_notify(struct device *dev, int index)
{ … }
#else
static int hwmon_thermal_register_sensors(struct device *dev)
{
return 0;
}
static void hwmon_thermal_notify(struct device *dev, int index) { }
#endif
static int hwmon_attr_base(enum hwmon_sensor_types type)
{ … }
#if IS_REACHABLE(CONFIG_I2C)
static DEFINE_MUTEX(hwmon_pec_mutex);
static int hwmon_match_device(struct device *dev, void *data)
{ … }
static ssize_t pec_show(struct device *dev, struct device_attribute *dummy,
char *buf)
{ … }
static ssize_t pec_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static DEVICE_ATTR_RW(pec);
static void hwmon_remove_pec(void *dev)
{ … }
static int hwmon_pec_register(struct device *hdev)
{ … }
#else
static int hwmon_pec_register(struct device *hdev)
{
return -EINVAL;
}
#endif
static ssize_t hwmon_attr_show(struct device *dev,
struct device_attribute *devattr, char *buf)
{ … }
static ssize_t hwmon_attr_show_string(struct device *dev,
struct device_attribute *devattr,
char *buf)
{ … }
static ssize_t hwmon_attr_store(struct device *dev,
struct device_attribute *devattr,
const char *buf, size_t count)
{ … }
static bool is_string_attr(enum hwmon_sensor_types type, u32 attr)
{ … }
static struct attribute *hwmon_genattr(const void *drvdata,
enum hwmon_sensor_types type,
u32 attr,
int index,
const char *template,
const struct hwmon_ops *ops)
{ … }
static const char * const hwmon_chip_attrs[] = …;
static const char * const hwmon_temp_attr_templates[] = …;
static const char * const hwmon_in_attr_templates[] = …;
static const char * const hwmon_curr_attr_templates[] = …;
static const char * const hwmon_power_attr_templates[] = …;
static const char * const hwmon_energy_attr_templates[] = …;
static const char * const hwmon_humidity_attr_templates[] = …;
static const char * const hwmon_fan_attr_templates[] = …;
static const char * const hwmon_pwm_attr_templates[] = …;
static const char * const hwmon_intrusion_attr_templates[] = …;
static const char * const *__templates[] = …;
static const int __templates_size[] = …;
int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel)
{ … }
EXPORT_SYMBOL_GPL(…);
static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
{ … }
static int hwmon_genattrs(const void *drvdata,
struct attribute **attrs,
const struct hwmon_ops *ops,
const struct hwmon_channel_info *info)
{ … }
static struct attribute **
__hwmon_create_attrs(const void *drvdata, const struct hwmon_chip_info *chip)
{ … }
static struct device *
__hwmon_device_register(struct device *dev, const char *name, void *drvdata,
const struct hwmon_chip_info *chip,
const struct attribute_group **groups)
{ … }
struct device *
hwmon_device_register_with_groups(struct device *dev, const char *name,
void *drvdata,
const struct attribute_group **groups)
{ … }
EXPORT_SYMBOL_GPL(…);
struct device *
hwmon_device_register_with_info(struct device *dev, const char *name,
void *drvdata,
const struct hwmon_chip_info *chip,
const struct attribute_group **extra_groups)
{ … }
EXPORT_SYMBOL_GPL(…);
struct device *
hwmon_device_register_for_thermal(struct device *dev, const char *name,
void *drvdata)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
struct device *hwmon_device_register(struct device *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
void hwmon_device_unregister(struct device *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
static void devm_hwmon_release(struct device *dev, void *res)
{ … }
struct device *
devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
void *drvdata,
const struct attribute_group **groups)
{ … }
EXPORT_SYMBOL_GPL(…);
struct device *
devm_hwmon_device_register_with_info(struct device *dev, const char *name,
void *drvdata,
const struct hwmon_chip_info *chip,
const struct attribute_group **extra_groups)
{ … }
EXPORT_SYMBOL_GPL(…);
static int devm_hwmon_match(struct device *dev, void *res, void *data)
{ … }
void devm_hwmon_device_unregister(struct device *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
static char *__hwmon_sanitize_name(struct device *dev, const char *old_name)
{ … }
char *hwmon_sanitize_name(const char *name)
{ … }
EXPORT_SYMBOL_GPL(…);
char *devm_hwmon_sanitize_name(struct device *dev, const char *name)
{ … }
EXPORT_SYMBOL_GPL(…);
static void __init hwmon_pci_quirks(void)
{ … }
static int __init hwmon_init(void)
{ … }
static void __exit hwmon_exit(void)
{ … }
subsys_initcall(hwmon_init);
module_exit(hwmon_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;