/* igb_add_hwmon_attr - Create hwmon attr table for a hwmon sysfs file. * @ adapter: pointer to the adapter structure * @ offset: offset in the eeprom sensor data table * @ type: type of sensor data to display * * For each file we want in hwmon's sysfs interface we need a device_attribute * This is included in our hwmon_attr struct that contains the references to * the data structures we need to get the data to display.
*/ staticint igb_add_hwmon_attr(struct igb_adapter *adapter, unsignedint offset, int type)
{ int rc; unsignedint n_attr; struct hwmon_attr *igb_attr;
/* These always the same regardless of type */
igb_attr->sensor =
&adapter->hw.mac.thermal_sensor_data.sensor[offset];
igb_attr->hw = &adapter->hw;
igb_attr->dev_attr.store = NULL;
igb_attr->dev_attr.attr.mode = 0444;
igb_attr->dev_attr.attr.name = igb_attr->name;
sysfs_attr_init(&igb_attr->dev_attr.attr);
/* Only create hwmon sysfs entries for sensors that have * meaningful data.
*/ if (adapter->hw.mac.thermal_sensor_data.sensor[i].location == 0) continue;
/* Bail if any hwmon attr struct fails to initialize */
rc = igb_add_hwmon_attr(adapter, i, IGB_HWMON_TYPE_CAUTION); if (rc) gotoexit;
rc = igb_add_hwmon_attr(adapter, i, IGB_HWMON_TYPE_LOC); if (rc) gotoexit;
rc = igb_add_hwmon_attr(adapter, i, IGB_HWMON_TYPE_TEMP); if (rc) gotoexit;
rc = igb_add_hwmon_attr(adapter, i, IGB_HWMON_TYPE_MAX); if (rc) gotoexit;
}
/* init i2c_client */
client = i2c_new_client_device(&adapter->i2c_adap, &i350_sensor_info); if (IS_ERR(client)) {
dev_info(&adapter->pdev->dev, "Failed to create new i2c device.\n");
rc = PTR_ERR(client); gotoexit;
}
adapter->i2c_client = client;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.