From patchwork Mon Sep 30 22:40:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13817213 X-Patchwork-Delegate: kuba@kernel.org 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 CB763187849; Mon, 30 Sep 2024 22:41:01 +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=1727736063; cv=none; b=fgyziDJNwcIPulKeASVZtuVmde8J6XZbtxxTsqUNs5/pL8dzrjGgq1zsQ4mmEs9oPp9lAfipKyAsWptc5Lv9o1wbs99qH+o9GrJGlrCfO6ZrNfhHMGwTEEFzqGhyL7MMd8xv8OSOvjtnB5gEk04NKNbe8bgKHIDhTSgBaKViUVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736063; c=relaxed/simple; bh=UO1AK6cSFv2YpB5vO4G4kuMpDK6Xz9tYWWRtpYMz804=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SrqZfybeH6SlsGrgb71elOmi8d6UXDfBPapDT8v447H5V2rC+NdwEzMwHMg4XCZZb6AThdnGpLeKX3N62ctjiwkh0kuEULsscn9nPvz7IW9psmKwTnxawi+yrFFJCEGuoJb1/xvjSt95UVrJ7drOZY80sXD4ZUrobppQCfzpXlk= 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=f5XY+G+U; 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="f5XY+G+U" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-71b070ff24dso4331753b3a.2; Mon, 30 Sep 2024 15:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727736061; x=1728340861; 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=f5XY+G+UrF+6Znk9Xn96ol+8A+YAMrH3xCB1iB/1W8p/1xhfNpcCs+DWlYkVJSMUvR w18Sm8fCn06hwB7vF6YKqdk8hL3iKN4MMfZdslHe18xypi2HhCf6ztrdNH65/OeB4mhy p7ZA90EDYcWKnJnG+sywZMiKO7cTFkTaK/kSQKJM2Pz6ElSBjr1V9pd2U8tknl2hWUyq FGarN/Z1h+TdB2mxjJSq00dIEA/bk6TXGWWPKkYYOv4IpYcF+m0NnLzo9COcjrEAI1Ve Ph413njpbSMfWnJwTy1F5Wed3yYsLr7uBhPQIzxvkDC18e7VD5q4UPqy4CUTotZRiLXU DEew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727736061; x=1728340861; 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=s5FBS3D2Dl435yYU3jG9nZEZ/j53VOPO3urWBvyYN2Ru+oQBFznXFIcdIIt8ACE2Zz gibnLKTGkPbMVYyLFhTDmB+FcrVebqprFXC6lWw+lyuNuCKkBPZpAFrKV7RYunB0GtHi 0LDhVn5wRpIpwGKKeQBgCcfQTDO1dlNdDQ4jv2xL50xqo0jFyd3rIeLcwr+Tl/GvCTcV VYo2lLrz6BI2POPdzypHbBhYif3D5Z3+Z41oQeW+O4O7UHEtVzkBORaATHZ59bSjB8Bm rbHjRRvL/SayZ4cB1FRHDkten9aY3KDU0L+1xOjVY0cviTcbetiR+RWvLHa1uFtxt8oC eoow== X-Forwarded-Encrypted: i=1; AJvYcCXP16S8QAniBcO4u1dSyVtowJuAvKBOQZO554PhZemJ/Hv5zroM7Esit4+NyuuB2oB9vydP5vIUNDOZNYA=@vger.kernel.org X-Gm-Message-State: AOJu0YwDd7tIT6xB6QUSIN9UrYjxvdPzYKg5d7nwjsuTA0VOfRYAGHBd l8lt7tYlDQaIQ6PYRVdhcS7wbRHuTRRZbPBP72WQcyxBeUZFyDc9mDVGCKnO X-Google-Smtp-Source: AGHT+IE8NZqlTieUcOjHj0al9kkTMlY+9HufH4pcT3RRtcgr2pW2tuxuXbEkrFDyqsGmiJbDT08WNQ== X-Received: by 2002:a05:6a00:3e1b:b0:714:15ff:a2a4 with SMTP id d2e1a72fcca58-71b25f75357mr21460538b3a.13.1727736060783; Mon, 30 Sep 2024 15:41:00 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26515e40sm6786921b3a.117.2024.09.30.15.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 15:41:00 -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: [PATCH net-next 1/8] net: smsc911x: use devm_platform_ioremap_resource Date: Mon, 30 Sep 2024 15:40:49 -0700 Message-ID: <20240930224056.354349-2-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930224056.354349-1-rosenp@gmail.com> References: <20240930224056.354349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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/smsc/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_device *pdev) { struct net_device *dev; struct smsc911x_data *pdata; - struct resource *res; dev = platform_get_drvdata(pdev); BUG_ON(!dev); @@ -2334,15 +2333,6 @@ static void smsc911x_drv_remove(struct platform_device *pdev) mdiobus_unregister(pdata->mii_bus); mdiobus_free(pdata->mii_bus); - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, - "smsc911x-memory"); - if (!res) - res = 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); @@ -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 = dev_get_platdata(&pdev->dev); - struct resource *res; - int res_size, irq; + int irq; int retval; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, - "smsc911x-memory"); - if (!res) - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - pr_warn("Could not allocate resource\n"); - retval = -ENODEV; - goto out_0; - } - res_size = resource_size(res); - irq = platform_get_irq(pdev, 0); if (irq == -EPROBE_DEFER) { retval = -EPROBE_DEFER; @@ -2439,24 +2417,17 @@ static int smsc911x_drv_probe(struct platform_device *pdev) goto out_0; } - if (!request_mem_region(res->start, res_size, SMSC_CHIPNAME)) { - retval = -EBUSY; - goto out_0; - } - dev = alloc_etherdev(sizeof(struct smsc911x_data)); - if (!dev) { - retval = -ENOMEM; - goto out_release_io_1; - } + if (!dev) + return -ENOMEM; SET_NETDEV_DEV(dev, &pdev->dev); pdata = netdev_priv(dev); dev->irq = irq; - pdata->ioaddr = ioremap(res->start, res_size); - if (!pdata->ioaddr) { - retval = -ENOMEM; + pdata->ioaddr = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(pdata->ioaddr)) { + retval = PTR_ERR(pdata->ioaddr); goto out_ioremap_fail; } @@ -2467,7 +2438,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev) retval = smsc911x_request_resources(pdev); if (retval) - goto out_request_resources_fail; + goto out_ioremap_fail; retval = 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; } From patchwork Mon Sep 30 22:40:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13817214 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.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 039A6188CB6; Mon, 30 Sep 2024 22:41:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736064; cv=none; b=kX4SZ/BPffLLJQFqRL9d5sgPksZ3n5OV11Diq06OmSNqbb2arYXx28A2sJHOs9sz3ZZAeUdT3mGPr6kNOoUT98eakSfsYwGlxbOf3qkOswqIuOb9AS4fEQWBZkkA1oK/0htyC0L6HOXajR6mhDeNP8nOf9qtomfwFi8mEUFsi2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736064; c=relaxed/simple; bh=iqj9a7iIpUjrYd15WVWnWZFhqqFG10G6AO3gHegYl1Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J4M4jYzPHpoAMFwD+1bOSwc83EXx54G+7kJQpecQ/WQ8MAQ7EK1rWNJaPcml3QnDjJnCjAObrY5up7ojtNvGxObZ7HrnY3TS26FuwAFwY6JDNipO9IXB/hFu8ftP1w1oUR6nq/3ZF//jcUxcBFpRlfbuN0GviWN1gc1gxnQqHrU= 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=mKf7WIcM; arc=none smtp.client-ip=209.85.210.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="mKf7WIcM" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-71979bf5e7aso3574371b3a.1; Mon, 30 Sep 2024 15:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727736062; x=1728340862; 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=mKf7WIcMbNsk2+O2hgnejO4w429vA4ePoXX2ehVKprp2k3TMYxQUbz4dLmJYefrPVk gh64ULoD4beZBA8lRKFIBqo48WmWT2QB15NkaDOGieusOHidza6sCAZ3AqZxd0UtcbWD i+EHRe1wMWEejDKlyVku5U2YJtOnNSLjcORio1628YCD71QjjBMPAatjywFBUgUTyMtV RUkBYWd5Irm5dr4X8d4ryLQ7E5rEKwH2mLrh3J0kuMeO4UY7/Ql9BpPhOxSjNaBTCkaz h9Lc0awzVbzQBVy5MA44YsBUuo2I0sFkzZBp0PQ5pRW04BpinF6VlP6aGjyUCgLTrOJL PAaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727736062; x=1728340862; 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=AadAr+X37C8t9bYTFligvJI5vGhF0hRyfsJPy4ylmQIB3rKEyZFvcF4rYaiCPXcDSD fNYhW2mAqS0/+/OXW6mgdaJ0VouzHQA0/ylloq4opVHCGv3h6CzuMxiUU7ql9jd6KXVW LEkBd0J4BG4f2i+ctK2WtbpHLimlMEh7jPSGJ+6J5aCjA0x+WzdsLKdmx6r6oUq8U+jv 3ZNA0GRzg6IdPYMFPq0xwu1opbjQ8bFEg2Wkc0wF0dd3tItOFH+xYSzTyru2yYG9OBDG ld1v4Hgt7BUQANbqzwyLy6u/4N1I/6dHaiDg5P3YjwmJCirtI25ASleQViWaKLoHK4gs +P4Q== X-Forwarded-Encrypted: i=1; AJvYcCUGjpYvVqQirn63/c8UEZWEETmbTMygf/AVtt4ci2V/iHi1rSZo6F1Y1ZClRbInhmA6c/UuhQvOLK12/YQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/u2+ZolFhqeclpTpt8jBko38QeysH9h+JXod+PsCLCBOyWIc+ 1Jbp6cvE2utPuirmD5/MzMvNJ8T3lqVH8tpq/NIHoo/yqEW3px3IWhl+1bx1 X-Google-Smtp-Source: AGHT+IEGn2qHNDIanhj5+COEzeMEGR77sc32cVkcEfI0ojBcaBh8IwX8BmdUaI7dL5UCAg+adDSpmQ== X-Received: by 2002:a05:6a00:1412:b0:719:8f90:5bae with SMTP id d2e1a72fcca58-71b260839admr20416723b3a.27.1727736062200; Mon, 30 Sep 2024 15:41:02 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26515e40sm6786921b3a.117.2024.09.30.15.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 15:41:01 -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: [PATCH net-next 2/8] net: smsc911x: use devm_alloc_etherdev Date: Mon, 30 Sep 2024 15:40:50 -0700 Message-ID: <20240930224056.354349-3-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930224056.354349-1-rosenp@gmail.com> References: <20240930224056.354349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Allows removal of various gotos and manual frees. Signed-off-by: Rosen Penev --- 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/smsc/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_device *pdev) (void)smsc911x_disable_resources(pdev); smsc911x_free_resources(pdev); - free_netdev(dev); - pm_runtime_disable(&pdev->dev); } @@ -2417,7 +2415,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev) goto out_0; } - dev = alloc_etherdev(sizeof(struct smsc911x_data)); + dev = devm_alloc_etherdev(&pdev->dev, sizeof(struct smsc911x_data)); if (!dev) return -ENOMEM; @@ -2426,10 +2424,8 @@ static int smsc911x_drv_probe(struct platform_device *pdev) pdata = netdev_priv(dev); dev->irq = irq; pdata->ioaddr = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(pdata->ioaddr)) { - retval = PTR_ERR(pdata->ioaddr); - goto out_ioremap_fail; - } + if (IS_ERR(pdata->ioaddr)) + return PTR_ERR(pdata->ioaddr); pdata->dev = dev; pdata->msg_enable = ((1 << debug) - 1); @@ -2438,7 +2434,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev) retval = smsc911x_request_resources(pdev); if (retval) - goto out_ioremap_fail; + return retval; retval = 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; } From patchwork Mon Sep 30 22:40:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13817215 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.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 6A419192B77; Mon, 30 Sep 2024 22:41:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736066; cv=none; b=WmpTRPr/ZBpzsIwDx7VQUc4yB5+veqF1aUAO4L9u7GGN4mZIl5O9KgAAlxUmFh5cBwUY3zZkRWdOlDuIMkeRxaVGNuyQX3msWICVGkYjuvvt4S8gFcLXOrwBs27pZ3F+3qQqUcTLt7zE6ojbTOTtKyOF2+PlVaZDxntdSqV+vQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736066; c=relaxed/simple; bh=x994x0rBBXuswtZWWrjpOvS/r+5K72UXBv+BHNYF1+I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U50Znn1mJN+Y6JRKdQKJJwNnoGQ5pby+FROrm105ulqWe+SDBmaFv9ScPVrNTY1nJZNJeAZKPZbdKT5yS1OMutp6+899VwF+1fUINLGRxtu7SNJmN+mgzH98UbVjEv3JwLFobeWTWpGuj00hrq8i/UebRa29W+OBY+mi4gQ1PbQ= 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=dCSimmsE; arc=none smtp.client-ip=209.85.210.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="dCSimmsE" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-7178df70f28so3831624b3a.2; Mon, 30 Sep 2024 15:41:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727736063; x=1728340863; 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=dCSimmsEhp7pJr4aAvOYxkx/dtGV/BSGqQnLJrzsBILGgoMqqQPvCtXDbuEYmRg/Ai a+ykGLn/+P3DuZzIEDK0L0+6unFGO+R+JB0ovwBOnxllnrhmfFc5EkUetM8SS0VN6jT9 to/KxidKRvo8DVkmP7+C2YIX/boYcH+sblu0yqBTcMDSP5fdWYssQMQkQhCaDwhR6V8E fjOpGX65dMz4WLMpLTZlNlwwTbt1jACsITP/MBAQRfeZ0Eo60up4ow/3V7ZvxM7ZtQeE pchzTWVau7vwmDD6MQvwKSED5oRV4shPWZHk9rf+5oeuQ5sXNeXlZbCh5DO84/Sew+VL iRRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727736063; x=1728340863; 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=dmOXrN+BMpd4g7lXd/PTeYqDulZgNwa9bQw2/9dXgCNbLVQYWOd+4xK2Vs2YsmbDWS kWgQDjIzRLRAKQbLhbNaIxtcWC6uJAWddFFmCCqf8Oz/y97abuZdsxZSb3Cv1bXmf1Cr ltKxb6kYnpyv3rv0ptzqzaalQu1fH9PYy4oXshJ459QdIgARfx2YkzzA1XjsA1lND9Ug LZK/PEf2bAkaDrqgj0mSX1kTs53lasre9KpEhmgYlJ+VZJcyj9X6ben1r/E8dQXgkLhP gbtzZHDWRXOXobatmEfi/zhWn9Bs0YrQc1GMDVUzzl2CNyBwlUXGCtxt7NACDU2mfh4y C2kg== X-Forwarded-Encrypted: i=1; AJvYcCUgwONzMnMyOBpr7CQ5SlACHf7fehoezC71KdvEwbEELANCsUW0B3lkS9XTmdBvBN+WGPfHv56Ldj9oPMk=@vger.kernel.org X-Gm-Message-State: AOJu0YzXGj8f9RqsBEvWvpLUS1zzh2otEsNtmrZdJazGbG/0GoTanrTu /BxwM3Oys8TvaromsS4+Qxovmlijrz3Wj/GThrXgvnyNnn6n1lTlCyEeXlRb X-Google-Smtp-Source: AGHT+IFm65tgB2Nwcn9iqP1ktq2K+3nuEjU6r3DPFHfqdhdqeDCCLFZl75U9ht87CpRJkaTCsvLA+Q== X-Received: by 2002:a05:6a00:2e87:b0:717:9154:b5b6 with SMTP id d2e1a72fcca58-71b25f3dae9mr21221595b3a.7.1727736063567; Mon, 30 Sep 2024 15:41:03 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26515e40sm6786921b3a.117.2024.09.30.15.41.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 15:41:03 -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: [PATCH net-next 3/8] net: smsc911x: use devm for regulators Date: Mon, 30 Sep 2024 15:40:51 -0700 Message-ID: <20240930224056.354349-4-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930224056.354349-1-rosenp@gmail.com> References: <20240930224056.354349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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/smsc/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; - /* regulators */ - struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES]; - /* Reset GPIO */ struct gpio_desc *reset_gpiod; - - /* clock */ - struct clk *clk; }; /* Easy access to information */ @@ -369,41 +363,10 @@ smsc911x_rx_readfifo_shift(struct smsc911x_data *pdata, unsigned int *buf, */ static int smsc911x_enable_resources(struct platform_device *pdev) { - struct net_device *ndev = platform_get_drvdata(pdev); - struct smsc911x_data *pdata = netdev_priv(ndev); - int ret = 0; - - ret = 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[] = { "vdd33a", "vddvario" }; - if (!IS_ERR(pdata->clk)) { - ret = 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 = platform_get_drvdata(pdev); - struct smsc911x_data *pdata = netdev_priv(ndev); - int ret = 0; - - ret = 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); } /* @@ -417,24 +380,7 @@ static int smsc911x_request_resources(struct platform_device *pdev) { struct net_device *ndev = platform_get_drvdata(pdev); struct smsc911x_data *pdata = netdev_priv(ndev); - int ret = 0; - - /* Request regulators */ - pdata->supplies[0].supply = "vdd33a"; - pdata->supplies[1].supply = "vddvario"; - ret = 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 == -EPROBE_DEFER) - return ret; - netdev_err(ndev, "couldn't get regulators %d\n", - ret); - } + struct clk *clk; /* Request optional RESET GPIO */ pdata->reset_gpiod = devm_gpiod_get_optional(&pdev->dev, @@ -442,32 +388,12 @@ static int smsc911x_request_resources(struct platform_device *pdev) GPIOD_OUT_LOW); /* Request clock */ - pdata->clk = 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 = platform_get_drvdata(pdev); - struct smsc911x_data *pdata = netdev_priv(ndev); + clk = devm_clk_get_optional(&pdev->dev, NULL); + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "couldn't get clock"); - /* Free regulators */ - regulator_bulk_free(ARRAY_SIZE(pdata->supplies), - pdata->supplies); - - /* Free clock */ - if (!IS_ERR(pdata->clk)) { - clk_put(pdata->clk); - pdata->clk = NULL; - } + return 0; } /* waits for MAC not busy, with timeout. Only called by smsc911x_mac_read @@ -2333,9 +2259,6 @@ static void smsc911x_drv_remove(struct platform_device *pdev) mdiobus_unregister(pdata->mii_bus); mdiobus_free(pdata->mii_bus); - (void)smsc911x_disable_resources(pdev); - smsc911x_free_resources(pdev); - pm_runtime_disable(&pdev->dev); } @@ -2438,12 +2361,11 @@ static int smsc911x_drv_probe(struct platform_device *pdev) retval = smsc911x_enable_resources(pdev); if (retval) - goto out_enable_resources_fail; + return retval; if (pdata->ioaddr == NULL) { SMSC_WARN(pdata, probe, "Error smsc911x base address invalid"); - retval = -ENOMEM; - goto out_disable_resources; + return -ENOMEM; } retval = smsc911x_probe_config(&pdata->config, &pdev->dev); @@ -2455,7 +2377,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev) if (retval) { SMSC_WARN(pdata, probe, "Error smsc911x config not found"); - goto out_disable_resources; + return retval; } /* 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; } From patchwork Mon Sep 30 22:40:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13817216 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.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 D89311A0BC8; Mon, 30 Sep 2024 22:41:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736067; cv=none; b=PF9u8eNvkv/7O+3rlTDaN84fuBhc8xMC5KO0kYP1cE1mMCiaUp3/zEdizcUeMHFZLuWch/oQSxKTsXgJ/q4ce5n9WPBQVFRirHJOXDn7QaOi1NOGcg4EqhAWmiimnQN7HsC5//qVWLi6BN1pURhtCGLrkObyR/uL8H3RqS4jl/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736067; c=relaxed/simple; bh=d1wcnJvYT1jEDXMivdbAMm3QJ4G3BETNR+XYEB1nViM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WK1Vs7aXDD6kLEw4KTcYJkKkubg0wZ2AZoI7dmmJJ41sGUphvmxA2qGVyoK2ga7RrX3gc0m9GZMj57CghibedLoJpEGRgUCe41V2NoZuQDTeZ1rjy6qCZiLl5IW9itrg/3hpNeaGawUYJIYp8TfLnYdn4ZHddFlj+YI3AZTRltE= 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=iYfIjUZ5; arc=none smtp.client-ip=209.85.215.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="iYfIjUZ5" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-7e6bb2aa758so1898613a12.2; Mon, 30 Sep 2024 15:41:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727736065; x=1728340865; 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=iYfIjUZ5dfd0qIcCcLqXW2kXoPbk8Dhe6v8AB9tA+Xu34VLGWMVkcwAbX0d+mPp0Si QEhdymA75pegjC7otvopWgK+P1kpoWkSWi4MTE5kbIfcu+sbeITUUzOC99Z02pr1oRQt FL08BVeqhP1LPgnDAYWF/wgw09hXRlHDkCYTqXXIUlUPMSs/J/5JK2ojqEEpMJaYwND1 v17cIOMjjXtz45wJ0+At477aDJxA7/xO7slLTDzT5qosbw0fMvcw3DZ+exXzunZKOeeh KCFXlrcBOikkGjJtmlX2ACjCFDesu6sVK6Gz3ndcsmgmB/LBWFwpjQ/qP8yn9DUdmNFZ 6T6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727736065; x=1728340865; 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=cxFIr8Sse3CI3fJaKW4SmT1rC2mDW99yTMcbZ7mDGDu3LvUf+Te4ZQWTESgFvIjJPm hkANDFhwXJA6+5YoKm2I5qQGicoIavOkAy77k01uPzJFtCEdsGm0LQT2h0TECcA8AgtL VuKzyfcY6wLwOgmTfmtIpf16dpa+NNihsKqF7z+1NaXskTmc5odBcrLlHtV1hzOMwNSs r2YI4b0uU2/8NTvVNVVFNbTR/0QivrefMs9b0nvH2cApQFm7UvWo+8OCFfgMQQ/lhpd4 FVGaQ6p+/mQJHQD4nT6feeiVjHUmE9lvcsWUj0CGpsD3F1kSK7N+bglnQ+cJ2a5fs0vu hQcA== X-Forwarded-Encrypted: i=1; AJvYcCUCHPgoHEWy7Pif6zaLme1bGLy9PIHli/SGA1tW8op12+KDn5RSzPCp/i9PxWPEK8xSDT2KjFD/s+594u8=@vger.kernel.org X-Gm-Message-State: AOJu0YzvwzH3gQ3JxladgvSA0D2j6c+Cu3CCFk5wzjKs90pzsERIvylA nVntw+lcfPoP7BgfOr3txKcMwhKFpfSz8AVNvdolwX7LgTOQn2aUcFO4gXNE X-Google-Smtp-Source: AGHT+IE2w+RXd5jCyBSR90eeIfdfGWdd7qpYNzmkULK33nPjOzgfoYw9CM/OGnt59HeRPG6alRJy4g== X-Received: by 2002:a05:6a20:948c:b0:1cf:ff65:3c30 with SMTP id adf61e73a8af0-1d4fa6cfd16mr14845120637.29.1727736064831; Mon, 30 Sep 2024 15:41:04 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26515e40sm6786921b3a.117.2024.09.30.15.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 15:41:04 -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: [PATCH net-next 4/8] net: smsc911x: use devm for mdiobus functions Date: Mon, 30 Sep 2024 15:40:52 -0700 Message-ID: <20240930224056.354349-5-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930224056.354349-1-rosenp@gmail.com> References: <20240930224056.354349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Frees are missing in _probe for these. OTOH simpler to use devm. Signed-off-by: Rosen Penev --- 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/smsc/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 = netdev_priv(dev); struct phy_device *phydev; - int err = -ENXIO; - pdata->mii_bus = mdiobus_alloc(); - if (!pdata->mii_bus) { - err = -ENOMEM; - goto err_out_1; - } + pdata->mii_bus = devm_mdiobus_alloc(&pdev->dev); + if (!pdata->mii_bus) + return -ENOMEM; pdata->mii_bus->name = 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 = ~(1 << 1); } - 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; } phydev = phy_find_first(pdata->mii_bus); @@ -1038,11 +1035,6 @@ static int smsc911x_mii_init(struct platform_device *pdev, phydev->mac_managed_pm = true; return 0; - -err_out_free_bus_2: - mdiobus_free(pdata->mii_bus); -err_out_1: - return err; } /* Gets the number of tx statuses in the fifo */ @@ -2256,9 +2248,6 @@ static void smsc911x_drv_remove(struct platform_device *pdev) unregister_netdev(dev); - mdiobus_unregister(pdata->mii_bus); - mdiobus_free(pdata->mii_bus); - pm_runtime_disable(&pdev->dev); } From patchwork Mon Sep 30 22:40:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13817217 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.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 BD0901A2561; Mon, 30 Sep 2024 22:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736068; cv=none; b=r/XbqJ9Bqz8dXGOKALJT2jHy0e7h0RNVDmaKji2QRALodMeNoqPj44oFGG/Ai27OyiFahEdRyGl9VjvBoi0Idr/OFEl/4ih12VN1LjN792M89HABGJ23tMFzQDzivVvcq7ets3KTfWmnR1b71AcNypOZwPobIf9dZsDrST7+b+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736068; c=relaxed/simple; bh=lPXA040TtFtcChL0NIAfL6DNCp52wqj/Kschiuuo53M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nYcJvdeWxprubI/Q+TL8MsT2oHmPGGFsnnJjoka+4AnpLVn5IHemcrtjnFSi6bRXyTfAs9JzCCYf2pil/KvQtsNcWXrIXydrLFUzxNfQXFPCfnFc3wpEv5EC3hpMtIysemxefmT2BxK7vyzAKkjTBlHcBVVrU9sy1NCpHhEjAFg= 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=nRKTaZSj; arc=none smtp.client-ip=209.85.215.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="nRKTaZSj" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-6e7b121be30so3252626a12.1; Mon, 30 Sep 2024 15:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727736066; x=1728340866; 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=nRKTaZSjXd7844CiF9oX1CC3UUm/Q2UhiQEL1dFV91iyugx2Aasy5cHtVB1GhxRQ57 2+GlcxFnMO4nQB5tquYQgy0PfjnuZHN2KM6OnL8ttrH4/Es63fJSgdStqxrlNVqy9qsK v66v7Tt3nln8csZP/wFVJ+X6WDSps1CSLc8d9zrAH7pTG7UGvDEkSiXaf+MZSYI0Uq0d beN6ILeizB9c5qfvU2dNUAVEnjzPjiv0mR+FRRHR5cuZBbgdJkayxXxDY6rfF6qdW4T1 u0WB07CIZt+tu3R50Gi8uFf5pfdLcu6b3Aoy4lcc2MFuquHQSXP89J3p79Rk0JRjgmAF cRJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727736066; x=1728340866; 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=HOkpdSS3yLjF6dxRx9mALNv6iP/Cqts0d8+Dds8GmjOEdGZQrinjzEdBdt8i3Q9lRE CDODw5w0A42sWnIHfSwJ6wHIFayC2QLs2lMdeIR+wkI9cFARwGN9y1JoG2kXbtQd7lVp K1Zyc9HLH2m1SMxxAQJXKV4py19qNu5PqrF2g3m2ylKqi6Svjb9Kb0Q78u2BBmBB0W6m V1tvR3v9YW7H8+PGSZ1JXCfXtLWZQ03NZR8gye7B9+JzBc/ifSdp6c+7BsLAi/LsDCGf P7EHxDG8OszDujtC5/+8nUoJl7vgSKEIcKeQKGVfRSaV3m8pFCgyYejqFxYGlaxITIaM 6y+A== X-Forwarded-Encrypted: i=1; AJvYcCV+Dh2lY5S2+NuOnDPiax7vQ9NgK7Yi/L+MawBA93hs48JbZ8PVNHafTpwRiA4XVie+duHvc6KrzYiCCTs=@vger.kernel.org X-Gm-Message-State: AOJu0YyvGNDkVz8cYy5YekWPH2ZGCwaWjpDCEhf3gO4RtLP+eywJ/NVk B5m4wj3w7uq4dNZ/pIeicr2IzEZZDLT+FCvr2w5qkNOZ/WgayjorPav311Eo X-Google-Smtp-Source: AGHT+IEFMBMY5pPA7J+uHeHiaA+Zi90TyFUs4A3JcThSakrH+/hcYRBVJll7JSS8vr4Nxji9nT1BEA== X-Received: by 2002:a05:6a21:174b:b0:1c4:a1f4:3490 with SMTP id adf61e73a8af0-1d4fa7ae379mr16392570637.39.1727736066041; Mon, 30 Sep 2024 15:41:06 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26515e40sm6786921b3a.117.2024.09.30.15.41.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 15:41:05 -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: [PATCH net-next 5/8] net: smsc911x: use devm for register_netdev Date: Mon, 30 Sep 2024 15:40:53 -0700 Message-ID: <20240930224056.354349-6-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930224056.354349-1-rosenp@gmail.com> References: <20240930224056.354349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org No need to call in _remove. Signed-off-by: Rosen Penev --- 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/smsc/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_device *pdev) SMSC_TRACE(pdata, ifdown, "Stopping driver"); - unregister_netdev(dev); - pm_runtime_disable(&pdev->dev); } @@ -2390,7 +2388,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev) goto out_init_fail; } - retval = register_netdev(dev); + retval = devm_register_netdev(&pdev->dev, dev); if (retval) { SMSC_WARN(pdata, probe, "Error %i registering device", retval); goto out_init_fail; From patchwork Mon Sep 30 22:40:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13817218 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 A85D21A2871; Mon, 30 Sep 2024 22:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736070; cv=none; b=BedfD5f+p5ZqfgElTMNAroGAl6fnmY+d4qigiYOCS/wiQsm0Xv5kNQt41RtfftKpyNmayR6FUiRwoB/PBG/bi+PUKCjJaQ5pJ1QWB5FYDbg8tQxyX7+SHPi1GKYCHI90MoL5BGAznuE7ArnRye97kncy8u9aBlsCDZFiOCFdPXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736070; c=relaxed/simple; bh=O1JnaGDR92Hsq5CghCDvAJY6RbxyyGAsCKoBXpIV9w0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VGd2egwqF5i4hNfCMkZuaU6xYhR5GJGVwa0POiXrl+0AbqvKk6DWMMwfznN28q79L1kfNYRfd//eRuhPM5CB9vBJm68txMPH810JS51rxuZSI+MPEkeXyfiqIyCcRknh78E3w3EQDq/zzsLulXXMPoRXdoTyUtgTaT1onFU5NCY= 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=SPHxr8sV; arc=none smtp.client-ip=209.85.210.169 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="SPHxr8sV" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-71979bf5e7aso3574411b3a.1; Mon, 30 Sep 2024 15:41:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727736068; x=1728340868; 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=SPHxr8sVj4q/26LiXm/RsOUs6oN/Bt80BbXhIcfpwb4TXN6qtA6jGWyrafI6+5VnWY wUHIyQq/JtIuRXxApuy6uJjURXYQ99OTEBXbXVhGwmVbM9yCV2yLdimvsFY5zw3TJlJ8 QK8XnoXTNmLkZBfjust3yz+oAChsGzP86Sr1eEjjzKI46YD89QepOL064ebUTZC0Ttmk DGt+Pl3ikM+Ia5OFUKEL0PzeHoGHvVgrObfKGzcnesjpFTneVzjs8poncjMaQ07uAISe iiK4Y2kAlMJ23jX8TEGKjLUDBjSgTw4MBWKHTsoeC2AVJX8mJup8WLgFVX+hB7Vy3Ixt uQsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727736068; x=1728340868; 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=F/cIutcDkEiyxQ1Twftaj87pYr+cxRZeYy9odIoCEIBfM2vONil4uBfhUu+vAUEFzE Qy1Tn4lrhavEEJ+G1OJKiooBB9Cjv+Tl3TqaEMzi5mZfWT34o7Dui7/BXu3gNHgzbYaD +e5thHCwABcHdvrVxXmx2BV0imygA/z5xl4gX6lHCmzp1NuPIbeqouEhWKNa0lP/NsWt Rj6Fzj0E8AnNFt0tLjO8J6fKt2cxEkWQp5JONA67SLNk24VPHwmlq9jNS1YXOhJlH78t vhKkQyCK/5OS/Vne3fmDt/FTLLXjNGEfuWFkFjhIq3BuC8eI2VosnytKQt1e4pgg8wcB hdIQ== X-Forwarded-Encrypted: i=1; AJvYcCVDlIDKJjnHHfdzrMDb6iyoVx3iFV4NIVWsQQyROBu2UMx0EbmzcmmpW7aPxCUHy7aed5KmFEUAyvVB//0=@vger.kernel.org X-Gm-Message-State: AOJu0YyQBwD6s2M+PnN5WQPEQzCEfmZMiIKke2RSFCEo2coOIyxwsLVV IwA+J1f0b7QlqokspNW+l8JRoTlt1Wja7jDmGbU79Edyrp7fPEOe4Z6miWS5 X-Google-Smtp-Source: AGHT+IGpHLEU5JVDyI2Q+/VJxRdfkXJT1VHBg+PDcnLmuUOHfSEUpqWMO5osjsPMxBv3F/nTzW/ZiA== X-Received: by 2002:a05:6a21:2d8c:b0:1cf:4da0:d95c with SMTP id adf61e73a8af0-1d4fa6f9a33mr21254205637.23.1727736067735; Mon, 30 Sep 2024 15:41:07 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26515e40sm6786921b3a.117.2024.09.30.15.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 15:41:06 -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: [PATCH net-next 6/8] net: smsc911x: remove debug stuff from _remove Date: Mon, 30 Sep 2024 15:40:54 -0700 Message-ID: <20240930224056.354349-7-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930224056.354349-1-rosenp@gmail.com> References: <20240930224056.354349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Not needed. Now only contains a single call to pm_runtime_disable. Signed-off-by: Rosen Penev --- 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/smsc/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) static void smsc911x_drv_remove(struct platform_device *pdev) { - struct net_device *dev; - struct smsc911x_data *pdata; - - dev = platform_get_drvdata(pdev); - BUG_ON(!dev); - pdata = netdev_priv(dev); - BUG_ON(!pdata); - BUG_ON(!pdata->ioaddr); - - SMSC_TRACE(pdata, ifdown, "Stopping driver"); - pm_runtime_disable(&pdev->dev); } From patchwork Mon Sep 30 22:40:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13817220 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 8A65C1A3055; Mon, 30 Sep 2024 22:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736072; cv=none; b=Z6ubeHznivqNWh8QBl0rOar9fnxTXms/EDO38NUQHfCCMvDjFKFgRgYrieVV5qlHMlzdwWeYsDMX04Vc6SnlyFNL2YJuinHui/k/C+h6f6xLVA3+0X6+RKeZ9UBvU0StO52FGoGk1mCwm9Rduy12nZmyDgw/bH9tB/OgGoHhUSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736072; c=relaxed/simple; bh=8IiCzwGKIwb37DfUyFbvLs9jfmb+OQepO33PB7ogdd8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gqdUuNu7WdXozIdsZQSmWGRpl1I7HbQcR/c47ypW80NKhVreHuZsTQ//13VD/zHQMJq/F9Gd27vL14JbvU3FMjNOsH9/ZRSWiuzlDW8j8Irb0I/tBaMZVvkeL8/Ptwh6F1BxqZwcOLdTvbKJyQSM6qwyH/1JLWpORwoh4qm7OV0= 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=dZO444W0; arc=none smtp.client-ip=209.85.210.169 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="dZO444W0" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-71b0d9535c0so3417676b3a.2; Mon, 30 Sep 2024 15:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727736069; x=1728340869; 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=kIGQVSC8663lz/zqOAP4sD5qctnun30Gq2oDBE/53KU=; b=dZO444W0Wk60bp9yWso2R1zDRev0LIamwrb0nSrX42fQWxVFJdBxmHj00inBkuyD2c kJ6VjtxGsDQQDzl+RSBHE4xafc7U7Zam8W0G9YxzHRIIslUeJc5iNiEfXon/95xHWtTb BzuwvTj2kHWwe38EeBeZE95qnzbj0Na8HEVY81bUWT0/kC65ZYsUZFf9qaZbl3uDVtWp bziYJmBvUYjRtC77GLRwZ/qM7r0TJE9FG6Qa5kiJJAjE217eqvgc7wtZ2qZ6ZajImnKi 8kvz7FtY2XbwW9487BQ4Nc/w1wrIBbkhRSo65clY8Ng7vf5Og4wdguRXKVvw+5GyQfnC T/VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727736069; x=1728340869; 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=kIGQVSC8663lz/zqOAP4sD5qctnun30Gq2oDBE/53KU=; b=IJR44U0bydy03ZNPUzTrJm0uupeiMYL01bgoIiXEQ3Zr1RnVJO+2D5FYsl5xuzs817 ReDoW5lOCoR//whqNH2IE/Ywimn5FFbwm6awa+bhk36+ppLHguSbFeZg70Wv/bn8LFIr mTSO06tzQHKTb+6WG7YAhPUnrHRigu8aL3OaqPrXqDh60sgP4ryXjdI2g3RAEcpD2h48 Ph/uKYVc0F7d0aA7wQaRsuSkHcPvennkOPG6zwJ40qlIRW8iREuZN5o448lEN0X7N6hN dqnXpRRyl7KuT5MIbSo7hJsgeIhxJosCepD98YMwG+cTjVQ/SARw1AtUDv2wt23wJcRG FThQ== X-Forwarded-Encrypted: i=1; AJvYcCWLUEb1zFB+aL/VoeQodsj5QmosTmtPOk5/uBvue9QMK6Tnq3z3SgHyJ02GQQN0gM1Gb+n+GXIE/PTzDcA=@vger.kernel.org X-Gm-Message-State: AOJu0YxtuQY7jvmVL5UQhMXxDIuHPBj94oHk9nAY4is6bLAserQWnaG0 3NAyELX2ysllraLiHQiIf/mqSCmhbE9LXGBPfKSLrXfzDiGjPEE4+c5mB3oU X-Google-Smtp-Source: AGHT+IHoIr3EZcchDHINeOyI3s1TIx2YDqAOXi8em11nNeEQMidqglapMlkLQM1Z2d05xdXBAjI2YQ== X-Received: by 2002:a05:6a00:114e:b0:714:1fc3:7a00 with SMTP id d2e1a72fcca58-71b2604408bmr21061635b3a.18.1727736069162; Mon, 30 Sep 2024 15:41:09 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26515e40sm6786921b3a.117.2024.09.30.15.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 15:41:08 -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: [PATCH net-next 7/8] net: smsc91xx: move down struct members Date: Mon, 30 Sep 2024 15:40:55 -0700 Message-ID: <20240930224056.354349-8-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930224056.354349-1-rosenp@gmail.com> References: <20240930224056.354349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org These are only used in these functions. Signed-off-by: Rosen Penev Reviewed-by: Kalesh AP --- drivers/net/ethernet/smsc/smsc911x.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index e757c5825620..5eea873db853 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -131,9 +131,6 @@ struct smsc911x_data { /* register access functions */ const struct smsc911x_ops *ops; - - /* Reset GPIO */ - struct gpio_desc *reset_gpiod; }; /* Easy access to information */ @@ -378,14 +375,12 @@ static int smsc911x_enable_resources(struct platform_device *pdev) */ static int smsc911x_request_resources(struct platform_device *pdev) { - struct net_device *ndev = platform_get_drvdata(pdev); - struct smsc911x_data *pdata = netdev_priv(ndev); + struct gpio_desc *reset_gpiod; struct clk *clk; /* Request optional RESET GPIO */ - pdata->reset_gpiod = devm_gpiod_get_optional(&pdev->dev, - "reset", - GPIOD_OUT_LOW); + reset_gpiod = + devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW); /* Request clock */ clk = devm_clk_get_optional(&pdev->dev, NULL); From patchwork Mon Sep 30 22:40:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 13817219 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 7803B1A304F; Mon, 30 Sep 2024 22:41:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736072; cv=none; b=rH35qG3URFhO09Z8ybKOwqwnrI7us0HWK97c77ESRmtcyKPQyDx+3GLM+TNZTf+iKDIRFLCDA6wA6u92lqkFFS+MhCuXEsRZP1yb4T9FhJ+3RfFhVas7zr32r9Xioup1AH4xMyqWAr8BGQkf2+en/cRG36YxjcTwZ9bZnXh36iE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727736072; c=relaxed/simple; bh=kloClghRgz+Yqeil0HFI/EHrorEwG4+kDSUa4p4zY/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IdaRDKTu8I4iIpoX/4s4/PAPLY1qLQuXCGlFgx9usMI/TU2kvSG30EQX6Ed3obvY/gm5s2gcnvLeFMkaQGKPROZX/ItBoM+Kk51GzKJxHej31SSs/5sjhdp1VUQskZ1Ym4w8AszVW/eR/z3f2/PuQG5jHbQVWbsV4R17kVWaPn8= 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=R63iPdU4; arc=none smtp.client-ip=209.85.210.171 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="R63iPdU4" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-719b17b2da1so3517674b3a.0; Mon, 30 Sep 2024 15:41:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727736071; x=1728340871; 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=hpOdTbaCej9dLM1JEzTBAYpYctEsql9gZez+rqFBwS0=; b=R63iPdU4KV4f4dKfQcSmxSOLfbDD47EAM0XxdqHbp8G8qa2mxx7CSqFgqLsATAXVIA RHcjC0VGoImzruTgr6bGXN4jw4m0UtZHIr6dr2UJCeXnPbrN0pkU2CnGlN1+5gnm1FFz F5jkZXxTzIa+10IyS/VedXh7ACqhWyqzwFsP9hC0ZqzDEy6nE6BsOchlk+pHXJnviihm Bhb2N/kgFO3jjADP95SBfK8dBoQjtbEKfaAtlCzeAuAiOp2KT+hhhQGwaQV24mUog2JZ twKvbQdSlLGHGLdDygvUYtioX6SRvJ1Cd7348q8zcbFEom75RIhzWsZnddwshEFrSLMo e0jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727736071; x=1728340871; 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=hpOdTbaCej9dLM1JEzTBAYpYctEsql9gZez+rqFBwS0=; b=e85OTSJO/J1CJ5LQtzkTIsVNuXDMwvdGvjO+pgFeU3INIf0Ih71eAPAkANkF+23MRe BnOPv3A+Oo9a45pGT0N15+B+YyoMo9wiUIvYU6leAkiAIWVHB+q1nXBu0NJhRuJBOXcg jIpy19omphSEx0hovm6BadydKHAXwNHXD+1HQq4vskwkAlG2wo7jVsz6Btv/9T4uc01r kTyqu+vv8LMdZZbm+FckUdURCCtQ5OCkW5r0u1DEXQrswf/s+Es9/oGubU5M6alICeyJ 97HWk2EYcspaal6vcHzm+62jql0xGMR2mcEqvja3yi6uAgMYUxCqgFMN4yEkrdYwqSVu YUpQ== X-Forwarded-Encrypted: i=1; AJvYcCW2ZgwWxqQZW44raU7u8ouGzOx/GewP+WaTrfZ1ehMode1gz7lfSHsDb/52rOg1T/xciPFq4Mb0/7GbMRw=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7ecRDS8URwVrvK/pKclKg5ZKO58OMfnFzIY3lGbFKgb/EFo2D C3xOr1+7uQIcnXH/hdUa/APiQ/xsjpJd7eJbU+GMemhfc/QC5j8JXgyLYfh7 X-Google-Smtp-Source: AGHT+IGDNsseyz1NhKJkcvNgjuZUoTKGam+hAXNLhx84epEyi19FBd+9ylY3cTL9JejjC2Q2M9WKug== X-Received: by 2002:a05:6a00:2191:b0:717:88eb:824d with SMTP id d2e1a72fcca58-71b25f356a3mr21158304b3a.7.1727736070534; Mon, 30 Sep 2024 15:41:10 -0700 (PDT) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b26515e40sm6786921b3a.117.2024.09.30.15.41.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 15:41:10 -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: [PATCH net-next 8/8] net: smsc911x: remove pointless NULL checks Date: Mon, 30 Sep 2024 15:40:56 -0700 Message-ID: <20240930224056.354349-9-rosenp@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20240930224056.354349-1-rosenp@gmail.com> References: <20240930224056.354349-1-rosenp@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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/smsc/smsc911x.c index 5eea873db853..a74c3f9f7110 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c @@ -2105,11 +2105,6 @@ static int smsc911x_init(struct net_device *dev) spin_lock_init(&pdata->dev_lock); spin_lock_init(&pdata->mac_lock); - if (pdata->ioaddr == 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 @@ -2334,11 +2329,6 @@ static int smsc911x_drv_probe(struct platform_device *pdev) if (retval) return retval; - if (pdata->ioaddr == NULL) { - SMSC_WARN(pdata, probe, "Error smsc911x base address invalid"); - return -ENOMEM; - } - retval = smsc911x_probe_config(&pdata->config, &pdev->dev); if (retval && config) { /* copy config parameters across to pdata */