From nobody Thu Nov 28 15:47:26 2024 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 375EE19F42E; Mon, 30 Sep 2024 20:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727728196; cv=none; b=L//s8RFAEFwJLVgC5/INIZe+0SDzcvOjHCnKh2FP49Lqk4XVgGcLCZtaRHWdOA+OxuQs2JOqPOpLdpBWyqUP7xkuztj4k3cwVZzeoQdE4YZgG79of08ZWjrEQ/OyX9Shc3QFwJlWugY1tmS7ajAJjfQXnrZ0rGzOidyPiwdLjGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727728196; c=relaxed/simple; bh=+00jZr7ZwdmIjTsWoO4PkDFuuKcXZlqjKC98APiB+cY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OOC+Kupu0iN758El3zAh0kOZQOXV/OokrqQYiZNGnuQew3G8BimsQ0B2jLxxeRJYBE9JQvU3PSoZZJR+pSEdyBy85BBy3esM/EmsFinpw4187OTOb5cr2U+RhG8CUZa51GM57gw2GrPyVeOOT5evDvbe93pjFsiJvdtPBhpVd0w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Gq8pq7/H; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Gq8pq7/H" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-719ba0654f9so4022150b3a.3; Mon, 30 Sep 2024 13:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727728194; x=1728332994; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=io1U+Eo5Bo5el06fukNjEThXwdMFxIrkLZyBN9luQKc=; b=Gq8pq7/HAFI3+0STFpNLYGQtGU7TBzmg3h0g50mbJngIE3TiZXkEYksu71HAGXDdTx Hmq3+obFzfeQo0RoPF1++Fr3VUM1x8f68gESC1TfRunuv7+a2xFW5HKKTj3O2vFpE+24 ksNzzbt0fI6cfvA9/rvjyeUhaSfJ52RzoWYSPFpzKwmyXHPmy/b8AE0KMuW5wAyptKjh tBAOmPzp3sRdLgXOLigfuZ6G8cMAJiavbaeB0UAnmkJn5UJi9NgWIFICUfUduoawP739 I/0so9p1veOJFRKuIRnHlaWxy8L2vgb9kNNBWy9BM7pyDuNJtOWxsSXqjuuIy0gCVJ3x 6xaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727728194; x=1728332994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=io1U+Eo5Bo5el06fukNjEThXwdMFxIrkLZyBN9luQKc=; b=WLn2oD/MWJ6yKLlzwEo57RNKFmfYeCPsnGqM19HFcxVcZMHk7RloVO2bImTFFHT/dM /bMyCbc0bop6OYUHj7ffHPZuMCKvJX1xr3tVMY5O+MpX5bhTRYQaXcIS1vnXP91aAWFv z403slnmG97oh0qSA0BnwVRVu0eOHBsASLPuCvNFd5T25d/GxRa2f7Uleo4xXUbXTMmE 6R2BfQdAq8Rmq50I1toq34kFXycSUCho/GFwd0FsQCExzmGS8omHakG4WBQ14SM56tp0 X+CrF4N+WY47PlPENVI10Fk1XfadZaHyzvLgYhLmf7Xi6MY2mC5ZwyJho8CoOTBSrW+N Oy1w== X-Forwarded-Encrypted: i=1; AJvYcCWxoK8pdEXr9gj3ROe3V5rwhR316HttcdJFTJedmvDDp2JQKEXyZRqiPoDEMVi4f7D9Penb7Ba/paFqzcc=@vger.kernel.org X-Gm-Message-State: AOJu0YzngGJrgz4SMGPjlkizluMlBDpBBpiPooDSv+qOG65xWYYXCGzq la2dp5nQuylgYHgzQ3AJvF1xgdfIBq+Dq98wYnHvbWUC5CUH7U2iWfRCDtp8 X-Google-Smtp-Source: AGHT+IF43Hww0PXELZYBxH71jwdS0plXyTSozmTGjKIQZMRDWhvkPlOxU/aEmE5Vu8OGJSgD10GsYw== X-Received: by 2002:a05:6a00:4650:b0:714:340c:b9ee with SMTP id d2e1a72fcca58-71b25f27594mr18938648b3a.1.1727728194295; Mon, 30 Sep 2024 13:29:54 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e6db5eb3ecsm6812943a12.60.2024.09.30.13.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 13:29:53 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/2] net: mv643xx: use devm_platform_ioremap_resource Date: Mon, 30 Sep 2024 13:29:50 -0700 Message-ID: <20240930202951.297737-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930202951.297737-1-rosenp@gmail.com> References: <20240930202951.297737-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This combines multiple steps in one function. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/marvell/mv643xx_eth.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ether= net/marvell/mv643xx_eth.c index a9e18f7b16cf..36646787885d 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2839,25 +2839,20 @@ static int mv643xx_eth_shared_probe(struct platform= _device *pdev) struct mv643xx_eth_shared_platform_data *pd; struct mv643xx_eth_shared_private *msp; const struct mbus_dram_target_info *dram; - struct resource *res; int ret; =20 if (!mv643xx_eth_version_printed++) pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n", mv643xx_eth_driver_version); =20 - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res =3D=3D NULL) - return -EINVAL; - msp =3D devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL); if (msp =3D=3D NULL) return -ENOMEM; platform_set_drvdata(pdev, msp); =20 - msp->base =3D devm_ioremap(&pdev->dev, res->start, resource_size(res)); - if (msp->base =3D=3D NULL) - return -ENOMEM; + msp->base =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(msp->base)) + return PTR_ERR(msp->base); =20 msp->clk =3D devm_clk_get(&pdev->dev, NULL); if (!IS_ERR(msp->clk)) --=20 2.46.2 From nobody Thu Nov 28 15:47:26 2024 Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B450B1A2646; Mon, 30 Sep 2024 20:29:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727728198; cv=none; b=agzWQdkI3LVy7iQKCWkiEDsAJSuY5idxHD8AyNcvKx9hzR562H5p+cXFdejSBpISj5aglgA0xbLRX2nQiBhFT3drI6IpyYgKZP69W8ltZnas80FIkVIJ87p6RATVCqacNLhy1LZuAKR+uNrZ/F/Czq15SZ5ZqG1wCbfRXBfAy48= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727728198; c=relaxed/simple; bh=iWf626H8Q+2FZQodXiYoFTnASSgaPE6KWBTgvxM7qgQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uQc2SONF7xW9B7r1Mc0OtBUvSv+m/StfdxzKlqHDvNFUfPIqA41dpdfjEJfntouJnx/jwjdyuigkGntX2WW4a+HtvbpgUX4GIAqMgQHyDiQIvcw1fMPWR4jnBYOg6/pkCj3yoY+dbIG8nnZFsSLjjJZ9oSbqoWiS1K1HeeiofYw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=drAr7cDO; arc=none smtp.client-ip=209.85.167.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="drAr7cDO" Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3e2a1049688so2386051b6e.1; Mon, 30 Sep 2024 13:29:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727728195; x=1728332995; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dOyB2Jo2ejc9eXn3CRqEZnVgRt9TH8TV7IBi/XBYhs4=; b=drAr7cDOoqGOrbyNUVJEkEOK55SN6oD85kdsTFIQe5Wn9qUNrmPSLOTYxFHK9tcG7u X6NpgeIAsdyCsBDDr6kVVI1STm+iIq4DHfGknqSN2oBzBuB6H6Gr2l1IRwc1R46MpSRS gGqo81rGsbmEmS7LMDRvZYfe3lkTEzjLjSHUhaIHHM21dbLO3at6qbGZEC3GvSN7GqTh 3lTYsGYUCPR0McKPgu2gJ66O7qNS0z+4fL/rbrekDpzoDSVo4Yj1iMoXZ8AYRs2+lC5c Hkpc3vaYZRsnFi345Kqf/BNdMDgO4YylnbtJjT/WsDzVNoTT5qTgNM1hqrtJR9fCRWsK uLcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727728195; x=1728332995; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dOyB2Jo2ejc9eXn3CRqEZnVgRt9TH8TV7IBi/XBYhs4=; b=KdsATKX7z0NjabsyWIa1JvMViE5Ww1gtzPpsK1yd4efzHRiXxL1VX1y8BOaASX03GK Zqw18sjaratIh0Bp/1yUr7s76vzEhlRGLERMd5ZLBO1K60JyxklbW/YNTpVSZ/LLMN4w x6Ie9rPbgZV6nwy175Sl/TmZCUiyOsb+W4ca9/5F87kEvhxOWHXvmnM9rRc6WFg4VyJf QOJNCz7QAqF51RAy3zvyRld9rl/81GeF4zIkyZzB029T6UVPKdz7tzqDkOEPw/rwrZsP ODGBB5MfZVVJey0pV5+nvbQopo3UDD3h+kbyNcwkEpYiuYGuvG3rj5Xm4gZ3H8jfBKe6 U89A== X-Forwarded-Encrypted: i=1; AJvYcCU/bRpm8OH2Oh5zNKHnKNsGt5DNuIgsx3DAiIbB1Svze5SGoFdo7gpkx+IqqgHCiSPY6CKVg3LBJAe/zkQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yyj8ArhNAqMlavOiMMZWXqS7sh5hQ3zfGm3KKPpU9uaPiAGHQ23 Rmrua+Zo0u6C2DESqD3HWaeAh2zTFoFhlrbAWG9Tv3zTqRKQFCzhAxAE4RmH X-Google-Smtp-Source: AGHT+IFmuRmg7PQQbecFM4j/4CN9Kc8i6T+U3rIPSu3F1jvFz2Xk9MkgFV7aQcGwHEs+lp3erJ4WBQ== X-Received: by 2002:a05:6808:3021:b0:3e0:47eb:baa with SMTP id 5614622812f47-3e393968f85mr9084358b6e.14.1727728195537; Mon, 30 Sep 2024 13:29:55 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e6db5eb3ecsm6812943a12.60.2024.09.30.13.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 13:29:55 -0700 (PDT) From: Rosen Penev To: netdev@vger.kernel.org Cc: andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/2] net: mv643xx: fix wrong devm_clk_get usage Date: Mon, 30 Sep 2024 13:29:51 -0700 Message-ID: <20240930202951.297737-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930202951.297737-1-rosenp@gmail.com> References: <20240930202951.297737-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This clock should be optional. In addition, PTR_ERR can be -EPROBE_DEFER in which case it should return. devm_clk_get_optional_enabled also allows removing explicit clock enable and disable calls. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/marvell/mv643xx_eth.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ether= net/marvell/mv643xx_eth.c index 36646787885d..73094b3b590c 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2854,9 +2854,9 @@ static int mv643xx_eth_shared_probe(struct platform_d= evice *pdev) if (IS_ERR(msp->base)) return PTR_ERR(msp->base); =20 - msp->clk =3D devm_clk_get(&pdev->dev, NULL); - if (!IS_ERR(msp->clk)) - clk_prepare_enable(msp->clk); + msp->clk =3D devm_clk_get_optional_enabled(&pdev->dev, NULL); + if (IS_ERR(msp->clk)) + return PTR_ERR(msp->clk); =20 /* * (Re-)program MBUS remapping windows if we are asked to. @@ -2867,7 +2867,7 @@ static int mv643xx_eth_shared_probe(struct platform_d= evice *pdev) =20 ret =3D mv643xx_eth_shared_of_probe(pdev); if (ret) - goto err_put_clk; + return ret; pd =3D dev_get_platdata(&pdev->dev); =20 msp->tx_csum_limit =3D (pd !=3D NULL && pd->tx_csum_limit) ? @@ -2875,20 +2875,11 @@ static int mv643xx_eth_shared_probe(struct platform= _device *pdev) infer_hw_params(msp); =20 return 0; - -err_put_clk: - if (!IS_ERR(msp->clk)) - clk_disable_unprepare(msp->clk); - return ret; } =20 static void mv643xx_eth_shared_remove(struct platform_device *pdev) { - struct mv643xx_eth_shared_private *msp =3D platform_get_drvdata(pdev); - mv643xx_eth_shared_of_remove(); - if (!IS_ERR(msp->clk)) - clk_disable_unprepare(msp->clk); } =20 static struct platform_driver mv643xx_eth_shared_driver =3D { --=20 2.46.2