mirror of
https://github.com/torvalds/linux.git
synced 2025-12-01 07:26:02 +07:00
mcb: use sysfs_emit_at() instead of scnprintf() in show functions
This change improves clarity and ensures proper bounds checking in line with the preferred sysfs_emit() API usage for sysfs 'show' functions. The PAGE_SIZE check is now handled internally by the helper. No functional change intended. Signed-off-by: Abhinav Ananthu <abhinav.ogl@gmail.com> Signed-off-by: Johannes Thumshirn <jth@kernel.org> Reviewed-by: Johannes Thumshirn <jth@kernel.org> Link: https://lore.kernel.org/r/20250707074720.40051-2-jth@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d1934ed980
commit
77e49c3588
@@ -107,7 +107,7 @@ static ssize_t revision_show(struct device *dev, struct device_attribute *attr,
|
|||||||
{
|
{
|
||||||
struct mcb_bus *bus = to_mcb_bus(dev);
|
struct mcb_bus *bus = to_mcb_bus(dev);
|
||||||
|
|
||||||
return scnprintf(buf, PAGE_SIZE, "%d\n", bus->revision);
|
return sysfs_emit(buf, "%d\n", bus->revision);
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(revision);
|
static DEVICE_ATTR_RO(revision);
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ static ssize_t model_show(struct device *dev, struct device_attribute *attr,
|
|||||||
{
|
{
|
||||||
struct mcb_bus *bus = to_mcb_bus(dev);
|
struct mcb_bus *bus = to_mcb_bus(dev);
|
||||||
|
|
||||||
return scnprintf(buf, PAGE_SIZE, "%c\n", bus->model);
|
return sysfs_emit(buf, "%c\n", bus->model);
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(model);
|
static DEVICE_ATTR_RO(model);
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ static ssize_t minor_show(struct device *dev, struct device_attribute *attr,
|
|||||||
{
|
{
|
||||||
struct mcb_bus *bus = to_mcb_bus(dev);
|
struct mcb_bus *bus = to_mcb_bus(dev);
|
||||||
|
|
||||||
return scnprintf(buf, PAGE_SIZE, "%d\n", bus->minor);
|
return sysfs_emit(buf, "%d\n", bus->minor);
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(minor);
|
static DEVICE_ATTR_RO(minor);
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr,
|
|||||||
{
|
{
|
||||||
struct mcb_bus *bus = to_mcb_bus(dev);
|
struct mcb_bus *bus = to_mcb_bus(dev);
|
||||||
|
|
||||||
return scnprintf(buf, PAGE_SIZE, "%s\n", bus->name);
|
return sysfs_emit(buf, "%s\n", bus->name);
|
||||||
}
|
}
|
||||||
static DEVICE_ATTR_RO(name);
|
static DEVICE_ATTR_RO(name);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user