[PATCH] mei: bus: Add newline to sysfs attribute outputs

Zhongqiu Han posted 1 patch 3 months, 1 week ago
drivers/misc/mei/bus.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] mei: bus: Add newline to sysfs attribute outputs
Posted by Zhongqiu Han 3 months, 1 week ago
Append newline characters to sysfs_emit() outputs in func max_conn_show(),
fixed_show(), and vtag_show(). This aligns with common kernel conventions
and improves readability for userspace tools that expect
newline-terminated values.

Signed-off-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
---
 drivers/misc/mei/bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 2c810ab12e62..8876c79bacfb 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -1210,7 +1210,7 @@ static ssize_t max_conn_show(struct device *dev, struct device_attribute *a,
 	struct mei_cl_device *cldev = to_mei_cl_device(dev);
 	u8 maxconn = mei_me_cl_max_conn(cldev->me_cl);
 
-	return sysfs_emit(buf, "%d", maxconn);
+	return sysfs_emit(buf, "%d\n", maxconn);
 }
 static DEVICE_ATTR_RO(max_conn);
 
@@ -1220,7 +1220,7 @@ static ssize_t fixed_show(struct device *dev, struct device_attribute *a,
 	struct mei_cl_device *cldev = to_mei_cl_device(dev);
 	u8 fixed = mei_me_cl_fixed(cldev->me_cl);
 
-	return sysfs_emit(buf, "%d", fixed);
+	return sysfs_emit(buf, "%d\n", fixed);
 }
 static DEVICE_ATTR_RO(fixed);
 
@@ -1230,7 +1230,7 @@ static ssize_t vtag_show(struct device *dev, struct device_attribute *a,
 	struct mei_cl_device *cldev = to_mei_cl_device(dev);
 	bool vt = mei_me_cl_vt(cldev->me_cl);
 
-	return sysfs_emit(buf, "%d", vt);
+	return sysfs_emit(buf, "%d\n", vt);
 }
 static DEVICE_ATTR_RO(vtag);
 
-- 
2.43.0
Re: [PATCH] mei: bus: Add newline to sysfs attribute outputs
Posted by Greg KH 3 months, 1 week ago
On Thu, Oct 30, 2025 at 08:30:00PM +0800, Zhongqiu Han wrote:
> Append newline characters to sysfs_emit() outputs in func max_conn_show(),
> fixed_show(), and vtag_show(). This aligns with common kernel conventions
> and improves readability for userspace tools that expect
> newline-terminated values.

What userspace tool reads these values today?  Will this user/kernel api
break them?  How was this tested?

thanks,

greg k-h
Re: [PATCH] mei: bus: Add newline to sysfs attribute outputs
Posted by Zhongqiu Han 3 months, 1 week ago
On 10/30/2025 8:32 PM, Greg KH wrote:
> On Thu, Oct 30, 2025 at 08:30:00PM +0800, Zhongqiu Han wrote:
>> Append newline characters to sysfs_emit() outputs in func max_conn_show(),
>> fixed_show(), and vtag_show(). This aligns with common kernel conventions
>> and improves readability for userspace tools that expect
>> newline-terminated values.
> 
> What userspace tool reads these values today?  Will this user/kernel api
> break them?  How was this tested?
> 
> thanks,
> 
> greg k-h

Hi Greg,
Thanks for your review~

Apologies for the confusion in the commit message — there isn't
actually a userspace tool that depends on the newline in this case. I
just made the change to follow common sysfs formatting practices and
improve consistency.

If you'd prefer the patch to be dropped or revised, I will proceed
accordingly.

-- 
Thx and BRs,
Zhongqiu Han
Re: [PATCH] mei: bus: Add newline to sysfs attribute outputs
Posted by Greg KH 3 months, 1 week ago
On Thu, Oct 30, 2025 at 09:11:34PM +0800, Zhongqiu Han wrote:
> On 10/30/2025 8:32 PM, Greg KH wrote:
> > On Thu, Oct 30, 2025 at 08:30:00PM +0800, Zhongqiu Han wrote:
> > > Append newline characters to sysfs_emit() outputs in func max_conn_show(),
> > > fixed_show(), and vtag_show(). This aligns with common kernel conventions
> > > and improves readability for userspace tools that expect
> > > newline-terminated values.
> > 
> > What userspace tool reads these values today?  Will this user/kernel api
> > break them?  How was this tested?
> > 
> > thanks,
> > 
> > greg k-h
> 
> Hi Greg,
> Thanks for your review~
> 
> Apologies for the confusion in the commit message — there isn't
> actually a userspace tool that depends on the newline in this case. I
> just made the change to follow common sysfs formatting practices and
> improve consistency.

That's fine, but please work with the people that wrote the tools that
depend on these files today to verify it will not break anything, and
then resubmit the patch with that information in the changelog.

thanks,

greg k-h
Re: [PATCH] mei: bus: Add newline to sysfs attribute outputs
Posted by Zhongqiu Han 3 months ago
On 11/3/2025 8:25 AM, Greg KH wrote:
> On Thu, Oct 30, 2025 at 09:11:34PM +0800, Zhongqiu Han wrote:
>> On 10/30/2025 8:32 PM, Greg KH wrote:
>>> On Thu, Oct 30, 2025 at 08:30:00PM +0800, Zhongqiu Han wrote:
>>>> Append newline characters to sysfs_emit() outputs in func max_conn_show(),
>>>> fixed_show(), and vtag_show(). This aligns with common kernel conventions
>>>> and improves readability for userspace tools that expect
>>>> newline-terminated values.
>>>
>>> What userspace tool reads these values today?  Will this user/kernel api
>>> break them?  How was this tested?
>>>
>>> thanks,
>>>
>>> greg k-h
>>
>> Hi Greg,
>> Thanks for your review~
>>
>> Apologies for the confusion in the commit message — there isn't
>> actually a userspace tool that depends on the newline in this case. I
>> just made the change to follow common sysfs formatting practices and
>> improve consistency.
> 
> That's fine, but please work with the people that wrote the tools that
> depend on these files today to verify it will not break anything, and
> then resubmit the patch with that information in the changelog.
> 
> thanks,
> 
> greg k-h

Hi Greg,

Thank you for your feedback. I’m happy to work on this, but I’m
currently not aware of any userspace tools that depend on these sysfs
interfaces, so I can’t confirm the impact right now. I will check and
monitor it and make sure to verify before next resubmitting.


-- 
Thx and BRs,
Zhongqiu Han