From nobody Fri Nov 22 16:45:08 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 CBFAC1E1C03; Fri, 15 Nov 2024 20:41:53 +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=1731703315; cv=none; b=p6qP9UlJjPEaJFymbum9FacmZ4Jqt1ByQC9CBEA1vdnWSkriILlTU33zKSL+p5kJ2y6zEKhHRz32VsvBPe3j4vLNkcey9lR4vU+c7b9RTSi3ID3Bc1vPY2hFXBQH0TpCVkmaJK0LPoX73TNuLb+p/MrQ91GlKMUmnagRak5EzFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731703315; c=relaxed/simple; bh=pu3JL68bu1cSv6fdM/I/ECn8R8R6/lc6ICYA0qYjMkc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XJlkhutuUe32FyfH4WaWYyEN3IJ4gdiBGJmtGjL3xzDzrLt3rsy2kL9UV9jdEmC1xytHshtt0vKDrvV6rz2nXnyf+Jg51wzTxepZNlRG/FPjqXig+pFKjGHl0uP0aPL93dxhaygMx+8aYMCVPgNFF0FounTWxNuJWfSt8EBIfDQ= 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=DomsSIB7; 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="DomsSIB7" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-72467c35ddeso1757998b3a.0; Fri, 15 Nov 2024 12:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731703313; x=1732308113; 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=RYLEpqANoyEmd5NTjy3oJeHuyxF++RP3Dua5hSNSzO4=; b=DomsSIB71RmIm5K3aX+Pd7UI0+rToMiSpUbMHF3kj3UUNimYPHgSvcCzp2Cvh6FqDJ 30rnfKjX1bWmHKN/BBzXdDYU1BbkEk1VtG6DqoCdhK+gHdBTjvyAMIFUb8kussuwHKVl o9Fs5YNAnQsRBr0QLnDTS/4c5IshLdOv1Er1sniCxC9GcWej2v4HLrVTFryG4C/1jA/4 TOfHfUNc8HUpJPscfpwIN8cXBHosDZZdLAfn3FAG5sepGts21vvII4kVw1gDSFiV2FUx nJkKIo4x3rvTr6hkJ/RhOHWMHF/M85enNT8qEuh+lb49cufBqTuNgbt0PFkhclZjMrvL Y9LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731703313; x=1732308113; 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=RYLEpqANoyEmd5NTjy3oJeHuyxF++RP3Dua5hSNSzO4=; b=Qq4LMIMMAy6BjZ5qDauriJA7TwjxaSa/ea5nKu9xYbDOqE85oH7h9osYZb8y0WagXv cHPBZ82Ma+x/kKlC666yaRO4NNAxDUzXtySICZ/qvnLKicaYw+UzKEwglj4zYzIYd/At 4Jl+D2mqolHsz8vNh5qz6VBkCgnOohJ9F9Jx3W9Ck29jcZyXnAnLkpHstFhoqe0ObvjT TXQ/pohbJJ9J+w+f67zhwyfx3Wff+dftPZuSV8lQeVTIKl9VPlRC1P7UKTDgC9CyzxNy NXUYWB9A9anXO14kN1oq3U+sxi+qxBq28boYTtIaOVc/jKixWflyCqIeSuzbTTaP+e0U /RRQ== X-Forwarded-Encrypted: i=1; AJvYcCVYRnGNvzfm9vtN00jEsr6QoRDTzaQQ/H4CKlt/0C9Iy+1ygTVgQn6psljSGZCn3vIOODuoOASE3x2GW0Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2U1H+BGNUI6abGDt1XkxoVUtyj9OobYiE1IQNtEmTmhR+zVUF RtHaHj9mhhAxHdHjUiIgZ13wJ4xrKbYwxdV8WlVe0Lk4DAJ7nxxrwDHOsNA7 X-Google-Smtp-Source: AGHT+IFk6vhQpSbCke5UFwKgbExv7XQwqvmbYHXFA3gerYBKAV/VI3K7+irT2LhyYyOA4Vn6Tr53LA== X-Received: by 2002:a05:6a00:3bf4:b0:724:6804:d663 with SMTP id d2e1a72fcca58-7246804d6ddmr11355726b3a.1.1731703312417; Fri, 15 Nov 2024 12:41:52 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724771e1ffesm1782744b3a.155.2024.11.15.12.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 12:41:52 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 1/5] net: fsl_pq_mdio: use dev variable in _probe Date: Fri, 15 Nov 2024 12:41:45 -0800 Message-ID: <20241115204149.6887-2-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241115204149.6887-1-rosenp@gmail.com> References: <20241115204149.6887-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" Moving &pdev->dev to its own variable makes the code slightly more readable. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/eth= ernet/freescale/fsl_pq_mdio.c index 56d2f79fb7e3..108e760c7a5f 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -409,16 +409,17 @@ static void set_tbipa(const u32 tbipa_val, struct pla= tform_device *pdev, static int fsl_pq_mdio_probe(struct platform_device *pdev) { const struct fsl_pq_mdio_data *data; - struct device_node *np =3D pdev->dev.of_node; - struct resource res; - struct device_node *tbi; + struct device *dev =3D &pdev->dev; struct fsl_pq_mdio_priv *priv; + struct device_node *tbi; struct mii_bus *new_bus; + struct device_node *np; + struct resource res; int err; =20 - data =3D device_get_match_data(&pdev->dev); + data =3D device_get_match_data(dev); if (!data) { - dev_err(&pdev->dev, "Failed to match device\n"); + dev_err(dev, "Failed to match device\n"); return -ENODEV; } =20 @@ -432,9 +433,10 @@ static int fsl_pq_mdio_probe(struct platform_device *p= dev) new_bus->write =3D &fsl_pq_mdio_write; new_bus->reset =3D &fsl_pq_mdio_reset; =20 + np =3D dev->of_node; err =3D of_address_to_resource(np, 0, &res); if (err < 0) { - dev_err(&pdev->dev, "could not obtain address information\n"); + dev_err(dev, "could not obtain address information\n"); goto error; } =20 @@ -454,20 +456,19 @@ static int fsl_pq_mdio_probe(struct platform_device *= pdev) * space. */ if (data->mii_offset > resource_size(&res)) { - dev_err(&pdev->dev, "invalid register map\n"); + dev_err(dev, "invalid register map\n"); err =3D -EINVAL; goto error; } priv->regs =3D priv->map + data->mii_offset; =20 - new_bus->parent =3D &pdev->dev; + new_bus->parent =3D dev; platform_set_drvdata(pdev, new_bus); =20 if (data->get_tbipa) { for_each_child_of_node(np, tbi) { if (of_node_is_type(tbi, "tbi-phy")) { - dev_dbg(&pdev->dev, "found TBI PHY node %pOFP\n", - tbi); + dev_dbg(dev, "found TBI PHY node %pOFP\n", tbi); break; } } @@ -475,7 +476,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pd= ev) if (tbi) { const u32 *prop =3D of_get_property(tbi, "reg", NULL); if (!prop) { - dev_err(&pdev->dev, + dev_err(dev, "missing 'reg' property in node %pOF\n", tbi); err =3D -EBUSY; @@ -491,8 +492,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pd= ev) =20 err =3D of_mdiobus_register(new_bus, np); if (err) { - dev_err(&pdev->dev, "cannot register %s as MDIO bus\n", - new_bus->name); + dev_err(dev, "cannot register %s as MDIO bus\n", new_bus->name); goto error; } =20 --=20 2.47.0 From nobody Fri Nov 22 16:45:08 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 F09F01E2609; Fri, 15 Nov 2024 20:41:54 +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=1731703316; cv=none; b=cI97Gd5RNZ9V2p/XI0QdRtAJL+KoiQK38YZbHFW/nc4DJF3n+DLI51Phm1IT+H732yvnjnwp2HJK8EaSYdlRuo5+6xHxSsP39OY6GHljw2uYkd+fsTxgQFbnor/qw1e6AD7/BrBJ+a3kederxu3ZrNggL2FMMJ6ISCZOochKUsw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731703316; c=relaxed/simple; bh=XL14k83axPDHYcjLckdEaN0RAzq7HGpUmxCP8iY2EFE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mkLJuW8yIiVA9O33j2y+w7S3v5tkQvK6dzIVquzimN+cOJ4OYvib3JQiscqmKhZ9ZPLbsWdx6QUNkB8a6i710v68qW6erjRN3weNXeiotOtyAOnlkqAxqWXs4BT8zKgrU458JjwFMr2zo1WwGl0eX7jgsdeGal6fsSCUHITahEc= 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=BP0iidqT; 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="BP0iidqT" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-724455f40a0so1566080b3a.0; Fri, 15 Nov 2024 12:41:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731703314; x=1732308114; 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=jRRatnkW2FFvyyS1UCowv2cxjzV8z8dktdXmCRcfyfY=; b=BP0iidqT2bCCc8hkZz/lk4C2/+6HY7EqBwiS3qM4P3xGgXpt1I2Ks6Apu6iQQaT6z2 86YndpvzlJAJziFxM0zhyZSZcw6h+gs/bsxqo1QjiO+eSvw3g4S4++rpQC8MVWEktNJh OtULNZuL1NFd9h0UNhDok1X/jG9XEVyiy/DXAUMmfxgeve0raR1tJQCXjW4d6nuQIjx4 91NK0yH+R4mOQnxqtsFfmG6/2g9RxYhw4pFX/T4zwIYsrBbjUNfM0PHXT65SsOm3PWo9 rMBBCS898VWdnjPkk60eu/9mv2iIag6UTWF80sMcRXXrifCm3Jm0T/pj0ilO/FnmefEM zAjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731703314; x=1732308114; 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=jRRatnkW2FFvyyS1UCowv2cxjzV8z8dktdXmCRcfyfY=; b=rpLMMxEuQg+/AAW4uOzRO31ZXyUg7WN1naEYBcbFxxJGj7qgKd2DQR0FXOhR/U42ka SA5pjdipmo/zBJlalIRZ2M+f+Wa2MakGRi6sYhoz2Xv3/3F7zrie+C79kFIT1INEx7up AQeBp+YVw9xkbhV50/VgqJFFOiFwxNuZcFmalC6lEpiIhu/8GiiMv/Hsb6aFGemjIlVc KSKAhRAZaT0290hIt31xmgL9GevsaCfnygc0X3y3BclZguwr8/OZSLVddWlq/WrXuD1A XKFxxmeVoSy4vcuRaRpDBi9H95lETUYbFgY8R2nbt14rmbRvDOzkxkcw2TpVwbBD0UnL uawQ== X-Forwarded-Encrypted: i=1; AJvYcCXZ+YkH/RLPojFebXydOR4KecZtb+k6y6DltrCq845PrWdpUrZAT+gRAC5d/LExV3TcoFQYIDHncoIgNII=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+16kT/jiJcfEjFxuT5dKIHtJr1lj8qRyylyYgo0ioBOKANE3V K17iWMLWzlyYTM9H5Z24Jd1lrzVn1dUcMm/xFD0OQI83ltVwBsPt2ufY9dV9 X-Google-Smtp-Source: AGHT+IHCks4beEhpK3bGBqpmHNgrf7UAru2wqyqk5/Honu4yiUlouf/8lwjaEMHWioI2Mf4QsVKqJA== X-Received: by 2002:a05:6a00:885:b0:71e:786c:3fa9 with SMTP id d2e1a72fcca58-72476a0cda4mr5059170b3a.0.1731703314091; Fri, 15 Nov 2024 12:41:54 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724771e1ffesm1782744b3a.155.2024.11.15.12.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 12:41:53 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 2/5] net: fsl_pq_mdio: use devm for mdiobus_alloc_size Date: Fri, 15 Nov 2024 12:41:46 -0800 Message-ID: <20241115204149.6887-3-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241115204149.6887-1-rosenp@gmail.com> References: <20241115204149.6887-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" Using devm avoids having to manually free. In the case of this driver, it's simple enough that it's ideal for devm. There also seems to be a mistake here. Using kfree instead of mdiobus_free. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/eth= ernet/freescale/fsl_pq_mdio.c index 108e760c7a5f..d7f9d99fe782 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -423,7 +423,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pd= ev) return -ENODEV; } =20 - new_bus =3D mdiobus_alloc_size(sizeof(*priv)); + new_bus =3D devm_mdiobus_alloc_size(dev, sizeof(*priv)); if (!new_bus) return -ENOMEM; =20 @@ -437,17 +437,15 @@ static int fsl_pq_mdio_probe(struct platform_device *= pdev) err =3D of_address_to_resource(np, 0, &res); if (err < 0) { dev_err(dev, "could not obtain address information\n"); - goto error; + return err; } =20 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%pOFn@%llx", np, (unsigned long long)res.start); =20 priv->map =3D of_iomap(np, 0); - if (!priv->map) { - err =3D -ENOMEM; - goto error; - } + if (!priv->map) + return -ENOMEM; =20 /* * Some device tree nodes represent only the MII registers, and @@ -502,8 +500,6 @@ static int fsl_pq_mdio_probe(struct platform_device *pd= ev) if (priv->map) iounmap(priv->map); =20 - kfree(new_bus); - return err; } =20 @@ -517,7 +513,6 @@ static void fsl_pq_mdio_remove(struct platform_device *= pdev) mdiobus_unregister(bus); =20 iounmap(priv->map); - mdiobus_free(bus); } =20 static struct platform_driver fsl_pq_mdio_driver =3D { --=20 2.47.0 From nobody Fri Nov 22 16:45:08 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 C63A41E32D0; Fri, 15 Nov 2024 20:41:56 +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=1731703318; cv=none; b=i3FgGDpVusQyaCKz0tKer0rM8wYcBhCJPaQFdWvvZobH+IkdkfzJoKH7VugGcKlHaptdlgyyzIUYwS9kvuVsvCbMmsR7yNfg1fNTUn0OAH2nMGXL44/DyUQPTXJsRQS2/Zh1x8hgBM/M+LryboD9gw04qypwqSDIYKAKlsNLTv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731703318; c=relaxed/simple; bh=UEe+01wXcA/6Vp2tXaLjKWUBpnQy8abf4E5ymq4FAlE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X/Y+jqjEX3SXQqtFSsQv5fAf6Z4ai5WJiCTzhIm/xOICHNfsdEVfC3GeYINthxfehcb7Po7C+CmyLBZoQz6ggm67G/ZF2Vno+nh7XIIi6jM50G40stgfhhTO1C/oDi287AO0Zx8Ob4C96pMn3G/dFg+2VV2tzMn1uus8KplbJ1k= 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=X/DcX5s1; 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="X/DcX5s1" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-71e79f73aaeso1751215b3a.3; Fri, 15 Nov 2024 12:41:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731703316; x=1732308116; 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=HCzzR8j2iKtf3UdeUk+5jPhNrUS+V0xjiwUoH7xZuyk=; b=X/DcX5s1sKwnCixHKiG4FRJXu0QpsiNqdoLcmCz72UmzLGBZxhbD5cBK12j3uDwWQH eX0/+2hnTPBsdaXW/wlV87CMIf95cI0CJDB7IhvHVSB0EXknKW5qdKGc5TSbRYujhyl/ /vsQm1mgfIgR3w3YRjMubBNyo8JKZbCzqD9PuyWdycsBvlaNH9NVnGZajpnhnuULGKXg 2YnXsEPh+rvC3YLuWChrGklhLpz/+CKoADpefx42dlUzneZlz/ucB3Zr1Xg9t58YsCtD HPc7T25zs9MbyUXDow6HhF3LWQA2csnitvSE9SV6/S492sVRfK7pPAkPdpP3BZpXaQo5 aEPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731703316; x=1732308116; 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=HCzzR8j2iKtf3UdeUk+5jPhNrUS+V0xjiwUoH7xZuyk=; b=A2inNC7rQvW8xEFNkzfaszOktWC26RFmBU+ouOZCeRUd0DGZ/RL2XMG4ARhU5wglFp WHQoYdZiAhA7JRQNt2ldkCvkkZzNY0PItQi8sNNBQJAoSLvV9Rw8OlAmOjg6a008SPCB G0hoIEB39X7Yj27F+T14rKEBmCaaMPBaoFI2E0EmBGhkeL+F5ZVv9Pl4m0uQ6eLqhaL/ b2cNYjPPALasjp7erkKdvlURazNrLev0VVswcSDUeWWEreU3HBFmUMLNqPeA8Ofrn508 kge4gGf5tk7D6ptd4HYWaSnDDs3QLG5TvmhD6SQ/iymOV9Qa2G+f6b1QxIWQDqjSdwfc AIlw== X-Forwarded-Encrypted: i=1; AJvYcCWOvfoCG3beZz4iomLX6jBoq/kOhKshb4et7vzKpFLgRJKLaLmVoAFmSu5kEnB0CtpCbkDU/oub6PnLrsE=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4ykhA92lVNf0tSphNCZ0n+HX+4ghPj6e15ettYFPYOS42szf/ 6S/i42O67SABrQ9VUtlhXRgn6iUiiMuOAoMaFByruGfirT2wxGEYsr4YmsUX X-Google-Smtp-Source: AGHT+IFL47ThZoo8cJ5HYJNSr3uIMbpU6x823MSeax4aaN454AWVKRocDwEOEXhTOOuRH8VazRb3ow== X-Received: by 2002:a05:6a00:4b54:b0:71e:7046:c0f8 with SMTP id d2e1a72fcca58-72476f7c766mr4431850b3a.26.1731703315822; Fri, 15 Nov 2024 12:41:55 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724771e1ffesm1782744b3a.155.2024.11.15.12.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 12:41:54 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 3/5] net: fsl_pq_mdio: use platform_get_resource Date: Fri, 15 Nov 2024 12:41:47 -0800 Message-ID: <20241115204149.6887-4-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241115204149.6887-1-rosenp@gmail.com> References: <20241115204149.6887-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" Replace of_address_to_resource with platform_get_resource. No need to use the of_node when the pdev is sufficient. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/eth= ernet/freescale/fsl_pq_mdio.c index d7f9d99fe782..f14607555f33 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -414,7 +414,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pd= ev) struct device_node *tbi; struct mii_bus *new_bus; struct device_node *np; - struct resource res; + struct resource *res; int err; =20 data =3D device_get_match_data(dev); @@ -433,15 +433,15 @@ static int fsl_pq_mdio_probe(struct platform_device *= pdev) new_bus->write =3D &fsl_pq_mdio_write; new_bus->reset =3D &fsl_pq_mdio_reset; =20 - np =3D dev->of_node; - err =3D of_address_to_resource(np, 0, &res); - if (err < 0) { + res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { dev_err(dev, "could not obtain address information\n"); - return err; + return -ENOMEM; } =20 + np =3D dev->of_node; snprintf(new_bus->id, MII_BUS_ID_SIZE, "%pOFn@%llx", np, - (unsigned long long)res.start); + (unsigned long long)res->start); =20 priv->map =3D of_iomap(np, 0); if (!priv->map) @@ -453,7 +453,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pd= ev) * contains the offset of the MII registers inside the mapped register * space. */ - if (data->mii_offset > resource_size(&res)) { + if (data->mii_offset > resource_size(res)) { dev_err(dev, "invalid register map\n"); err =3D -EINVAL; goto error; @@ -480,13 +480,12 @@ static int fsl_pq_mdio_probe(struct platform_device *= pdev) err =3D -EBUSY; goto error; } - set_tbipa(*prop, pdev, - data->get_tbipa, priv->map, &res); + set_tbipa(*prop, pdev, data->get_tbipa, priv->map, res); } } =20 if (data->ucc_configure) - data->ucc_configure(res.start, res.end); + data->ucc_configure(res->start, res->end); =20 err =3D of_mdiobus_register(new_bus, np); if (err) { --=20 2.47.0 From nobody Fri Nov 22 16:45:08 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 0A4B81E4120; Fri, 15 Nov 2024 20:41:57 +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=1731703319; cv=none; b=My++3MOfRPjZbPJc/nl7xFHcAfun09XT8lr8DXUHuZW8bIcUk/5JuS9aKD14zMF4B+9fKIBeX+paY99vFEDuGh69pyc3orDx51kXCT7z0efbfLnpWwmqK7cNoiz7C9dXdjmP2oXUTUEFMpYS0uWBhQsx+mELQM+z6HzEyQ/xPkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731703319; c=relaxed/simple; bh=bxNdSWBFOuU160wYi2ZuwoNG6N1rmqN5rH4LXYxLWWI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bg+y6LI3HOtb7XqD+47N2vbqosITsh9ExCdQ0New3n9LcHnZgATW9KfLWGhVlP8PofDjRgXs0agoRbUq6XEHLHmr/5EOBQVWQ4bil4Xe0VoVhx+PHr79SFh35RNbdLIX7RPc0o5Pu+Xp9c+sAdE2vXmxWH2X+fcT2e6AwsuJe0c= 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=V0o47x7t; 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="V0o47x7t" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7206304f93aso45735b3a.0; Fri, 15 Nov 2024 12:41:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731703317; x=1732308117; 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=iQ2w1hRvX2gv5YNJeLZGgNGigEr7WSReYY3PlM5Kufw=; b=V0o47x7tQ4MdoBkguKQD1KsRn3XkdoFQ2i35HE4nb+554Cf0n1QmeWLzkImonC3X/L XLGytN0sQ8+wdire1KQSI1kkfnsKk6UD6u2+5uHx/LY9+cnMaBfGcpLZ+2mDJIkBJz2X SygdETRGDWFqEQGGhsRevE/NaoO17v29scY0HPjQOjf+yYN8IPpNMa8eiFPdw7srJuNN Z4y4VaAOCZqAgXLB1eIC79zPaFIfyyTlQm07DXcaqc+ND8IrhbuUkOGG/JNTr4kC5Bq8 eI9jPnThIatk0oWAk2koqhjAEfbSuwWWSASZCqpWdIbO7MIJ1qDaRS8xzT9Nfpqo98ee Oxqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731703317; x=1732308117; 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=iQ2w1hRvX2gv5YNJeLZGgNGigEr7WSReYY3PlM5Kufw=; b=HdUh+3Ta/meoFXq1V8gzY0SpBoUBtCMFbqAJuggYgem/o2mw/u8s4xnMlODwQM/J0y dILV9Uggb2h4GNg0byCi2YdCzjLw8wboqUqQYzXDnDHQcAikVYMWEgnlKem0yNwNSFtP WtEQZq618M89HS8LDxfjB4QsLIT2WQ/ZMA9EFIDyAZKr0ceD2YS31UwTTRgzK2RfsiiL pVYF4gLfjcrNkiGCYc+BQ2dXGr3zgLiKs83egBJZAFtEj/jX0X7kjH0BqUHM5sYjy5UI v1Zs4v64D87f515LVUXl6+d/m0BnVjfTb4rXg65KkObv7Cny8wopOVJPilniEUWLOBM6 0Eyw== X-Forwarded-Encrypted: i=1; AJvYcCV5ai9c+o7YVbgLeKnVtUz8GjSZx4pJEfFH9PJclmCKs7rpytG3cDjM/slSHoDZVkxYJJHydFGQeQtsxIk=@vger.kernel.org X-Gm-Message-State: AOJu0YwF94rpa+mt8wQvGAzpcxCscvhNayFH/A1MM8bMLbNKFuou/UNw IZ2NCFIDuxCAPgIPA8cf6pFFt3V9Rp5lj+Unhq9WpxrvX4KA03FYZGbRdoMN X-Google-Smtp-Source: AGHT+IHfZ7d3aaomlm9+JfgSOZe27g0dYGIVKOtrqV6lk3DqQx/mXWLXlOXI2dERnGMXGpqp5PXyJg== X-Received: by 2002:a05:6a00:1144:b0:71e:4930:1620 with SMTP id d2e1a72fcca58-72476b724aemr5354852b3a.3.1731703317047; Fri, 15 Nov 2024 12:41:57 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724771e1ffesm1782744b3a.155.2024.11.15.12.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 12:41:56 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 4/5] net: fsl_pq_mdio: use devm for of_iomap Date: Fri, 15 Nov 2024 12:41:48 -0800 Message-ID: <20241115204149.6887-5-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241115204149.6887-1-rosenp@gmail.com> References: <20241115204149.6887-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" Using devm for of_iomap avoids having to manually iounmap in error paths for this simple driver. Add a note for why not devm_platform helper. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 24 ++++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/eth= ernet/freescale/fsl_pq_mdio.c index f14607555f33..640929a4562d 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -443,7 +443,12 @@ static int fsl_pq_mdio_probe(struct platform_device *p= dev) snprintf(new_bus->id, MII_BUS_ID_SIZE, "%pOFn@%llx", np, (unsigned long long)res->start); =20 - priv->map =3D of_iomap(np, 0); + /* + * While tempting, this cannot be converted to + * devm_platform_get_and_ioremap_resource as some platforms overlap the + * memory regions with the ethernet node. + */ + priv->map =3D devm_of_iomap(dev, np, 0, NULL); if (!priv->map) return -ENOMEM; =20 @@ -455,8 +460,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pd= ev) */ if (data->mii_offset > resource_size(res)) { dev_err(dev, "invalid register map\n"); - err =3D -EINVAL; - goto error; + return -EINVAL; } priv->regs =3D priv->map + data->mii_offset; =20 @@ -477,8 +481,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pd= ev) dev_err(dev, "missing 'reg' property in node %pOF\n", tbi); - err =3D -EBUSY; - goto error; + return -EBUSY; } set_tbipa(*prop, pdev, data->get_tbipa, priv->map, res); } @@ -490,16 +493,10 @@ static int fsl_pq_mdio_probe(struct platform_device *= pdev) err =3D of_mdiobus_register(new_bus, np); if (err) { dev_err(dev, "cannot register %s as MDIO bus\n", new_bus->name); - goto error; + return err; } =20 return 0; - -error: - if (priv->map) - iounmap(priv->map); - - return err; } =20 =20 @@ -507,11 +504,8 @@ static void fsl_pq_mdio_remove(struct platform_device = *pdev) { struct device *device =3D &pdev->dev; struct mii_bus *bus =3D dev_get_drvdata(device); - struct fsl_pq_mdio_priv *priv =3D bus->priv; =20 mdiobus_unregister(bus); - - iounmap(priv->map); } =20 static struct platform_driver fsl_pq_mdio_driver =3D { --=20 2.47.0 From nobody Fri Nov 22 16:45:08 2024 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.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 980001E6DCF; Fri, 15 Nov 2024 20:41:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731703321; cv=none; b=d00eS+Rff77RHwW18VuClTda7qaojqp7ybypSIW/ZIHUmiTabzAJQcJAXIajCzOkMaiJVCv3h3g42sVDZVyni8Nh5tKp/xqAWtgmCQuRgqoMTjie9r4vrCoYtRc6zWaIuonymvcACGyFQMUmTrRqwn0oHbl5+n9EZm8soRB05Fc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731703321; c=relaxed/simple; bh=atjNlLzigxLFocWOYZ3P9pm/bgS/RCNfQxHKO7I/vHw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eWWoDNV1Cp1sbAFfr9vD32/nW/lzpfp4E1hrtpgBc84Ys/MZO6RJSJ09dSD0Iw8GNS6JGDdy1bCWSgxf/4NJ3tlRxa4070CI//FWuLyGrbbFHZ62QSqZIiou0UrXV0lXRX+OwocZkdIT1vAuniMuZMdXCy6gu1N3oZoIIFyoSkg= 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=f1dmWGRN; arc=none smtp.client-ip=209.85.215.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="f1dmWGRN" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-7f12ba78072so1766835a12.2; Fri, 15 Nov 2024 12:41:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731703319; x=1732308119; 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=fNJMkhvDACNxbVOybBT2qMig0uprGHP3aEgGM+RIyTQ=; b=f1dmWGRNq5GqWy6RhwX6EhXh6sdpHQIqAQLBoons3wJlYoMNi0LCs0T2AoseiIDg+h PgbGoUBqGggk/wLpJe3tn5XEC14VNbXNLlig09dQSCXiaEFaiZpfXUrqIEd0VstbAQUx RVkrYPjfpLLPocTGaE0LrLi7SesfBWwvR8n6sowjOG5A0bLjxNRrYjMujtvbap0bts08 pd/edyDG8pOXaYNeSF5lclwulL+cjVbmIAcjCvnpQBef9i5zdhck1Z7W6EKyV1LsmEVN 02RRY7YwGBB9eeTXabOeH/A8fIhf3LVDAUeurGth6Jy9AOztxLq4IGxVXMHRsVOw+Uun ixpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731703319; x=1732308119; 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=fNJMkhvDACNxbVOybBT2qMig0uprGHP3aEgGM+RIyTQ=; b=bZk6L6MX9Vy76v+M/Zii7qGq1xKExMeJT8bTZIsj9JAr1Fa0ceZHjIW3FM6h2XqwNg k++TDxLXwvboD+PDQJ+BG73+pHZyM2a4A6hAahkAJlmOUfs+8mgFLXDXeA1AwfWmCrYg egYo9k/AoW3HDn5FuDWj4p+gJKfKIJIoMyh0DqYvlhrFzAOTPmrmultRQIguO5pBhBOE XF4IA3UaO5bPQBvfn/T2zxSvz4ZUpeBd3cO4C8AbkpzoR512trbUpvMhOoP1g3LURk4a OS9+HhSgduVfBx48RZ194n5wGomx+JmBB3dOVyOr7tQ7EQz5JnW7bNn2730+DWoJMOzQ gcHg== X-Forwarded-Encrypted: i=1; AJvYcCUoyyTzS2LApCRsgc3uWfZBkwa4e+alxybOlpCYVPwBMSOPZA8mxkjRlrvkI3W5Gzv6ZuJ3dLWlmaJ3nEw=@vger.kernel.org X-Gm-Message-State: AOJu0YzF6L7K29IyueIlatHYwFpnvLGmqXO4D1PyvF7oXUsXsaYIzCBq VOwKGk5u8m+o4RONMMTmSyUbAy4iNryU8OflxBnPexgWLByWbhbIWtw+nVyI X-Google-Smtp-Source: AGHT+IG4dLahHtutDalVm2ymCu3Q/BejwwfktlNjcCOSUUEWRykLPVrhxmsHRMjGgB7cdIbmX19kEA== X-Received: by 2002:a05:6a20:2590:b0:1d8:a9c0:8853 with SMTP id adf61e73a8af0-1dc90b39de6mr5457055637.23.1731703318673; Fri, 15 Nov 2024 12:41:58 -0800 (PST) Received: from ryzen.lan ([2601:644:8200:dab8::a86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-724771e1ffesm1782744b3a.155.2024.11.15.12.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 12:41:57 -0800 (PST) From: Rosen Penev To: netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 5/5] net: fsl_pq_mdio: return directly in probe Date: Fri, 15 Nov 2024 12:41:49 -0800 Message-ID: <20241115204149.6887-6-rosenp@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241115204149.6887-1-rosenp@gmail.com> References: <20241115204149.6887-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" Instead of generating two errors in probe, just return directly to generate one. mdiobus_register was switched away from the of_ variant as no children are being used. No more need for a _remove function. Signed-off-by: Rosen Penev --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/eth= ernet/freescale/fsl_pq_mdio.c index 640929a4562d..12b6c11d9cf9 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -415,7 +415,6 @@ static int fsl_pq_mdio_probe(struct platform_device *pd= ev) struct mii_bus *new_bus; struct device_node *np; struct resource *res; - int err; =20 data =3D device_get_match_data(dev); if (!data) { @@ -465,7 +464,6 @@ static int fsl_pq_mdio_probe(struct platform_device *pd= ev) priv->regs =3D priv->map + data->mii_offset; =20 new_bus->parent =3D dev; - platform_set_drvdata(pdev, new_bus); =20 if (data->get_tbipa) { for_each_child_of_node(np, tbi) { @@ -490,22 +488,7 @@ static int fsl_pq_mdio_probe(struct platform_device *p= dev) if (data->ucc_configure) data->ucc_configure(res->start, res->end); =20 - err =3D of_mdiobus_register(new_bus, np); - if (err) { - dev_err(dev, "cannot register %s as MDIO bus\n", new_bus->name); - return err; - } - - return 0; -} - - -static void fsl_pq_mdio_remove(struct platform_device *pdev) -{ - struct device *device =3D &pdev->dev; - struct mii_bus *bus =3D dev_get_drvdata(device); - - mdiobus_unregister(bus); + return devm_mdiobus_register(dev, new_bus); } =20 static struct platform_driver fsl_pq_mdio_driver =3D { @@ -514,7 +497,6 @@ static struct platform_driver fsl_pq_mdio_driver =3D { .of_match_table =3D fsl_pq_mdio_match, }, .probe =3D fsl_pq_mdio_probe, - .remove =3D fsl_pq_mdio_remove, }; =20 module_platform_driver(fsl_pq_mdio_driver); --=20 2.47.0