Thread (34 messages) 34 messages, 2 authors, 2013-09-09

Re: [PATCH 13/16] c_can: flexcard: add ioctl to reset FIFO message object

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2013-09-09 10:24:14
Also in: linux-can

On 09/09/2013 09:25 AM, Benedikt Spranger wrote:
The FlexCard FIFO reset implementation did not reset the FIFO message object.
Since the FIFO configuration is done from userspace a function to reset the
FIFO message object is needed. Add an ioctl to reset the FIFO message object
from userspace.
Can you elaborate this a bit.
quoted hunk ↗ jump to hunk
Signed-off-by: Benedikt Spranger <redacted>

---
 drivers/net/can/c_can/c_can.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 51ca2a6..670a6b1 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -1447,7 +1447,21 @@ void free_c_can_dev(struct net_device *dev)
 }
 EXPORT_SYMBOL_GPL(free_c_can_dev);
 
+static int c_can_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+	switch (cmd) {
+	case SIOCDEVPRIVATE:
+		c_can_inval_msg_object(dev, 0, FC_TXFIFO_MO);
+		break;
What happens if you call this ioctl on non flexcard HW?
+	default:
+		return -ENOIOCTLCMD;
+	}
+
+	return 0;
+}
+
 static const struct net_device_ops c_can_netdev_ops = {
+	.ndo_do_ioctl = c_can_ioctl,
 	.ndo_open = c_can_open,
 	.ndo_stop = c_can_close,
 	.ndo_start_xmit = c_can_start_xmit,
Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachments

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