Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mei: bus: export client protocol version

export me client protocol version to sysfs and uevent

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Tomas Winkler and committed by
Greg Kroah-Hartman
40b7320e 59796edc

+37
+7
Documentation/ABI/testing/sysfs-bus-mei
··· 19 19 Contact: Tomas Winkler <tomas.winkler@intel.com> 20 20 Description: Stores mei client device uuid 21 21 Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 22 + 23 + What: /sys/bus/mei/devices/.../version 24 + Date: Aug 2015 25 + KernelVersion: 4.3 26 + Contact: Tomas Winkler <tomas.winkler@intel.com> 27 + Description: Stores mei client protocol version 28 + Format: %d
+18
drivers/misc/mei/bus.c
··· 590 590 } 591 591 static DEVICE_ATTR_RO(uuid); 592 592 593 + static ssize_t version_show(struct device *dev, struct device_attribute *a, 594 + char *buf) 595 + { 596 + struct mei_cl_device *cldev = to_mei_cl_device(dev); 597 + u8 version = mei_me_cl_ver(cldev->me_cl); 598 + size_t len; 599 + 600 + len = snprintf(buf, PAGE_SIZE, "%02X", version); 601 + 602 + return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len; 603 + } 604 + static DEVICE_ATTR_RO(version); 605 + 593 606 static ssize_t modalias_show(struct device *dev, struct device_attribute *a, 594 607 char *buf) 595 608 { ··· 618 605 static struct attribute *mei_cl_dev_attrs[] = { 619 606 &dev_attr_name.attr, 620 607 &dev_attr_uuid.attr, 608 + &dev_attr_version.attr, 621 609 &dev_attr_modalias.attr, 622 610 NULL, 623 611 }; ··· 636 622 { 637 623 struct mei_cl_device *cldev = to_mei_cl_device(dev); 638 624 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); 625 + u8 version = mei_me_cl_ver(cldev->me_cl); 626 + 627 + if (add_uevent_var(env, "MEI_CL_VERSION=%d", version)) 628 + return -ENOMEM; 639 629 640 630 if (add_uevent_var(env, "MEI_CL_UUID=%pUl", uuid)) 641 631 return -ENOMEM;
+12
drivers/misc/mei/client.h
··· 68 68 return &me_cl->props.protocol_name; 69 69 } 70 70 71 + /** 72 + * mei_me_cl_ver - return me client protocol version 73 + * 74 + * @me_cl: me client 75 + * 76 + * Return: me client protocol version 77 + */ 78 + static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl) 79 + { 80 + return me_cl->props.protocol_version; 81 + } 82 + 71 83 /* 72 84 * MEI IO Functions 73 85 */