[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yt9dmsj5r2uu.fsf@linux.ibm.com>
Date: Tue, 15 Oct 2024 14:02:17 +0200
From: Sven Schnelle <svens@...ux.ibm.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Heiko Carstens <hca@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger
<borntraeger@...ux.ibm.com>,
Richard Cochran <richardcochran@...il.com>,
"Ricardo B. Marliere" <ricardo@...liere.net>,
linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH 2/3] ptp: Add clock name to uevent
Greg Kroah-Hartman <gregkh@...uxfoundation.org> writes:
> On Tue, Oct 15, 2024 at 12:54:13PM +0200, Sven Schnelle wrote:
>> To allow users to have stable device names with the help of udev,
>> add the name to the udev event that is sent when a new PtP clock
>> is available. The key is called 'PTP_CLOCK_NAME'.
>
> Where are you documenting this new user/kernel api you are adding?
>
>>
>> Signed-off-by: Sven Schnelle <svens@...ux.ibm.com>
>> ---
>> drivers/ptp/ptp_clock.c | 11 ++++++++++-
>> 1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
>> index c56cd0f63909..15937acb79c6 100644
>> --- a/drivers/ptp/ptp_clock.c
>> +++ b/drivers/ptp/ptp_clock.c
>> @@ -25,9 +25,11 @@
>> #define PTP_PPS_EVENT PPS_CAPTUREASSERT
>> #define PTP_PPS_MODE (PTP_PPS_DEFAULTS | PPS_CANWAIT | PPS_TSFMT_TSPEC)
>>
>> +static int ptp_udev_uevent(const struct device *dev, struct kobj_uevent_env *env);
>> const struct class ptp_class = {
>> .name = "ptp",
>> - .dev_groups = ptp_groups
>> + .dev_groups = ptp_groups,
>> + .dev_uevent = ptp_udev_uevent
>> };
>>
>> /* private globals */
>> @@ -514,6 +516,13 @@ EXPORT_SYMBOL(ptp_cancel_worker_sync);
>>
>> /* module operations */
>>
>> +static int ptp_udev_uevent(const struct device *dev, struct kobj_uevent_env *env)
>> +{
>> + struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev);
>> +
>> + return add_uevent_var(env, "PTP_CLOCK_NAME=%s", ptp->info->name);
>
> Why is this needed? Can't you get the name from the sysfs paths, the
> symlink should be there already.
You mean the 'clock_name' attribute in sysfs? That would require to
write some script to iterate over all ptp devices and check the name,
or is there a way to match that in udev?
Powered by blists - more mailing lists