From patchwork Thu Mar 19 14:33:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Wang X-Patchwork-Id: 6050031 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2A7619F2A9 for ; Thu, 19 Mar 2015 14:33:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5617C20527 for ; Thu, 19 Mar 2015 14:33:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E406920525 for ; Thu, 19 Mar 2015 14:33:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755120AbbCSOdN (ORCPT ); Thu, 19 Mar 2015 10:33:13 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:36758 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754578AbbCSOdN (ORCPT ); Thu, 19 Mar 2015 10:33:13 -0400 Received: by wgra20 with SMTP id a20so64095562wgr.3 for ; Thu, 19 Mar 2015 07:33:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=jrFhAdCq/ug6Us0JO7RmZu//PLtJWZI7mAsQhnN8B7k=; b=YkyU/JnqnZ+w60knNhE+amejC5nvFy3kQTLYY/hCiBJDgx1NpPzv4RqS1IRs9892eY 1gCaI4jGMAt1y/9QRtUzSRrQLsOugdQBcTXP6mn3SU+AV3GRZKMwj8wwsiqf4ew4VCCO iTNr0fgMYQaYDFS+KHnyhgNgvRC8tBkb6bmhwHGyn+Ax06gl9PVbBBMiQfw8Z2J70hag elGT2RiM8b/c7RZaao81KvdH4hYZ0dBBLNKsGqmSq9YHzKoStm1nzp56GPQXU/TIwZx5 CDkSKeSev0NswvQbEb1JIPotyFQ/06n/JglpYJ1sflHaKk8358kWP4I5PUopiWG5sGPJ gnjA== X-Gm-Message-State: ALoCoQllGPAdlwI1swwbJ/bTEw9EMi5YK9eRQP1yWi0UuSzqZpF9203aR+sb1cUboA2zQntveMdV X-Received: by 10.180.35.72 with SMTP id f8mr10051854wij.31.1426775591904; Thu, 19 Mar 2015 07:33:11 -0700 (PDT) Received: from [192.168.71.52] ([62.217.45.26]) by mx.google.com with ESMTPSA id e18sm2212148wjz.27.2015.03.19.07.33.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 07:33:11 -0700 (PDT) Message-ID: <550ADE25.9060605@profitbricks.com> Date: Thu, 19 Mar 2015 15:33:09 +0100 From: Michael Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC] IB/core: Move start_port() and end_port() to head file Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP start_port() and end_port() has been defined in both 'cache.c' and 'device.c' with exactly the same implementation. This patch move them to the head file 'core_priv.h' for all the IB core files to utilize. Signed-off-by: Michael Wang --- drivers/infiniband/core/cache.c | 11 ----------- drivers/infiniband/core/core_priv.h | 12 ++++++++++++ drivers/infiniband/core/device.c | 12 ------------ 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 80f6cf2..02315a1 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -58,17 +58,6 @@ struct ib_update_work { u8 port_num; }; -static inline int start_port(struct ib_device *device) -{ - return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1; -} - -static inline int end_port(struct ib_device *device) -{ - return (device->node_type == RDMA_NODE_IB_SWITCH) ? - 0 : device->phys_port_cnt; -} - int ib_get_cached_gid(struct ib_device *device, u8 port_num, int index, diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index 87d1936..3a74db0 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h @@ -51,4 +51,16 @@ void ib_cache_cleanup(void); int ib_resolve_eth_l2_attrs(struct ib_qp *qp, struct ib_qp_attr *qp_attr, int *qp_attr_mask); + +static inline int start_port(struct ib_device *device) +{ + return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1; +} + +static inline int end_port(struct ib_device *device) +{ + return (device->node_type == RDMA_NODE_IB_SWITCH) ? + 0 : device->phys_port_cnt; +} + #endif /* _CORE_PRIV_H */ diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 18c1ece..2c29dea 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -151,18 +151,6 @@ static int alloc_name(char *name) return 0; } -static int start_port(struct ib_device *device) -{ - return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1; -} - - -static int end_port(struct ib_device *device) -{ - return (device->node_type == RDMA_NODE_IB_SWITCH) ? - 0 : device->phys_port_cnt; -} - /** * ib_alloc_device - allocate an IB device struct * @size:size of structure to allocate