All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergio Paracuellos <sergio.paracuellos@gmail.com>
To: gregkh@linuxfoundation.org
Cc: driverdev-devel@linuxdriverproject.org, wsa@the-dreams.de
Subject: [PATCH 02/47] staging: ks7010: move tx and rx queues definitions into ks_wlan.h header
Date: Mon, 30 Apr 2018 15:43:47 +0200	[thread overview]
Message-ID: <1525095872-8613-3-git-send-email-sergio.paracuellos@gmail.com> (raw)
In-Reply-To: <1525095872-8613-1-git-send-email-sergio.paracuellos@gmail.com>

There are some definitions for rx and tx queues in ks7010_sdio
which is not the best place to put them. Changing them into the
ks_wlan header file there is no need to explicity include ks7010_sdio.h
which makes no sense at all and can be resolved easily using
forward declarations. The functions related with the queues circular
buffers have been moved also into this header.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/ks7010/ks7010_sdio.c |  45 --------------
 drivers/staging/ks7010/ks7010_sdio.h |  63 +-------------------
 drivers/staging/ks7010/ks_wlan.h     | 112 ++++++++++++++++++++++++++++++++++-
 3 files changed, 112 insertions(+), 108 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 6a5565d..9c22a76 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -8,7 +8,6 @@
  */
 
 #include <linux/atomic.h>
-#include <linux/circ_buf.h>
 #include <linux/firmware.h>
 #include <linux/jiffies.h>
 #include <linux/mmc/card.h>
@@ -98,50 +97,6 @@ enum gen_com_reg_b {
 
 #define KS7010_IO_BLOCK_SIZE 512
 
-static inline void inc_txqhead(struct ks_wlan_private *priv)
-{
-	priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE;
-}
-
-static inline void inc_txqtail(struct ks_wlan_private *priv)
-{
-	priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE;
-}
-
-static inline bool txq_has_space(struct ks_wlan_private *priv)
-{
-	return (CIRC_SPACE(priv->tx_dev.qhead, priv->tx_dev.qtail,
-			   TX_DEVICE_BUFF_SIZE) > 0);
-}
-
-static inline void inc_rxqhead(struct ks_wlan_private *priv)
-{
-	priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE;
-}
-
-static inline void inc_rxqtail(struct ks_wlan_private *priv)
-{
-	priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE;
-}
-
-static inline bool rxq_has_space(struct ks_wlan_private *priv)
-{
-	return (CIRC_SPACE(priv->rx_dev.qhead, priv->rx_dev.qtail,
-			   RX_DEVICE_BUFF_SIZE) > 0);
-}
-
-static inline unsigned int txq_count(struct ks_wlan_private *priv)
-{
-	return CIRC_CNT_TO_END(priv->tx_dev.qhead, priv->tx_dev.qtail,
-			       TX_DEVICE_BUFF_SIZE);
-}
-
-static inline unsigned int rxq_count(struct ks_wlan_private *priv)
-{
-	return CIRC_CNT_TO_END(priv->rx_dev.qhead, priv->rx_dev.qtail,
-			       RX_DEVICE_BUFF_SIZE);
-}
-
 /* Read single byte from device address into byte (CMD52) */
 static int ks7010_sdio_readb(struct ks_wlan_private *priv,
 			     u32 address, u8 *byte)
diff --git a/drivers/staging/ks7010/ks7010_sdio.h b/drivers/staging/ks7010/ks7010_sdio.h
index 831b2f1..891a09f 100644
--- a/drivers/staging/ks7010/ks7010_sdio.h
+++ b/drivers/staging/ks7010/ks7010_sdio.h
@@ -8,6 +8,8 @@
 #ifndef _KS7010_SDIO_H
 #define _KS7010_SDIO_H
 
+struct ks_wlan_private;
+
 /**
  * struct ks_sdio_card - SDIO device data.
  *
@@ -21,65 +23,4 @@ struct ks_sdio_card {
 	struct ks_wlan_private *priv;
 };
 
-/* Tx Device struct */
-#define	TX_DEVICE_BUFF_SIZE	1024
-
-/**
- * struct tx_device_buffer - Queue item for the tx queue.
- * @sendp: Pointer to the send request data.
- * @size: Size of @sendp data.
- * @complete_handler: Function called once data write to device is complete.
- * @arg1: First argument to @complete_handler.
- * @arg2: Second argument to @complete_handler.
- */
-struct tx_device_buffer {
-	unsigned char *sendp;
-	unsigned int size;
-	void (*complete_handler)(struct ks_wlan_private *priv,
-				 struct sk_buff *skb);
-	struct sk_buff *skb;
-};
-
-/**
- * struct tx_device - Tx buffer queue.
- * @tx_device_buffer: Queue buffer.
- * @qhead: Head of tx queue.
- * @qtail: Tail of tx queue.
- * @tx_dev_lock: Queue lock.
- */
-struct tx_device {
-	struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE];
-	unsigned int qhead;
-	unsigned int qtail;
-	spinlock_t tx_dev_lock;	/* protect access to the queue */
-};
-
-/* Rx Device struct */
-#define	RX_DATA_SIZE	(2 + 2 + 2347 + 1)
-#define	RX_DEVICE_BUFF_SIZE	32
-
-/**
- * struct rx_device_buffer - Queue item for the rx queue.
- * @data: rx data.
- * @size: Size of @data.
- */
-struct rx_device_buffer {
-	unsigned char data[RX_DATA_SIZE];
-	unsigned int size;
-};
-
-/**
- * struct rx_device - Rx buffer queue.
- * @rx_device_buffer: Queue buffer.
- * @qhead: Head of rx queue.
- * @qtail: Tail of rx queue.
- * @rx_dev_lock: Queue lock.
- */
-struct rx_device {
-	struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE];
-	unsigned int qhead;
-	unsigned int qtail;
-	spinlock_t rx_dev_lock;	/* protect access to the queue */
-};
-
 #endif /* _KS7010_SDIO_H */
diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 5070af8..d73f622 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -10,14 +10,13 @@
 #define _KS_WLAN_H
 
 #include <linux/atomic.h>	/* struct atomic_t */
+#include <linux/circ_buf.h>
 #include <linux/completion.h>	/* struct completion */
 #include <linux/netdevice.h>	/* struct net_device_stats,  struct sk_buff */
 #include <linux/sched.h>	/* wait_queue_head_t */
 #include <linux/spinlock.h>	/* spinlock_t */
 #include <linux/wireless.h>
 
-#include "ks7010_sdio.h"
-
 struct ks_wlan_parameter {
 	u8 operation_mode;	/* Operation Mode */
 	u8 channel;	/*  Channel */
@@ -366,6 +365,71 @@ struct wps_status {
 	u8 ie[255];
 };
 
+/* Tx Device struct */
+#define	TX_DEVICE_BUFF_SIZE	1024
+
+struct ks_wlan_private;
+
+/**
+ * struct tx_device_buffer - Queue item for the tx queue.
+ * @sendp: Pointer to the send request data.
+ * @size: Size of @sendp data.
+ * @complete_handler: Function called once data write to device is complete.
+ * @arg1: First argument to @complete_handler.
+ * @arg2: Second argument to @complete_handler.
+ */
+struct tx_device_buffer {
+	unsigned char *sendp;
+	unsigned int size;
+	void (*complete_handler)(struct ks_wlan_private *priv,
+				 struct sk_buff *skb);
+	struct sk_buff *skb;
+};
+
+/**
+ * struct tx_device - Tx buffer queue.
+ * @tx_device_buffer: Queue buffer.
+ * @qhead: Head of tx queue.
+ * @qtail: Tail of tx queue.
+ * @tx_dev_lock: Queue lock.
+ */
+struct tx_device {
+	struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE];
+	unsigned int qhead;
+	unsigned int qtail;
+	spinlock_t tx_dev_lock;	/* protect access to the queue */
+};
+
+/* Rx Device struct */
+#define	RX_DATA_SIZE	(2 + 2 + 2347 + 1)
+#define	RX_DEVICE_BUFF_SIZE	32
+
+/**
+ * struct rx_device_buffer - Queue item for the rx queue.
+ * @data: rx data.
+ * @size: Size of @data.
+ */
+struct rx_device_buffer {
+	unsigned char data[RX_DATA_SIZE];
+	unsigned int size;
+};
+
+/**
+ * struct rx_device - Rx buffer queue.
+ * @rx_device_buffer: Queue buffer.
+ * @qhead: Head of rx queue.
+ * @qtail: Tail of rx queue.
+ * @rx_dev_lock: Queue lock.
+ */
+struct rx_device {
+	struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE];
+	unsigned int qhead;
+	unsigned int qtail;
+	spinlock_t rx_dev_lock;	/* protect access to the queue */
+};
+
+struct ks_sdio_card;
+
 struct ks_wlan_private {
 	/* hardware information */
 	struct ks_sdio_card *ks_sdio_card;
@@ -452,6 +516,50 @@ struct ks_wlan_private {
 	uint wakeup_count;	/* for detect wakeup loop */
 };
 
+static inline void inc_txqhead(struct ks_wlan_private *priv)
+{
+	priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE;
+}
+
+static inline void inc_txqtail(struct ks_wlan_private *priv)
+{
+	priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE;
+}
+
+static inline bool txq_has_space(struct ks_wlan_private *priv)
+{
+	return (CIRC_SPACE(priv->tx_dev.qhead, priv->tx_dev.qtail,
+			   TX_DEVICE_BUFF_SIZE) > 0);
+}
+
+static inline void inc_rxqhead(struct ks_wlan_private *priv)
+{
+	priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE;
+}
+
+static inline void inc_rxqtail(struct ks_wlan_private *priv)
+{
+	priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE;
+}
+
+static inline bool rxq_has_space(struct ks_wlan_private *priv)
+{
+	return (CIRC_SPACE(priv->rx_dev.qhead, priv->rx_dev.qtail,
+			   RX_DEVICE_BUFF_SIZE) > 0);
+}
+
+static inline unsigned int txq_count(struct ks_wlan_private *priv)
+{
+	return CIRC_CNT_TO_END(priv->tx_dev.qhead, priv->tx_dev.qtail,
+			       TX_DEVICE_BUFF_SIZE);
+}
+
+static inline unsigned int rxq_count(struct ks_wlan_private *priv)
+{
+	return CIRC_CNT_TO_END(priv->rx_dev.qhead, priv->rx_dev.qtail,
+			       RX_DEVICE_BUFF_SIZE);
+}
+
 int ks_wlan_net_start(struct net_device *dev);
 int ks_wlan_net_stop(struct net_device *dev);
 bool is_connect_status(u32 status);
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  parent reply	other threads:[~2018-04-30 13:44 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30 13:43 [PATCH 00/47] staging: ks7010: next cleanups Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 01/47] staging: ks7010: add SPDX identifiers to all files Sergio Paracuellos
2018-04-30 13:43 ` Sergio Paracuellos [this message]
2018-04-30 13:43 ` [PATCH 03/47] staging: ks7010: avoid ks_sdio_card dependency in ks_wlan header Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 04/47] staging: ks7010: change netdev_dbg msg to avoid a long line Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 05/47] staging: ks7010: remove missing WPS preprocessor conditional code Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 06/47] staging: ks7010: use u8 instead of unsigned char in write_to_device function Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 07/47] staging: ks7010: change local variable type in _ks_wlan_hw_power_save Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 08/47] staging: ks7010: change local variable type in ks7010_rw_function Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 09/47] staging: ks7010: change some local variables type in ks_sdio_interrupt Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 10/47] staging: ks7010: change local variable type in ks7010_sdio_init_irqs Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 11/47] staging: ks7010: use the same parameter for 'event' in hostif_sme_enqueue Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 12/47] staging: ks7010: refactor ks7010_sme_enqueue_events function Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 13/47] staging: ks7010: change local variable type in ks_wlan_hw_rx Sergio Paracuellos
2018-04-30 13:43 ` [PATCH 14/47] staging: ks7010: remove nonsense comment in ks_wlan.h file Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 15/47] staging: ks7010: clean SME_MIC_FAILURE_REQUEST case in hostif_sme_execute Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 16/47] staging: ks7010: convert MIB preprocessor defs into an enum Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 17/47] staging: ks7010: conver MIB attributes " Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 18/47] staging: ks7010: change some casts from uint8_t to u8 in ks_hostif header Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 19/47] staging: ks7010: change parameter types and reorder them in hostif_mib_set_request Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 20/47] staging: ks7010: add new helpers to achieve mib set request and simplify code Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 21/47] staging: ks7010: use ether_addr_copy in get_current_ap Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 22/47] staging: ks7010: move two preprocessor definitions to ks_wlan.h Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 23/47] staging: ks7010: avoid two long lines in hostif_sme_mode_setup Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 24/47] staging: ks7010: remove non sense comments in ks_hostif.c source file Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 25/47] staging: ks7010: change type for rsn_enabled in wpa_status struct Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 26/47] staging: ks7010: use ether_addr_copy to copy ethernet address sa_data Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 27/47] staging: ks7010: use ether_addr_copy in get_ap_information function Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 28/47] staging: ks7010: move WLAN_EID_DS_PARAMS to different place inside switch Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 29/47] staging: ks7010: factor out send_request_to_device function Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 30/47] staging: ks7010: fix some style issues in ks_hostif.c Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 31/47] staging: ks7010: add blank line between after definitions Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 32/47] staging: ks7010: refactor hostif_sme_set_rsn function Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 33/47] staging: ks7010: change parameter types in hostif_power_mgmt_request Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 34/47] staging: ks7010: refactor hostif_sme_power_mgmt_set function Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 35/47] staging: ks7010: use ether_addr_copy in ks_wlan_set_mac_address Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 36/47] staging: ks7010: use ether_addr_copy in ks_wlan_net_start Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 37/47] staging: ks7010: refactor ks_wlan_set_sleep_mode function Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 38/47] staging: ks7010: refactor ks_wlan_set_phy_type function Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 39/47] staging: ks7010: refactor ks_wlan_set_mlme function Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 40/47] staging: ks7010: refactor ks_get_wireless_stats function Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 41/47] staging: ks7010: use CIRC_CNT_TO_END macro in cnt_smeqbody Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 42/47] staging: ks7010: refactor LOCAL_EEPROM_SUM case in hostif_mib_get_confirm Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 43/47] staging: ks7010: use u16 instead of unsigned short in hostif_event_check Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 44/47] staging: ks7010: use u16 instead of unsigned short in hostif_data_indication Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 45/47] staging: ks7010: use u16 instead of unsigned short in hostif_connect_indication Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 46/47] staging: ks7010: use u32 instead of unsigned int in hostif_bss_scan_confirm Sergio Paracuellos
2018-04-30 13:44 ` [PATCH 47/47] staging: ks7010: review local variable types in hostif_phy_information_confirm Sergio Paracuellos

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=1525095872-8613-3-git-send-email-sergio.paracuellos@gmail.com \
    --to=sergio.paracuellos@gmail.com \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=wsa@the-dreams.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.