From nobody Thu Nov 28 11:25:39 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 From nobody Thu Nov 28 11:25:39 2024 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (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 6FE4E1CCB58; Tue, 1 Oct 2024 18:29:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807363; cv=none; b=hEP7uqfArg6LyIamjC7yE+YMIEwFGV9PrR8kiFDLk8uZdw6nzVuvFNqQgRhZauWN4SkczperaBt/t9N/NLetAFLL7WlWxWjPWC9K8lBddifP7f1Sj40+bebfEPmwwclHirNmH8BLmb+0bOEj7Z+ZTZgDrmEgRedECqN/d0MD+IQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807363; c=relaxed/simple; bh=iqj9a7iIpUjrYd15WVWnWZFhqqFG10G6AO3gHegYl1Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V9ZcptmaPcUrJSQbjA28PhdSQV49SgNGkJ90SlmbXFeZVNv0Wv2L4exOD3y3PIO+mHvRkFFNNJzqyAxlM3ydpkF8yIWYlFa+PrebbIL3KGiKlux/8Huci4INjasys9qSwhXUezrn37XeG6a2JU/3rNfVVLdwx7lyJ3PULEqKr4w= 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=ml+0mxA2; arc=none smtp.client-ip=209.85.210.173 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="ml+0mxA2" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-71788bfe60eso4361825b3a.1; Tue, 01 Oct 2024 11:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727807362; x=1728412162; 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=7ZaALxrETLenGQam95OTWhwOfcaIjjMmX+34RjWfT3c=; b=ml+0mxA2xXPemyiIzrJ1L/k7Saodw1BbNS8FNDwRJvqI6C1Qfyvm63K5RO0ZRQ4oem MSaxY5gr2oQxONyLhpH2kb8buMFeA1M8yDgGZp0Xd4aLEScVzdZjpgiHG5xBZww61rPw 8cLTM/xVd3I3jhW5BJOrs1YqtXXbOoslauO0Q/h5kO25sOhSMPvkdKr+G1g0vV8gQe+5 My69WF0inRVJnXcXeMMWQbk8OKTzBTnodoGzAG1MBU6biHfsswH6QmLw9B93QUh6toJV 6pstvEG5NG/np7U0o2DlMeFCXOVpq1FdH3myWWSWxCNxIr4+DBDVnUfyPyG1gwgOn+oY D/KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727807362; x=1728412162; 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=7ZaALxrETLenGQam95OTWhwOfcaIjjMmX+34RjWfT3c=; b=U8IHzlUSRHYoBMw56VeH2tnqNxnzb9XkHhgIK4hoFSIzg8OYfqzHEef/gKMr8Op9JT dez+pvQ9kVoTeBVXPpSXPW9pdx6/SqxuYTtlqVygJvaL55fRi9Hh4TB54nJDzWKeHPef UUMM3+1JRaeVbYD0j7ebaGk0OSlH+YixWV8t7GEAaYVAF4rkFmEUeQeSmtvySvstsIiN 0VGsoV+L/jJ2RwgjlcfMRuicWWvwZiXV0VoYjxVPBlfDPcYbMHXq8DIthD5l+k+Kp+1N ByD91bbq6Ga1vd0J/FRQJ/J0B8oX1SvJQkJXEA/TCyY9KvOXkDgYzXXAlHOnjCXoc6oB 2WXQ== X-Forwarded-Encrypted: i=1; AJvYcCWaI7j8CscHYkZGUuSU3q8b3hBklwf3hrptF0RiLX1BhGNjJpY1tFR8XTRUk0XX45VVH0/UkIzjl9CeA2k=@vger.kernel.org X-Gm-Message-State: AOJu0Yzbrow7a41s8tQciKNUx6EoHd12io8j/z3WRlv5lb9Tpns+yXgM sCCvAQOUMwrUoQ6zHxpGWD1bZerRwi1EzjKtmsKLks3XME1izOW1CAK6L9kn X-Google-Smtp-Source: AGHT+IFbvefUJ3ZT2GV9XYzxcdx4Wvw92a/DClDY6dkxpfyHzBQWS68K7zEhFlN3Cauk6Nu60wIIzw== X-Received: by 2002:aa7:8882:0:b0:706:700c:7864 with SMTP id d2e1a72fcca58-71dc5c43fe2mr839969b3a.4.1727807361684; Tue, 01 Oct 2024 11:29:21 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 11:29:21 -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 2/9] net: smsc911x: use devm_alloc_etherdev Date: Tue, 1 Oct 2024 11:29:09 -0700 Message-ID: <20241001182916.122259-3-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 various gotos and manual frees. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/smsc/smsc911x.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/sm= sc/smsc911x.c index 3d4356df0070..3b3295b4e9e5 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -2336,8 +2336,6 @@ static void smsc911x_drv_remove(struct platform_devic= e *pdev) (void)smsc911x_disable_resources(pdev); smsc911x_free_resources(pdev); =20 - free_netdev(dev); - pm_runtime_disable(&pdev->dev); } =20 @@ -2417,7 +2415,7 @@ static int smsc911x_drv_probe(struct platform_device = *pdev) goto out_0; } =20 - dev =3D alloc_etherdev(sizeof(struct smsc911x_data)); + dev =3D devm_alloc_etherdev(&pdev->dev, sizeof(struct smsc911x_data)); if (!dev) return -ENOMEM; =20 @@ -2426,10 +2424,8 @@ static int smsc911x_drv_probe(struct platform_device= *pdev) pdata =3D netdev_priv(dev); dev->irq =3D irq; pdata->ioaddr =3D devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(pdata->ioaddr)) { - retval =3D PTR_ERR(pdata->ioaddr); - goto out_ioremap_fail; - } + if (IS_ERR(pdata->ioaddr)) + return PTR_ERR(pdata->ioaddr); =20 pdata->dev =3D dev; pdata->msg_enable =3D ((1 << debug) - 1); @@ -2438,7 +2434,7 @@ static int smsc911x_drv_probe(struct platform_device = *pdev) =20 retval =3D smsc911x_request_resources(pdev); if (retval) - goto out_ioremap_fail; + return retval; =20 retval =3D smsc911x_enable_resources(pdev); if (retval) @@ -2535,8 +2531,6 @@ static int smsc911x_drv_probe(struct platform_device = *pdev) (void)smsc911x_disable_resources(pdev); out_enable_resources_fail: smsc911x_free_resources(pdev); -out_ioremap_fail: - free_netdev(dev); out_0: return retval; } --=20 2.46.2 From nobody Thu Nov 28 11:25:39 2024 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (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 CF7481CCEE8; Tue, 1 Oct 2024 18:29:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807365; cv=none; b=pxlGmT2chUX63x+t8vNOCd/3p8e8gvQ8bw9PHI3stORJ2qeecvqVB5gVQ+6CbOUw7Nlkfp4jVniAH0rsuw+gAg+/NDw8ijf1/JO/Wd5Z01U4LY05otovk1T7dDzLoguId1Bb84d+ygPGihXAKTN0cbeNsgTRCmKKYvtWDgvuJlw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807365; c=relaxed/simple; bh=x994x0rBBXuswtZWWrjpOvS/r+5K72UXBv+BHNYF1+I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j0zSR8WqWmP1zeKTl4djkCeY88s5bCuqFivPFqq6VUyVnnq3EAcusDH2x1k54bBfxSELAIBpU767OhSy8Fsf5TkjMKiAn7UIBLOGJBTz71KBMBUVsARoV0kprHq7HH7Sf9JM3QLMJXjuNWmrfDCBXMr2vl17Yr8tslvnBUUBepc= 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=HTY3+AlJ; arc=none smtp.client-ip=209.85.215.176 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="HTY3+AlJ" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7e6d04f74faso76068a12.1; Tue, 01 Oct 2024 11:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727807363; x=1728412163; 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=r/rvMPtWP8DD5zfR08yofPW0Dn4PaREoOaJcNdoxwJU=; b=HTY3+AlJJ7Zn+K6o+IcsMclbTGv5P2Y5ZO7ro1v7l13iApw8Ak9jgt6yhc22jG3B6n GPpOqP7CfL3igEwCjJORcQujykeKSVPxZD0V3kvDJRi9LlKAMxV+rTslQg5zXoaZsjI3 LtqbeC/brFeUXzHnC1GTYMH+ydU67Okln9XUXRegusywFrHSl9CtzCcyCT7YkY2s7Jw1 CPEeJ6pQ9t7HZMnq2U3U4UQ10jCULzvDYMcYmFgNFMNFAU4gkgd6qz/N4u4VB38PZ5GG ctRPQGZmVdU/yB1p9p10PbFdi4VLKzcuudZUF4gmXnX5awJpn8B4yK1nEnVkQKTdXG2x 1fmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727807363; x=1728412163; 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=r/rvMPtWP8DD5zfR08yofPW0Dn4PaREoOaJcNdoxwJU=; b=BAdHwrd2p7S32o3x1zYLyuoXXufxHv4TW3TXBpTmjIEbK0o2jXQIBtGnwXvDrkietQ Muifbmvp4sIWSwgs1lq5POv0ZhuuTa8LAqaDLS7cIQHCPAd9TLpCck9qOWmS8Kq3SNc8 JZ5NlwXpBKsBXuHGdKUt+7ooTAS3FUtPaafHHripSpFcpZim2luHl+S4YV0yeUldqU0R cPKWyj3B7HBTMHK1Z/bve3kZILINMXf7tr6ohjl9ksg3psXSZXIoG57qGBJFrnXBZ/Sy y/NUA6xGWJH3tC5+bdjQMmzXptNSzfLLpJxOVYFYmQw/wVx+sh2dILNc2UaBpdSUe3x2 jQng== X-Forwarded-Encrypted: i=1; AJvYcCX0pJWDtANbHo23gX1uw7jum/CzAg6kvtmuQDmRBNnRfgy1QHBPr/uj8MOUfnztVlvpdlU/CXxp33W8jsU=@vger.kernel.org X-Gm-Message-State: AOJu0YxKzYsnFvRCgaZ22LVI8EyY/FD9rrjopnUvXMYS/pIc5CsA2S2F WZhmzioeyIzXg/4FkDZnyk4WRaT0nvuasnT0o5NS6IsDHK6NLGUZcbU6rzUL X-Google-Smtp-Source: AGHT+IG8Q0jX9Ja5aSm0+Tcy74vu0jwOLkDjgzb5XuLV0jrA6wYPbvhYbsJqQHFfhUm88V/JTlBtbQ== X-Received: by 2002:a05:6a20:d494:b0:1d2:eaea:39d7 with SMTP id adf61e73a8af0-1d62e24393emr829625637.9.1727807362927; Tue, 01 Oct 2024 11:29:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 11:29:22 -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 3/9] net: smsc911x: use devm for regulators Date: Tue, 1 Oct 2024 11:29:10 -0700 Message-ID: <20241001182916.122259-4-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 to get rid of freeing functions. Signed-off-by: Rosen Penev --- drivers/net/ethernet/smsc/smsc911x.c | 106 +++------------------------ 1 file changed, 12 insertions(+), 94 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/sm= sc/smsc911x.c index 3b3295b4e9e5..68687df4eb3b 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -132,14 +132,8 @@ struct smsc911x_data { /* register access functions */ const struct smsc911x_ops *ops; =20 - /* regulators */ - struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES]; - /* Reset GPIO */ struct gpio_desc *reset_gpiod; - - /* clock */ - struct clk *clk; }; =20 /* Easy access to information */ @@ -369,41 +363,10 @@ smsc911x_rx_readfifo_shift(struct smsc911x_data *pdat= a, unsigned int *buf, */ static int smsc911x_enable_resources(struct platform_device *pdev) { - struct net_device *ndev =3D platform_get_drvdata(pdev); - struct smsc911x_data *pdata =3D netdev_priv(ndev); - int ret =3D 0; - - ret =3D regulator_bulk_enable(ARRAY_SIZE(pdata->supplies), - pdata->supplies); - if (ret) - netdev_err(ndev, "failed to enable regulators %d\n", - ret); + static const char *const supplies[] =3D { "vdd33a", "vddvario" }; =20 - if (!IS_ERR(pdata->clk)) { - ret =3D clk_prepare_enable(pdata->clk); - if (ret < 0) - netdev_err(ndev, "failed to enable clock %d\n", ret); - } - - return ret; -} - -/* - * disable resources, currently just regulators. - */ -static int smsc911x_disable_resources(struct platform_device *pdev) -{ - struct net_device *ndev =3D platform_get_drvdata(pdev); - struct smsc911x_data *pdata =3D netdev_priv(ndev); - int ret =3D 0; - - ret =3D regulator_bulk_disable(ARRAY_SIZE(pdata->supplies), - pdata->supplies); - - if (!IS_ERR(pdata->clk)) - clk_disable_unprepare(pdata->clk); - - return ret; + return devm_regulator_bulk_get_enable(&pdev->dev, ARRAY_SIZE(supplies), + supplies); } =20 /* @@ -417,24 +380,7 @@ static int smsc911x_request_resources(struct platform_= device *pdev) { struct net_device *ndev =3D platform_get_drvdata(pdev); struct smsc911x_data *pdata =3D netdev_priv(ndev); - int ret =3D 0; - - /* Request regulators */ - pdata->supplies[0].supply =3D "vdd33a"; - pdata->supplies[1].supply =3D "vddvario"; - ret =3D regulator_bulk_get(&pdev->dev, - ARRAY_SIZE(pdata->supplies), - pdata->supplies); - if (ret) { - /* - * Retry on deferrals, else just report the error - * and try to continue. - */ - if (ret =3D=3D -EPROBE_DEFER) - return ret; - netdev_err(ndev, "couldn't get regulators %d\n", - ret); - } + struct clk *clk; =20 /* Request optional RESET GPIO */ pdata->reset_gpiod =3D devm_gpiod_get_optional(&pdev->dev, @@ -442,32 +388,12 @@ static int smsc911x_request_resources(struct platform= _device *pdev) GPIOD_OUT_LOW); =20 /* Request clock */ - pdata->clk =3D clk_get(&pdev->dev, NULL); - if (IS_ERR(pdata->clk)) - dev_dbg(&pdev->dev, "couldn't get clock %li\n", - PTR_ERR(pdata->clk)); - - return ret; -} - -/* - * Free resources, currently just regulators. - * - */ -static void smsc911x_free_resources(struct platform_device *pdev) -{ - struct net_device *ndev =3D platform_get_drvdata(pdev); - struct smsc911x_data *pdata =3D netdev_priv(ndev); + clk =3D devm_clk_get_optional(&pdev->dev, NULL); + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "couldn't get clock"); =20 - /* Free regulators */ - regulator_bulk_free(ARRAY_SIZE(pdata->supplies), - pdata->supplies); - - /* Free clock */ - if (!IS_ERR(pdata->clk)) { - clk_put(pdata->clk); - pdata->clk =3D NULL; - } + return 0; } =20 /* waits for MAC not busy, with timeout. Only called by smsc911x_mac_read @@ -2333,9 +2259,6 @@ static void smsc911x_drv_remove(struct platform_devic= e *pdev) mdiobus_unregister(pdata->mii_bus); mdiobus_free(pdata->mii_bus); =20 - (void)smsc911x_disable_resources(pdev); - smsc911x_free_resources(pdev); - pm_runtime_disable(&pdev->dev); } =20 @@ -2438,12 +2361,11 @@ static int smsc911x_drv_probe(struct platform_devic= e *pdev) =20 retval =3D smsc911x_enable_resources(pdev); if (retval) - goto out_enable_resources_fail; + return retval; =20 if (pdata->ioaddr =3D=3D NULL) { SMSC_WARN(pdata, probe, "Error smsc911x base address invalid"); - retval =3D -ENOMEM; - goto out_disable_resources; + return -ENOMEM; } =20 retval =3D smsc911x_probe_config(&pdata->config, &pdev->dev); @@ -2455,7 +2377,7 @@ static int smsc911x_drv_probe(struct platform_device = *pdev) =20 if (retval) { SMSC_WARN(pdata, probe, "Error smsc911x config not found"); - goto out_disable_resources; + return retval; } =20 /* assume standard, non-shifted, access to HW registers */ @@ -2527,10 +2449,6 @@ static int smsc911x_drv_probe(struct platform_device= *pdev) out_init_fail: pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); -out_disable_resources: - (void)smsc911x_disable_resources(pdev); -out_enable_resources_fail: - smsc911x_free_resources(pdev); out_0: return retval; } --=20 2.46.2 From nobody Thu Nov 28 11:25:39 2024 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 DC3C11CDA25; Tue, 1 Oct 2024 18:29:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807366; cv=none; b=dkbzhl7eHIpxJf0OwS3boyg8QxEui5wniIOxUsEVgsWVpkNmn/qwugg9Sergy69Rf6q7SoY9mcTYMsuG1l3eRGB1SVY/DL4cjXO7M+/grg6D03Q57Y2tsSiXHkCajIt4oSQZIytil44bqrkQCcFnejAnhIeoEgDSpRp4VnUo2R4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807366; c=relaxed/simple; bh=d1wcnJvYT1jEDXMivdbAMm3QJ4G3BETNR+XYEB1nViM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d5NkU0eSqoImVcy2HGMDgWiTPdhWd99MmDlEmA+hhE34VUAmKCnnchu5JD/lIpn7R7l2wPJds7JbLAhw6211fKs6UYRv+oJmCABxgHNDIOz6d+EOEfygifyruPudWQGq/KhEqYbkDlA+E8LnZ18vSlsVp2oOehWrxO5t13PBMoo= 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=fq3kE87E; arc=none smtp.client-ip=209.85.210.180 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="fq3kE87E" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-7198de684a7so4124545b3a.2; Tue, 01 Oct 2024 11:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727807364; x=1728412164; 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=7/VnWmql9WWehTPtP4OLmkpJC/y6jUxvQfB7GmfsfBk=; b=fq3kE87E/f5ph9FuBTOLt5zdnNv6BY9KngC6jKgcwMhh0bHPveToSvFyiQd4Cv2CjA hewrrnxcqVjHQpfS3k64ooAFBoamYnQNr4VxZGKc6XK2zdQnVgFcjohe3i6xzpihHkf8 DfgQglMM2eUxSSIlpKyhtuJUq2QUZkJJsWdFGZepEoaXjXXcdJ6gYy2TtyC/W3gDHlwA 5GSz+6w7OfQx3KoyhJJNa7ZKCLaulRDRqwbzPckoCSNC3Lz1/0Dsp8G7e3SosyjatOHf t5766nWjW+0p/QsLdRb4fT6NPWv58AhF3rhWeSd+G3gM/zqvJf3TPwRaue69VnnRuvkv ZeLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727807364; x=1728412164; 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=7/VnWmql9WWehTPtP4OLmkpJC/y6jUxvQfB7GmfsfBk=; b=c7ALvZok5FE8wQGtwX1E1aFqhYUWBle+TUj9H0zTMdwxjcGS4PjKpTK0qvdZZuAM/B ARRE30MwkFju+nOj5lmuRY9QbhT7DuAixuKwRu7PHhknzL2HhW9q/5eg7594n027l9j7 v7+kSxHcBB5BPgMYKKv6W5XTEAg46fP4CkwImtSye003aee0lJL3hn+cBMu8Lf7BAJZc 7w/eu4dstoE6UVTtEXraRWxOUpsA0Nn0ek2eANzNGTjImtay8JTMt45ey6z18uoVET81 JD41wYFO7NKAOAjtU0Zc0Y+8iT/P13mnfsN2sPzKVwWR6KVtxh+BJ/G1AzE3NTQPocWP 6IbA== X-Forwarded-Encrypted: i=1; AJvYcCUWRYIdkZvROyCvM8LWT9exrakXM29aik++vusNcXGMOR5yz4b8w9FHxBYtokFIUa+hVglQotJDEIexYKo=@vger.kernel.org X-Gm-Message-State: AOJu0Yygxg6Xz7ApnCxTb2mKolgT4brIZ5BAAbGcU5fwFQQS7S9HOsMy Qq8xWyr/QVpFVhPCKSDwNSxyVp/0dzOJZZK4XJBet7/N211CaA4FK7RrLqgI X-Google-Smtp-Source: AGHT+IGgKsUhqiufYkpWD+3wntMC/sVJCE5LCvSaAV3HzyWzXRVsKSFZCvfvIBMmUv/SoHY4aIed/g== X-Received: by 2002:a05:6a00:98a:b0:710:9d5e:555c with SMTP id d2e1a72fcca58-71dc5d6d9bamr904336b3a.23.1727807364145; Tue, 01 Oct 2024 11:29:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 11:29:23 -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 4/9] net: smsc911x: use devm for mdiobus functions Date: Tue, 1 Oct 2024 11:29:11 -0700 Message-ID: <20241001182916.122259-5-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" Frees are missing in _probe for these. OTOH simpler to use devm. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/smsc/smsc911x.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/sm= sc/smsc911x.c index 68687df4eb3b..843e3606c2ea 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -991,13 +991,10 @@ static int smsc911x_mii_init(struct platform_device *= pdev, { struct smsc911x_data *pdata =3D netdev_priv(dev); struct phy_device *phydev; - int err =3D -ENXIO; =20 - pdata->mii_bus =3D mdiobus_alloc(); - if (!pdata->mii_bus) { - err =3D -ENOMEM; - goto err_out_1; - } + pdata->mii_bus =3D devm_mdiobus_alloc(&pdev->dev); + if (!pdata->mii_bus) + return -ENOMEM; =20 pdata->mii_bus->name =3D SMSC_MDIONAME; snprintf(pdata->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", @@ -1028,9 +1025,9 @@ static int smsc911x_mii_init(struct platform_device *= pdev, pdata->mii_bus->phy_mask =3D ~(1 << 1); } =20 - if (mdiobus_register(pdata->mii_bus)) { + if (devm_mdiobus_register(&pdev->dev, pdata->mii_bus)) { SMSC_WARN(pdata, probe, "Error registering mii bus"); - goto err_out_free_bus_2; + return -ENXIO; } =20 phydev =3D phy_find_first(pdata->mii_bus); @@ -1038,11 +1035,6 @@ static int smsc911x_mii_init(struct platform_device = *pdev, phydev->mac_managed_pm =3D true; =20 return 0; - -err_out_free_bus_2: - mdiobus_free(pdata->mii_bus); -err_out_1: - return err; } =20 /* Gets the number of tx statuses in the fifo */ @@ -2256,9 +2248,6 @@ static void smsc911x_drv_remove(struct platform_devic= e *pdev) =20 unregister_netdev(dev); =20 - mdiobus_unregister(pdata->mii_bus); - mdiobus_free(pdata->mii_bus); - pm_runtime_disable(&pdev->dev); } =20 --=20 2.46.2 From nobody Thu Nov 28 11:25:39 2024 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 2B7201CDFCA; Tue, 1 Oct 2024 18:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807367; cv=none; b=WD2q56zLynZKBQUN9LBunPCSHk56x5eN1Vl7NnvIHYcQ0BD5VnmQNn7e4wdgtdHTneYf8YM0F8ywP74fhkKMM/oTbGM0u5qWv+pGovNL0nRLBqOukleZKnMdXPkVvpo9/Gdc8z74/Xdm8CbVj/aC3nOrQE68Q/fYDhcRuubfqT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807367; c=relaxed/simple; bh=lPXA040TtFtcChL0NIAfL6DNCp52wqj/Kschiuuo53M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c0VhNKARlXwmM9HNZgx2Titq/3MUWAeAQhJOrEFkhqE086+AUicXmgCzJ1myYDVvuutNmyR7VO5DgNwWFqXzEiolGqB+ebIyvmzN0Aiu0gKvS4FQsplQT6aH34TKuzPvjBww7RXyUshEIcFOajDF/0F8TwaFmZwK/6Pf2mNMKVg= 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=FYfcCh3Y; arc=none smtp.client-ip=209.85.210.175 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="FYfcCh3Y" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-719ba0654f9so4968937b3a.3; Tue, 01 Oct 2024 11:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727807365; x=1728412165; 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=ZC9YYCI7GpBan+FLHwaAVr2Bv2esNxWuipK7ENQ5lAQ=; b=FYfcCh3Yd+lTeigfKe5d3HJOLcL+FmG7kDpo99hbfGbJk/Br+GnCAMqRrIN7VYemUA XnDnE+akW8P5gkvcTkScDQXU5A/aDh/MqLWnZttWwJLuvA4DPOlmC6OmXpCuzNHoZ7wI BoJxhquYbVSgcr41OjgyE5ZvpbFOOTbim6xEzML9o7i7JxEaY5kKrTSsR1pt9Ym9f6pB VgBeOZnNUTZV4p5HLpTl0j5VuGJE+8A9O7dG2JnsI4dmrGuM36M3oTCdeiBrfZAt6zC4 DZFJn+MfQcRMZu2rpEwsV6NA/C0vrFo6sw7/qrnSkXay/BmB3FnwuNNPy0wExwruHpsh Zw7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727807365; x=1728412165; 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=ZC9YYCI7GpBan+FLHwaAVr2Bv2esNxWuipK7ENQ5lAQ=; b=TzHeN+4diCe93Vat6k8FJQlhVNff3wfprD7VH/b3KJyut4IkDG0LkSK9E/OZ2acj7C EWvqGMosOXwlM1F+IHwXG2oWyRew91RsdJTfhqxtkdUoFeDiefgXPd3fMW1Ak4+sXQjE 1u5vLmEHcHGRpXc+vk7aspCVZ/NfJPc1SdI3JSZyLZC519EhU1Gq1/es6mUzYnCinUVw m72QrjoHym6vlH0seAKVVaZkbEK6qpVgAYdP5O4Qa6hNJaIWnECxhC4W2E4WAIMFG17v YjOC+02LDmpjQsjbMPfKwWmtA7zEzvQe75SfuR2GZSsmQ94u2Aeel9cEYLZdeXqjaNQU J/xQ== X-Forwarded-Encrypted: i=1; AJvYcCWNKLHBGGMbSaRS3+pPk9qqeOmFUxtPfZ/B3RS5BzOmjfJYp8JpvxiTptokiz2kfbtEyJrWbw6c6VOIYG8=@vger.kernel.org X-Gm-Message-State: AOJu0YytYWvwpjLVV8P8XdFtusec6pJt/OckjYZq9aUHCl/WjmIzSDZW MZ3ukvBgq1Y94hX20/UDeirSLnpJuovoaysczzKz341PS2pqw0XpzSPC7lXn X-Google-Smtp-Source: AGHT+IF+KhBldFk4V8U/mKoMt31YjvjYWuE1qDl2IUJZLe6+7ElAUe8WCVrlGHRCpsoxyoNBVm2Fcw== X-Received: by 2002:a05:6a20:db0a:b0:1d4:fb5b:bf44 with SMTP id adf61e73a8af0-1d5db1a4301mr980866637.5.1727807365351; Tue, 01 Oct 2024 11:29:25 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 11:29:25 -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 5/9] net: smsc911x: use devm for register_netdev Date: Tue, 1 Oct 2024 11:29:12 -0700 Message-ID: <20241001182916.122259-6-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" No need to call in _remove. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/smsc/smsc911x.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/sm= sc/smsc911x.c index 843e3606c2ea..4e0a277a5ee3 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -2246,8 +2246,6 @@ static void smsc911x_drv_remove(struct platform_devic= e *pdev) =20 SMSC_TRACE(pdata, ifdown, "Stopping driver"); =20 - unregister_netdev(dev); - pm_runtime_disable(&pdev->dev); } =20 @@ -2390,7 +2388,7 @@ static int smsc911x_drv_probe(struct platform_device = *pdev) goto out_init_fail; } =20 - retval =3D register_netdev(dev); + retval =3D devm_register_netdev(&pdev->dev, dev); if (retval) { SMSC_WARN(pdata, probe, "Error %i registering device", retval); goto out_init_fail; --=20 2.46.2 From nobody Thu Nov 28 11:25:39 2024 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (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 3E30F1CDA36; Tue, 1 Oct 2024 18:29:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807368; cv=none; b=SlbH6iy/wMiD5xTzhNN/7kg9/aIWSZr+mul3kmAdsVGXPXqofr966NR1ZnX3YgKmN3W42OOg/LvThUoZoQ32igZjN4v2s8XctajO0pdc/QOZpsZyJvxujweykSoRRgBYalZXuRAWiqv3ck79DPizakGlz/k6vyF1PSiIr81xmRs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807368; c=relaxed/simple; bh=O1JnaGDR92Hsq5CghCDvAJY6RbxyyGAsCKoBXpIV9w0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YdlZUAOtiQrsL3E10Tf8JCnoEfiHfjHuvnYU00rJ00S7nzFIMnUZoMpIx4QUXTYqf6n/T61Xyo99koP5IFaQQlir8Rg96mMJ3+dAHu7FeX/HElly/mmW2RVWwGF2/Z2VxO6sVGu8IBm9upjX05A3jxP5MsmHfJ/K9Mql3IDrbDY= 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=d/QY98Dv; arc=none smtp.client-ip=209.85.210.178 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="d/QY98Dv" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-71b070ff24dso5229451b3a.2; Tue, 01 Oct 2024 11:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727807366; x=1728412166; 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=L/ZUwxmusPDGmPf3q3AUKBZNi8n/O0xq8YxGYUSv+QE=; b=d/QY98DvRvDcoP8WuWUyIDbGsnjW9nsq7b9ShJuEz5DgU27cdEFwTFZh0RJqHmnS6e +0SFCyz797eAmEDNUUz3z1b2AmoxD1bceTzUtHl9WHrr5Btp8ctdvX13L4HwKdiDrrrD rhC4s8vsoK3QqYzkIxhA/aklLO9HM9WROoorYJSzaX8S1BvAkJdiEm0Favvft7SiA8Nj Q+aTYs0Dxt81TEmpnsaLpFbMH2ZjiI/wbhgiq234TDQg0NislLWB73H3KGOBU6WTOQWj rSVxiphv1vPpN10GnNE7urlIffVKHtT1FzPJzhyfIaZiFzNdgsmXZnmdlOFiwJrkpSqq 9oXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727807366; x=1728412166; 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=L/ZUwxmusPDGmPf3q3AUKBZNi8n/O0xq8YxGYUSv+QE=; b=FWisI5mkDoEp8hfdVQocvurFmVIeOf0utOOme2WXWMI0fJaMzLVIuGTKXR9yekTQzd CRMU4pEI+t2vBAXwjEhB6ybPPCssn7lGyiUJbYN5bl+HuR5TpSaPWsNVL8jioY+PSl/D OUrtqiZ2aTd7WgEzM1pmpKieCBFE6TL8Tl/7i5Tz64bIDwTnscziVj30U27FzKDi+UlC JlSeILt/cJ3yUwwJvJB2Nh2KhSF8WdzwB+zTEKCHKNQg3/mCTKNXxy9PRReBZXZ4js8g KqxSI+zsjLj1tveSkNq7HhZT6lOW503kFEhAmxMEhBmHUM8Fpql86xvAgj8wComzPz24 P25w== X-Forwarded-Encrypted: i=1; AJvYcCUe0JQHYNflxIZND7/NGRqsIAcG6Ec3vXeKNv4iuHHXiFkq4ZGozp/imw4lsNjdLpU69Es3wKKIevJTl6Y=@vger.kernel.org X-Gm-Message-State: AOJu0YxJSXl2+i0X+6moN4HDyharSAYAOijhOc8ZAuzTaBu/RLWC4e3P FN74YzmOJW2ENi2lz0PXfcL2L92zjnITytszzeTTlxfuQQJkQIG2jUXOeYHA X-Google-Smtp-Source: AGHT+IFTupHWxKat/ORC44dzuzBBNo5qnvcHZis8sog5Ylcm45A+gEGemYA/0Wf52E7U5ldQlAlByg== X-Received: by 2002:a05:6a00:3cce:b0:719:2046:5d4f with SMTP id d2e1a72fcca58-71dc5d7157amr942077b3a.24.1727807366527; Tue, 01 Oct 2024 11:29:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 11:29:26 -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 6/9] net: smsc911x: remove debug stuff from _remove Date: Tue, 1 Oct 2024 11:29:13 -0700 Message-ID: <20241001182916.122259-7-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" Not needed. Now only contains a single call to pm_runtime_disable. Signed-off-by: Rosen Penev Reviewed-by: Andrew Lunn --- drivers/net/ethernet/smsc/smsc911x.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/sm= sc/smsc911x.c index 4e0a277a5ee3..e757c5825620 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -2235,17 +2235,6 @@ static int smsc911x_init(struct net_device *dev) =20 static void smsc911x_drv_remove(struct platform_device *pdev) { - struct net_device *dev; - struct smsc911x_data *pdata; - - dev =3D platform_get_drvdata(pdev); - BUG_ON(!dev); - pdata =3D netdev_priv(dev); - BUG_ON(!pdata); - BUG_ON(!pdata->ioaddr); - - SMSC_TRACE(pdata, ifdown, "Stopping driver"); - pm_runtime_disable(&pdev->dev); } =20 --=20 2.46.2 From nobody Thu Nov 28 11:25:39 2024 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (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 68C661CEE83; Tue, 1 Oct 2024 18:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807369; cv=none; b=lJ3ojoeIo5+fG2Sl81GtHMUUie3F2C7+Qy7OSHZUO6PSUlA8sR9Uz8NsgZbXMj1J/2nUvVbKjN0qDnBWFrOIBQzevFIUfrUniOyVwu7AiMLG8BXizPoX7vMfaBg4K3QpGBuUq4B6Zn6AMuQrfRFN/UYOxPckhhHFFDLJFJs8+9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807369; c=relaxed/simple; bh=PDXYm2utKtz7LGkMNyUJjDXaEuT47anuaBNZiCi4TBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AR4vJOIifdq+amfacMdaG3K36EkZzVO0HQoJ3lmOJLx2rIPnRhqqMVk61jzGaFoXwlOdJj/XxqUCOKlZJ+4WR7HPzx9KicNEBDkoNTTQpHKL254Eh9Kj8w7xLoxAOR4BpQP36P8ad7/xFzX+KrvB67aFP7jkFbRHB5ujeI3xIuI= 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=O7LqlfRD; arc=none smtp.client-ip=209.85.215.172 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="O7LqlfRD" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-656d8b346d2so3666841a12.2; Tue, 01 Oct 2024 11:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727807368; x=1728412168; 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=usyRTJ1DkSrlbIlzl9LbRK9K4nsTBzuR3bUK5KmITFc=; b=O7LqlfRDWvrfSOwpgdEzKzwYIhl7nAtdT4a8AZFyCb+vwCPzIwTSey+afrYikEYPKL e+5K8iw3hqYMqRPacqlv45nxcpTjpX8nCaiQUV6/Gc8uBWzS/g9Guu4ytY1lGxv2fmDI WscHMhZiTnXzN8Q1YwvFJNmmSKfrMNWSFrm6o7sohX+gS5G334OStIqO0ez7xUR/oPuZ 1+N4rnEX5BM+q0pbjJfoF+0jDJavrVPeuwxDNbzN5uu965RmpMLVorik5tXod2TGk5lB ca3XTfU0XvWhEx+iDG8ttTwODlaCrUW78q3NfsDPN6jdHd9Wf52AidKp4BF5C9yy6o6/ SQhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727807368; x=1728412168; 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=usyRTJ1DkSrlbIlzl9LbRK9K4nsTBzuR3bUK5KmITFc=; b=chaHxOH0lskMsNBZljLUbgUAoDjjgZH+EQHYEYiokd2Yl/LkValwND5W0J9uwyGIau 0XRT9GnlhfRCFOHob5/kDApQysrdHOrgX74ES0R+FwadpLpAU8QMPmSv7tc4VT4k8b1x k7eZTKEzr+6BFkMGK/P7W7Sx48KTZLIzVYTZrHLs68HnDklADUrg+IhX2uLIaXhRJO70 RBoDk1CYGkFjQh90JKT1sam0DZwTMP91FEEO1yaXGBQ1yo/DSBhYxZt7yHSKtYe29iF6 qNalsRQ3HHh+XHrYRx2qv/yrcaXWokv/SlfvDIvmvQL579JN0BmgffJ3mbQRONUkQUDd lTKQ== X-Forwarded-Encrypted: i=1; AJvYcCUXwvdcaDtRNlSV2bJUaTwczlANAuybZY5K9cS/qySZcW1Fkwq02oWy0a1BJtu611xkN83jGF6wpmSc5h8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz94+WxeAFQDltoqRz2vXTHIPozi2p4h9G6Wijx4d5eHRur93SC v+gc+0GWBc+sb69mFKdfBwxDncrnvqhFLySbR0EbkXLoKwRp9sQ5EDlrI2ti X-Google-Smtp-Source: AGHT+IFRQTphqlr/cKwpbAzWDIa8N2PRYNDHgTopk5GDJ8INBQRI2kngXlLQsYvsj1k+fpZaggM3VQ== X-Received: by 2002:a05:6a20:9f8a:b0:1cf:4d4e:532b with SMTP id adf61e73a8af0-1d5e2d9e65fmr903495637.43.1727807367753; Tue, 01 Oct 2024 11:29:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 11:29:27 -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 7/9] net: smsc911x: remove pointless NULL checks Date: Tue, 1 Oct 2024 11:29:14 -0700 Message-ID: <20241001182916.122259-8-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" ioaddr can never be NULL. Probe aborts in such a case. Signed-off-by: Rosen Penev Reviewed-by: Kalesh AP --- drivers/net/ethernet/smsc/smsc911x.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/sm= sc/smsc911x.c index e757c5825620..c4c6480c0ffe 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -2110,11 +2110,6 @@ static int smsc911x_init(struct net_device *dev) spin_lock_init(&pdata->dev_lock); spin_lock_init(&pdata->mac_lock); =20 - if (pdata->ioaddr =3D=3D NULL) { - SMSC_WARN(pdata, probe, "pdata->ioaddr: 0x00000000"); - return -ENODEV; - } - /* * poll the READY bit in PMT_CTRL. Any other access to the device is * forbidden while this bit isn't set. Try for 100ms @@ -2339,11 +2334,6 @@ static int smsc911x_drv_probe(struct platform_device= *pdev) if (retval) return retval; =20 - if (pdata->ioaddr =3D=3D NULL) { - SMSC_WARN(pdata, probe, "Error smsc911x base address invalid"); - return -ENOMEM; - } - retval =3D smsc911x_probe_config(&pdata->config, &pdev->dev); if (retval && config) { /* copy config parameters across to pdata */ --=20 2.46.2 From nobody Thu Nov 28 11:25:39 2024 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.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 3D1571CF293; Tue, 1 Oct 2024 18:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807371; cv=none; b=IBYqD9ZY8U3sevvXkSd8JMusqdjATh2nHeBUCd+1v2k9YpjiCRYSzimS1in9lFcUtMsniA9OAb+scRWYNZHR5UMGjfp3hvyvyFOh8guVB2GGZmgeIuJHqvz1usGsOFAD1mZ9TWH/UtSeZA1VZ1QYDV+xvsyI6fw+xmUlUx2xCsw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807371; c=relaxed/simple; bh=5yjkC6YExtO3uf8ed6K9yODndT1J9WrA8/wPT3wPRzU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tvXVYfbnWpgA91JxTVplXZJT3QTZTbRyWZ0UXQVolCjOifEiZmsAl8kLDSYYjhH9n1Fz7ivfQx6QhAiugRL8U6fDiZchZR8SEGehbbhCU0rsuagLVZdCc+fKKT8bLkwXUxfzAldXJ1NyFj54z9wISw9p1l8O7S18J7UhBhFK0eo= 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=cZdeVXie; arc=none smtp.client-ip=209.85.210.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="cZdeVXie" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-718e6299191so3162651b3a.2; Tue, 01 Oct 2024 11:29:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727807369; x=1728412169; 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=FlwbjCnpCbTphdFb+H0V+2QdmOG77Vw2ZnVKuqpgYbs=; b=cZdeVXie+lF0QmSNzh+AUK/RletAqr4BPJzSWuPcUV3+2fhk3xpuQB9urOdcvgaBxh Idq6zrqMfNu2SRR3R8J9La9OMAhQwqMAtJdhXSyVLUDA6epL5Ar8mt3ronV7vNUGZ59D Cbu55glJy7o/OF7JOnR7ChvnaE1DTdbtPxyAEodW9cv79P8gjHnazb5nbqMjzbE618mX ZQsdC/9+Cn5jNrBJNOJe2SQjtdFe+yA2BNJrKd42u90dlx/dEtpkFISsrc3sMSLdTFuV OY14J8Si6qAAbiaTBaDKGYz5K8Ojts/TcKgoFK6a1r+y+p129cArIzx5BOaN6ysPLryo 9Kng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727807369; x=1728412169; 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=FlwbjCnpCbTphdFb+H0V+2QdmOG77Vw2ZnVKuqpgYbs=; b=JYPR2FgEFUFzsf+FWqUc0Zdao2jokWpRGtbK5yUTEsIcFEibI9WxAooVDSH0kjRZjR NtKV1SGl6sfrdSoRip7OaJkCidTBXFDnrbM+R0nn0IMOPzMippwK55vI5iUE97rX5Gjq pNWczesbaNaLuh1Si5GzqKG9APDIBUU276r6ET1pqW9uvtWZPAYFalBX2DcSOkYcQmV9 mZyiSWK/6PyRvxczuHUhK+WA+rLUG4LlRxkhwKe14KYVumLSOeacE30w9LhMcgGsUXMW xkar09TMGpORE/diRKdCBA2/iT2awNgU041119S8rKhrQT9UR0I0epfl7ZY2tlbbSfaf Dbzg== X-Forwarded-Encrypted: i=1; AJvYcCWC9wt2QQF5qEu/CbWG3HdubsspMfgLA6gLjypiK5IOLBkQw/Cv3wzboKpsalaJkReYDTvcYvsfLOfAI6A=@vger.kernel.org X-Gm-Message-State: AOJu0YxhpRZKuPFFr2gpK3LdM3jTz9Qvj0gqzvC0CAWrqK+jsGn9cY1C PAvlgBu015Gn1nIpLwL43K4DPLjZOXemaA6Urfdef+bLbCzhBLnERavMku5P X-Google-Smtp-Source: AGHT+IG5T8CTRv0LIJW6TPROAeJu9QkwXVZQPRanIGYE+jSloz6ifICltiu4ta0m2N3jDQSOMJXJ9A== X-Received: by 2002:a05:6a21:1509:b0:1d4:fcd0:5bea with SMTP id adf61e73a8af0-1d5db0cc895mr1128991637.6.1727807368993; Tue, 01 Oct 2024 11:29:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 11:29:28 -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 8/9] net: smsc911x: remove enable_resources function Date: Tue, 1 Oct 2024 11:29:15 -0700 Message-ID: <20241001182916.122259-9-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" With devm cleanups, only one function makes sense to have here. Signed-off-by: Rosen Penev --- drivers/net/ethernet/smsc/smsc911x.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/sm= sc/smsc911x.c index c4c6480c0ffe..77a5b766751c 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -359,25 +359,16 @@ smsc911x_rx_readfifo_shift(struct smsc911x_data *pdat= a, unsigned int *buf, } =20 /* - * enable regulator and clock resources. - */ -static int smsc911x_enable_resources(struct platform_device *pdev) -{ - static const char *const supplies[] =3D { "vdd33a", "vddvario" }; - - return devm_regulator_bulk_get_enable(&pdev->dev, ARRAY_SIZE(supplies), - supplies); -} - -/* - * Request resources, currently just regulators. + * Request and enable resources. * * The SMSC911x has two power pins: vddvario and vdd33a, in designs where * these are not always-on we need to request regulators to be turned on * before we can try to access the device registers. */ + static int smsc911x_request_resources(struct platform_device *pdev) { + static const char *const supplies[] =3D { "vdd33a", "vddvario" }; struct net_device *ndev =3D platform_get_drvdata(pdev); struct smsc911x_data *pdata =3D netdev_priv(ndev); struct clk *clk; @@ -393,7 +384,8 @@ static int smsc911x_request_resources(struct platform_d= evice *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(clk), "couldn't get clock"); =20 - return 0; + return devm_regulator_bulk_get_enable(&pdev->dev, ARRAY_SIZE(supplies), + supplies); } =20 /* waits for MAC not busy, with timeout. Only called by smsc911x_mac_read @@ -2330,10 +2322,6 @@ static int smsc911x_drv_probe(struct platform_device= *pdev) if (retval) return retval; =20 - retval =3D smsc911x_enable_resources(pdev); - if (retval) - return retval; - retval =3D smsc911x_probe_config(&pdata->config, &pdev->dev); if (retval && config) { /* copy config parameters across to pdata */ --=20 2.46.2 From nobody Thu Nov 28 11:25:39 2024 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 5C1C71CF5CE; Tue, 1 Oct 2024 18:29:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807373; cv=none; b=gz5e/tYAcu8OBcuV/xAHUDx7bXdChXcVBEcJJDt+muBuiMbWDYpCFaZ8vv9s2amlDOAWegfEuTCy9aLV3VrH8AiVdmRHb57W00O1RQTLabSp6YBTdBlytk4L4lHs2AchE35Tx6u7PgMfP7hJhaiZiE5TIj/YZaPgrjGRJh1B4eo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807373; c=relaxed/simple; bh=R7pMI3RlR/Q1QL96R7slexlvSamq12LC67dyRYJ+w0s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uxxicCy0aADCVcurysC0WZgLxktl811DpRueNKNoKU6RawiEYVsuNAAE3XXbG/1kSmmqsRSfQB9zll/g9eUmxHEUH5BIvwcjaL0Fjl9sePEe6f+1GaFFkDxaU/phQI/jEdWYpcx8gxMKoj/NigpnWjCniAPZvyTHNMvsJ0deqhY= 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=HqpwcmN0; arc=none smtp.client-ip=209.85.210.182 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="HqpwcmN0" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-719ba0654f9so4969010b3a.3; Tue, 01 Oct 2024 11:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727807370; x=1728412170; 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=Iw8VwDOz5fOX4AAGu9NDF1NRWlAj+unYZmC2Pjfirnw=; b=HqpwcmN0ZP4pNZJ3uMUJefGtR9ORi1B3GzbGyVg1Wt4fKToln02ErhndgqgKUmG1QG juRWD8RuciLk50zA33/0Oxw+6usVQvUC+lYbPZFEVdOBSbXztddYV9UyXIDzZB6IWZjp OzAYV0p+TRVSmR7C7xD940N6VNbzAdmQu/Ejw7u8W/3oAnmh2cVyaXVachQM84KyDpND jOg1eBj+zPBemH3U+YbK+9YmiKA273hlvBCoiICkLwqisZsyrGtBEuWK4XOCYl7g+k67 ZShhpA09KSJDB0uv9kXgBM/eARZ9nLxsQMAL9F+rhmcx2vc4wRevGeNsbeZeQAsoLvuA TeSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727807370; x=1728412170; 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=Iw8VwDOz5fOX4AAGu9NDF1NRWlAj+unYZmC2Pjfirnw=; b=u/khBob631kB8uBlpkU7cTvTKEjHxErn1hknC1MpsW3QM9zPll0QyXinBfV10OZVM4 mw+D659UwqbwEadIrvZoDKnjyNC2HQSBa/V5amEHmDPPUjuv9FV7sIugREu00iGnIX6V gK/idoA+DSbZ0KfoSxQw6llVbO42+NMGo9c3ygdvYyQ5Z6x2r9hsXz1DDJ+Y1/Mf/DKE jU//O5+GZkjNmcVxb5NmP9Kn/+agf8LeW/7+tQVilm/x3+sHroTDqzx1Rv8C7397vJmR P9IIZ3UWnKHYJojC3xi/GYqHUmO8s1FV+xuxePyuApasWDiXOyXq9afGfSPRRHZYutgn zkOQ== X-Forwarded-Encrypted: i=1; AJvYcCXSM7Od3Jsrjw9tk7sbSjEczlKJ1zGQUZIrsUBHzubq4h8lr/qEt7El/nOdgPPdjsHDL7CLyLJiUCqdVd8=@vger.kernel.org X-Gm-Message-State: AOJu0YxvB44t5A3ZdQzzDyrL0doa/ziKNYEcmy5VKlDHMKKjW/6Ol9VL QyxVC8Tdgpwyf1IVzFK81ra5HtCA3+iRuzqDFxJLs/ri9DsALW47hGmaG9fB X-Google-Smtp-Source: AGHT+IG9I4dbXDNY9oRlsmnlCgX5xW4nOY/g+16GVSiYV6shXVFS2IczH6pnRmiYXt5yP3NJwt3cwA== X-Received: by 2002:a05:6a21:e92:b0:1cc:da34:585e with SMTP id adf61e73a8af0-1d5e2dd9f6dmr801905637.46.1727807370485; Tue, 01 Oct 2024 11:29:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 11:29:29 -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 9/9] net: smsc911x: move reset_gpio member down Date: Tue, 1 Oct 2024 11:29:16 -0700 Message-ID: <20241001182916.122259-10-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" Not needed in struct. It seems to be unused actually. Add error handling to avoid unused variable errors and to handle -EPROBE_DEFER, if applicable. Signed-off-by: Rosen Penev --- drivers/net/ethernet/smsc/smsc911x.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/sm= sc/smsc911x.c index 77a5b766751c..3b2388c1c939 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -131,9 +131,6 @@ struct smsc911x_data { =20 /* register access functions */ const struct smsc911x_ops *ops; - - /* Reset GPIO */ - struct gpio_desc *reset_gpiod; }; =20 /* Easy access to information */ @@ -369,14 +366,15 @@ smsc911x_rx_readfifo_shift(struct smsc911x_data *pdat= a, unsigned int *buf, static int smsc911x_request_resources(struct platform_device *pdev) { static const char *const supplies[] =3D { "vdd33a", "vddvario" }; - struct net_device *ndev =3D platform_get_drvdata(pdev); - struct smsc911x_data *pdata =3D netdev_priv(ndev); + struct gpio_desc *reset_gpiod; struct clk *clk; =20 /* Request optional RESET GPIO */ - pdata->reset_gpiod =3D devm_gpiod_get_optional(&pdev->dev, - "reset", - GPIOD_OUT_LOW); + reset_gpiod =3D + devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(reset_gpiod)) + return dev_err_probe(&pdev->dev, PTR_ERR(reset_gpiod), + "GPIO device not found"); =20 /* Request clock */ clk =3D devm_clk_get_optional(&pdev->dev, NULL); --=20 2.46.2