mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-14 21:01:29 +00:00
mei: export fw status registers through sysfs
The interface is for applications that monitor the fw health. We use device_create_with_groups interface to register attribute with the mei class device Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
edca5ea3ff
commit
55c4e6405d
@ -631,6 +631,44 @@ out:
|
|||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fw_status_show - mei device attribute show method
|
||||||
|
*
|
||||||
|
* @device: device pointer
|
||||||
|
* @attr: attribute pointer
|
||||||
|
* @buf: char out buffer
|
||||||
|
*
|
||||||
|
* Return: number of the bytes printed into buf or error
|
||||||
|
*/
|
||||||
|
static ssize_t fw_status_show(struct device *device,
|
||||||
|
struct device_attribute *attr, char *buf)
|
||||||
|
{
|
||||||
|
struct mei_device *dev = dev_get_drvdata(device);
|
||||||
|
struct mei_fw_status fw_status;
|
||||||
|
int err, i;
|
||||||
|
ssize_t cnt = 0;
|
||||||
|
|
||||||
|
mutex_lock(&dev->device_lock);
|
||||||
|
err = mei_fw_status(dev, &fw_status);
|
||||||
|
mutex_unlock(&dev->device_lock);
|
||||||
|
if (err) {
|
||||||
|
dev_err(device, "read fw_status error = %d\n", err);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < fw_status.count; i++)
|
||||||
|
cnt += scnprintf(buf + cnt, PAGE_SIZE - cnt, "%08X\n",
|
||||||
|
fw_status.status[i]);
|
||||||
|
return cnt;
|
||||||
|
}
|
||||||
|
static DEVICE_ATTR_RO(fw_status);
|
||||||
|
|
||||||
|
static struct attribute *mei_attrs[] = {
|
||||||
|
&dev_attr_fw_status.attr,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
ATTRIBUTE_GROUPS(mei);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* file operations structure will be used for mei char device.
|
* file operations structure will be used for mei char device.
|
||||||
*/
|
*/
|
||||||
@ -710,8 +748,9 @@ int mei_register(struct mei_device *dev, struct device *parent)
|
|||||||
goto err_dev_add;
|
goto err_dev_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
clsdev = device_create(mei_class, parent, devno,
|
clsdev = device_create_with_groups(mei_class, parent, devno,
|
||||||
NULL, "mei%d", dev->minor);
|
dev, mei_groups,
|
||||||
|
"mei%d", dev->minor);
|
||||||
|
|
||||||
if (IS_ERR(clsdev)) {
|
if (IS_ERR(clsdev)) {
|
||||||
dev_err(parent, "unable to create device %d:%d\n",
|
dev_err(parent, "unable to create device %d:%d\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user