Thread (14 messages) 14 messages, 5 authors, 2021-11-29

Re: [PATCH net-next v4 2/6] net: lan966x: add the basic lan966x driver

From: Philipp Zabel <p.zabel@pengutronix.de>
Date: 2021-11-26 10:31:08
Also in: lkml, netdev

Hi Horatiu,

On Fri, 2021-11-26 at 10:05 +0100, Horatiu Vultur wrote:
[...]
+static int lan966x_reset_switch(struct lan966x *lan966x)
+{
+	struct reset_control *reset;
+	int val = 0;
+	int ret;
+
+	reset = devm_reset_control_get_shared(lan966x->dev, "switch");
+	if (IS_ERR(reset))
+		return dev_err_probe(lan966x->dev, PTR_ERR(reset),
+				     "Could not obtain switch reset");
+	reset_control_reset(reset);
+
+	reset = devm_reset_control_get_shared(lan966x->dev, "phy");
+	if (IS_ERR(reset))
+		return dev_err_probe(lan966x->dev, PTR_ERR(reset),
+				     "Could not obtain phy reset\n");
+	reset_control_reset(reset);
In general, please request all resources before activating the hardware.
Here I'd request both reset controls first and only then trigger them.
That way a failure to optain the phy reset won't cause an unnecessary
switch reset.

[...]
+static int lan966x_remove(struct platform_device *pdev)
+{
+	return 0;
+}
If there is nothing to do here, this function can be removed altogether.

regards
Philipp
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help