From nobody Thu Nov 28 13:34:25 2024 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 77F6B1CCB37; Tue, 1 Oct 2024 18:29:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807362; cv=none; b=S+UFTmKG9vgdrNS91urUt/zehBJgSEAyzGMhh21X8LOIGpaW1g2kCRNREoVFqEu+XAeFSFG4Wil6E8hW/S3xfwYnYevfW96yzHsaCoHz/A5qBPTk0U9sToGPkWgGI05gF6d6U3Zx4XgMoo7MCsX1yeOLPLJrOWRIEoAzl2B6+nU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807362; c=relaxed/simple; bh=UO1AK6cSFv2YpB5vO4G4kuMpDK6Xz9tYWWRtpYMz804=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bSPzjTHXrgz7idGzMaOPgE+V8Imsr+7QYneA6Tu/EQxhhSMcPOHuTQF86/UFMOdpfAeoMYW9i+RnKxjHvOuypLEsEpcnzV2LY3998gTSgY33c3XCwYgeX9BXeBQE9EZBWgGuAoRfhFrqqypCcn+RaBjOv7l+XZlKgTdHq7o0Z30= 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=J8VWbwiG; arc=none smtp.client-ip=209.85.210.179 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="J8VWbwiG" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-717934728adso4575636b3a.2; Tue, 01 Oct 2024 11:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727807360; x=1728412160; 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=BNW0qIQYuJi3K43w+QYrXz5749AOyaUHcAHp+VAUvX8=; b=J8VWbwiGgr66BcE/XzrokDlmiM31NanpjeOXLzismNGhs4s3pI6d3EC4mZphVi8GGX x88p/T+TEMJZscPA+bD6kmqp8P5hgnLRbgVijjJDHQkmlGMYozg13sHhcV0Gm/+hV4RY vsJ3gVM9zC5q3TDDaHEs9bD4jjM0YGoVn7vbYtq1yBsh0OqGjNRiXD/AjIxVsILPClY3 rvi27nVD5Qqz2X33A6uAZnCkX5s+05zeQy7gROWohUa1xtzwS0FMO17WkYzeGCMVrk2Z c09iEW3EkeU2aMNxDvj0ELNH0aOCZLhX3wKllBrVUKzZACkQnvSi3RCB6M3MVwrpUnf3 Whkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727807360; x=1728412160; 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=BNW0qIQYuJi3K43w+QYrXz5749AOyaUHcAHp+VAUvX8=; b=HlVmXIzIdczoPSFikppgj/MaKvKlXK6bKLFm8sKbwKSS2284cOqB4noFIfr3gTZPzM zwRLu1Ka5w3jCUVqeZZK1HO3ouHjfDLXpWxN+Ih+F/VVPLDT35O1UCTU5W2SJNbv9J9S NI8RlbUJKUwxCP6iqOOqoyMmXUl1zVUyZn8rB7KMywNiai+2pD1YE75plaDXeZ9uqPCz FKp0tJgscYTRMqBTDNGku3F0xVZ7d49CrlFh2T4p0HxG22TfwT+EsF2IKCO305YxU1MB UwshwKGhIRMyU3Xh9RbVGlpwcMt/7KkBv30k2sGi3YdAPv5RFnT/wkfPJBBJ/VQekxfG RXyg== X-Forwarded-Encrypted: i=1; AJvYcCXEV4OtqKo6whYQfUCs5wibFyGc1rZDSPJtqUqrPRtB3c/qHQKo/SrBvQ824NrlVagpk9YbjLiexWT4fpI=@vger.kernel.org X-Gm-Message-State: AOJu0YwBccfZPnwrZNJyG1mxl9SowciBYP9zKp9JwkQ1wioDrzZwydZ5 WYJsMAIz8cbBIA/2B05v+9Kuy9t6rXXdCU/K6ClHn40aisNUwhgEAbhmzYud X-Google-Smtp-Source: AGHT+IHCRQkqAgnNFAUzucFB9h5q6M3RzDuijt5RBuntg5OAKKr9hdtc9yUC7qRFq5VrxAFERkSmRA== X-Received: by 2002:a05:6a00:2d06:b0:717:d4e3:df21 with SMTP id d2e1a72fcca58-71dc5d8707emr902251b3a.23.1727807360449; Tue, 01 Oct 2024 11:29:20 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26529d56sm8649467b3a.170.2024.10.01.11.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 11:29:20 -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, steve.glendinning@shawell.net Subject: [PATCHv2 net-next 1/9] net: smsc911x: use devm_platform_ioremap_resource Date: Tue, 1 Oct 2024 11:29:08 -0700 Message-ID: <20241001182916.122259-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241001182916.122259-1-rosenp@gmail.com> References: <20241001182916.122259-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" Allows removal of a bunch of code relating to grabbing resources. Signed-off-by: Rosen Penev --- drivers/net/ethernet/smsc/smsc911x.c | 47 +++++----------------------- 1 file changed, 7 insertions(+), 40 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/sm= sc/smsc911x.c index 74f1ccc96459..3d4356df0070 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -2319,7 +2319,6 @@ static void smsc911x_drv_remove(struct platform_devic= e *pdev) { struct net_device *dev; struct smsc911x_data *pdata; - struct resource *res; =20 dev =3D platform_get_drvdata(pdev); BUG_ON(!dev); @@ -2334,15 +2333,6 @@ static void smsc911x_drv_remove(struct platform_devi= ce *pdev) mdiobus_unregister(pdata->mii_bus); mdiobus_free(pdata->mii_bus); =20 - res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, - "smsc911x-memory"); - if (!res) - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); - - release_mem_region(res->start, resource_size(res)); - - iounmap(pdata->ioaddr); - (void)smsc911x_disable_resources(pdev); smsc911x_free_resources(pdev); =20 @@ -2414,21 +2404,9 @@ static int smsc911x_drv_probe(struct platform_device= *pdev) struct net_device *dev; struct smsc911x_data *pdata; struct smsc911x_platform_config *config =3D dev_get_platdata(&pdev->dev); - struct resource *res; - int res_size, irq; + int irq; int retval; =20 - res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, - "smsc911x-memory"); - if (!res) - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - pr_warn("Could not allocate resource\n"); - retval =3D -ENODEV; - goto out_0; - } - res_size =3D resource_size(res); - irq =3D platform_get_irq(pdev, 0); if (irq =3D=3D -EPROBE_DEFER) { retval =3D -EPROBE_DEFER; @@ -2439,24 +2417,17 @@ static int smsc911x_drv_probe(struct platform_devic= e *pdev) goto out_0; } =20 - if (!request_mem_region(res->start, res_size, SMSC_CHIPNAME)) { - retval =3D -EBUSY; - goto out_0; - } - dev =3D alloc_etherdev(sizeof(struct smsc911x_data)); - if (!dev) { - retval =3D -ENOMEM; - goto out_release_io_1; - } + if (!dev) + return -ENOMEM; =20 SET_NETDEV_DEV(dev, &pdev->dev); =20 pdata =3D netdev_priv(dev); dev->irq =3D irq; - pdata->ioaddr =3D ioremap(res->start, res_size); - if (!pdata->ioaddr) { - retval =3D -ENOMEM; + pdata->ioaddr =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(pdata->ioaddr)) { + retval =3D PTR_ERR(pdata->ioaddr); goto out_ioremap_fail; } =20 @@ -2467,7 +2438,7 @@ static int smsc911x_drv_probe(struct platform_device = *pdev) =20 retval =3D smsc911x_request_resources(pdev); if (retval) - goto out_request_resources_fail; + goto out_ioremap_fail; =20 retval =3D smsc911x_enable_resources(pdev); if (retval) @@ -2564,12 +2535,8 @@ static int smsc911x_drv_probe(struct platform_device= *pdev) (void)smsc911x_disable_resources(pdev); out_enable_resources_fail: smsc911x_free_resources(pdev); -out_request_resources_fail: - iounmap(pdata->ioaddr); out_ioremap_fail: free_netdev(dev); -out_release_io_1: - release_mem_region(res->start, resource_size(res)); out_0: return retval; } --=20 2.46.2