Re: [PATCH net-next v3 4/7] net: rpmsg-eth: Add netdev ops
From: Anwar, Md Danish <hidden>
Date: 2025-09-09 14:09:42
Also in:
linux-arm-kernel, linux-devicetree, linux-doc, lkml
Hi Parthiban On 9/9/2025 12:08 PM, Parthiban.Veerasooran@microchip.com wrote:
Hi, On 08/09/25 2:37 pm, MD Danish Anwar wrote:quoted
+static int create_request(struct rpmsg_eth_common *common, + enum rpmsg_eth_rpmsg_type rpmsg_type) +{ + struct message *msg = &common->send_msg; + int ret = 0; + + msg->msg_hdr.src_id = common->port->port_id; + msg->req_msg.type = rpmsg_type; + + switch (rpmsg_type) { + case RPMSG_ETH_REQ_SHM_INFO: + msg->msg_hdr.msg_type = RPMSG_ETH_REQUEST_MSG; + break; + case RPMSG_ETH_REQ_SET_MAC_ADDR: + msg->msg_hdr.msg_type = RPMSG_ETH_REQUEST_MSG; + ether_addr_copy(msg->req_msg.mac_addr.addr, + common->port->ndev->dev_addr); + break; + case RPMSG_ETH_NOTIFY_PORT_UP: + case RPMSG_ETH_NOTIFY_PORT_DOWN: + msg->msg_hdr.msg_type = RPMSG_ETH_NOTIFY_MSG; + break; + default: + ret = -EINVAL; + dev_err(common->dev, "Invalid RPMSG request\n");I don't think you need 'ret' here instead directly return -EINVAL and above 'ret' declaration can be removed.quoted
+ } + return ret;can be return 0;
Sure. I will drop ret.
quoted
+} + +static int rpmsg_eth_create_send_request(struct rpmsg_eth_common *common, + enum rpmsg_eth_rpmsg_type rpmsg_type, + bool wait) +{ + unsigned long flags; + int ret = 0;No need to initialize.
Sure. Will drop this.
quoted
+ + if (wait) + reinit_completion(&common->sync_msg); + + spin_lock_irqsave(&common->send_msg_lock, flags); + +static int rpmsg_eth_set_mac_address(struct net_device *ndev, void *addr) +{ + struct rpmsg_eth_common *common = rpmsg_eth_ndev_to_common(ndev); + int ret; + + ret = eth_mac_addr(ndev, addr); + + if (ret < 0) + return ret; + ret = rpmsg_eth_create_send_request(common, RPMSG_ETH_REQ_SET_MAC_ADDR, false);You can directly return from here.
Sure.
quoted
+ return ret; +} +Best regards, Parthiban V
-- Thanks and Regards, Md Danish Anwar