Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'ptp_ocp-set-of-small-cleanups'

Andy Shevchenko says:

====================
ptp_ocp: set of small cleanups

The set of (independent) cleanups against ptp_ocp driver.
Each patch has its own description, no need to repeat it here.
====================

Link: https://lore.kernel.org/r/20220608120358.81147-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+10 -13
+10 -13
drivers/ptp/ptp_ocp.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* Copyright (c) 2020 Facebook */ 3 3 4 + #include <linux/bits.h> 4 5 #include <linux/err.h> 5 6 #include <linux/kernel.h> 6 7 #include <linux/module.h> ··· 89 88 #define TOD_CTRL_DISABLE_FMT_A BIT(17) 90 89 #define TOD_CTRL_DISABLE_FMT_B BIT(16) 91 90 #define TOD_CTRL_ENABLE BIT(0) 92 - #define TOD_CTRL_GNSS_MASK ((1U << 4) - 1) 91 + #define TOD_CTRL_GNSS_MASK GENMASK(3, 0) 93 92 #define TOD_CTRL_GNSS_SHIFT 24 94 93 95 - #define TOD_STATUS_UTC_MASK 0xff 94 + #define TOD_STATUS_UTC_MASK GENMASK(7, 0) 96 95 #define TOD_STATUS_UTC_VALID BIT(8) 97 96 #define TOD_STATUS_LEAP_ANNOUNCE BIT(12) 98 97 #define TOD_STATUS_LEAP_VALID BIT(16) ··· 206 205 #define FREQ_STATUS_VALID BIT(31) 207 206 #define FREQ_STATUS_ERROR BIT(30) 208 207 #define FREQ_STATUS_OVERRUN BIT(29) 209 - #define FREQ_STATUS_MASK (BIT(24) - 1) 208 + #define FREQ_STATUS_MASK GENMASK(23, 0) 210 209 211 210 struct ptp_ocp_flash_info { 212 211 const char *name; ··· 675 674 { } 676 675 }; 677 676 677 + #define SMA_DISABLE BIT(16) 678 678 #define SMA_ENABLE BIT(15) 679 - #define SMA_SELECT_MASK ((1U << 15) - 1) 680 - #define SMA_DISABLE 0x10000 679 + #define SMA_SELECT_MASK GENMASK(14, 0) 681 680 682 681 static const struct ocp_selector ptp_ocp_sma_in[] = { 683 682 { .name = "10Mhz", .value = 0x0000 }, ··· 2155 2154 struct ptp_pin_desc *config; 2156 2155 int i; 2157 2156 2158 - config = kzalloc(sizeof(*config) * 4, GFP_KERNEL); 2157 + config = kcalloc(4, sizeof(*config), GFP_KERNEL); 2159 2158 if (!config) 2160 2159 return -ENOMEM; 2161 2160 ··· 3441 3440 3442 3441 val = ioread32(&bp->tod->utc_status); 3443 3442 seq_printf(s, "UTC status register: 0x%08X\n", val); 3444 - seq_printf(s, "UTC offset: %d valid:%d\n", 3443 + seq_printf(s, "UTC offset: %ld valid:%d\n", 3445 3444 val & TOD_STATUS_UTC_MASK, val & TOD_STATUS_UTC_VALID ? 1 : 0); 3446 3445 seq_printf(s, "Leap second info valid:%d, Leap second announce %d\n", 3447 3446 val & TOD_STATUS_LEAP_VALID ? 1 : 0, ··· 3701 3700 serial8250_unregister_port(bp->mac_port); 3702 3701 if (bp->nmea_port != -1) 3703 3702 serial8250_unregister_port(bp->nmea_port); 3704 - if (bp->spi_flash) 3705 - platform_device_unregister(bp->spi_flash); 3706 - if (bp->i2c_ctrl) 3707 - platform_device_unregister(bp->i2c_ctrl); 3703 + platform_device_unregister(bp->spi_flash); 3704 + platform_device_unregister(bp->i2c_ctrl); 3708 3705 if (bp->i2c_clk) 3709 3706 clk_hw_unregister_fixed_rate(bp->i2c_clk); 3710 3707 if (bp->n_irqs) ··· 3772 3773 3773 3774 out: 3774 3775 ptp_ocp_detach(bp); 3775 - pci_set_drvdata(pdev, NULL); 3776 3776 out_disable: 3777 3777 pci_disable_device(pdev); 3778 3778 out_free: ··· 3787 3789 3788 3790 devlink_unregister(devlink); 3789 3791 ptp_ocp_detach(bp); 3790 - pci_set_drvdata(pdev, NULL); 3791 3792 pci_disable_device(pdev); 3792 3793 3793 3794 devlink_free(devlink);