linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 00/13] ptp: Belated spring cleaning of the chardev driver
@ 2025-06-20 13:24 Thomas Gleixner
  2025-06-20 13:24 ` [patch 01/13] ptp: Split out PTP_CLOCK_GETCAPS ioctl code Thomas Gleixner
                   ` (12 more replies)
  0 siblings, 13 replies; 36+ messages in thread
From: Thomas Gleixner @ 2025-06-20 13:24 UTC (permalink / raw)
  To: LKML; +Cc: Richard Cochran, netdev

When looking into supporting auxiliary clocks in the PTP ioctl, the
inpenetrable ptp_ioctl() letter soup bothered me enough to clean it up.

The code (~400 lines!) is really hard to follow due to a gazillion of
local variables, which are only used in certain case scopes, and a
mixture of gotos, breaks and direct error return paths.

Clean it up by splitting out the IOCTL functionality into seperate
functions, which contain only the required local variables and are trivial
to follow. Complete the cleanup by converting the code to lock guards and
_free(), which gets rid of all gotos.

That reduces the code size by 58 lines and also the binary text size is
90 bytes smaller than the current maze.

The series is split up into one patch per IOCTL command group for easy
review.

Applies against v6.16-rc1 and also cleanly against next. It's also
available from git:

     git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git timers/ptp/driver

Thanks,

	tglx
---
 ptp_chardev.c |  754 ++++++++++++++++++++++++++--------------------------------
 1 file changed, 348 insertions(+), 406 deletions(-)

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2025-06-25 10:33 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20 13:24 [patch 00/13] ptp: Belated spring cleaning of the chardev driver Thomas Gleixner
2025-06-20 13:24 ` [patch 01/13] ptp: Split out PTP_CLOCK_GETCAPS ioctl code Thomas Gleixner
2025-06-21 20:22   ` Vadim Fedorenko
2025-06-20 13:24 ` [patch 02/13] ptp: Split out PTP_EXTTS_REQUEST " Thomas Gleixner
2025-06-21 20:24   ` Vadim Fedorenko
2025-06-20 13:24 ` [patch 03/13] ptp: Split out PTP_PEROUT_REQUEST " Thomas Gleixner
2025-06-21 20:24   ` Vadim Fedorenko
2025-06-20 13:24 ` [patch 04/13] ptp: Split out PTP_ENABLE_PPS " Thomas Gleixner
2025-06-21 20:25   ` Vadim Fedorenko
2025-06-20 13:24 ` [patch 05/13] ptp: Split out PTP_SYS_OFFSET_PRECISE " Thomas Gleixner
2025-06-21 20:27   ` Vadim Fedorenko
2025-06-20 13:24 ` [patch 06/13] ptp: Split out PTP_SYS_OFFSET_EXTENDED " Thomas Gleixner
2025-06-21 20:29   ` Vadim Fedorenko
2025-06-20 13:24 ` [patch 07/13] ptp: Split out PTP_SYS_OFFSET " Thomas Gleixner
2025-06-21 20:14   ` Vadim Fedorenko
2025-06-21 20:42     ` Thomas Gleixner
2025-06-21 20:58       ` Vadim Fedorenko
2025-06-20 13:24 ` [patch 08/13] ptp: Split out PTP_PIN_GETFUNC " Thomas Gleixner
2025-06-21 20:29   ` Vadim Fedorenko
2025-06-24  9:22   ` Paolo Abeni
2025-06-24 13:39     ` Thomas Gleixner
2025-06-25  8:19       ` Thomas Gleixner
2025-06-20 13:24 ` [patch 09/13] ptp: Split out PTP_PIN_SETFUNC " Thomas Gleixner
2025-06-21 20:30   ` Vadim Fedorenko
2025-06-20 13:24 ` [patch 10/13] ptp: Split out PTP_MASK_CLEAR_ALL " Thomas Gleixner
2025-06-21 20:36   ` Vadim Fedorenko
2025-06-21 20:44     ` Thomas Gleixner
2025-06-21 20:59       ` Vadim Fedorenko
2025-06-20 13:24 ` [patch 11/13] ptp: Split out PTP_MASK_EN_SINGLE " Thomas Gleixner
2025-06-21 20:32   ` Vadim Fedorenko
2025-06-20 13:24 ` [patch 12/13] ptp: Convert chardev code to lock guards Thomas Gleixner
2025-06-20 13:24 ` [patch 13/13] ptp: Convert ptp_open/read() to __free() Thomas Gleixner
2025-06-24  9:48   ` Paolo Abeni
2025-06-24 13:38     ` Thomas Gleixner
2025-06-24 16:36   ` Jakub Kicinski
2025-06-25 10:33     ` Thomas Gleixner

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).