Merge tag 'compat-ioctl-5.5' of git://git.kernel.org:/pub/scm/linux/kernel/git/arnd...
[linux-2.6-block.git] / drivers / misc / mei / main.c
index 133fa8cbb1c8f9da8209aa062946b931185a72d2..f17297f2943d37fc82a7fce8d77eeebaa1bcf79d 100644 (file)
@@ -682,6 +682,29 @@ static int mei_fasync(int fd, struct file *file, int band)
        return fasync_helper(fd, file, band, &cl->ev_async);
 }
 
+/**
+ * trc_show - mei device trc 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 trc_show(struct device *device,
+                       struct device_attribute *attr, char *buf)
+{
+       struct mei_device *dev = dev_get_drvdata(device);
+       u32 trc;
+       int ret;
+
+       ret = mei_trc_status(dev, &trc);
+       if (ret)
+               return ret;
+       return sprintf(buf, "%08X\n", trc);
+}
+static DEVICE_ATTR_RO(trc);
+
 /**
  * fw_status_show - mei device fw_status attribute show method
  *
@@ -869,6 +892,7 @@ static struct attribute *mei_attrs[] = {
        &dev_attr_tx_queue_limit.attr,
        &dev_attr_fw_ver.attr,
        &dev_attr_dev_state.attr,
+       &dev_attr_trc.attr,
        NULL
 };
 ATTRIBUTE_GROUPS(mei);