From patchwork Wed Jun 12 20:55:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2712261 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B8F029F1E2 for ; Wed, 12 Jun 2013 20:55:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D442E2026A for ; Wed, 12 Jun 2013 20:55:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD2A920269 for ; Wed, 12 Jun 2013 20:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932086Ab3FLUzo (ORCPT ); Wed, 12 Jun 2013 16:55:44 -0400 Received: from mail-la0-f52.google.com ([209.85.215.52]:57262 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932143Ab3FLUzn (ORCPT ); Wed, 12 Jun 2013 16:55:43 -0400 Received: by mail-la0-f52.google.com with SMTP id fo12so6473976lab.11 for ; Wed, 12 Jun 2013 13:55:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:cc:from:organization:date:mime-version:content-type :content-transfer-encoding:message-id:x-gm-message-state; bh=8Vz+wJOk4r4ypIoXq5QzExdKZajHIKxf6+/OY6QPfn4=; b=BOniwi5vMWKr8Q9+eiGVkgBb/7UwOKh1rQ/VOSqCDyou7HLca8QgcCcxK8ATIhE/LD 7poyhoGh7w7MNWdmLSacfvrLEKu+d4ua+CUltZL2caWNFm8XzXQmZHHMGWDrgBw/cDdo Pb61rEJ3Yi9+YMc4xybeDn6VW8ilz2K3JkRXH4eyTtBoduRgbZpbRkDbbw8JQIWlp5YU Glrvf+OnswWxdLKqUFR+VKq607Ji6cdglLhophBTIW0+8SJmf7PmB/xG28IajiwQFLB7 LOEnAMV0Tcl8og8qDz/sfZsHitVwaUsXNxDkccU5dDAyOmfGJvevSnF2SMJpw2lciRcY f3VQ== X-Received: by 10.112.235.104 with SMTP id ul8mr11669097lbc.36.1371070540767; Wed, 12 Jun 2013 13:55:40 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (mail.dev.rtsoft.ru. [213.79.90.226]) by mx.google.com with ESMTPSA id n1sm8633543lae.0.2013.06.12.13.55.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 12 Jun 2013 13:55:39 -0700 (PDT) To: netdev@vger.kernel.org Subject: [PATCH] sh_eth: split 'sh_eth_netdev_ops' Cc: nobuhiro.iwamatsu.yj@renesas.com, linux-sh@vger.kernel.org From: Sergei Shtylyov Organization: Cogent Embedded Date: Thu, 13 Jun 2013 00:55:34 +0400 MIME-Version: 1.0 Message-Id: <201306130055.34780.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQnaJBidBdqOdmZADsWBOqrJ/2YEDgk1keaD6/Q3MtQHI15K/DMbNcLzcXQobv/5pI62cSkR Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 9f86134155047720a3685cda21467f68695152d2 (sh_eth: remove SH_ETH_HAS_TSU) removes 'const' from 'sh_eth_netdev_ops' and modifies it in case TSU registers are present. I've originally suggested to Iwamatsu-san to split this structure in two instead and afterwards Dave M. suggested doing the same. Split 'sh_eth_netdev_ops_tsu' from 'sh_eth_netdev_ops', making both 'const', and assigning 'ndev->detdev_ops' depending on the presence of TSU registers. Signed-off-by: Sergei Shtylyov --- The patch is against Dave Miller's 'net-next.git' repo. drivers/net/ethernet/renesas/sh_eth.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 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 @@ -2486,7 +2486,7 @@ static const u16 *sh_eth_get_register_of return reg_offset; } -static struct net_device_ops sh_eth_netdev_ops = { +static const struct net_device_ops sh_eth_netdev_ops = { .ndo_open = sh_eth_open, .ndo_stop = sh_eth_close, .ndo_start_xmit = sh_eth_start_xmit, @@ -2498,6 +2498,21 @@ static struct net_device_ops sh_eth_netd .ndo_change_mtu = eth_change_mtu, }; +static const struct net_device_ops sh_eth_netdev_ops_tsu = { + .ndo_open = sh_eth_open, + .ndo_stop = sh_eth_close, + .ndo_start_xmit = sh_eth_start_xmit, + .ndo_get_stats = sh_eth_get_stats, + .ndo_set_rx_mode = sh_eth_set_multicast_list, + .ndo_vlan_rx_add_vid = sh_eth_vlan_rx_add_vid, + .ndo_vlan_rx_kill_vid = sh_eth_vlan_rx_kill_vid, + .ndo_tx_timeout = sh_eth_tx_timeout, + .ndo_do_ioctl = sh_eth_do_ioctl, + .ndo_validate_addr = eth_validate_addr, + .ndo_set_mac_address = eth_mac_addr, + .ndo_change_mtu = eth_change_mtu, +}; + static int sh_eth_drv_probe(struct platform_device *pdev) { int ret, devno = 0; @@ -2568,14 +2583,10 @@ static int sh_eth_drv_probe(struct platf sh_eth_set_default_cpu_data(mdp->cd); /* set function */ - if (mdp->cd->tsu) { - sh_eth_netdev_ops.ndo_set_rx_mode = sh_eth_set_multicast_list; - sh_eth_netdev_ops.ndo_vlan_rx_add_vid = sh_eth_vlan_rx_add_vid; - sh_eth_netdev_ops.ndo_vlan_rx_kill_vid = - sh_eth_vlan_rx_kill_vid; - } - - ndev->netdev_ops = &sh_eth_netdev_ops; + if (mdp->cd->tsu) + ndev->netdev_ops = &sh_eth_netdev_ops_tsu; + else + ndev->netdev_ops = &sh_eth_netdev_ops; SET_ETHTOOL_OPS(ndev, &sh_eth_ethtool_ops); ndev->watchdog_timeo = TX_TIMEOUT;