netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ptp: ocp: Add newline to sysfs attribute output
@ 2025-10-30 12:45 Zhongqiu Han
  2025-10-31 23:59 ` Jakub Kicinski
  0 siblings, 1 reply; 6+ messages in thread
From: Zhongqiu Han @ 2025-10-30 12:45 UTC (permalink / raw)
  To: richardcochran, jonathan.lemon, vadim.fedorenko, andrew+netdev,
	davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, zhongqiu.han

Append a newline character to the sysfs_emit() output in ptp_ocp_tty_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/ptp/ptp_ocp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
index a5c363252986..cdff357456aa 100644
--- a/drivers/ptp/ptp_ocp.c
+++ b/drivers/ptp/ptp_ocp.c
@@ -3430,7 +3430,7 @@ ptp_ocp_tty_show(struct device *dev, struct device_attribute *attr, char *buf)
 	struct dev_ext_attribute *ea = to_ext_attr(attr);
 	struct ptp_ocp *bp = dev_get_drvdata(dev);
 
-	return sysfs_emit(buf, "ttyS%d", bp->port[(uintptr_t)ea->var].line);
+	return sysfs_emit(buf, "ttyS%d\n", bp->port[(uintptr_t)ea->var].line);
 }
 
 static umode_t
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ptp: ocp: Add newline to sysfs attribute output
  2025-10-30 12:45 [PATCH] ptp: ocp: Add newline to sysfs attribute output Zhongqiu Han
@ 2025-10-31 23:59 ` Jakub Kicinski
  2025-11-01 11:18   ` Vadim Fedorenko
  2025-11-01 23:45   ` Vadim Fedorenko
  0 siblings, 2 replies; 6+ messages in thread
From: Jakub Kicinski @ 2025-10-31 23:59 UTC (permalink / raw)
  To: vadim.fedorenko
  Cc: Zhongqiu Han, richardcochran, jonathan.lemon, andrew+netdev,
	davem, edumazet, pabeni, netdev, linux-kernel

On Thu, 30 Oct 2025 20:45:19 +0800 Zhongqiu Han wrote:
> Append a newline character to the sysfs_emit() output in ptp_ocp_tty_show.
> This aligns with common kernel conventions and improves readability for
> userspace tools that expect newline-terminated values.

Vadim? Is the backward compat here a concern?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ptp: ocp: Add newline to sysfs attribute output
  2025-10-31 23:59 ` Jakub Kicinski
@ 2025-11-01 11:18   ` Vadim Fedorenko
  2025-11-01 23:45   ` Vadim Fedorenko
  1 sibling, 0 replies; 6+ messages in thread
From: Vadim Fedorenko @ 2025-11-01 11:18 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Zhongqiu Han, richardcochran, jonathan.lemon, andrew+netdev,
	davem, edumazet, pabeni, netdev, linux-kernel

On 31/10/2025 23:59, Jakub Kicinski wrote:
> On Thu, 30 Oct 2025 20:45:19 +0800 Zhongqiu Han wrote:
>> Append a newline character to the sysfs_emit() output in ptp_ocp_tty_show.
>> This aligns with common kernel conventions and improves readability for
>> userspace tools that expect newline-terminated values.
> 
> Vadim? Is the backward compat here a concern?

I'm checking our software now, hopefully it will not break, but I need a
bit of time to be sure

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ptp: ocp: Add newline to sysfs attribute output
  2025-10-31 23:59 ` Jakub Kicinski
  2025-11-01 11:18   ` Vadim Fedorenko
@ 2025-11-01 23:45   ` Vadim Fedorenko
  2025-11-03  0:00     ` Jakub Kicinski
  1 sibling, 1 reply; 6+ messages in thread
From: Vadim Fedorenko @ 2025-11-01 23:45 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Zhongqiu Han, richardcochran, jonathan.lemon, andrew+netdev,
	davem, edumazet, pabeni, netdev, linux-kernel

On 31/10/2025 23:59, Jakub Kicinski wrote:
> On Thu, 30 Oct 2025 20:45:19 +0800 Zhongqiu Han wrote:
>> Append a newline character to the sysfs_emit() output in ptp_ocp_tty_show.
>> This aligns with common kernel conventions and improves readability for
>> userspace tools that expect newline-terminated values.
> 
> Vadim? Is the backward compat here a concern?

Well, unfortunately, this patch breaks software we use:

openat(AT_FDCWD, "/dev/ttyS4\n", O_RDWR|O_NONBLOCK) = -1 ENOENT (No such 
file or directory)
newfstatat(AT_FDCWD, "/etc/localtime", {st_mode=S_IFREG|0644, 
st_size=114, ...}, 0) = 0
write(2, "23:40:33 \33[31mERROR\33[0m ", 2423:40:33 ERROR ) = 24
write(2, "Could not open sa5x device\n", 27Could not open sa5x device

So it looks like uAPI change, which is already used...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ptp: ocp: Add newline to sysfs attribute output
  2025-11-01 23:45   ` Vadim Fedorenko
@ 2025-11-03  0:00     ` Jakub Kicinski
  2025-11-03 13:04       ` Zhongqiu Han
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2025-11-03  0:00 UTC (permalink / raw)
  To: Vadim Fedorenko
  Cc: Zhongqiu Han, richardcochran, jonathan.lemon, andrew+netdev,
	davem, edumazet, pabeni, netdev, linux-kernel

On Sat, 1 Nov 2025 23:45:00 +0000 Vadim Fedorenko wrote:
> On 31/10/2025 23:59, Jakub Kicinski wrote:
> > On Thu, 30 Oct 2025 20:45:19 +0800 Zhongqiu Han wrote:  
> >> Append a newline character to the sysfs_emit() output in ptp_ocp_tty_show.
> >> This aligns with common kernel conventions and improves readability for
> >> userspace tools that expect newline-terminated values.  
> > 
> > Vadim? Is the backward compat here a concern?  
> 
> Well, unfortunately, this patch breaks software we use:
> 
> openat(AT_FDCWD, "/dev/ttyS4\n", O_RDWR|O_NONBLOCK) = -1 ENOENT (No such 
> file or directory)
> newfstatat(AT_FDCWD, "/etc/localtime", {st_mode=S_IFREG|0644, 
> st_size=114, ...}, 0) = 0
> write(2, "23:40:33 \33[31mERROR\33[0m ", 2423:40:33 ERROR ) = 24
> write(2, "Could not open sa5x device\n", 27Could not open sa5x device
> 
> So it looks like uAPI change, which is already used...
> 

Zhongqiu Han please consider sending a patch to add a comment above 
the unfortunate emit() explaining that we can't change it now.
I get the feeling that otherwise this "fix" may resurface.
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ptp: ocp: Add newline to sysfs attribute output
  2025-11-03  0:00     ` Jakub Kicinski
@ 2025-11-03 13:04       ` Zhongqiu Han
  0 siblings, 0 replies; 6+ messages in thread
From: Zhongqiu Han @ 2025-11-03 13:04 UTC (permalink / raw)
  To: Jakub Kicinski, Vadim Fedorenko
  Cc: richardcochran, jonathan.lemon, andrew+netdev, davem, edumazet,
	pabeni, netdev, linux-kernel, zhongqiu.han

On 11/3/2025 8:00 AM, Jakub Kicinski wrote:
> On Sat, 1 Nov 2025 23:45:00 +0000 Vadim Fedorenko wrote:
>> On 31/10/2025 23:59, Jakub Kicinski wrote:
>>> On Thu, 30 Oct 2025 20:45:19 +0800 Zhongqiu Han wrote:
>>>> Append a newline character to the sysfs_emit() output in ptp_ocp_tty_show.
>>>> This aligns with common kernel conventions and improves readability for
>>>> userspace tools that expect newline-terminated values.
>>>
>>> Vadim? Is the backward compat here a concern?
>>
>> Well, unfortunately, this patch breaks software we use:
>>
>> openat(AT_FDCWD, "/dev/ttyS4\n", O_RDWR|O_NONBLOCK) = -1 ENOENT (No such
>> file or directory)
>> newfstatat(AT_FDCWD, "/etc/localtime", {st_mode=S_IFREG|0644,
>> st_size=114, ...}, 0) = 0
>> write(2, "23:40:33 \33[31mERROR\33[0m ", 2423:40:33 ERROR ) = 24
>> write(2, "Could not open sa5x device\n", 27Could not open sa5x device
>>
>> So it looks like uAPI change, which is already used...
>>
> 
> Zhongqiu Han please consider sending a patch to add a comment above
> the unfortunate emit() explaining that we can't change it now.
> I get the feeling that otherwise this "fix" may resurface.

Hi Jakub,
Sure, will send the comment patch. Thanks


-- 
Thx and BRs,
Zhongqiu Han

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-03 13:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 12:45 [PATCH] ptp: ocp: Add newline to sysfs attribute output Zhongqiu Han
2025-10-31 23:59 ` Jakub Kicinski
2025-11-01 11:18   ` Vadim Fedorenko
2025-11-01 23:45   ` Vadim Fedorenko
2025-11-03  0:00     ` Jakub Kicinski
2025-11-03 13:04       ` Zhongqiu Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).