Commit 54930e88 authored by David Cross's avatar David Cross Committed by Greg Kroah-Hartman

staging: west bridge, addition of common lock on cyasdevice

This patch adds and initializes a common lock to
cyasdevice module. This is meant to be used in order
to avoid error scenarios where the device module
could be called by both the block and gadget modules
at the same time.
Signed-off-by: default avatarDavid Cross <david.cross@cypress.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d11a5c6e
...@@ -48,6 +48,8 @@ typedef struct cyasdevice { ...@@ -48,6 +48,8 @@ typedef struct cyasdevice {
cy_as_device_handle dev_handle; cy_as_device_handle dev_handle;
/* Handle to the HAL */ /* Handle to the HAL */
cy_as_hal_device_tag hal_tag; cy_as_hal_device_tag hal_tag;
spinlock_t common_lock;
unsigned long flags;
} cyasdevice; } cyasdevice;
/* global ptr to astoria device */ /* global ptr to astoria device */
...@@ -126,6 +128,20 @@ static void cy_misc_callback(cy_as_device_handle h, ...@@ -126,6 +128,20 @@ static void cy_misc_callback(cy_as_device_handle h,
} }
} }
void cy_as_acquire_common_lock()
{
spin_lock_irqsave(&cy_as_device_controller->common_lock,
cy_as_device_controller->flags);
}
EXPORT_SYMBOL(cy_as_acquire_common_lock);
void cy_as_release_common_lock()
{
spin_unlock_irqrestore(&cy_as_device_controller->common_lock,
cy_as_device_controller->flags);
}
EXPORT_SYMBOL(cy_as_release_common_lock);
/* reset astoria and reinit all regs */ /* reset astoria and reinit all regs */
#define PNAND_REG_CFG_INIT_VAL 0x0000 #define PNAND_REG_CFG_INIT_VAL 0x0000
void hal_reset(cy_as_hal_device_tag tag) void hal_reset(cy_as_hal_device_tag tag)
...@@ -331,6 +347,8 @@ static int cyasdevice_initialize(void) ...@@ -331,6 +347,8 @@ static int cyasdevice_initialize(void)
((ver_data.is_debug_mode) ? "debug" : "release"), ((ver_data.is_debug_mode) ? "debug" : "release"),
ver_data.major, ver_data.minor, ver_data.build, str); ver_data.major, ver_data.minor, ver_data.build, str);
spin_lock_init(&cy_as_dev->common_lock);
/* done now */ /* done now */
cy_as_device_controller = cy_as_dev; cy_as_device_controller = cy_as_dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment