Subject: Re: [PATCH net v3 1/2] ptp: ocp: adjust sysfs entries to expose tty information

From: Vadim Fedorenko <[email-masked]>
Date: Thu, 15 Aug 2024 15:05:28 +0100

On 15/08/2024 14:54, Simon Horman wrote:
> On Thu, Aug 15, 2024 at 05:59:04AM -0700, Vadim Fedorenko wrote:
>> Starting v6.8 the serial port subsystem changed the hierarchy of devices
>> and symlinks are not working anymore. Previous discussion made it clear
>> that the idea of symlinks for tty devices was wrong by design. Implement
>> additional attributes to expose the information. Fixes tag points to the
>> commit which introduced the change.
> 
> Hi Vadim,
> 
> Would it be possible to provide a link to the discussion(s)?
> 

Hi Simon,

Yeah, sure:
the initial RFC of serial port subsystem changes is
https://lore.kernel.org/linux-serial/[email-masked]/

the merged version is (serial port subsystem):
https://lore.kernel.org/linux-serial/[email-masked]/

The first update to ptp_ocp driver is
https://lore.kernel.org/linux-serial/[email-masked]/

>>
>> Fixes: b286f4e87e32 ("serial: core: Move tty and serdev to be children of serial core port device")
>> Signed-off-by: Vadim Fedorenko <[email-masked]>
> 
> ...
> 
>> diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c
> 
> ...
> 
>> @@ -3346,6 +3352,54 @@ static EXT_ATTR_RO(freq, frequency, 1);
>>   static EXT_ATTR_RO(freq, frequency, 2);
>>   static EXT_ATTR_RO(freq, frequency, 3);
>>   
>> +static ssize_t
>> +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);
>> +	struct ptp_ocp_serial_port *port;
> 
> nit: Port is unused in this function, it should be removed.

Ah, yeah, it was last second change, didn't clean it fully,
thanks for pointing.

> 
>> +
>> +	return sysfs_emit(buf, "ttyS%d", bp->port[(uintptr_t)ea->var].line);
>> +}
> 
> ...