aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ntb
diff options
context:
space:
mode:
authorJon Mason <jon.mason@intel.com>2013-01-21 17:28:52 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-21 17:34:21 -0500
commit74465645cdb4391b9fc95d12fd750a88012ad479 (patch)
tree6b64d37f7abe89195a0cfd8cff7931a03e14bff1 /drivers/ntb
parent719234f9444552a8b3ac30a7c373db62e13c14f4 (diff)
NTB: Fix Sparse Warnings
Address the sparse warnings and resulting fallout Signed-off-by: Jon Mason <jon.mason@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/ntb')
-rw-r--r--drivers/ntb/ntb_hw.c4
-rw-r--r--drivers/ntb/ntb_hw.h4
-rw-r--r--drivers/ntb/ntb_transport.c32
3 files changed, 20 insertions, 20 deletions
diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
index 6d8e937670c4..f802e7c92356 100644
--- a/drivers/ntb/ntb_hw.c
+++ b/drivers/ntb/ntb_hw.c
@@ -104,7 +104,7 @@ MODULE_DEVICE_TABLE(pci, ntb_pci_tbl);
104 * RETURNS: An appropriate -ERRNO error value on error, or zero for success. 104 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
105 */ 105 */
106int ntb_register_event_callback(struct ntb_device *ndev, 106int ntb_register_event_callback(struct ntb_device *ndev,
107 void (*func)(void *handle, unsigned int event)) 107 void (*func)(void *handle, enum ntb_hw_event event))
108{ 108{
109 if (ndev->event_cb) 109 if (ndev->event_cb)
110 return -EINVAL; 110 return -EINVAL;
@@ -343,7 +343,7 @@ int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
343 * 343 *
344 * RETURNS: pointer to virtual address, or NULL on error. 344 * RETURNS: pointer to virtual address, or NULL on error.
345 */ 345 */
346void *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw) 346void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
347{ 347{
348 if (mw > NTB_NUM_MW) 348 if (mw > NTB_NUM_MW)
349 return NULL; 349 return NULL;
diff --git a/drivers/ntb/ntb_hw.h b/drivers/ntb/ntb_hw.h
index 5e009519c64f..3a3038ca83e6 100644
--- a/drivers/ntb/ntb_hw.h
+++ b/drivers/ntb/ntb_hw.h
@@ -165,14 +165,14 @@ int ntb_register_db_callback(struct ntb_device *ndev, unsigned int idx,
165void ntb_unregister_db_callback(struct ntb_device *ndev, unsigned int idx); 165void ntb_unregister_db_callback(struct ntb_device *ndev, unsigned int idx);
166int ntb_register_event_callback(struct ntb_device *ndev, 166int ntb_register_event_callback(struct ntb_device *ndev,
167 void (*event_cb_func) (void *handle, 167 void (*event_cb_func) (void *handle,
168 unsigned int event)); 168 enum ntb_hw_event event));
169void ntb_unregister_event_callback(struct ntb_device *ndev); 169void ntb_unregister_event_callback(struct ntb_device *ndev);
170int ntb_get_max_spads(struct ntb_device *ndev); 170int ntb_get_max_spads(struct ntb_device *ndev);
171int ntb_write_local_spad(struct ntb_device *ndev, unsigned int idx, u32 val); 171int ntb_write_local_spad(struct ntb_device *ndev, unsigned int idx, u32 val);
172int ntb_read_local_spad(struct ntb_device *ndev, unsigned int idx, u32 *val); 172int ntb_read_local_spad(struct ntb_device *ndev, unsigned int idx, u32 *val);
173int ntb_write_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 val); 173int ntb_write_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 val);
174int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val); 174int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val);
175void *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw); 175void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw);
176resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw); 176resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw);
177void ntb_ring_sdb(struct ntb_device *ndev, unsigned int idx); 177void ntb_ring_sdb(struct ntb_device *ndev, unsigned int idx);
178void *ntb_find_transport(struct pci_dev *pdev); 178void *ntb_find_transport(struct pci_dev *pdev);
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index b3afb2442dc0..e0bdfd7f9930 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -58,7 +58,7 @@
58#include <linux/ntb.h> 58#include <linux/ntb.h>
59#include "ntb_hw.h" 59#include "ntb_hw.h"
60 60
61#define NTB_TRANSPORT_VERSION 1 61#define NTB_TRANSPORT_VERSION 2
62 62
63static unsigned int transport_mtu = 0x401E; 63static unsigned int transport_mtu = 0x401E;
64module_param(transport_mtu, uint, 0644); 64module_param(transport_mtu, uint, 0644);
@@ -91,14 +91,14 @@ struct ntb_transport_qp {
91 bool qp_link; 91 bool qp_link;
92 u8 qp_num; /* Only 64 QP's are allowed. 0-63 */ 92 u8 qp_num; /* Only 64 QP's are allowed. 0-63 */
93 93
94 struct ntb_rx_info *rx_info; 94 struct ntb_rx_info __iomem *rx_info;
95 struct ntb_rx_info *remote_rx_info; 95 struct ntb_rx_info *remote_rx_info;
96 96
97 void (*tx_handler) (struct ntb_transport_qp *qp, void *qp_data, 97 void (*tx_handler) (struct ntb_transport_qp *qp, void *qp_data,
98 void *data, int len); 98 void *data, int len);
99 struct list_head tx_free_q; 99 struct list_head tx_free_q;
100 spinlock_t ntb_tx_free_q_lock; 100 spinlock_t ntb_tx_free_q_lock;
101 void *tx_mw; 101 void __iomem *tx_mw;
102 unsigned int tx_index; 102 unsigned int tx_index;
103 unsigned int tx_max_entry; 103 unsigned int tx_max_entry;
104 unsigned int tx_max_frame; 104 unsigned int tx_max_frame;
@@ -166,7 +166,7 @@ enum {
166}; 166};
167 167
168struct ntb_payload_header { 168struct ntb_payload_header {
169 u64 ver; 169 unsigned int ver;
170 unsigned int len; 170 unsigned int len;
171 unsigned int flags; 171 unsigned int flags;
172}; 172};
@@ -474,7 +474,7 @@ static void ntb_transport_setup_qp_mw(struct ntb_transport *nt,
474 u8 mw_num = QP_TO_MW(qp_num); 474 u8 mw_num = QP_TO_MW(qp_num);
475 unsigned int i; 475 unsigned int i;
476 476
477 WARN_ON(nt->mw[mw_num].virt_addr == 0); 477 WARN_ON(nt->mw[mw_num].virt_addr == NULL);
478 478
479 if (nt->max_qps % NTB_NUM_MW && mw_num < nt->max_qps % NTB_NUM_MW) 479 if (nt->max_qps % NTB_NUM_MW && mw_num < nt->max_qps % NTB_NUM_MW)
480 num_qps_mw = nt->max_qps / NTB_NUM_MW + 1; 480 num_qps_mw = nt->max_qps / NTB_NUM_MW + 1;
@@ -933,7 +933,7 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp)
933 entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q); 933 entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q);
934 if (!entry) { 934 if (!entry) {
935 dev_dbg(&ntb_query_pdev(qp->ndev)->dev, 935 dev_dbg(&ntb_query_pdev(qp->ndev)->dev,
936 "no buffer - HDR ver %llu, len %d, flags %x\n", 936 "no buffer - HDR ver %u, len %d, flags %x\n",
937 hdr->ver, hdr->len, hdr->flags); 937 hdr->ver, hdr->len, hdr->flags);
938 qp->rx_err_no_buf++; 938 qp->rx_err_no_buf++;
939 return -ENOMEM; 939 return -ENOMEM;
@@ -946,9 +946,9 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp)
946 return -EAGAIN; 946 return -EAGAIN;
947 } 947 }
948 948
949 if (hdr->ver != qp->rx_pkts) { 949 if (hdr->ver != (u32) qp->rx_pkts) {
950 dev_dbg(&ntb_query_pdev(qp->ndev)->dev, 950 dev_dbg(&ntb_query_pdev(qp->ndev)->dev,
951 "qp %d: version mismatch, expected %llu - got %llu\n", 951 "qp %d: version mismatch, expected %llu - got %u\n",
952 qp->qp_num, qp->rx_pkts, hdr->ver); 952 qp->qp_num, qp->rx_pkts, hdr->ver);
953 ntb_list_add(&qp->ntb_rx_pend_q_lock, &entry->entry, 953 ntb_list_add(&qp->ntb_rx_pend_q_lock, &entry->entry,
954 &qp->rx_pend_q); 954 &qp->rx_pend_q);
@@ -965,7 +965,7 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp)
965 } 965 }
966 966
967 dev_dbg(&ntb_query_pdev(qp->ndev)->dev, 967 dev_dbg(&ntb_query_pdev(qp->ndev)->dev,
968 "rx offset %u, ver %llu - %d payload received, buf size %d\n", 968 "rx offset %u, ver %u - %d payload received, buf size %d\n",
969 qp->rx_index, hdr->ver, hdr->len, entry->len); 969 qp->rx_index, hdr->ver, hdr->len, entry->len);
970 970
971 if (hdr->len <= entry->len) { 971 if (hdr->len <= entry->len) {
@@ -988,7 +988,7 @@ out:
988 /* Ensure that the data is fully copied out before clearing the flag */ 988 /* Ensure that the data is fully copied out before clearing the flag */
989 wmb(); 989 wmb();
990 hdr->flags = 0; 990 hdr->flags = 0;
991 qp->rx_info->entry = qp->rx_index; 991 iowrite32(qp->rx_index, &qp->rx_info->entry);
992 992
993 qp->rx_index++; 993 qp->rx_index++;
994 qp->rx_index %= qp->rx_max_entry; 994 qp->rx_index %= qp->rx_max_entry;
@@ -1018,19 +1018,19 @@ static void ntb_transport_rxc_db(void *data, int db_num)
1018 1018
1019static void ntb_tx_copy_task(struct ntb_transport_qp *qp, 1019static void ntb_tx_copy_task(struct ntb_transport_qp *qp,
1020 struct ntb_queue_entry *entry, 1020 struct ntb_queue_entry *entry,
1021 void *offset) 1021 void __iomem *offset)
1022{ 1022{
1023 struct ntb_payload_header *hdr; 1023 struct ntb_payload_header __iomem *hdr;
1024 1024
1025 memcpy_toio(offset, entry->buf, entry->len); 1025 memcpy_toio(offset, entry->buf, entry->len);
1026 1026
1027 hdr = offset + qp->tx_max_frame - sizeof(struct ntb_payload_header); 1027 hdr = offset + qp->tx_max_frame - sizeof(struct ntb_payload_header);
1028 hdr->len = entry->len; 1028 iowrite32(entry->len, &hdr->len);
1029 hdr->ver = qp->tx_pkts; 1029 iowrite32((u32) qp->tx_pkts, &hdr->ver);
1030 1030
1031 /* Ensure that the data is fully copied out before setting the flag */ 1031 /* Ensure that the data is fully copied out before setting the flag */
1032 wmb(); 1032 wmb();
1033 hdr->flags = entry->flags | DESC_DONE_FLAG; 1033 iowrite32(entry->flags | DESC_DONE_FLAG, &hdr->flags);
1034 1034
1035 ntb_ring_sdb(qp->ndev, qp->qp_num); 1035 ntb_ring_sdb(qp->ndev, qp->qp_num);
1036 1036
@@ -1052,7 +1052,7 @@ static void ntb_tx_copy_task(struct ntb_transport_qp *qp,
1052static int ntb_process_tx(struct ntb_transport_qp *qp, 1052static int ntb_process_tx(struct ntb_transport_qp *qp,
1053 struct ntb_queue_entry *entry) 1053 struct ntb_queue_entry *entry)
1054{ 1054{
1055 void *offset; 1055 void __iomem *offset;
1056 1056
1057 offset = qp->tx_mw + qp->tx_max_frame * qp->tx_index; 1057 offset = qp->tx_mw + qp->tx_max_frame * qp->tx_index;
1058 1058