On Mon, Sep 11, 2023 at 04:29:11PM +0100, Russell King (Oracle) wrote: > Add a platform library of helper functions for common traits in the > platform drivers. Currently, this is setting the tx clock. > > Signed-off-by: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx> Hi Russell, some minor issues raised by checkpatch follow. > --- > drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +- > .../ethernet/stmicro/stmmac/stmmac_plat_lib.c | 29 +++++++++++++++++++ > .../ethernet/stmicro/stmmac/stmmac_plat_lib.h | 8 +++++ > 3 files changed, 38 insertions(+), 1 deletion(-) > create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_plat_lib.c > create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_plat_lib.h > > diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile > index 5b57aee19267..ba2cbfa0c9d1 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/Makefile > +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile > @@ -6,7 +6,7 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \ > mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o dwmac4_descs.o \ > dwmac4_dma.o dwmac4_lib.o dwmac4_core.o dwmac5.o hwif.o \ > stmmac_tc.o dwxgmac2_core.o dwxgmac2_dma.o dwxgmac2_descs.o \ > - stmmac_xdp.o \ > + stmmac_xdp.o stmmac_plat_lib.o \ > $(stmmac-y) > > stmmac-$(CONFIG_STMMAC_SELFTESTS) += stmmac_selftests.o > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_plat_lib.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_plat_lib.c > new file mode 100644 > index 000000000000..abb9f512bb0e > --- /dev/null > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_plat_lib.c > @@ -0,0 +1,29 @@ Is an SPDX identifier appropriate here? > +#include <linux/stmmac.h> > +#include <linux/clk.h> > + > +#include "stmmac_plat_lib.h" > + > +int dwmac_set_tx_clk_gmii(struct clk *tx_clk, int speed) > +{ > + unsigned long rate; > + > + switch (speed) { > + case SPEED_1000: > + rate = 125000000; > + break; > + > + case SPEED_100: > + rate = 25000000; > + break; > + > + case SPEED_10: > + rate = 2500000; > + break; > + > + default: > + return -ENOTSUPP; Checkpatch seems to think that EOPNOTSUPP would be more appropriate as "ENOTSUPP is not a SUSV4 error code". > + } > + > + return clk_set_rate(tx_clk, rate); > +} > +EXPORT_SYMBOL_GPL(dwmac_set_tx_clk_gmii); ...