Page MenuHomeFreeBSD

e6000sw: Add readphy and writephy wrappers
ClosedPublic

Authored by aja_semihalf.com on Jun 29 2022, 1:36 PM.
Tags
None
Referenced Files
F86783995: D35656.diff
Tue, Jun 25, 1:02 PM
Unknown Object (File)
Mon, Jun 24, 3:35 AM
Unknown Object (File)
May 21 2024, 3:09 PM
Unknown Object (File)
May 21 2024, 9:38 AM
Unknown Object (File)
May 20 2024, 9:09 PM
Unknown Object (File)
May 18 2024, 9:00 AM
Unknown Object (File)
May 17 2024, 5:27 AM
Unknown Object (File)
May 15 2024, 6:56 PM
Subscribers

Details

Summary

New functions take lock and give lock after operation.
Removed locking and unlocking within other methods,
to prevent from recursive locking on non recursive lock.

Tested on EspressoBin.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

aja_semihalf.com created this revision.
mw requested changes to this revision.Jul 5 2022, 10:03 PM
mw added inline comments.
sys/dev/etherswitch/e6000sw/e6000sw.c
659

Please rename to e6000sw_readphy_locked - it will be more meaningful.

710

Please rename to e6000sw_writephy_locked.

1041

Don't remove this line.

This revision now requires changes to proceed.Jul 5 2022, 10:03 PM
aja_semihalf.com marked 2 inline comments as done.
This revision is now accepted and ready to land.Jul 6 2022, 8:56 AM
This revision now requires review to proceed.Jul 6 2022, 9:47 AM

I agree the wrapper routines should not be suffixed with _locked. However, because we have a different case than e6000sw_readreg/e6000sw_readreg_wrapper, I propose a following change:
new functions should take the original name (the DEVMETHODs declarations will remain intact). i.e.:

  • e6000sw_writephy_wrapper -> e6000sw_writephy
  • e6000sw_readphy_wrapper -> e6000sw_readphy

the original routines should be suffixed with _locked:

  • e6000sw_writephy -> e6000sw_writephy_locked
  • e6000sw_readphy -> - e6000sw_readphy_locked
sys/dev/etherswitch/e6000sw/e6000sw.c
115

Please do not modify the orignal lines, just add the new ones. This way the diff will be reduced to a minimum:

static int e6000sw_read_xmdio(device_t, int, int, int);
static int e6000sw_write_xmdio(device_t, int, int, int, int);
static int e6000sw_readphy(device_t, int, int);
static int e6000sw_writephy(device_t, int, int, int);
+static int e6000sw_readphy_locked(device_t, int, int);
+static int e6000sw_writephy_locked(device_t, int, int, int);
static int e6000sw_readphy(device_t, int, int);
static int e6000sw_writephy(device_t, int, int, int);
This revision is now accepted and ready to land.Jul 6 2022, 2:38 PM
This revision now requires review to proceed.Jul 7 2022, 7:50 AM
This revision is now accepted and ready to land.Jul 7 2022, 4:25 PM
This revision was automatically updated to reflect the committed changes.