IB/iser: Use helper for container_of
authorSagi Grimberg <sagig@mellanox.com>
Wed, 4 Nov 2015 08:50:32 +0000 (10:50 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 11 Dec 2015 22:10:51 +0000 (14:10 -0800)
Nicer this way.

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/infiniband/ulp/iser/iscsi_iser.h
drivers/infiniband/ulp/iser/iser_initiator.c
drivers/infiniband/ulp/iser/iser_verbs.c

index 10bba4c098bfbd2f2b0eba04ca3c13543f589797..87030799270a4f4a3875027991bea60d684243a3 100644 (file)
@@ -731,4 +731,10 @@ iser_tx_next_wr(struct iser_tx_desc *tx_desc)
        return cur_wr;
 }
 
+static inline struct iser_conn *
+to_iser_conn(struct ib_conn *ib_conn)
+{
+       return container_of(ib_conn, struct iser_conn, ib_conn);
+}
+
 #endif
index 21f28c8dd8444f897ed98c529af958d66d485078..21148b62d797b666995f6bb39fa660e9f7f38a1b 100644 (file)
@@ -559,8 +559,7 @@ void iser_rcv_completion(struct iser_rx_desc *rx_desc,
                         unsigned long rx_xfer_len,
                         struct ib_conn *ib_conn)
 {
-       struct iser_conn *iser_conn = container_of(ib_conn, struct iser_conn,
-                                                  ib_conn);
+       struct iser_conn *iser_conn = to_iser_conn(ib_conn);
        struct iscsi_hdr *hdr;
        char *data;
        u64 rx_dma;
index 7eccfa7e82f6333dc60af0429a19ee4fcdad36da..67c4e341291d29f38b2d512b6a907359436e0e78 100644 (file)
@@ -461,8 +461,7 @@ void iser_free_fastreg_pool(struct ib_conn *ib_conn)
  */
 static int iser_create_ib_conn_res(struct ib_conn *ib_conn)
 {
-       struct iser_conn *iser_conn = container_of(ib_conn, struct iser_conn,
-                                                  ib_conn);
+       struct iser_conn *iser_conn = to_iser_conn(ib_conn);
        struct iser_device      *device;
        struct ib_device_attr *dev_attr;
        struct ib_qp_init_attr  init_attr;
@@ -1166,9 +1165,8 @@ static void
 iser_handle_comp_error(struct ib_conn *ib_conn,
                       struct ib_wc *wc)
 {
+       struct iser_conn *iser_conn = to_iser_conn(ib_conn);
        void *wr_id = (void *)(uintptr_t)wc->wr_id;
-       struct iser_conn *iser_conn = container_of(ib_conn, struct iser_conn,
-                                                  ib_conn);
 
        if (wc->status != IB_WC_WR_FLUSH_ERR)
                if (iser_conn->iscsi_conn)