From patchwork Sat Dec 12 22:44:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 7837611 X-Patchwork-Delegate: horms@verge.net.au Return-Path: X-Original-To: patchwork-linux-sh@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 1E3879F350 for ; Sat, 12 Dec 2015 22:46:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B924203AE for ; Sat, 12 Dec 2015 22:46:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB7332039E for ; Sat, 12 Dec 2015 22:46:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751206AbbLLWo7 (ORCPT ); Sat, 12 Dec 2015 17:44:59 -0500 Received: from mail-lf0-f44.google.com ([209.85.215.44]:33556 "EHLO mail-lf0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750876AbbLLWo6 (ORCPT ); Sat, 12 Dec 2015 17:44:58 -0500 Received: by lfap203 with SMTP id p203so31560148lfa.0 for ; Sat, 12 Dec 2015 14:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :mime-version:content-transfer-encoding:content-type; bh=2hJ7GMaKr1OGsEcyDvu+Xa2ZgxwEPC5gEFP1GeGbJWI=; b=p+VQTtdRjr1i9SMiTyjcaVsITgg53lJ9UuBtdAzUuDQuEwkamo4haJr77kM/U9iGIJ RItGet/nVgHvgIIR7zDJ+8gXz7qLeuNhwz6MU7KTY1NxtrK7xw/N+v5HEC33WJa2+ZjP r4cp9poNYMTIbaZrEtN3rYqkvuBYeE5Lu1Xj/FySiHmTO5041ybYuJ4LGC6Vs1zvhAPo Q+Z3KoPndOZmEUmJRX2prOxQrMLnbz+VldKtShMc8fJeVDXwOWQXjGalt0QEUlVACRPj 0X8uT0JbBShuDkY+ovQwr/xUKDnBds7Tpdst6ecIYqqOtoJ55bPMo27w6BiC9fGmWDX6 TqLQ== 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=2hJ7GMaKr1OGsEcyDvu+Xa2ZgxwEPC5gEFP1GeGbJWI=; b=U1IJOk+qfrrvqYfJBgIhzBKx31YeJpDoB0YorF5InXuE89d/cqYabMdP/2QHOOVVeZ YSyjaB4K+Y8ESSLwBbwrCPly1pTJhQ/8w1brW7zmKFgcQxqv17dCMg3ZzYSHUOvwXTab dW3TgNcyWVMBt7/8iMeqLsvWGZ8pgGLqVN5pnDOheO4dwdhI7nP6jj5gBFtWOsTbl8D/ AyHN204iEJfNxKgrfPaa6/6XouMdNyi85hC4IXLsm5oJa7OraPmDQ6xY2WnY9p4ykAW1 m/MsPtcXcvG6WuRz4bJpnvjPKTRfNUs79QF1rEoidCfeFX4Ai7kHN0+S9JGyRA1wGEX7 BDeQ== X-Gm-Message-State: ALoCoQmCrLNRcQHtBW2AT5T16JrL07qvYqqQoXK6FmNRuREJ6H7y7VSteXJUOKVN7+C86sWCIrobuDZPgn7rJQeK8+3DVV4AYg== X-Received: by 10.25.18.231 with SMTP id 100mr1159593lfs.25.1449960297005; Sat, 12 Dec 2015 14:44:57 -0800 (PST) Received: from wasted.cogentembedded.com ([195.16.111.21]) by smtp.gmail.com with ESMTPSA id t82sm4340062lfe.14.2015.12.12.14.44.55 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 Dec 2015 14:44:55 -0800 (PST) From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-sh@vger.kernel.org, ben.hutchings@codethink.co.uk Subject: [PATCH] sh_eth: uninline sh_eth_{write|read}() Date: Sun, 13 Dec 2015 01:44:50 +0300 Message-ID: <4404920.p7TanuLbY1@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.10 (Linux/4.2.6-201.fc22.x86_64; KDE/4.14.14; 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,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 Commit 3365711df024 ("sh_eth: WARN on access to a register not implemented in in a particular chip") added WARN_ON() to sh_eth_{read|write}(), thus making it unacceptable for these functions to be *inline* anymore. Remove *inline* and move the functions from the header to the driver itself. Below is our code economy with ARM gcc 4.7.3: $ size drivers/net/ethernet/renesas/sh_eth.o{~,} text data bss dec hex filename 32489 1140 0 33629 835d drivers/net/ethernet/renesas/sh_eth.o~ 25413 1140 0 26553 67b9 drivers/net/ethernet/renesas/sh_eth.o Suggested-by: Ben Hutchings Signed-off-by: Sergei Shtylyov --- The patch is against DaveM's 'net-next.git' repo. drivers/net/ethernet/renesas/sh_eth.c | 24 ++++++++++++++++++++++++ drivers/net/ethernet/renesas/sh_eth.h | 25 ------------------------- 2 files changed, 24 insertions(+), 25 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 @@ -52,6 +52,8 @@ NETIF_MSG_RX_ERR| \ NETIF_MSG_TX_ERR) +#define SH_ETH_OFFSET_INVALID ((u16)~0) + #define SH_ETH_OFFSET_DEFAULTS \ [0 ... SH_ETH_MAX_REGISTER_OFFSET - 1] = SH_ETH_OFFSET_INVALID @@ -404,6 +406,28 @@ static const u16 sh_eth_offset_fast_sh3_ static void sh_eth_rcv_snd_disable(struct net_device *ndev); static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev); +static void sh_eth_write(struct net_device *ndev, u32 data, int enum_index) +{ + struct sh_eth_private *mdp = netdev_priv(ndev); + u16 offset = mdp->reg_offset[enum_index]; + + if (WARN_ON(offset == SH_ETH_OFFSET_INVALID)) + return; + + iowrite32(data, mdp->addr + offset); +} + +static u32 sh_eth_read(struct net_device *ndev, int enum_index) +{ + struct sh_eth_private *mdp = netdev_priv(ndev); + u16 offset = mdp->reg_offset[enum_index]; + + if (WARN_ON(offset == SH_ETH_OFFSET_INVALID)) + return ~0U; + + return ioread32(mdp->addr + offset); +} + static bool sh_eth_is_gether(struct sh_eth_private *mdp) { return mdp->reg_offset == sh_eth_offset_gigabit; 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,31 +546,6 @@ static inline void sh_eth_soft_swap(char #endif } -#define SH_ETH_OFFSET_INVALID ((u16) ~0) - -static inline void sh_eth_write(struct net_device *ndev, u32 data, - int enum_index) -{ - struct sh_eth_private *mdp = netdev_priv(ndev); - u16 offset = mdp->reg_offset[enum_index]; - - if (WARN_ON(offset == SH_ETH_OFFSET_INVALID)) - return; - - iowrite32(data, mdp->addr + offset); -} - -static inline u32 sh_eth_read(struct net_device *ndev, int enum_index) -{ - struct sh_eth_private *mdp = netdev_priv(ndev); - u16 offset = mdp->reg_offset[enum_index]; - - if (WARN_ON(offset == SH_ETH_OFFSET_INVALID)) - return ~0U; - - return ioread32(mdp->addr + offset); -} - static inline void *sh_eth_tsu_get_offset(struct sh_eth_private *mdp, int enum_index) {