mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
net: ti: icss-iep: Remove spinlock-based synchronization
[ Upstream commit 5758e03cf604aa282b9afa61aec3188c4a9b3fe7 ] As all sources of concurrency in hardware register access occur in non-interrupt context eliminate spinlock-based synchronization and rely on the mutex-based synchronization that is already present. Signed-off-by: Diogo Ivo <diogo.ivo@siemens.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Stable-dep-of: 54e1b4becf5e ("net: ti: icss-iep: Reject perout generation request") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
73b769252d
commit
8a299cc110
@@ -110,7 +110,6 @@ struct icss_iep {
|
||||
struct ptp_clock_info ptp_info;
|
||||
struct ptp_clock *ptp_clock;
|
||||
struct mutex ptp_clk_mutex; /* PHC access serializer */
|
||||
spinlock_t irq_lock; /* CMP IRQ vs icss_iep_ptp_enable access */
|
||||
u32 def_inc;
|
||||
s16 slow_cmp_inc;
|
||||
u32 slow_cmp_count;
|
||||
@@ -192,14 +191,11 @@ static void icss_iep_update_to_next_boundary(struct icss_iep *iep, u64 start_ns)
|
||||
*/
|
||||
static void icss_iep_settime(struct icss_iep *iep, u64 ns)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
if (iep->ops && iep->ops->settime) {
|
||||
iep->ops->settime(iep->clockops_data, ns);
|
||||
return;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&iep->irq_lock, flags);
|
||||
if (iep->pps_enabled || iep->perout_enabled)
|
||||
writel(0, iep->base + iep->plat_data->reg_offs[ICSS_IEP_SYNC_CTRL_REG]);
|
||||
|
||||
@@ -210,7 +206,6 @@ static void icss_iep_settime(struct icss_iep *iep, u64 ns)
|
||||
writel(IEP_SYNC_CTRL_SYNC_N_EN(0) | IEP_SYNC_CTRL_SYNC_EN,
|
||||
iep->base + iep->plat_data->reg_offs[ICSS_IEP_SYNC_CTRL_REG]);
|
||||
}
|
||||
spin_unlock_irqrestore(&iep->irq_lock, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -549,7 +544,6 @@ static int icss_iep_perout_enable_hw(struct icss_iep *iep,
|
||||
static int icss_iep_perout_enable(struct icss_iep *iep,
|
||||
struct ptp_perout_request *req, int on)
|
||||
{
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&iep->ptp_clk_mutex);
|
||||
@@ -562,11 +556,9 @@ static int icss_iep_perout_enable(struct icss_iep *iep,
|
||||
if (iep->perout_enabled == !!on)
|
||||
goto exit;
|
||||
|
||||
spin_lock_irqsave(&iep->irq_lock, flags);
|
||||
ret = icss_iep_perout_enable_hw(iep, req, on);
|
||||
if (!ret)
|
||||
iep->perout_enabled = !!on;
|
||||
spin_unlock_irqrestore(&iep->irq_lock, flags);
|
||||
|
||||
exit:
|
||||
mutex_unlock(&iep->ptp_clk_mutex);
|
||||
@@ -578,7 +570,6 @@ static int icss_iep_pps_enable(struct icss_iep *iep, int on)
|
||||
{
|
||||
struct ptp_clock_request rq;
|
||||
struct timespec64 ts;
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
u64 ns;
|
||||
|
||||
@@ -592,8 +583,6 @@ static int icss_iep_pps_enable(struct icss_iep *iep, int on)
|
||||
if (iep->pps_enabled == !!on)
|
||||
goto exit;
|
||||
|
||||
spin_lock_irqsave(&iep->irq_lock, flags);
|
||||
|
||||
rq.perout.index = 0;
|
||||
if (on) {
|
||||
ns = icss_iep_gettime(iep, NULL);
|
||||
@@ -610,8 +599,6 @@ static int icss_iep_pps_enable(struct icss_iep *iep, int on)
|
||||
if (!ret)
|
||||
iep->pps_enabled = !!on;
|
||||
|
||||
spin_unlock_irqrestore(&iep->irq_lock, flags);
|
||||
|
||||
exit:
|
||||
mutex_unlock(&iep->ptp_clk_mutex);
|
||||
|
||||
@@ -861,7 +848,6 @@ static int icss_iep_probe(struct platform_device *pdev)
|
||||
|
||||
iep->ptp_info = icss_iep_ptp_info;
|
||||
mutex_init(&iep->ptp_clk_mutex);
|
||||
spin_lock_init(&iep->irq_lock);
|
||||
dev_set_drvdata(dev, iep);
|
||||
icss_iep_disable(iep);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user