Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp3810124pxb; Mon, 21 Feb 2022 06:13:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXtCIFCmf6D4wx/C5qg3NrP0BBU6A1/jeRIFXKgF8oX0krJ4JeLBYGVVqbVCVAL5nALB9E X-Received: by 2002:aa7:dbd6:0:b0:408:4a31:97a5 with SMTP id v22-20020aa7dbd6000000b004084a3197a5mr21795026edt.186.1645452798136; Mon, 21 Feb 2022 06:13:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645452798; cv=none; d=google.com; s=arc-20160816; b=prPaWioMlGCspcCzvCDaugNmXfRHL6b/cvyQqbpFmIT1L8F0/QaSX7zvIih5LANWjv i6BV5XBIbwyb9SAdOeo/jsBUKOd1Oq6zaL1GC23pjnW4wdRE69m0AqP7l/W/nr3fjv85 oApbipfBo/XKW+dNuHxRnlhhN71EPCdLztE5WIkXi9I5RjSvWHCy1r46zVjmV2bXDqJf LYY+ZVucnYitSAwNNyM/d9ipdK9TifB6EnCeWf5fHMlhFb8HEfbKh4CeFCCyEMGvG5b3 tX23v+hMudZWlDtidrkkkTE/DPlH4xYkXT0H2YXQyGVhNsj9VU1czXKJjOuvlDCN6vve gGpQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PH2hsPcjbz58CLvmEutt32ASPIX78Iif3csfG9mvbrI=; b=tpcSMrZyIYlGhjrDQhJ+2JNy4ofiX1kfMDmKmdqYjExMj9WOioKpg0YFXsOMTbAl9v Mhms5V4RpdemKvV456ullSXBgBCRgQd1zSiMyaerzwRAjtz4rJcXnq2okKObCdxoxJ7R DWi43Hkir2TX6JOZcrS0TTsmnms5VWDEDx/4ysH4PkmU1AoMlUf/L4U2e2KTPtLsJ1Qe A2H5nq2qXQDdZzBJ0fSXn1vx2OCDJjs+BKbwnPvq3Knaz2f612ZwP5fGT++WGxR0wnz7 YhaWyVdDP4k6zx8jT1hg6Vj+kIboK1du7qZoq/pzYajx/vo9NWluRhUz7QYisjPAlB/4 uUMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bs3uHlCz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17si12720369edc.160.2022.02.21.06.12.53; Mon, 21 Feb 2022 06:13:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bs3uHlCz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351917AbiBUJyg (ORCPT + 99 others); Mon, 21 Feb 2022 04:54:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352910AbiBUJsB (ORCPT ); Mon, 21 Feb 2022 04:48:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 809D120199; Mon, 21 Feb 2022 01:21:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1CC3060EDF; Mon, 21 Feb 2022 09:21:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03C2DC340E9; Mon, 21 Feb 2022 09:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435275; bh=OXvfCS9PD0SNk8WUZWIhK1lM9qzjLIKjwNP/Cekcf6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bs3uHlCzBGTpb4Fpk8rTBUaPXesGLgGvMlQ6HkKp1sJcPFUoHySeFzxlEBcguUUjE gPAxh7jcqJ7z7OBSeQKS6fhWaxLyW1Rq/Wk/ouYR4zwUt/CL3PikUFQAIlWQjDl/PI ROBpe3d7wMoeYdWwEhQtW94z9VMIFo+uL3FS5mCg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonas Gorski , Florian Fainelli , Andrew Lunn , Jakub Kicinski Subject: [PATCH 5.16 105/227] Revert "net: ethernet: bgmac: Use devm_platform_ioremap_resource_byname" Date: Mon, 21 Feb 2022 09:48:44 +0100 Message-Id: <20220221084938.366020326@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonas Gorski commit 6aba04ee3263669b335458c4cf4c7d97d6940229 upstream. This reverts commit 3710e80952cf2dc48257ac9f145b117b5f74e0a5. Since idm_base and nicpm_base are still optional resources not present on all platforms, this breaks the driver for everything except Northstar 2 (which has both). The same change was already reverted once with 755f5738ff98 ("net: broadcom: fix a mistake about ioremap resource"). So let's do it again. Fixes: 3710e80952cf ("net: ethernet: bgmac: Use devm_platform_ioremap_resource_byname") Signed-off-by: Jonas Gorski [florian: Added comments to explain the resources are optional] Signed-off-by: Florian Fainelli Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220216184634.2032460-1-f.fainelli@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bgmac-platform.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/broadcom/bgmac-platform.c +++ b/drivers/net/ethernet/broadcom/bgmac-platform.c @@ -172,6 +172,7 @@ static int bgmac_probe(struct platform_d { struct device_node *np = pdev->dev.of_node; struct bgmac *bgmac; + struct resource *regs; int ret; bgmac = bgmac_alloc(&pdev->dev); @@ -208,15 +209,23 @@ static int bgmac_probe(struct platform_d if (IS_ERR(bgmac->plat.base)) return PTR_ERR(bgmac->plat.base); - bgmac->plat.idm_base = devm_platform_ioremap_resource_byname(pdev, "idm_base"); - if (IS_ERR(bgmac->plat.idm_base)) - return PTR_ERR(bgmac->plat.idm_base); - else + /* The idm_base resource is optional for some platforms */ + regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base"); + if (regs) { + bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs); + if (IS_ERR(bgmac->plat.idm_base)) + return PTR_ERR(bgmac->plat.idm_base); bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK; + } - bgmac->plat.nicpm_base = devm_platform_ioremap_resource_byname(pdev, "nicpm_base"); - if (IS_ERR(bgmac->plat.nicpm_base)) - return PTR_ERR(bgmac->plat.nicpm_base); + /* The nicpm_base resource is optional for some platforms */ + regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base"); + if (regs) { + bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev, + regs); + if (IS_ERR(bgmac->plat.nicpm_base)) + return PTR_ERR(bgmac->plat.nicpm_base); + } bgmac->read = platform_bgmac_read; bgmac->write = platform_bgmac_write;