From: Sven Schnelle <svens@linux.ibm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Richard Cochran <richardcochran@gmail.com>,
"Ricardo B. Marliere" <ricardo@marliere.net>,
linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH 2/3] ptp: Add clock name to uevent
Date: Tue, 15 Oct 2024 14:19:21 +0200 [thread overview]
Message-ID: <yt9dv7xtftiu.fsf@linux.ibm.com> (raw)
In-Reply-To: <2024101549-bungee-dodge-057d@gregkh> (Greg Kroah-Hartman's message of "Tue, 15 Oct 2024 14:16:09 +0200")
Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> On Tue, Oct 15, 2024 at 02:02:17PM +0200, Sven Schnelle wrote:
>> Greg Kroah-Hartman <gregkh@linuxfoundation.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@linux.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?
>
> Great, yes, it's right there.
>
>> 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?
>
> Yes there is. Please use that :)
Indeed. Sorry, will drop the patch.
next prev parent reply other threads:[~2024-10-15 12:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 10:54 [PATCH RESEND 0/3] PtP driver for s390 clocks Sven Schnelle
2024-10-15 10:54 ` [PATCH 1/3] s390/time: Add clocksource id to TOD clock Sven Schnelle
2024-10-15 10:54 ` [PATCH 2/3] ptp: Add clock name to uevent Sven Schnelle
2024-10-15 10:59 ` Greg Kroah-Hartman
2024-10-15 12:02 ` Sven Schnelle
2024-10-15 12:16 ` Greg Kroah-Hartman
2024-10-15 12:19 ` Sven Schnelle [this message]
2024-10-15 10:54 ` [PATCH 3/3] s390/time: Add PtP driver Sven Schnelle
2024-10-16 6:19 ` kernel test robot
2024-10-16 7:31 ` kernel test robot
2024-10-16 10:20 ` Heiko Carstens
-- strict thread matches above, loose matches on Subject: below --
2024-10-15 8:47 [PATCH 0/3] PtP driver for s390 clocks Sven Schnelle
2024-10-15 8:47 ` [PATCH 2/3] ptp: Add clock name to uevent Sven Schnelle
2024-10-15 12:43 ` Andrew Lunn
2024-10-16 3:38 ` Richard Cochran
2024-10-16 5:20 ` Sven Schnelle
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=yt9dv7xtftiu.fsf@linux.ibm.com \
--to=svens@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=ricardo@marliere.net \
--cc=richardcochran@gmail.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;
as well as URLs for NNTP newsgroup(s).