Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp147826pxb; Fri, 16 Apr 2021 01:52:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRb7CGi1sb3/qcM7jdD1pbv+B6oVehlWmDoGf3hSYrlxrlquVk0gBSKCH1tqmrpKUoebub X-Received: by 2002:a17:906:3c45:: with SMTP id i5mr7193326ejg.368.1618563148886; Fri, 16 Apr 2021 01:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618563148; cv=none; d=google.com; s=arc-20160816; b=ifGfjEwB+M/oSgsp3OcuCMbxkRRkn2mtwzxfkByvWJOEREfy2Toafwf0WtjobqbM5b bMF+ohm7bA5Gg2CWHvM+K6h8rU341UdTh8j8CYgkOFwiHge2hIM0s60sVGEjFwZJ6yv2 XDAHXORbaIAdhDJUnvP/R0dD/zgoDxC+so0TgKJVlfR23P3GsESlwAOhXPShgGxCHJXK vEy+yifWDP5fCZnKnC2Xs6q4pnIekHtRVQMrALSa2gUhWYbJY3HLLDwJt55/nbMfxkvQ +5X36QC0Ui1gdrWSzngk5zr8lG7q/k2JDwxb+i3PfbXiMQ4jEU3jT9waNpX0cPz+RwoF JgjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=Pa3BJBLQR673PJjwY79Qo6M2kBRlzIKs4Ej9fGe08ug=; b=KDTRhesLnUTaVXk2DQJyJTVcIZx5gcAYHrR7Q5WwGHtwaMIyFVcGf6BjbOlQUqwzpm rUsnW5goaCOOHliyjSIlZ+IX+pxlvuaynDl9qRxbj+uB1K1xVNAZJIUNlC6Bs31Ggws+ Usw4wZn08w6EQ48nobLKfi3JK45L2t/MUlQ9XCbslKAI2YE2dRsncxzIrpKiVSuB5H3t RYwacuE3qLO+L/K7R1GMIWSf8hkoIY1zoFEMAAkBtzdQVU35f6IWZFgSRt0YBNE0YkVL TqHW80CZLd/mMQxgJduJ5RK5s/baRmJO/xGX65TjYltcqEajAlc7OMnf2veGDXn7vjZ1 QbLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jx16si3647119ejc.661.2021.04.16.01.52.05; Fri, 16 Apr 2021 01:52:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241108AbhDPIs3 (ORCPT + 99 others); Fri, 16 Apr 2021 04:48:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:46070 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240872AbhDPIrm (ORCPT ); Fri, 16 Apr 2021 04:47:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A05D5AF42; Fri, 16 Apr 2021 08:47:16 +0000 (UTC) From: Thomas Bogendoerfer To: "David S. Miller" , Jakub Kicinski , Rob Herring , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v4 net-next 06/10] net: korina: Only pass mac address via platform data Date: Fri, 16 Apr 2021 10:47:07 +0200 Message-Id: <20210416084712.62561-7-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210416084712.62561-1-tsbogend@alpha.franken.de> References: <20210416084712.62561-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Get rid of access to struct korina_device by just passing the mac address via platform data and use drvdata for passing netdev to remove function. Signed-off-by: Thomas Bogendoerfer --- arch/mips/rb532/devices.c | 5 +++-- drivers/net/ethernet/korina.c | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c index dd34f1b32b79..5fc3c8ee4f31 100644 --- a/arch/mips/rb532/devices.c +++ b/arch/mips/rb532/devices.c @@ -105,6 +105,9 @@ static struct platform_device korina_dev0 = { .name = "korina", .resource = korina_dev0_res, .num_resources = ARRAY_SIZE(korina_dev0_res), + .dev = { + .platform_data = &korina_dev0_data.mac, + } }; static struct resource cf_slot0_res[] = { @@ -299,8 +302,6 @@ static int __init plat_setup_devices(void) /* set the uart clock to the current cpu frequency */ rb532_uart_res[0].uartclk = idt_cpu_freq; - dev_set_drvdata(&korina_dev0.dev, &korina_dev0_data); - gpiod_add_lookup_table(&cf_slot0_gpio_table); return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs)); } diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c index 44fad9e924ca..d6dbbdd43d7c 100644 --- a/drivers/net/ethernet/korina.c +++ b/drivers/net/ethernet/korina.c @@ -1055,7 +1055,7 @@ static const struct net_device_ops korina_netdev_ops = { static int korina_probe(struct platform_device *pdev) { - struct korina_device *bif = platform_get_drvdata(pdev); + u8 *mac_addr = dev_get_platdata(&pdev->dev); struct korina_private *lp; struct net_device *dev; void __iomem *p; @@ -1068,8 +1068,7 @@ static int korina_probe(struct platform_device *pdev) SET_NETDEV_DEV(dev, &pdev->dev); lp = netdev_priv(dev); - bif->dev = dev; - memcpy(dev->dev_addr, bif->mac, ETH_ALEN); + memcpy(dev->dev_addr, mac_addr, ETH_ALEN); lp->rx_irq = platform_get_irq_byname(pdev, "korina_rx"); lp->tx_irq = platform_get_irq_byname(pdev, "korina_tx"); @@ -1123,6 +1122,8 @@ static int korina_probe(struct platform_device *pdev) lp->mii_if.phy_id_mask = 0x1f; lp->mii_if.reg_num_mask = 0x1f; + platform_set_drvdata(pdev, dev); + rc = register_netdev(dev); if (rc < 0) { printk(KERN_ERR DRV_NAME @@ -1140,9 +1141,9 @@ static int korina_probe(struct platform_device *pdev) static int korina_remove(struct platform_device *pdev) { - struct korina_device *bif = platform_get_drvdata(pdev); + struct net_device *dev = platform_get_drvdata(pdev); - unregister_netdev(bif->dev); + unregister_netdev(dev); return 0; } -- 2.29.2