linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jassi Brar <jassisinghbrar@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org, s-anna@ti.com, tony@atomide.com,
	omar.ramirez@copitl.com, loic.pallardy@st.com,
	lftan.linux@gmail.com, slapdau@yahoo.com.au,
	courtney.cavin@sonymobile.com, rafael.j.wysocki@intel.com
Subject: [PATCHv3 6/6] mailbox: move the internal definitions into a private file
Date: Sat, 15 Feb 2014 23:57:02 +0530	[thread overview]
Message-ID: <1392488822-18178-1-git-send-email-jaswinder.singh@linaro.org> (raw)
In-Reply-To: <1392488526-17715-1-git-send-email-jaswinder.singh@linaro.org>

From: Suman Anna <s-anna@ti.com>

This is needed for extracting the omap_mbox. The OMAP mailbox
code has a need for exporting some pre-existing API to not
break the current clients.

Signed-off-by: Suman Anna <s-anna@ti.com>
---
 drivers/mailbox/mailbox.c          | 62 +-----------------------------
 drivers/mailbox/mailbox_internal.h | 77 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 61 deletions(-)
 create mode 100644 drivers/mailbox/mailbox_internal.h

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index bac767e..b0e7126 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -14,67 +14,7 @@
 #include <linux/mailbox_client.h>
 #include <linux/mailbox_controller.h>
 
-/*
- * The length of circular buffer for queuing messages from a client.
- * 'msg_count' tracks the number of buffered messages while 'msg_free'
- * is the index where the next message would be buffered.
- * We shouldn't need it too big because every transferr is interrupt
- * triggered and if we have lots of data to transfer, the interrupt
- * latencies are going to be the bottleneck, not the buffer length.
- * Besides, ipc_send_message could be called from atomic context and
- * the client could also queue another message from the notifier 'txcb'
- * of the last transfer done.
- * REVIST: If too many platforms see the "Try increasing MBOX_TX_QUEUE_LEN"
- * print, it needs to be taken from config option or somesuch.
- */
-#define MBOX_TX_QUEUE_LEN	20
-
-#define TXDONE_BY_IRQ	(1 << 0) /* controller has remote RTR irq */
-#define TXDONE_BY_POLL	(1 << 1) /* controller can read status of last TX */
-#define TXDONE_BY_ACK	(1 << 2) /* S/W ACK recevied by Client ticks the TX */
-
-struct ipc_chan {
-	char name[16]; /* link_name */
-	struct ipc_con *con; /* Parent Controller */
-	unsigned txdone_method;
-
-	/* Cached values from controller */
-	struct ipc_link *link;
-	struct ipc_link_ops *link_ops;
-
-	/* Cached values from client */
-	void *cl_id;
-	void (*rxcb)(void *cl_id, void *mssg);
-	void (*txcb)(void *cl_id, void *mssg, enum xfer_result r);
-	bool tx_block;
-	unsigned long tx_tout;
-	struct completion tx_complete;
-
-	void *active_req;
-	unsigned msg_count, msg_free;
-	void *msg_data[MBOX_TX_QUEUE_LEN];
-	bool assigned;
-	/* Serialize access to the channel */
-	spinlock_t lock;
-	/* Hook to add to the controller's list of channels */
-	struct list_head node;
-	/* Notifier to all clients waiting on aquiring this channel */
-	struct blocking_notifier_head avail;
-};
-
-/* Internal representation of a controller */
-struct ipc_con {
-	char name[16]; /* controller_name */
-	struct list_head channels;
-	/*
-	 * If the controller supports only TXDONE_BY_POLL,
-	 * this timer polls all the links for txdone.
-	 */
-	struct timer_list poll;
-	unsigned period;
-	/* Hook to add to the global controller list */
-	struct list_head node;
-};
+#include "mailbox_internal.h"
 
 static LIST_HEAD(ipc_cons);
 static DEFINE_MUTEX(con_mutex);
diff --git a/drivers/mailbox/mailbox_internal.h b/drivers/mailbox/mailbox_internal.h
new file mode 100644
index 0000000..a39dcb7
--- /dev/null
+++ b/drivers/mailbox/mailbox_internal.h
@@ -0,0 +1,77 @@
+/*
+ * mailbox: interprocessor communication module
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef MAILBOX_INTERNAL_H
+#define MAILBOX_INTERNAL_H
+
+#include <linux/device.h>
+#include <linux/mailbox_controller.h>
+
+/*
+ * The length of circular buffer for queuing messages from a client.
+ * 'msg_count' tracks the number of buffered messages while 'msg_free'
+ * is the index where the next message would be buffered.
+ * We shouldn't need it too big because every transferr is interrupt
+ * triggered and if we have lots of data to transfer, the interrupt
+ * latencies are going to be the bottleneck, not the buffer length.
+ * Besides, ipc_send_message could be called from atomic context and
+ * the client could also queue another message from the notifier 'txcb'
+ * of the last transfer done.
+ * REVIST: If too many platforms see the "Try increasing MBOX_TX_QUEUE_LEN"
+ * print, it needs to be taken from config option or somesuch.
+ */
+#define MBOX_TX_QUEUE_LEN	20
+
+#define TXDONE_BY_IRQ	(1 << 0) /* controller has remote RTR irq */
+#define TXDONE_BY_POLL	(1 << 1) /* controller can read status of last TX */
+#define TXDONE_BY_ACK	(1 << 2) /* S/W ACK recevied by Client ticks the TX */
+
+struct ipc_chan {
+	char name[16]; /* link_name */
+	struct ipc_con *con; /* Parent Controller */
+	unsigned txdone_method;
+
+	/* Cached values from controller */
+	struct ipc_link *link;
+	struct ipc_link_ops *link_ops;
+
+	/* Cached values from client */
+	void *cl_id;
+	void (*rxcb)(void *cl_id, void *mssg);
+	void (*txcb)(void *cl_id, void *mssg, enum xfer_result r);
+	bool tx_block;
+	unsigned long tx_tout;
+	struct completion tx_complete;
+
+	void *active_req;
+	unsigned msg_count, msg_free;
+	void *msg_data[MBOX_TX_QUEUE_LEN];
+	bool assigned;
+	/* Serialize access to the channel */
+	spinlock_t lock;
+	/* Hook to add to the controller's list of channels */
+	struct list_head node;
+	/* Notifier to all clients waiting on aquiring this channel */
+	struct blocking_notifier_head avail;
+};
+
+/* Internal representation of a controller */
+struct ipc_con {
+	char name[16]; /* controller_name */
+	struct list_head channels;
+	/*
+	 * If the controller supports only TXDONE_BY_POLL,
+	 * this timer polls all the links for txdone.
+	 */
+	struct timer_list poll;
+	unsigned period;
+	/* Hook to add to the global controller list */
+	struct list_head node;
+};
+
+#endif /* MAILBOX_INTERNAL_H */
-- 
1.8.1.2


  parent reply	other threads:[~2014-02-15 18:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-15 18:22 [PATCHv3] Generic Mailbox API Jassi Brar
2014-02-15 18:24 ` [PATCHv3 1/6] mailbox: rename pl320-ipc specific mailbox.h Jassi Brar
2014-02-15 18:25 ` [PATCHv3 2/6] mailbox: Introduce a new common API Jassi Brar
2014-02-15 19:03   ` Greg KH
2014-02-15 19:04   ` Greg KH
2014-02-15 19:05   ` Greg KH
2014-02-15 19:15   ` Greg KH
2014-02-16  6:36     ` Jassi Brar
2014-02-16 16:36       ` Greg KH
2014-02-18  0:52   ` Courtney Cavin
2014-02-18  7:06     ` Jassi Brar
2014-02-18 17:30       ` Bjorn Andersson
2014-02-18 18:33         ` Jassi Brar
2014-02-18 19:47       ` Courtney Cavin
2014-02-19 21:43         ` Jassi Brar
2014-02-18 21:32   ` Kumar Gala
2014-02-19 10:53     ` Jassi Brar
2014-02-15 18:25 ` [PATCHv3 3/6] mailbox: pl320: Introduce common API driver Jassi Brar
2014-02-15 18:26 ` [PATCHv3 4/6] mailbox: Fix TX completion init Jassi Brar
2014-02-15 18:26 ` [PATCHv3 5/6] mailbox: Fix deleteing poll timer Jassi Brar
2014-02-15 18:27 ` Jassi Brar [this message]
2014-02-15 19:15   ` [PATCHv3 6/6] mailbox: move the internal definitions into a private file Greg KH
2014-02-15 19:16   ` Greg KH
2014-02-16  6:38     ` Jassi Brar
2014-02-17  5:57 ` [PATCHv3] Generic Mailbox API Craig McGeachie
2014-02-17  6:02   ` Jassi Brar
2014-02-17  6:03 ` Craig McGeachie
2014-02-17  6:12   ` Jassi Brar
2014-03-06  3:55 ` Jassi Brar

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=1392488822-18178-1-git-send-email-jaswinder.singh@linaro.org \
    --to=jassisinghbrar@gmail.com \
    --cc=courtney.cavin@sonymobile.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=lftan.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.pallardy@st.com \
    --cc=omar.ramirez@copitl.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=s-anna@ti.com \
    --cc=slapdau@yahoo.com.au \
    --cc=tony@atomide.com \
    /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;
as well as URLs for NNTP newsgroup(s).