Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp148909pxb; Fri, 16 Apr 2021 01:55:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2HC9adS7E/G7rgocPGhrrCY+kIEnR9VM+cCnmRPKZdjk4l+rFNcBSU1Kb+d9GdxgEsYR3 X-Received: by 2002:a05:6402:c7:: with SMTP id i7mr8748912edu.33.1618563306834; Fri, 16 Apr 2021 01:55:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618563306; cv=none; d=google.com; s=arc-20160816; b=TEtT6sP7BY28HpDvcj4/uJgLnzM2LlrkZPw1hH9mRl0/V9B8LTpa+pSqY2rdKnb06+ lrf2lFAogRlGY6xpkFLrDfRmxZbrSNZ5J2VhLq1zzmKfTaXQvf/IMLwecHmUYzbZa5SD kx78fPROJ+VB8+8doLQv5Q0shEfFqJRfKL7+Hm8GkYPFjLT6MRfWiItUdRCtXtK16Ev+ OonHASnfDAK+wzJf+y8FtmgtVkHdxGVBY95UbO6D1mub2KcLTd9Um8ju5nSCyQQwgnDZ Jk07JFOpVH6zD3obcWMKImvdGBSQt8Nasd0so67iuTq8xoG9+0R4IIptuE8cVBxOTVtK cSGg== 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=A629L0E5rlhGGA6Gv5xYpPJ2ufYOb6+CQAFMBPVZ1X2Q8DjeNAvVefWUgmsoj7bB93 U/E1jD2D9VqPw1lbtIOKh4/sw/gKgzBE371gbXPLn22LeYy8CkiwzoVhHHmjkSK3z3ZU hUjp6+76vSOJYdrZhEVTM3AZkjIHI3WWT3E53s3oTytKE2SnHEhD34O2IGiIjqC+ub7S Efayi2D3FeZGzUC2L221nexaDXR6FUaijP1Nn07fC8E6E73pctya4QZd/V4W3+MLjcoM 5RAfO48tMvDxMcB/8t2Wg05F17RpW+DAZm6AkudzJqBpzBLQ9CYWKM2LSGXA6bPXcPKh +8UQ== 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 yj16si978892ejb.31.2021.04.16.01.54.44; Fri, 16 Apr 2021 01:55:06 -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 S241594AbhDPIxA (ORCPT + 99 others); Fri, 16 Apr 2021 04:53:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:54114 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240930AbhDPIwj (ORCPT ); Fri, 16 Apr 2021 04:52:39 -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 16AE2AF3D; Fri, 16 Apr 2021 08:52:13 +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 v5 net-next 06/10] net: korina: Only pass mac address via platform data Date: Fri, 16 Apr 2021 10:52:02 +0200 Message-Id: <20210416085207.63181-7-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210416085207.63181-1-tsbogend@alpha.franken.de> References: <20210416085207.63181-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