Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH V2 0/2] can: xilinx_can: Bug fixes on can driver
@ 2019-12-02 13:02 Srinivas Neeli
  2019-12-02 13:02 ` [PATCH V2 1/2] can: xilinx_can: skip error message on deferred probe Srinivas Neeli
  2019-12-02 13:02 ` [PATCH V2 2/2] can: xilinx_can: Fix usage of skb memory Srinivas Neeli
  0 siblings, 2 replies; 3+ messages in thread
From: Srinivas Neeli @ 2019-12-02 13:02 UTC (permalink / raw)
  To: wg, mkl, davem, michal.simek, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel, git, nagasure,
	Srinivas Neeli

This patch series does the following:
-skip printing error message on deferred probe
-Fix usage of skb memory
---
Changes in V2:
-Called can_put_echo_skb call after usage of skb memory
---

Srinivas Neeli (1):
  can: xilinx_can: Fix usage of skb memory

Venkatesh Yadav Abbarapu (1):
  can: xilinx_can: skip error message on deferred probe

 drivers/net/can/xilinx_can.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH V2 1/2] can: xilinx_can: skip error message on deferred probe
  2019-12-02 13:02 [PATCH V2 0/2] can: xilinx_can: Bug fixes on can driver Srinivas Neeli
@ 2019-12-02 13:02 ` Srinivas Neeli
  2019-12-02 13:02 ` [PATCH V2 2/2] can: xilinx_can: Fix usage of skb memory Srinivas Neeli
  1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Neeli @ 2019-12-02 13:02 UTC (permalink / raw)
  To: wg, mkl, davem, michal.simek, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel, git, nagasure,
	Venkatesh Yadav Abbarapu, Srinivas Neeli

From: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>

When can bus clock is provided from the clock wizard, clock wizard driver
may not be available when can driver probes resulting to the error
message "bus clock not found error".

As this error message is not very useful to the end user, skip printing
in the case of deferred probe.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>
Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Appana Durga Kedareswara Rao <appana.durga.rao@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 4a96e2dd7d77..c5f05b994435 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -1772,7 +1772,8 @@ static int xcan_probe(struct platform_device *pdev)
 
 	priv->bus_clk = devm_clk_get(&pdev->dev, devtype->bus_clk_name);
 	if (IS_ERR(priv->bus_clk)) {
-		dev_err(&pdev->dev, "bus clock not found\n");
+		if (PTR_ERR(priv->bus_clk) != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "bus clock not found\n");
 		ret = PTR_ERR(priv->bus_clk);
 		goto err_free;
 	}
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH V2 2/2] can: xilinx_can: Fix usage of skb memory
  2019-12-02 13:02 [PATCH V2 0/2] can: xilinx_can: Bug fixes on can driver Srinivas Neeli
  2019-12-02 13:02 ` [PATCH V2 1/2] can: xilinx_can: skip error message on deferred probe Srinivas Neeli
@ 2019-12-02 13:02 ` Srinivas Neeli
  1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Neeli @ 2019-12-02 13:02 UTC (permalink / raw)
  To: wg, mkl, davem, michal.simek, appanad
  Cc: linux-can, netdev, linux-arm-kernel, linux-kernel, git, nagasure,
	Srinivas Neeli

As per linux can framework, driver not allowed to touch the skb memory
after can_put_echo_skb() call.
This patch fixes the same.
https://www.spinics.net/lists/linux-can/msg02199.html

Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
Reviewed-by: Appana Durga Kedareswara Rao <appana.durga.rao@xilinx.com>
---
 drivers/net/can/xilinx_can.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index c5f05b994435..464af939cd8a 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -542,16 +542,17 @@ static int xcan_do_set_mode(struct net_device *ndev, enum can_mode mode)
 
 /**
  * xcan_write_frame - Write a frame to HW
- * @priv:		Driver private data structure
+ * @ndev:		Pointer to net_device structure
  * @skb:		sk_buff pointer that contains data to be Txed
  * @frame_offset:	Register offset to write the frame to
  */
-static void xcan_write_frame(struct xcan_priv *priv, struct sk_buff *skb,
+static void xcan_write_frame(struct net_device *ndev, struct sk_buff *skb,
 			     int frame_offset)
 {
 	u32 id, dlc, data[2] = {0, 0};
 	struct canfd_frame *cf = (struct canfd_frame *)skb->data;
 	u32 ramoff, dwindex = 0, i;
+	struct xcan_priv *priv = netdev_priv(ndev);
 
 	/* Watch carefully on the bit sequence */
 	if (cf->can_id & CAN_EFF_FLAG) {
@@ -587,6 +588,14 @@ static void xcan_write_frame(struct xcan_priv *priv, struct sk_buff *skb,
 		dlc |= XCAN_DLCR_EDL_MASK;
 	}
 
+	if (!(priv->devtype.flags & XCAN_FLAG_TX_MAILBOXES) &&
+	    (priv->devtype.flags & XCAN_FLAG_TXFEMP))
+		can_put_echo_skb(skb, ndev, priv->tx_head % priv->tx_max);
+	else
+		can_put_echo_skb(skb, ndev, 0);
+
+	priv->tx_head++;
+
 	priv->write_reg(priv, XCAN_FRAME_ID_OFFSET(frame_offset), id);
 	/* If the CAN frame is RTR frame this write triggers transmission
 	 * (not on CAN FD)
@@ -638,13 +647,9 @@ static int xcan_start_xmit_fifo(struct sk_buff *skb, struct net_device *ndev)
 			XCAN_SR_TXFLL_MASK))
 		return -ENOSPC;
 
-	can_put_echo_skb(skb, ndev, priv->tx_head % priv->tx_max);
-
 	spin_lock_irqsave(&priv->tx_lock, flags);
 
-	priv->tx_head++;
-
-	xcan_write_frame(priv, skb, XCAN_TXFIFO_OFFSET);
+	xcan_write_frame(ndev, skb, XCAN_TXFIFO_OFFSET);
 
 	/* Clear TX-FIFO-empty interrupt for xcan_tx_interrupt() */
 	if (priv->tx_max > 1)
@@ -675,13 +680,9 @@ static int xcan_start_xmit_mailbox(struct sk_buff *skb, struct net_device *ndev)
 		     BIT(XCAN_TX_MAILBOX_IDX)))
 		return -ENOSPC;
 
-	can_put_echo_skb(skb, ndev, 0);
-
 	spin_lock_irqsave(&priv->tx_lock, flags);
 
-	priv->tx_head++;
-
-	xcan_write_frame(priv, skb,
+	xcan_write_frame(ndev, skb,
 			 XCAN_TXMSG_FRAME_OFFSET(XCAN_TX_MAILBOX_IDX));
 
 	/* Mark buffer as ready for transmit */
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 13:02 [PATCH V2 0/2] can: xilinx_can: Bug fixes on can driver Srinivas Neeli
2019-12-02 13:02 ` [PATCH V2 1/2] can: xilinx_can: skip error message on deferred probe Srinivas Neeli
2019-12-02 13:02 ` [PATCH V2 2/2] can: xilinx_can: Fix usage of skb memory Srinivas Neeli

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git