diff options
| -rw-r--r-- | drivers/net/can/mttcan/native/m_ttcan_linux.c | 2 | ||||
| -rw-r--r-- | drivers/platform/tegra/ptp-notifier.c | 23 | ||||
| -rw-r--r-- | include/linux/platform/tegra/ptp-notifier.h | 5 |
3 files changed, 18 insertions, 12 deletions
diff --git a/drivers/net/can/mttcan/native/m_ttcan_linux.c b/drivers/net/can/mttcan/native/m_ttcan_linux.c index 6829f9bde..820eb47fd 100644 --- a/drivers/net/can/mttcan/native/m_ttcan_linux.c +++ b/drivers/net/can/mttcan/native/m_ttcan_linux.c | |||
| @@ -104,6 +104,8 @@ static __init int mttcan_hw_init(struct mttcan_priv *priv) | |||
| 104 | 104 | ||
| 105 | ttcan_print_version(ttcan); | 105 | ttcan_print_version(ttcan); |
| 106 | 106 | ||
| 107 | raw_spin_lock_init(&priv->tc_lock); | ||
| 108 | |||
| 107 | return err; | 109 | return err; |
| 108 | } | 110 | } |
| 109 | 111 | ||
diff --git a/drivers/platform/tegra/ptp-notifier.c b/drivers/platform/tegra/ptp-notifier.c index 2bd047586..50dac5b54 100644 --- a/drivers/platform/tegra/ptp-notifier.c +++ b/drivers/platform/tegra/ptp-notifier.c | |||
| @@ -18,8 +18,9 @@ | |||
| 18 | 18 | ||
| 19 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
| 20 | 20 | ||
| 21 | static u64 (*get_systime)(void); | 21 | static u64 (*get_systime)(void *); |
| 22 | static DEFINE_SPINLOCK(ptp_notifier_lock); | 22 | static void *param; |
| 23 | static DEFINE_RAW_SPINLOCK(ptp_notifier_lock); | ||
| 23 | static ATOMIC_NOTIFIER_HEAD(tegra_hwtime_chain_head); | 24 | static ATOMIC_NOTIFIER_HEAD(tegra_hwtime_chain_head); |
| 24 | 25 | ||
| 25 | /* Clients register for notification of hwtime change events */ | 26 | /* Clients register for notification of hwtime change events */ |
| @@ -44,13 +45,14 @@ int tegra_hwtime_notifier_call_chain(unsigned int val, void *v) | |||
| 44 | return notifier_to_errno(ret); | 45 | return notifier_to_errno(ret); |
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | void tegra_register_hwtime_source(u64 (*func)(void)) | 48 | void tegra_register_hwtime_source(u64 (*func)(void *), void *data) |
| 48 | { | 49 | { |
| 49 | unsigned long flags; | 50 | unsigned long flags; |
| 50 | 51 | ||
| 51 | spin_lock_irqsave(&ptp_notifier_lock, flags); | 52 | raw_spin_lock_irqsave(&ptp_notifier_lock, flags); |
| 52 | get_systime = func; | 53 | get_systime = func; |
| 53 | spin_unlock_irqrestore(&ptp_notifier_lock, flags); | 54 | param = data; |
| 55 | raw_spin_unlock_irqrestore(&ptp_notifier_lock, flags); | ||
| 54 | 56 | ||
| 55 | /* Notify HW time stamp update to registered clients. | 57 | /* Notify HW time stamp update to registered clients. |
| 56 | * NULL callback parameter. We use a separate timestamp | 58 | * NULL callback parameter. We use a separate timestamp |
| @@ -64,9 +66,10 @@ void tegra_unregister_hwtime_source(void) | |||
| 64 | { | 66 | { |
| 65 | unsigned long flags; | 67 | unsigned long flags; |
| 66 | 68 | ||
| 67 | spin_lock_irqsave(&ptp_notifier_lock, flags); | 69 | raw_spin_lock_irqsave(&ptp_notifier_lock, flags); |
| 68 | get_systime = NULL; | 70 | get_systime = NULL; |
| 69 | spin_unlock_irqrestore(&ptp_notifier_lock, flags); | 71 | param = NULL; |
| 72 | raw_spin_unlock_irqrestore(&ptp_notifier_lock, flags); | ||
| 70 | } | 73 | } |
| 71 | EXPORT_SYMBOL(tegra_unregister_hwtime_source); | 74 | EXPORT_SYMBOL(tegra_unregister_hwtime_source); |
| 72 | 75 | ||
| @@ -75,12 +78,12 @@ u64 get_ptp_hwtime(void) | |||
| 75 | unsigned long flags; | 78 | unsigned long flags; |
| 76 | u64 ns; | 79 | u64 ns; |
| 77 | 80 | ||
| 78 | spin_lock_irqsave(&ptp_notifier_lock, flags); | 81 | raw_spin_lock_irqsave(&ptp_notifier_lock, flags); |
| 79 | if (get_systime) | 82 | if (get_systime) |
| 80 | ns = get_systime(); | 83 | ns = get_systime(param); |
| 81 | else | 84 | else |
| 82 | ns = ktime_to_ns(ktime_get_raw()); | 85 | ns = ktime_to_ns(ktime_get_raw()); |
| 83 | spin_unlock_irqrestore(&ptp_notifier_lock, flags); | 86 | raw_spin_unlock_irqrestore(&ptp_notifier_lock, flags); |
| 84 | 87 | ||
| 85 | return ns; | 88 | return ns; |
| 86 | } | 89 | } |
diff --git a/include/linux/platform/tegra/ptp-notifier.h b/include/linux/platform/tegra/ptp-notifier.h index 57a7b0070..17bd5e52c 100644 --- a/include/linux/platform/tegra/ptp-notifier.h +++ b/include/linux/platform/tegra/ptp-notifier.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | #if IS_ENABLED(CONFIG_TEGRA_PTP_NOTIFIER) | 22 | #if IS_ENABLED(CONFIG_TEGRA_PTP_NOTIFIER) |
| 23 | /* register / unregister HW time source */ | 23 | /* register / unregister HW time source */ |
| 24 | void tegra_register_hwtime_source(u64 (*func)(void)); | 24 | void tegra_register_hwtime_source(u64 (*func)(void *), void *data); |
| 25 | void tegra_unregister_hwtime_source(void); | 25 | void tegra_unregister_hwtime_source(void); |
| 26 | 26 | ||
| 27 | /* clients registering / unregistering for time update events */ | 27 | /* clients registering / unregistering for time update events */ |
| @@ -41,7 +41,8 @@ u64 get_ptp_hwtime(void); | |||
| 41 | #else /* CONFIG_TEGRA_PTP_NOTIFIER */ | 41 | #else /* CONFIG_TEGRA_PTP_NOTIFIER */ |
| 42 | 42 | ||
| 43 | /* register / unregister HW time source */ | 43 | /* register / unregister HW time source */ |
| 44 | static inline void tegra_register_hwtime_source(u64 (*func)(void)) | 44 | static inline void tegra_register_hwtime_source(u64 (*func)(void *), |
| 45 | void *data) | ||
| 45 | { | 46 | { |
| 46 | } | 47 | } |
| 47 | 48 | ||
