From 8fff27e46b31b03774a61a6adf58862e86056d5c Mon Sep 17 00:00:00 2001 From: kram Date: Wed, 7 Mar 2018 14:51:59 -0800 Subject: [PATCH] cleanup and update kernel modules --- .../sonic-platform-modules-bfn-montara/MAINTAINERS | 4 ---- .../barefoot/sonic-platform-modules-bfn/MAINTAINERS | 3 --- .../sonic-platform-modules-bfn/modules/bf_kdrv.c | 11 ++++++++--- .../modules/bf_kdrv.c | 11 ++++++++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS b/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS index 05b0cea082..ed64c78242 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/MAINTAINERS @@ -1,7 +1,3 @@ # This file describes the maintainers for sonic-platform-modules-bfn # See the SONiC project governance document for more information - -Name = "Daxay" -Email = "support@barefootnetworks.com" -Github = barefootnetworks Mailinglist = sonicproject@googlegroups.com diff --git a/platform/barefoot/sonic-platform-modules-bfn/MAINTAINERS b/platform/barefoot/sonic-platform-modules-bfn/MAINTAINERS index 05b0cea082..b9c62ce015 100644 --- a/platform/barefoot/sonic-platform-modules-bfn/MAINTAINERS +++ b/platform/barefoot/sonic-platform-modules-bfn/MAINTAINERS @@ -1,7 +1,4 @@ # This file describes the maintainers for sonic-platform-modules-bfn # See the SONiC project governance document for more information -Name = "Daxay" -Email = "support@barefootnetworks.com" -Github = barefootnetworks Mailinglist = sonicproject@googlegroups.com diff --git a/platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c b/platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c index 5f084f6a04..fd66ad0949 100644 --- a/platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c +++ b/platform/barefoot/sonic-platform-modules-bfn/modules/bf_kdrv.c @@ -58,7 +58,13 @@ #include #include #include -#include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + #include +#else + #include +#endif + #include #include #include @@ -591,7 +597,6 @@ static ssize_t bf_read(struct file *filep, char __user *buf, return -EINVAL; count = sizeof(s32); } - count = sizeof(s32)*BF_MSIX_ENTRY_CNT; do { set_current_state(TASK_INTERRUPTIBLE); @@ -611,7 +616,7 @@ static ssize_t bf_read(struct file *filep, char __user *buf, if (copy_to_user(buf, &event_count, count)) retval = -EFAULT; else { /* adjust the listener->event_count; */ - for (i = 0 ; i < BF_MSIX_ENTRY_CNT; i++) { + for (i = 0 ; i < (count/sizeof(s32)); i++) { if (cnt_match[i]) { listener->event_count[i] = event_count[i]; } diff --git a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c index 5f084f6a04..fd66ad0949 100644 --- a/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c +++ b/platform/barefoot/sonic-platform-modules-wnc-osw1800/modules/bf_kdrv.c @@ -58,7 +58,13 @@ #include #include #include -#include + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) + #include +#else + #include +#endif + #include #include #include @@ -591,7 +597,6 @@ static ssize_t bf_read(struct file *filep, char __user *buf, return -EINVAL; count = sizeof(s32); } - count = sizeof(s32)*BF_MSIX_ENTRY_CNT; do { set_current_state(TASK_INTERRUPTIBLE); @@ -611,7 +616,7 @@ static ssize_t bf_read(struct file *filep, char __user *buf, if (copy_to_user(buf, &event_count, count)) retval = -EFAULT; else { /* adjust the listener->event_count; */ - for (i = 0 ; i < BF_MSIX_ENTRY_CNT; i++) { + for (i = 0 ; i < (count/sizeof(s32)); i++) { if (cnt_match[i]) { listener->event_count[i] = event_count[i]; }