All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH net-next 2/5] net: sfp: use device_get_match_data()
Date: Wed, 18 Jan 2023 10:21:03 +0000	[thread overview]
Message-ID: <E1pI5Z1-006GoO-7M@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <Y8fH+Vqx6huYQFDU@shell.armlinux.org.uk>

Rather than using of_match_node() to get the matching of_device_id
to then retrieve the match data, use device_get_match_data() instead
to avoid firmware specific functions, and free the driver from having
firmware specific code.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/sfp.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index aa2f7ebbdebc..402dcdd59acb 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -2685,19 +2685,11 @@ static int sfp_probe(struct platform_device *pdev)
 	if (err < 0)
 		return err;
 
-	sff = sfp->type = &sfp_data;
+	sff = device_get_match_data(sfp->dev);
+	if (!sff)
+		sff = &sfp_data;
 
-	if (pdev->dev.of_node) {
-		const struct of_device_id *id;
-
-		id = of_match_node(sfp_of_match, pdev->dev.of_node);
-		if (WARN_ON(!id))
-			return -EINVAL;
-
-		sff = sfp->type = id->data;
-	} else if (!has_acpi_companion(&pdev->dev)) {
-		return -EINVAL;
-	}
+	sfp->type = sff;
 
 	err = sfp_i2c_get(sfp);
 	if (err)
-- 
2.30.2


  parent reply	other threads:[~2023-01-18 11:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 10:20 [PATCH net-next 0/5] net: sfp: cleanup i2c / dt / acpi / fwnode / includes Russell King (Oracle)
2023-01-18 10:20 ` [PATCH net-next 1/5] net: sfp: use i2c_get_adapter_by_fwnode() Russell King (Oracle)
2023-01-18 10:21 ` Russell King (Oracle) [this message]
2023-01-18 10:21 ` [PATCH net-next 3/5] net: sfp: rename gpio_of_names[] Russell King (Oracle)
2023-01-18 10:21 ` [PATCH net-next 4/5] net: sfp: remove acpi.h include Russell King (Oracle)
2023-01-18 10:21 ` [PATCH net-next 5/5] net: sfp: remove unused ctype.h include Russell King (Oracle)
2023-01-20  3:00 ` [PATCH net-next 0/5] net: sfp: cleanup i2c / dt / acpi / fwnode / includes patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1pI5Z1-006GoO-7M@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.