Thread (36 messages) flat view 36 messages, 5 authors, 2021-04-25

Re: [PATCH 05/14] drivers: net: dsa: qca8k: add support for qca8327 switch

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-04-23 12:42:12
Also in: lkml, netdev

quoted hunk ↗ jump to hunk
@@ -1467,11 +1468,16 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
 		gpiod_set_value_cansleep(priv->reset_gpio, 0);
 	}
 
+	/* get the switches ID from the compatible */
+	data = of_device_get_match_data(&mdiodev->dev);
+	if (!data)
+		return -ENODEV;
+
 	/* read the switches ID register */
 	id = qca8k_read(priv, QCA8K_REG_MASK_CTRL);
 	id >>= QCA8K_MASK_CTRL_ID_S;
 	id &= QCA8K_MASK_CTRL_ID_M;
-	if (id != QCA8K_ID_QCA8337)
+	if (id != data->id)
 		return -ENODEV;
It is useful to print an error message here: Found X, expected
Y. Gives the DT writer an idea what they did wrong.

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