public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>,
	jonathan.lemon@gmail.com, richardcochran@gmail.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ptp: ocp: Document sysfs output format for backward compatibility
Date: Fri, 7 Nov 2025 18:01:02 +0000	[thread overview]
Message-ID: <cd54cc15-b51f-4bf7-9362-2086031a9c7a@linux.dev> (raw)
In-Reply-To: <20251107074533.416048-1-zhongqiu.han@oss.qualcomm.com>

On 07/11/2025 07:45, Zhongqiu Han wrote:
> Add a comment to ptp_ocp_tty_show() explaining that the sysfs output
> intentionally does not include a trailing newline. This is required for
> backward compatibility with existing userspace software that reads the
> sysfs attribute and uses the value directly as a device path.
> 
> A previous attempt to add a newline to align with common kernel
> conventions broke userspace applications that were opening device paths
> like "/dev/ttyS4\n" instead of "/dev/ttyS4", resulting in ENOENT errors.
> 
> This comment prevents future attempts to "fix" this behavior, which would
> break existing userspace applications.
> 
> Link: https://lore.kernel.org/netdev/20251030124519.1828058-1-zhongqiu.han@oss.qualcomm.com/
> Link: https://lore.kernel.org/netdev/aef3b850-5f38-4c28-a018-3b0006dc2f08@linux.dev/
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
> ---
>   drivers/ptp/ptp_ocp.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> index a5c363252986..eeebe4d149f7 100644
> --- a/drivers/ptp/ptp_ocp.c
> +++ b/drivers/ptp/ptp_ocp.c
> @@ -3430,6 +3430,12 @@ 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);
>   
> +	/*
> +	 * NOTE: This output does not include a trailing newline for backward
> +	 * compatibility. Existing userspace software uses this value directly
> +	 * as a device path (e.g., "/dev/ttyS4"), and adding a newline would
> +	 * break those applications. Do not add a newline to this output.
> +	 */
>   	return sysfs_emit(buf, "ttyS%d", bp->port[(uintptr_t)ea->var].line);
>   }
>   
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

  reply	other threads:[~2025-11-07 18:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07  7:45 [PATCH] ptp: ocp: Document sysfs output format for backward compatibility Zhongqiu Han
2025-11-07 18:01 ` Vadim Fedorenko [this message]
2025-11-11  0:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd54cc15-b51f-4bf7-9362-2086031a9c7a@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=zhongqiu.han@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox