From patchwork Sun Apr 5 21:13:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 6162641 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 38CA3BF4A6 for ; Sun, 5 Apr 2015 21:13:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2407A203B7 for ; Sun, 5 Apr 2015 21:13:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 168B1203B6 for ; Sun, 5 Apr 2015 21:13:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752643AbbDEVNv (ORCPT ); Sun, 5 Apr 2015 17:13:51 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:33614 "EHLO mail-lb0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752010AbbDEVNu (ORCPT ); Sun, 5 Apr 2015 17:13:50 -0400 Received: by lbbzk7 with SMTP id zk7so9574212lbb.0 for ; Sun, 05 Apr 2015 14:13:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:mime-version:content-transfer-encoding:content-type; bh=40r2Zrm6yKgs4atdS03H0FRGOr2KOR0Bvn109z4BQVk=; b=Fv3AI09wXK4i5ISi9dFkvB5WqHhU/hP2RBLu143MDEAMfTVlK1qkl1pPnOFRbYkdt+ BR5zXwmOWLxw5gQvIftlQu5ZeGYisCHERCK3pYvfz+m5pEBm//zfeDwWNjXz+BeQUDsF 0d1zM6je9RM3SwbCxLFrG3aGJroZWcbtgqwNuLEPMo4OHatpHmQjWTMzmd2EFIWhHQew pRSbM2prUDhcogpJ9DHxmPvFxK4ql+rguLHPaIaE8dEqGzw5/DhI/fiMp7rdOp5x/nHB RK2kqoghWuI97Cz/qUiJF1b0ExP8LPIAQx8otfvsq0iQj/Yysc8tTONjONCNnZxlzh7u N/YQ== X-Gm-Message-State: ALoCoQmE60vKfiPVr74+UMaKEKmP8wLIuaa33cCu+mjzJKwKs2ChqXEDSNHz9PDX0DFbOqmRMmhf X-Received: by 10.152.27.194 with SMTP id v2mr10817402lag.75.1428268428982; Sun, 05 Apr 2015 14:13:48 -0700 (PDT) Received: from wasted.cogentembedded.com (ppp28-175.pppoe.mtu-net.ru. [81.195.28.175]) by mx.google.com with ESMTPSA id zv4sm531108lbb.29.2015.04.05.14.13.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Apr 2015 14:13:47 -0700 (PDT) From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH] sh_eth: move inline functions to the header file Date: Mon, 06 Apr 2015 00:13:46 +0300 Message-ID: <4254119.qJUdUQCUqs@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.4 (Linux/3.18.9-100.fc20.x86_64; KDE/4.14.6; x86_64; ; ) MIME-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@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=ham 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 The explicitly inline functions belong to the header files, so move cpu_to_edmac() and edmac_to_cpu() into the driver header. While at it, make these functions return 'u32' instead of '__u32'. Signed-off-by: Sergei Shtylyov --- The patch is against the David Miller's 'net-next.git' repo. I was going to let gcc figure out whether inlining was needed but it turned out that with *inline* keywords removed gcc generated even more code... drivers/net/ethernet/renesas/sh_eth.c | 24 ------------------------ drivers/net/ethernet/renesas/sh_eth.h | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 24 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net-next/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net-next/drivers/net/ethernet/renesas/sh_eth.c @@ -941,30 +941,6 @@ static void sh_eth_set_receive_align(str skb_reserve(skb, SH_ETH_RX_ALIGN - reserve); } - -/* CPU <-> EDMAC endian convert */ -static inline __u32 cpu_to_edmac(struct sh_eth_private *mdp, u32 x) -{ - switch (mdp->edmac_endian) { - case EDMAC_LITTLE_ENDIAN: - return cpu_to_le32(x); - case EDMAC_BIG_ENDIAN: - return cpu_to_be32(x); - } - return x; -} - -static inline __u32 edmac_to_cpu(struct sh_eth_private *mdp, u32 x) -{ - switch (mdp->edmac_endian) { - case EDMAC_LITTLE_ENDIAN: - return le32_to_cpu(x); - case EDMAC_BIG_ENDIAN: - return be32_to_cpu(x); - } - return x; -} - /* Program the hardware MAC address from dev->dev_addr. */ static void update_mac_address(struct net_device *ndev) { Index: net-next/drivers/net/ethernet/renesas/sh_eth.h =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.h +++ net-next/drivers/net/ethernet/renesas/sh_eth.h @@ -546,6 +546,29 @@ static inline void sh_eth_soft_swap(char #endif } +/* CPU <-> EDMAC endian convert */ +static inline u32 cpu_to_edmac(struct sh_eth_private *mdp, u32 x) +{ + switch (mdp->edmac_endian) { + case EDMAC_LITTLE_ENDIAN: + return cpu_to_le32(x); + case EDMAC_BIG_ENDIAN: + return cpu_to_be32(x); + } + return x; +} + +static inline u32 edmac_to_cpu(struct sh_eth_private *mdp, u32 x) +{ + switch (mdp->edmac_endian) { + case EDMAC_LITTLE_ENDIAN: + return le32_to_cpu(x); + case EDMAC_BIG_ENDIAN: + return be32_to_cpu(x); + } + return x; +} + #define SH_ETH_OFFSET_INVALID ((u16) ~0) static inline void sh_eth_write(struct net_device *ndev, u32 data,