pkarashchenko commented on code in PR #12676:
URL: https://github.com/apache/nuttx/pull/12676#discussion_r1683490680
##########
drivers/net/lan9250.c:
##########
@@ -2322,6 +2327,79 @@ static int lan9250_rmmac(FAR struct net_driver_s *dev,
}
#endif
+/****************************************************************************
+ * Name: lan9250_ioctl
+ *
+ * Description:
+ * Handle network IOCTL commands directed to this device.
+ *
+ * Parameters:
+ * dev - Reference to the NuttX driver state structure
+ * cmd - The IOCTL command
+ * arg - The argument for the IOCTL command
+ *
+ * Returned Value:
+ * OK on success; Negated errno on failure.
+ *
+ * Assumptions:
+ * The network is locked.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_NETDEV_IOCTL
+static int lan9250_ioctl(FAR struct net_driver_s *dev, int cmd,
+ unsigned long arg)
+{
+ FAR struct lan9250_driver_s *priv =
+ (FAR struct lan9250_driver_s *)dev->d_private;
+ int ret = OK;
+
+ /* Lock the SPI bus so that we have exclusive access */
+
+ lan9250_lock_spi(priv);
+
+ /* Decode and dispatch the driver-specific IOCTL command */
+
+ switch (cmd)
+ {
+#ifdef CONFIG_NETDEV_PHY_IOCTL
+ case SIOCGMIIPHY: /* Get MII PHY address */
+ {
+ struct mii_ioctl_data_s *req =
+ (struct mii_ioctl_data_s *)((uintptr_t)arg);
+ req->phy_id = 0;
+ }
+ break;
+
+ case SIOCGMIIREG: /* Get register from MII PHY */
+ {
+ struct mii_ioctl_data_s *req =
+ (struct mii_ioctl_data_s *)((uintptr_t)arg);
+ req->val_out = lan9250_get_phyreg(priv, req->reg_num);
+ }
+ break;
+
+ case SIOCSMIIREG: /* Set register in MII PHY */
+ {
+ struct mii_ioctl_data_s *req =
+ (struct mii_ioctl_data_s *)((uintptr_t)arg);
+ lan9250_set_phyreg(priv, req->reg_num, req->val_in);
+ }
+ break;
+#endif /* CONFIG_NETDEV_PHY_IOCTL */
+
+ default:
+ nerr("ERROR: Unrecognized IOCTL command: %d\n", cmd);
+ ret = -ENOTTY; /* Special return value for this case */
Review Comment:
Needs 2 spaces more for indent
##########
drivers/net/lan9250.c:
##########
@@ -2322,6 +2327,79 @@ static int lan9250_rmmac(FAR struct net_driver_s *dev,
}
#endif
+/****************************************************************************
+ * Name: lan9250_ioctl
+ *
+ * Description:
+ * Handle network IOCTL commands directed to this device.
+ *
+ * Parameters:
+ * dev - Reference to the NuttX driver state structure
+ * cmd - The IOCTL command
+ * arg - The argument for the IOCTL command
+ *
+ * Returned Value:
+ * OK on success; Negated errno on failure.
+ *
+ * Assumptions:
+ * The network is locked.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_NETDEV_IOCTL
+static int lan9250_ioctl(FAR struct net_driver_s *dev, int cmd,
+ unsigned long arg)
+{
+ FAR struct lan9250_driver_s *priv =
+ (FAR struct lan9250_driver_s *)dev->d_private;
+ int ret = OK;
+
+ /* Lock the SPI bus so that we have exclusive access */
+
+ lan9250_lock_spi(priv);
+
+ /* Decode and dispatch the driver-specific IOCTL command */
+
+ switch (cmd)
+ {
+#ifdef CONFIG_NETDEV_PHY_IOCTL
+ case SIOCGMIIPHY: /* Get MII PHY address */
+ {
+ struct mii_ioctl_data_s *req =
+ (struct mii_ioctl_data_s *)((uintptr_t)arg);
Review Comment:
`FAR` missing here and in other places of switch/case
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]