Skip to content

ptp: Belated spring cleaning of the chardev driver

Thomas Gleixner lkml netdev 2 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest13 patches 3 repliesApplied 13/13
  2. v113 patches 22 repliesSuperseded

Changes in v2 from the cover letter

- Picked up Reviewed tags as appropriate

- Dropped the pointless memset()s in GETFUNC/SETFUNC - Paolo

- Dropped the __free() in ptp_open/read() - Jakub

Patches in v2 All 13 applied

#Subject and filesSizeRepliesApplied
1/13ptp: Split out PTP_CLOCK_GETCAPS ioctl codedrivers/ptp/ptp_chardev.c+23 -180 repliesApplied
2/13ptp: Split out PTP_EXTTS_REQUEST ioctl codedrivers/ptp/ptp_chardev.c+50 -550 repliesApplied
3/13ptp: Split out PTP_PEROUT_REQUEST ioctl codedrivers/ptp/ptp_chardev.c+58 -710 repliesApplied
4/13ptp: Split out PTP_ENABLE_PPS ioctl codedrivers/ptp/ptp_chardev.c+16 -170 repliesApplied
5/13ptp: Split out PTP_SYS_OFFSET_PRECISE ioctl codedrivers/ptp/ptp_chardev.c+29 -240 repliesApplied
6/13ptp: Split out PTP_SYS_OFFSET_EXTENDED ioctl codedrivers/ptp/ptp_chardev.c+39 -360 repliesApplied
7/13ptp: Split out PTP_SYS_OFFSET ioctl codedrivers/ptp/ptp_chardev.c+40 -380 repliesApplied
8/13ptp: Split out PTP_PIN_GETFUNC ioctl codedrivers/ptp/ptp_chardev.c+21 -290 repliesApplied
9/13ptp: Split out PTP_PIN_SETFUNC ioctl codedrivers/ptp/ptp_chardev.c+24 -340 repliesApplied
10/13ptp: Split out PTP_MASK_CLEAR_ALL ioctl codedrivers/ptp/ptp_chardev.c+7 -20 repliesApplied
11/13ptp: Split out PTP_MASK_EN_SINGLE ioctl codedrivers/ptp/ptp_chardev.c+15 -200 repliesApplied
12/13ptp: Convert chardev code to lock guardsdrivers/ptp/ptp_chardev.c+13 -210 repliesApplied
13/13ptp: Simplify ptp_read()drivers/ptp/ptp_chardev.c+16 -380 repliesApplied

Reviews trailers per patch

10 of 13 patches have a Reviewed-by or Acked-by.

PatchVadim Fedorenko
1/13R-b
2/13R-b
3/13R-b
4/13R-b
5/13R-b
6/13R-b
7/13
8/13R-b
9/13R-b
10/13R-b
11/13R-b
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [patch V2 00/13] ptp: Belated spring cleaning of the chardev driver

This is V2 of the series. V1 can be found here:

     https://lore.kernel.org/all/[email protected]

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 get rid of all gotos.

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

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

Changes vs. V1:

- Picked up Reviewed tags as appropriate

- Dropped the pointless memset()s in GETFUNC/SETFUNC - Paolo

- Dropped the __free() in ptp_open/read() - Jakub

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 |  734 ++++++++++++++++++++++++++--------------------------------
 1 file changed, 341 insertions(+), 393 deletions(-)