From 6c1ca56d85377498bec760064c02e33f4678a2dd Mon Sep 17 00:00:00 2001 From: Vaibhav Hiremath Date: Thu, 5 May 2016 15:34:57 +0100 Subject: [PATCH] greybus: arche-platform: Rename spinlock variable lock => wake_detect_lock With addition of exported function, required for TIMESYNC operation, we need more locking mechanism for driver state, so to avoid confusion rename existing spinlock variable to its appropriate name. Testing Done: Tested on DB3.5 platform. Signed-off-by: Vaibhav Hiremath Signed-off-by: Bryan O'Donoghue Reviewed-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/arche-platform.c | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c index d1083cfbc081..9a117176ad50 100644 --- a/drivers/staging/greybus/arche-platform.c +++ b/drivers/staging/greybus/arche-platform.c @@ -55,7 +55,7 @@ struct arche_platform_drvdata { enum svc_wakedetect_state wake_detect_state; int wake_detect_irq; - spinlock_t lock; + spinlock_t wake_lock; /* Protect wake_detect_state */ unsigned long wake_detect_start; struct notifier_block pm_notifier; @@ -117,15 +117,15 @@ static irqreturn_t arche_platform_wd_irq_thread(int irq, void *devid) struct arche_platform_drvdata *arche_pdata = devid; unsigned long flags; - spin_lock_irqsave(&arche_pdata->lock, flags); + spin_lock_irqsave(&arche_pdata->wake_lock, flags); if (arche_pdata->wake_detect_state != WD_STATE_COLDBOOT_TRIG) { /* Something is wrong */ - spin_unlock_irqrestore(&arche_pdata->lock, flags); + spin_unlock_irqrestore(&arche_pdata->wake_lock, flags); return IRQ_HANDLED; } arche_pdata->wake_detect_state = WD_STATE_COLDBOOT_START; - spin_unlock_irqrestore(&arche_pdata->lock, flags); + spin_unlock_irqrestore(&arche_pdata->wake_lock, flags); /* It should complete power cycle, so first make sure it is poweroff */ device_for_each_child(arche_pdata->dev, NULL, apb_poweroff); @@ -137,9 +137,9 @@ static irqreturn_t arche_platform_wd_irq_thread(int irq, void *devid) if (usb3613_hub_mode_ctrl(true)) dev_warn(arche_pdata->dev, "failed to control hub device\n"); - spin_lock_irqsave(&arche_pdata->lock, flags); + spin_lock_irqsave(&arche_pdata->wake_lock, flags); arche_pdata->wake_detect_state = WD_STATE_IDLE; - spin_unlock_irqrestore(&arche_pdata->lock, flags); + spin_unlock_irqrestore(&arche_pdata->wake_lock, flags); return IRQ_HANDLED; } @@ -149,7 +149,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void *devid) struct arche_platform_drvdata *arche_pdata = devid; unsigned long flags; - spin_lock_irqsave(&arche_pdata->lock, flags); + spin_lock_irqsave(&arche_pdata->wake_lock, flags); if (gpio_get_value(arche_pdata->wake_detect_gpio)) { /* wake/detect rising */ @@ -170,7 +170,9 @@ static irqreturn_t arche_platform_wd_irq(int irq, void *devid) WD_STATE_COLDBOOT_START) { arche_pdata->wake_detect_state = WD_STATE_COLDBOOT_TRIG; - spin_unlock_irqrestore(&arche_pdata->lock, flags); + spin_unlock_irqrestore( + &arche_pdata->wake_lock, + flags); return IRQ_WAKE_THREAD; } } @@ -188,7 +190,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void *devid) } } - spin_unlock_irqrestore(&arche_pdata->lock, flags); + spin_unlock_irqrestore(&arche_pdata->wake_lock, flags); return IRQ_HANDLED; } @@ -257,9 +259,9 @@ static void arche_platform_poweroff_seq(struct arche_platform_drvdata *arche_pda /* Send disconnect/detach event to SVC */ gpio_direction_output(arche_pdata->wake_detect_gpio, 0); usleep_range(100, 200); - spin_lock_irqsave(&arche_pdata->lock, flags); + spin_lock_irqsave(&arche_pdata->wake_lock, flags); arche_pdata->wake_detect_state = WD_STATE_IDLE; - spin_unlock_irqrestore(&arche_pdata->lock, flags); + spin_unlock_irqrestore(&arche_pdata->wake_lock, flags); clk_disable_unprepare(arche_pdata->svc_ref_clk); } @@ -465,7 +467,7 @@ static int arche_platform_probe(struct platform_device *pdev) arche_pdata->dev = &pdev->dev; - spin_lock_init(&arche_pdata->lock); + spin_lock_init(&arche_pdata->wake_lock); arche_pdata->wake_detect_irq = gpio_to_irq(arche_pdata->wake_detect_gpio);