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 16:06:15 +0100

On 15/08/2024 14:41, Greg Kroah-Hartman 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.
>>
>> Fixes: b286f4e87e32 ("serial: core: Move tty and serdev to be children of serial core port device")
>> Signed-off-by: Vadim Fedorenko <[email-masked]>
> 
> Complicated fixes, nice!  Thanks for doing this.  One question:
> 
>> +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;
>> +
>> +	return sysfs_emit(buf, "ttyS%d", bp->port[(uintptr_t)ea->var].line);
> 
> "uintptr_t"?  That's not a normal kernel type.  var is of type "void *"
> so can't this just be "int" here?  Or am I reading this wrong?

Well, yes, looks like it can be used as pure int provided enum is int
and we simply use "void *" as a transport.

I'll send v4 with this fix and the one Simon pointed in 24hr (as per
netdev policy).

Thanks!

> thanks,
> greg k-h