Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 423de92f authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Greg Kroah-Hartman
Browse files

mei: bus: use scnprintf in *_show



There's no reason to duplicate the logic provided by scnprintf().

Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f55532a0
Loading
Loading
Loading
Loading
+4 −15
Original line number Original line Diff line number Diff line
@@ -634,11 +634,8 @@ static ssize_t name_show(struct device *dev, struct device_attribute *a,
			     char *buf)
			     char *buf)
{
{
	struct mei_cl_device *cldev = to_mei_cl_device(dev);
	struct mei_cl_device *cldev = to_mei_cl_device(dev);
	size_t len;


	len = snprintf(buf, PAGE_SIZE, "%s", cldev->name);
	return scnprintf(buf, PAGE_SIZE, "%s", cldev->name);

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


@@ -647,11 +644,8 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *a,
{
{
	struct mei_cl_device *cldev = to_mei_cl_device(dev);
	struct mei_cl_device *cldev = to_mei_cl_device(dev);
	const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
	const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
	size_t len;

	len = snprintf(buf, PAGE_SIZE, "%pUl", uuid);


	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
	return scnprintf(buf, PAGE_SIZE, "%pUl", uuid);
}
}
static DEVICE_ATTR_RO(uuid);
static DEVICE_ATTR_RO(uuid);


@@ -660,11 +654,8 @@ static ssize_t version_show(struct device *dev, struct device_attribute *a,
{
{
	struct mei_cl_device *cldev = to_mei_cl_device(dev);
	struct mei_cl_device *cldev = to_mei_cl_device(dev);
	u8 version = mei_me_cl_ver(cldev->me_cl);
	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;
	return scnprintf(buf, PAGE_SIZE, "%02X", version);
}
}
static DEVICE_ATTR_RO(version);
static DEVICE_ATTR_RO(version);


@@ -673,10 +664,8 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
{
{
	struct mei_cl_device *cldev = to_mei_cl_device(dev);
	struct mei_cl_device *cldev = to_mei_cl_device(dev);
	const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
	const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
	size_t len;


	len = snprintf(buf, PAGE_SIZE, "mei:%s:%pUl:", cldev->name, uuid);
	return scnprintf(buf, PAGE_SIZE, "mei:%s:%pUl:", cldev->name, uuid);
	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
}
}
static DEVICE_ATTR_RO(modalias);
static DEVICE_ATTR_RO(modalias);