mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Cross <david.cross@cypress.com>
To: greg@kroah.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] west bridge, addition of common lock on cyasdevice
Date: Tue, 05 Oct 2010 18:48:08 -0700	[thread overview]
Message-ID: <1286329688.9470.11.camel@odc-laptop> (raw)
In-Reply-To: <1285287600.17888.2.camel@odc-laptop>

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: David Cross <david.cross@cypress.com>
---
diff -uprN -X linux-next-vanilla/Documentation/dontdiff linux-next-vanilla/drivers/staging/westbridge/astoria/device/cyasdevice.c linux-next-incremen/drivers/staging/westbridge/astoria/device/cyasdevice.c
--- linux-next-vanilla/drivers/staging/westbridge/astoria/device/cyasdevice.c	2010-10-04 21:56:31.000000000 -0700
+++ linux-next-incremen/drivers/staging/westbridge/astoria/device/cyasdevice.c	2010-10-05 16:25:18.000000000 -0700
@@ -48,6 +48,8 @@ typedef struct cyasdevice {
 		cy_as_device_handle			dev_handle;
 		/* Handle to the HAL */
 		cy_as_hal_device_tag			hal_tag;
+		spinlock_t	  common_lock;
+		unsigned long flags;
 } cyasdevice;
 
 /* global ptr to astoria device */
@@ -126,6 +128,20 @@ static void cy_misc_callback(cy_as_devic
 	}
 }
 
+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 */
  #define PNAND_REG_CFG_INIT_VAL 0x0000
 void  hal_reset(cy_as_hal_device_tag tag)
@@ -331,6 +347,8 @@ static int cyasdevice_initialize(void)
 		((ver_data.is_debug_mode) ? "debug" : "release"),
 		ver_data.major, ver_data.minor, ver_data.build, str);
 
+	spin_lock_init(&cy_as_dev->common_lock);
+
 	/* done now */
 	cy_as_device_controller = cy_as_dev;
 


---------------------------------------------------------------
This message and any attachments may contain Cypress (or its
subsidiaries) confidential information. If it has been received
in error, please advise the sender and immediately delete this
message.
---------------------------------------------------------------


  parent reply	other threads:[~2010-10-06  1:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-24  0:20 [PATCH] west bridge, cyasgadget fix for usb_gadget_probe_driver David Cross
2010-09-30  1:37 ` Staging: " Greg KH
     [not found] ` <1285287885.17888.7.camel@odc-laptop>
2010-10-06  1:44   ` [PATCH] west bridge cyasgadget, removal of " " before ";" David Cross
2010-10-06  1:48 ` David Cross [this message]
2010-10-06  1:50   ` [PATCH] west bridge, block driver change for partition support David Cross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1286329688.9470.11.camel@odc-laptop \
    --to=david.cross@cypress.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome