Skip to content

Commit

Permalink
mei: bus: export client protocol version
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tomas Winkler authored and Greg Kroah-Hartman committed Sep 21, 2015
1 parent 59796ed commit 40b7320
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Documentation/ABI/testing/sysfs-bus-mei
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ KernelVersion: 4.2
Contact: Tomas Winkler <tomas.winkler@intel.com>
Description: Stores mei client device uuid
Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

What: /sys/bus/mei/devices/.../version
Date: Aug 2015
KernelVersion: 4.3
Contact: Tomas Winkler <tomas.winkler@intel.com>
Description: Stores mei client protocol version
Format: %d
18 changes: 18 additions & 0 deletions drivers/misc/mei/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,19 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *a,
}
static DEVICE_ATTR_RO(uuid);

static ssize_t version_show(struct device *dev, struct device_attribute *a,
char *buf)
{
struct mei_cl_device *cldev = to_mei_cl_device(dev);
u8 version = mei_me_cl_ver(cldev->me_cl);
size_t len;

len = snprintf(buf, PAGE_SIZE, "%02X", version);

return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
}
static DEVICE_ATTR_RO(version);

static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
char *buf)
{
Expand All @@ -605,6 +618,7 @@ static DEVICE_ATTR_RO(modalias);
static struct attribute *mei_cl_dev_attrs[] = {
&dev_attr_name.attr,
&dev_attr_uuid.attr,
&dev_attr_version.attr,
&dev_attr_modalias.attr,
NULL,
};
Expand All @@ -622,6 +636,10 @@ static int mei_cl_device_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct mei_cl_device *cldev = to_mei_cl_device(dev);
const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
u8 version = mei_me_cl_ver(cldev->me_cl);

if (add_uevent_var(env, "MEI_CL_VERSION=%d", version))
return -ENOMEM;

if (add_uevent_var(env, "MEI_CL_UUID=%pUl", uuid))
return -ENOMEM;
Expand Down
12 changes: 12 additions & 0 deletions drivers/misc/mei/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ static inline const uuid_le *mei_me_cl_uuid(const struct mei_me_client *me_cl)
return &me_cl->props.protocol_name;
}

/**
* mei_me_cl_ver - return me client protocol version
*
* @me_cl: me client
*
* Return: me client protocol version
*/
static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl)
{
return me_cl->props.protocol_version;
}

/*
* MEI IO Functions
*/
Expand Down

0 comments on commit 40b7320

Please sign in to comment.