]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
misc: xilinx-sdfec: Add CLEAR_STATS IOCTL
authorDerek Kiernan <derek.kiernan@xilinx.com>
Tue, 15 May 2018 00:16:57 +0000 (01:16 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 15 May 2018 15:22:33 +0000 (17:22 +0200)
Allows the user to clear error stats collected during interrupts.

Signed-off-by: Derek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/misc/xilinx_sdfec.c
include/uapi/misc/xilinx_sdfec.h

index c1591ea442f9f15b1ae408eea15c3ddced5bd15d..78055b92a6d2a87758add26f385e46547c67ae7c 100644 (file)
@@ -1193,6 +1193,16 @@ xsdfec_reset_req(struct xsdfec_dev *xsdfec)
        return 0;
 }
 
+static int
+xsdfec_clear_stats(struct xsdfec_dev *xsdfec)
+{
+       atomic_set(&xsdfec->isr_err_count, 0);
+       atomic_set(&xsdfec->uecc_count, 0);
+       atomic_set(&xsdfec->cecc_count, 0);
+
+       return 0;
+}
+
 static long
 xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd, unsigned long data)
 {
@@ -1248,6 +1258,9 @@ xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd, unsigned long data)
        case XSDFEC_RESET_REQ:
                rval = xsdfec_reset_req(xsdfec);
                break;
+       case XSDFEC_CLEAR_STATS:
+               rval = xsdfec_clear_stats(xsdfec);
+               break;
        case XSDFEC_GET_STATUS:
                rval = xsdfec_get_status(xsdfec, arg);
                break;
index 4671cc6b06daca2bf5977f353176b2c1590085c7..51271d7e4d9f2285cf7bbaab3e92ec8f22d87012 100644 (file)
@@ -204,5 +204,7 @@ struct xsdfec_irq {
 #define XSDFEC_SET_BYPASS      _IOW(XSDFEC_MAGIC, 11, unsigned long *)
 /* ioctl that determines if sdfec is processing data */
 #define XSDFEC_IS_ACTIVE       _IOR(XSDFEC_MAGIC, 12, bool *)
+/* ioctl that clears error stats collected during interrupts */
+#define XSDFEC_CLEAR_STATS     _IO(XSDFEC_MAGIC, 13)
 
 #endif /* __XILINX_SDFEC_H__ */