From patchwork Wed Aug 31 15:57:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 664576 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3sPVQP2g8xz9sf6 for ; Thu, 1 Sep 2016 01:57:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=networkplumber-org.20150623.gappssmtp.com header.i=@networkplumber-org.20150623.gappssmtp.com header.b=yzWGLilP; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964951AbcHaP52 (ORCPT ); Wed, 31 Aug 2016 11:57:28 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34530 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964891AbcHaP51 (ORCPT ); Wed, 31 Aug 2016 11:57:27 -0400 Received: by mail-pf0-f169.google.com with SMTP id p64so20866705pfb.1 for ; Wed, 31 Aug 2016 08:57:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ybkmImJPtOW9NUVb8ckEA1vZtvZOxh9VkbnSG6eqNxc=; b=yzWGLilPeJo7VBCOYPGm7I5SHk5P3AUf1tsf+RqpLhmKlseD/hF7UlGrhqT7ScVx/S 6ZU0tLEKgdPFfK9q1GePTETa+OPRgQwt+Z2kuHeKQTyWh13GSyFLeZ1JGKmEKUHdjXlB 6UdpineDxe4E7fkt1vf/Rfk4IH4ZCQYGEs4j3B/LFz69Zw9ZFa5ApLi51MbA0mAj4her 5gvDyRRJxTOamWk4pDK762OmDdErV5+TMy/LNBx40fDO03k3Km/Y9ecV4cryKzxKo6Vo dc8VAbHEAZPgoP28avX2yURBX2ROYLcT9yzycD6yaXcgFE6z/SodkHU/8eJEHViuXqnN Wt7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ybkmImJPtOW9NUVb8ckEA1vZtvZOxh9VkbnSG6eqNxc=; b=MNKt9Q215VuoMOjg3sl0nigZLQwRxRKXLkiz67ng80YqZa9KyrJf7p+DR/1+9ts2JT k+4vSaYLeH885n9ojtzk5JKwzQpm7qhZfEEqBCEZ/oeDkqBj19bs3MFdGh2ve6KEmbjO JqIyjqj2YaHrzYVv5lOcNIqya4Gy6FlET1s6sSUS45s1tRH6AJnWm7SIpWHGSInbc6l/ SAovUPLJUVzS2Z2kjSa5QdkwVilR5tUCDP4gcHDQ8MbAho3c15B+p90eiIqHhaoHIrBh 7c7pIKDUThuvMhU4v9W4rJdE3lYWhhUfb3N4Mqx/L+Pgutu4StN1XY/AKWU3djT4Vs9p GEfw== X-Gm-Message-State: AE9vXwOrHlGYnNXkOTUYFsG5Zp6PXqjLhuHw1A5KrVh3NdXtCVCC3wCfhgf53GOIwOi7WQ== X-Received: by 10.98.39.193 with SMTP id n184mr7617993pfn.164.1472659046964; Wed, 31 Aug 2016 08:57:26 -0700 (PDT) Received: from xeon-e3 (static-50-53-69-251.bvtn.or.frontiernet.net. [50.53.69.251]) by smtp.gmail.com with ESMTPSA id p64sm756536pfd.11.2016.08.31.08.57.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Aug 2016 08:57:26 -0700 (PDT) Date: Wed, 31 Aug 2016 08:57:36 -0700 From: Stephen Hemminger To: Julia Lawall , Tom Lendacky Cc: netdev@vger.kernel.org Subject: [RFC] xgbe: constify get_netdev_ops and get_ethtool_ops Message-ID: <20160831085736.29fc6512@xeon-e3> In-Reply-To: <1472628648-3603-1-git-send-email-Julia.Lawall@lip6.fr> References: <1472628648-3603-1-git-send-email-Julia.Lawall@lip6.fr> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Casting away const is bad practice. Since this is ARM specific driver don't have hardware actually test this. Having getter functions for ops is really unnecessary code bloat, but not going to touch that. Signed-off-by: Stephen Hemminger Tested-by: Tom Lendacky --- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 4 ++-- drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 4 ++-- drivers/net/ethernet/amd/xgbe/xgbe.h | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index a9b2709..7f9216d 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -1708,9 +1708,9 @@ static const struct net_device_ops xgbe_netdev_ops = { .ndo_set_features = xgbe_set_features, }; -struct net_device_ops *xgbe_get_netdev_ops(void) +const struct net_device_ops *xgbe_get_netdev_ops(void) { - return (struct net_device_ops *)&xgbe_netdev_ops; + return &xgbe_netdev_ops; } static void xgbe_rx_refresh(struct xgbe_channel *channel) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c index 11d9f0c..4007b42 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c @@ -623,7 +623,7 @@ static const struct ethtool_ops xgbe_ethtool_ops = { .get_ts_info = xgbe_get_ts_info, }; -struct ethtool_ops *xgbe_get_ethtool_ops(void) +const struct ethtool_ops *xgbe_get_ethtool_ops(void) { - return (struct ethtool_ops *)&xgbe_ethtool_ops; + return &xgbe_ethtool_ops; } diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h index 98d9d63..5dd17dc 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe.h @@ -956,8 +956,9 @@ struct xgbe_prv_data { void xgbe_init_function_ptrs_dev(struct xgbe_hw_if *); void xgbe_init_function_ptrs_phy(struct xgbe_phy_if *); void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *); -struct net_device_ops *xgbe_get_netdev_ops(void); -struct ethtool_ops *xgbe_get_ethtool_ops(void); +const struct net_device_ops *xgbe_get_netdev_ops(void); +const struct ethtool_ops *xgbe_get_ethtool_ops(void); + #ifdef CONFIG_AMD_XGBE_DCB const struct dcbnl_rtnl_ops *xgbe_get_dcbnl_ops(void); #endif