Message ID | 20220207210730.75252-1-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 4e76b5c11d25119b16757f14a0a88415fd285df7 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [v2,net-next,1/6] ptp_pch: use mac_pton() | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Clearly marked for net-next |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/subject_prefix | success | Link |
netdev/cover_letter | warning | Series does not have a cover letter |
netdev/patch_count | success | Link |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/cc_maintainers | success | CCed 2 of 2 maintainers |
netdev/build_clang | success | Errors and warnings before: 0 this patch: 0 |
netdev/module_param | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/verify_fixes | success | No Fixes tag |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 62 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
On Mon, Feb 07, 2022 at 11:07:25PM +0200, Andy Shevchenko wrote: > Use mac_pton() instead of custom approach. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > v2: no changes > drivers/ptp/ptp_pch.c | 41 ++++++++++------------------------------- > 1 file changed, 10 insertions(+), 31 deletions(-) For the series: Acked-by: Richard Cochran <richardcochran@gmail.com>
Hello: This series was applied to netdev/net-next.git (master) by Jakub Kicinski <kuba@kernel.org>: On Mon, 7 Feb 2022 23:07:25 +0200 you wrote: > Use mac_pton() instead of custom approach. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > v2: no changes > drivers/ptp/ptp_pch.c | 41 ++++++++++------------------------------- > 1 file changed, 10 insertions(+), 31 deletions(-) Here is the summary with links: - [v2,net-next,1/6] ptp_pch: use mac_pton() https://git.kernel.org/netdev/net-next/c/4e76b5c11d25 - [v2,net-next,2/6] ptp_pch: Use ioread64_lo_hi() / iowrite64_lo_hi() https://git.kernel.org/netdev/net-next/c/8664d49a815e - [v2,net-next,3/6] ptp_pch: Use ioread64_hi_lo() / iowrite64_hi_lo() https://git.kernel.org/netdev/net-next/c/d09adf61002f - [v2,net-next,4/6] ptp_pch: Switch to use module_pci_driver() macro https://git.kernel.org/netdev/net-next/c/3fa66d3d60b9 - [v2,net-next,5/6] ptp_pch: Convert to use managed functions pcim_* and devm_* https://git.kernel.org/netdev/net-next/c/874f50c82e14 - [v2,net-next,6/6] ptp_pch: Remove unused pch_pm_ops https://git.kernel.org/netdev/net-next/c/946df10db670 You are awesome, thank you!
diff --git a/drivers/ptp/ptp_pch.c b/drivers/ptp/ptp_pch.c index 8070f3fd98f0..cbf7ce3db93a 100644 --- a/drivers/ptp/ptp_pch.c +++ b/drivers/ptp/ptp_pch.c @@ -100,7 +100,6 @@ struct pch_ts_regs { #define PCH_ECS_ETH (1 << 0) #define PCH_ECS_CAN (1 << 1) -#define PCH_STATION_BYTES 6 #define PCH_IEEE1588_ETH (1 << 0) #define PCH_IEEE1588_CAN (1 << 1) @@ -292,8 +291,9 @@ static void pch_reset(struct pch_dev *chip) */ int pch_set_station_address(u8 *addr, struct pci_dev *pdev) { - s32 i; struct pch_dev *chip = pci_get_drvdata(pdev); + bool valid; + u64 mac; /* Verify the parameter */ if ((chip->regs == NULL) || addr == (u8 *)NULL) { @@ -301,37 +301,16 @@ int pch_set_station_address(u8 *addr, struct pci_dev *pdev) "invalid params returning PCH_INVALIDPARAM\n"); return PCH_INVALIDPARAM; } - /* For all station address bytes */ - for (i = 0; i < PCH_STATION_BYTES; i++) { - u32 val; - s32 tmp; - tmp = hex_to_bin(addr[i * 3]); - if (tmp < 0) { - dev_err(&pdev->dev, - "invalid params returning PCH_INVALIDPARAM\n"); - return PCH_INVALIDPARAM; - } - val = tmp * 16; - tmp = hex_to_bin(addr[(i * 3) + 1]); - if (tmp < 0) { - dev_err(&pdev->dev, - "invalid params returning PCH_INVALIDPARAM\n"); - return PCH_INVALIDPARAM; - } - val += tmp; - /* Expects ':' separated addresses */ - if ((i < 5) && (addr[(i * 3) + 2] != ':')) { - dev_err(&pdev->dev, - "invalid params returning PCH_INVALIDPARAM\n"); - return PCH_INVALIDPARAM; - } - - /* Ideally we should set the address only after validating - entire string */ - dev_dbg(&pdev->dev, "invoking pch_station_set\n"); - iowrite32(val, &chip->regs->ts_st[i]); + valid = mac_pton(addr, (u8 *)&mac); + if (!valid) { + dev_err(&pdev->dev, "invalid params returning PCH_INVALIDPARAM\n"); + return PCH_INVALIDPARAM; } + + dev_dbg(&pdev->dev, "invoking pch_station_set\n"); + iowrite32(lower_32_bits(mac), &chip->regs->ts_st[0]); + iowrite32(upper_32_bits(mac), &chip->regs->ts_st[4]); return 0; } EXPORT_SYMBOL(pch_set_station_address);
Use mac_pton() instead of custom approach. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- v2: no changes drivers/ptp/ptp_pch.c | 41 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 31 deletions(-)