Re: [PATCH] scsi: storvsc: missing error code in storvsc_probe()

2018-01-16 Thread Martin K. Petersen

Dan,

> We should set the error code if fc_remote_port_add() fails.

Applied to 4.16/scsi-queue, thanks!

-- 
Martin K. Petersen  Oracle Linux Engineering
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: lustre: Fix avoid intensive reconnecting for ko2iblnd patch

2018-01-16 Thread Dilger, Andreas

> On Jan 16, 2018, at 09:56, Greg Kroah-Hartman  
> wrote:
> 
> On Tue, Jan 16, 2018 at 03:01:49PM +, Eremin, Dmitry wrote:
>> In the original commit 4d99b2581effe115376402e710fbcb1c3c073769
> 
> Please use the documented way to write this:
>   4d99b2581eff ("staging: lustre: avoid intensive reconnecting for 
> ko2iblnd")
> 

>> was missed one hunk. Added it now to avoid issue with use after free.
> 
> And I do not understand this commit message at all.
> 
>> Signed-off-by: Dmitry Eremin 
>> ---
>> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
>> b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
>> index 2ebc484..a15a625 100644
>> --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
>> +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
>> @@ -890,7 +890,8 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool 
>> free_conn)
>>  atomic_dec(>ibn_nconns);
>>  }
>> 
>> -kfree(conn);
>> +if (free_conn)
>> +kfree(conn);
> 
> This looks really odd, don't you think?

I'm not sure what the objection is here?  There is an argument to this
this function named "free_conn" which determines if the structure should
be freed, or if the network connection is just being torn down and
reconnected.

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation







___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 4/4] Staging: rtl8723bs: Use !x instead of NULL comparison

2018-01-16 Thread Shreeya Patel
If "x" is compared to NULL, use "!x" instead of it, so
as to follow the kernel coding style.

Signed-off-by: Shreeya Patel 
---

Changes in v2
  -Rebase and resend.

 drivers/staging/rtl8723bs/hal/sdio_ops.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index 314b31f..08e6a7b 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -215,7 +215,7 @@ static u32 sdio_read32(struct intf_hdl *intfhdl, u32 addr)
u8 *tmpbuf;
 
tmpbuf = rtw_malloc(8);
-   if (NULL == tmpbuf) {
+   if (!tmpbuf) {
DBG_8192C(KERN_ERR "%s: Allocate memory FAIL!(size =8) 
addr = 0x%x\n", __func__, addr);
return SDIO_ERR_VAL32;
}
@@ -264,7 +264,7 @@ static s32 sdio_readN(struct intf_hdl *intfhdl, u32 addr, 
u32 cnt, u8 *buf)
ftaddr &= ~(u16)0x3;
n = cnt + shift;
tmpbuf = rtw_malloc(n);
-   if (NULL == tmpbuf)
+   if (!tmpbuf)
return -1;
 
err = sd_read(intfhdl, ftaddr, n, tmpbuf);
@@ -367,7 +367,7 @@ static s32 sdio_writeN(struct intf_hdl *intfhdl, u32 addr, 
u32 cnt, u8 *buf)
ftaddr &= ~(u16)0x3;
n = cnt + shift;
tmpbuf = rtw_malloc(n);
-   if (NULL == tmpbuf)
+   if (!tmpbuf)
return -1;
err = sd_read(intfhdl, ftaddr, 4, tmpbuf);
if (err) {
@@ -457,7 +457,7 @@ static u32 sdio_read_port(
 #ifdef SDIO_DYNAMIC_ALLOC_MEM
oldmem = mem;
mem = rtw_malloc(cnt);
-   if (mem == NULL) {
+   if (!mem) {
DBG_8192C(KERN_WARNING "%s: allocate memory %d bytes 
fail!\n", __func__, cnt);
mem = oldmem;
oldmem = NULL;
@@ -745,7 +745,7 @@ static s32 ReadInterrupt8723BSdio(struct adapter *adapter, 
u32 *phisr)
u8 val8, hisr_len;
 
 
-   if (phisr == NULL)
+   if (!phisr)
return false;
 
himr = GET_HAL_DATA(adapter)->sdio_himr;
@@ -969,13 +969,13 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter 
*adapter, u32 size)
/* 3 1. alloc recvbuf */
recv_priv = >recvpriv;
recvbuf = rtw_dequeue_recvbuf(_priv->free_recv_buf_queue);
-   if (recvbuf == NULL) {
+   if (!recvbuf) {
DBG_871X_LEVEL(_drv_err_, "%s: alloc recvbuf FAIL!\n", 
__func__);
return NULL;
}
 
/* 3 2. alloc skb */
-   if (recvbuf->pskb == NULL) {
+   if (!recvbuf->pskb) {
SIZE_PTR tmpaddr = 0;
SIZE_PTR alignment = 0;
 
@@ -989,7 +989,7 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter 
*adapter, u32 size)
skb_reserve(recvbuf->pskb, (RECVBUFF_ALIGN_SZ - 
alignment));
}
 
-   if (recvbuf->pskb == NULL) {
+   if (!recvbuf->pskb) {
DBG_871X("%s: alloc_skb fail! read =%d\n", __func__, 
readsize);
return NULL;
}
@@ -1247,7 +1247,7 @@ u8 RecvOnePkt(struct adapter *adapter, u32 size)
 
DBG_871X("+%s: size: %d+\n", __func__, size);
 
-   if (adapter == NULL) {
+   if (!adapter) {
DBG_871X(KERN_ERR "%s: adapter is NULL!\n", __func__);
return false;
}
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 3/4] Staging: rtl8723bs: Change condition to assignment

2018-01-16 Thread Shreeya Patel
Change the conditional operator to assignment as it is
not a conditional statement.

Signed-off-by: Shreeya Patel 
---

Changes in v2
  -Rebase and resend.

 drivers/staging/rtl8723bs/hal/sdio_ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index 00b20c0..314b31f 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -460,7 +460,7 @@ static u32 sdio_read_port(
if (mem == NULL) {
DBG_8192C(KERN_WARNING "%s: allocate memory %d bytes 
fail!\n", __func__, cnt);
mem = oldmem;
-   oldmem == NULL;
+   oldmem = NULL;
}
 #else
/*  in this case, caller should gurante the buffer is big 
enough */
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 2/4] Staging: rtl8723bs: Change names to conform to the kernel code

2018-01-16 Thread Shreeya Patel
Change names of some variables and functions to conform
to the kernel coding style.

Signed-off-by: Shreeya Patel 
---

Changes in v2
  -Rebase and resend.

 drivers/staging/rtl8723bs/hal/sdio_ops.c | 714 +++
 1 file changed, 357 insertions(+), 357 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index aa52c31..00b20c0 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -28,35 +28,35 @@
 /*  Creadted by Roger, 2011.01.31. */
 /*  */
 static void HalSdioGetCmdAddr8723BSdio(
-   struct adapter *padapter,
-   u8 DeviceID,
-   u32 Addr,
-   u32 *pCmdAddr
+   struct adapter *adapter,
+   u8 device_id,
+   u32 addr,
+   u32 *cmdaddr
 )
 {
-   switch (DeviceID) {
+   switch (device_id) {
case SDIO_LOCAL_DEVICE_ID:
-   *pCmdAddr = ((SDIO_LOCAL_DEVICE_ID << 13) | (Addr & 
SDIO_LOCAL_MSK));
+   *cmdaddr = ((SDIO_LOCAL_DEVICE_ID << 13) | (addr & 
SDIO_LOCAL_MSK));
break;
 
case WLAN_IOREG_DEVICE_ID:
-   *pCmdAddr = ((WLAN_IOREG_DEVICE_ID << 13) | (Addr & 
WLAN_IOREG_MSK));
+   *cmdaddr = ((WLAN_IOREG_DEVICE_ID << 13) | (addr & 
WLAN_IOREG_MSK));
break;
 
case WLAN_TX_HIQ_DEVICE_ID:
-   *pCmdAddr = ((WLAN_TX_HIQ_DEVICE_ID << 13) | (Addr & 
WLAN_FIFO_MSK));
+   *cmdaddr = ((WLAN_TX_HIQ_DEVICE_ID << 13) | (addr & 
WLAN_FIFO_MSK));
break;
 
case WLAN_TX_MIQ_DEVICE_ID:
-   *pCmdAddr = ((WLAN_TX_MIQ_DEVICE_ID << 13) | (Addr & 
WLAN_FIFO_MSK));
+   *cmdaddr = ((WLAN_TX_MIQ_DEVICE_ID << 13) | (addr & 
WLAN_FIFO_MSK));
break;
 
case WLAN_TX_LOQ_DEVICE_ID:
-   *pCmdAddr = ((WLAN_TX_LOQ_DEVICE_ID << 13) | (Addr & 
WLAN_FIFO_MSK));
+   *cmdaddr = ((WLAN_TX_LOQ_DEVICE_ID << 13) | (addr & 
WLAN_FIFO_MSK));
break;
 
case WLAN_RX0FF_DEVICE_ID:
-   *pCmdAddr = ((WLAN_RX0FF_DEVICE_ID << 13) | (Addr & 
WLAN_RX0FF_MSK));
+   *cmdaddr = ((WLAN_RX0FF_DEVICE_ID << 13) | (addr & 
WLAN_RX0FF_MSK));
break;
 
default:
@@ -66,64 +66,64 @@ static void HalSdioGetCmdAddr8723BSdio(
 
 static u8 get_deviceid(u32 addr)
 {
-   u8 devideId;
-   u16 pseudoId;
+   u8 devide_id;
+   u16 pseudo_id;
 
 
-   pseudoId = (u16)(addr >> 16);
-   switch (pseudoId) {
+   pseudo_id = (u16)(addr >> 16);
+   switch (pseudo_id) {
case 0x1025:
-   devideId = SDIO_LOCAL_DEVICE_ID;
+   devide_id = SDIO_LOCAL_DEVICE_ID;
break;
 
case 0x1026:
-   devideId = WLAN_IOREG_DEVICE_ID;
+   devide_id = WLAN_IOREG_DEVICE_ID;
break;
 
 /* case 0x1027: */
-/* devideId = SDIO_FIRMWARE_FIFO; */
+/* devide_id = SDIO_FIRMWARE_FIFO; */
 /* break; */
 
case 0x1031:
-   devideId = WLAN_TX_HIQ_DEVICE_ID;
+   devide_id = WLAN_TX_HIQ_DEVICE_ID;
break;
 
case 0x1032:
-   devideId = WLAN_TX_MIQ_DEVICE_ID;
+   devide_id = WLAN_TX_MIQ_DEVICE_ID;
break;
 
case 0x1033:
-   devideId = WLAN_TX_LOQ_DEVICE_ID;
+   devide_id = WLAN_TX_LOQ_DEVICE_ID;
break;
 
case 0x1034:
-   devideId = WLAN_RX0FF_DEVICE_ID;
+   devide_id = WLAN_RX0FF_DEVICE_ID;
break;
 
default:
-/* devideId = (u8)((addr >> 13) & 0xF); */
-   devideId = WLAN_IOREG_DEVICE_ID;
+/* devide_id = (u8)((addr >> 13) & 0xF); */
+   devide_id = WLAN_IOREG_DEVICE_ID;
break;
}
 
-   return devideId;
+   return devide_id;
 }
 
 /*
  * Ref:
  *HalSdioGetCmdAddr8723BSdio()
  */
-static u32 _cvrt2ftaddr(const u32 addr, u8 *pdeviceId, u16 *poffset)
+static u32 _cvrt2ftaddr(const u32 addr, u8 *pdevice_id, u16 *poffset)
 {
-   u8 deviceId;
+   u8 device_id;
u16 offset;
u32 ftaddr;
 
 
-   deviceId = get_deviceid(addr);
+   device_id = get_deviceid(addr);
offset = 0;
 
-   switch (deviceId) {
+   switch (device_id) {
case SDIO_LOCAL_DEVICE_ID:
offset = addr & SDIO_LOCAL_MSK;
break;
@@ -140,44 +140,44 @@ static u32 _cvrt2ftaddr(const u32 addr, u8 *pdeviceId, 
u16 *poffset)
 
case WLAN_IOREG_DEVICE_ID:
default:
-   deviceId = WLAN_IOREG_DEVICE_ID;
+   device_id = WLAN_IOREG_DEVICE_ID;
offset = addr & WLAN_IOREG_MSK;
break;
}
-   ftaddr = (deviceId << 13) | offset;
+   ftaddr = (device_id << 13) | 

[PATCH v2 0/4] Remove checkpatch warnings

2018-01-16 Thread Shreeya Patel
This patchset removes some warnings generated by checkpatch
for cleanup of the rtl8723bs driver. Also some additional
cleanups are introduced in the *[1/4] and *[3/4] patches
to make the code according to the kernel coding style.

Changes in v2
  -Rebase and resend the patches [2/4], [3/4] and [4/4].


Shreeya Patel (4):
  Staging: rtl8723bs: Replace true with x and false with !x
  Staging: rtl8723bs: Change names to conform to the kernel code
  Staging: rtl8723bs: Change condition to assignment
  Staging: rtl8723bs: Use !x instead of NULL comparison

 drivers/staging/rtl8723bs/hal/sdio_ops.c | 722 +++
 1 file changed, 360 insertions(+), 362 deletions(-)

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 3/7] x86/hyper-v: reenlightenment notifications support

2018-01-16 Thread Thomas Gleixner
On Tue, 16 Jan 2018, Vitaly Kuznetsov wrote:
> Hyper-V supports Live Migration notification. This is supposed to be used
> in conjunction with TSC emulation: when we are migrated to a host with
> different TSC frequency for some short period host emulates our accesses
> to TSC and sends us an interrupt to notify about the event. When we're
> done updating everything we can disable TSC emulation and everything will
> start working fast again.
> 
> We didn't need these notifications before as Hyper-V guests are not
> supposed to use TSC as a clocksource: in Linux we even mark it as unstable
> on boot. Guests normally use 'tsc page' clocksouce and host updates its
> values on migrations automatically.
> 
> Things change when we want to run nested virtualization: even when we pass
> through PV clocksources (kvm-clock or tsc page) to our guests we need to
> know TSC frequency and when it changes.
> 
> Hyper-V Top Level Functional Specification (as of v5.0b) wrongly specifies
> EAX:BIT(12) of CPUID:0x4009 as the feature identification bit. The
> right one to check is EAX:BIT(13) of CPUID:0x4003. I was assured that
> the fix in on the way.
> 
> Signed-off-by: Vitaly Kuznetsov 

Reviewed-by: Thomas Gleixner 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 5/7] x86/irq: Count Hyper-V reenlightenment interrupts

2018-01-16 Thread Thomas Gleixner
On Tue, 16 Jan 2018, Vitaly Kuznetsov wrote:

> Hyper-V reenlightenment interrupts arrive when the VM is migrated, we're
> not supposed to see many of them. However, it may be important to know
> that the event has happened in case we have L2 nested guests.
> 
> Signed-off-by: Vitaly Kuznetsov 

Reviewed-by: Thomas Gleixner 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 4/7] x86/hyper-v: redirect reenlightment notifications on CPU offlining

2018-01-16 Thread Thomas Gleixner
On Tue, 16 Jan 2018, Vitaly Kuznetsov wrote:

> It is very unlikely for CPUs to get offlined when we run on Hyper-V as
> we have a protection in vmbus module which prevents it when we have any
> VMBus devices assigned. This, however,  may change in future if an option
> to reassign an already active channel will be added. It is also possible
> to run without any Hyper-V devices of have a CPU with no assigned channels.
> 
> Reassign reenlightenment notifications to some other active CPU when
> the CPU which is assigned to get them goes offline.
> 
> Signed-off-by: Vitaly Kuznetsov 

Reviewed-by: Thomas Gleixner 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 6/7] x86/kvm: pass stable clocksource to guests when running nested on Hyper-V

2018-01-16 Thread Vitaly Kuznetsov
Currently, KVM is able to work in 'masterclock' mode passing
PVCLOCK_TSC_STABLE_BIT to guests when the clocksource we use on the host
is TSC. When running nested on Hyper-V we normally use a different one:
TSC page which is resistant to TSC frequency changes on event like L1
migration. Add support for it in KVM.

The only non-trivial change in the patch is in vgettsc(): when updating
our gtod copy we now need to get both the clockread and tsc value.

Signed-off-by: Vitaly Kuznetsov 
Acked-by: Paolo Bonzini 
---
 arch/x86/kvm/x86.c | 93 +++---
 1 file changed, 68 insertions(+), 25 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1cec2c62a0b0..f14e0129c8f5 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -67,6 +67,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define CREATE_TRACE_POINTS
 #include "trace.h"
@@ -1377,6 +1378,11 @@ static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 
kernel_ns)
return tsc;
 }
 
+static inline int gtod_is_based_on_tsc(int mode)
+{
+   return mode == VCLOCK_TSC || mode == VCLOCK_HVCLOCK;
+}
+
 static void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
 {
 #ifdef CONFIG_X86_64
@@ -1396,7 +1402,7 @@ static void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
 * perform request to enable masterclock.
 */
if (ka->use_master_clock ||
-   (gtod->clock.vclock_mode == VCLOCK_TSC && vcpus_matched))
+   (gtod_is_based_on_tsc(gtod->clock.vclock_mode) && vcpus_matched))
kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu);
 
trace_kvm_track_tsc(vcpu->vcpu_id, ka->nr_vcpus_matched_tsc,
@@ -1459,6 +1465,19 @@ static void kvm_vcpu_write_tsc_offset(struct kvm_vcpu 
*vcpu, u64 offset)
vcpu->arch.tsc_offset = offset;
 }
 
+static inline bool kvm_check_tsc_unstable(void)
+{
+#ifdef CONFIG_X86_64
+   /*
+* TSC is marked unstable when we're running on Hyper-V,
+* 'TSC page' clocksource is good.
+*/
+   if (pvclock_gtod_data.clock.vclock_mode == VCLOCK_HVCLOCK)
+   return false;
+#endif
+   return check_tsc_unstable();
+}
+
 void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr)
 {
struct kvm *kvm = vcpu->kvm;
@@ -1504,7 +1523,7 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data 
*msr)
  */
if (synchronizing &&
vcpu->arch.virtual_tsc_khz == kvm->arch.last_tsc_khz) {
-   if (!check_tsc_unstable()) {
+   if (!kvm_check_tsc_unstable()) {
offset = kvm->arch.cur_tsc_offset;
pr_debug("kvm: matched tsc offset for %llu\n", data);
} else {
@@ -1604,18 +1623,43 @@ static u64 read_tsc(void)
return last;
 }
 
-static inline u64 vgettsc(u64 *cycle_now)
+static inline u64 vgettsc(u64 *tsc_timestamp, int *mode)
 {
long v;
struct pvclock_gtod_data *gtod = _gtod_data;
+   u64 tsc_pg_val;
+
+   switch (gtod->clock.vclock_mode) {
+   case VCLOCK_HVCLOCK:
+   tsc_pg_val = hv_read_tsc_page_tsc(hv_get_tsc_page(),
+ tsc_timestamp);
+   if (tsc_pg_val != U64_MAX) {
+   /* TSC page valid */
+   *mode = VCLOCK_HVCLOCK;
+   v = (tsc_pg_val - gtod->clock.cycle_last) &
+   gtod->clock.mask;
+   } else {
+   /* TSC page invalid */
+   *mode = VCLOCK_NONE;
+   }
+   break;
+   case VCLOCK_TSC:
+   *mode = VCLOCK_TSC;
+   *tsc_timestamp = read_tsc();
+   v = (*tsc_timestamp - gtod->clock.cycle_last) &
+   gtod->clock.mask;
+   break;
+   default:
+   *mode = VCLOCK_NONE;
+   }
 
-   *cycle_now = read_tsc();
+   if (*mode == VCLOCK_NONE)
+   *tsc_timestamp = v = 0;
 
-   v = (*cycle_now - gtod->clock.cycle_last) & gtod->clock.mask;
return v * gtod->clock.mult;
 }
 
-static int do_monotonic_boot(s64 *t, u64 *cycle_now)
+static int do_monotonic_boot(s64 *t, u64 *tsc_timestamp)
 {
struct pvclock_gtod_data *gtod = _gtod_data;
unsigned long seq;
@@ -1624,9 +1668,8 @@ static int do_monotonic_boot(s64 *t, u64 *cycle_now)
 
do {
seq = read_seqcount_begin(>seq);
-   mode = gtod->clock.vclock_mode;
ns = gtod->nsec_base;
-   ns += vgettsc(cycle_now);
+   ns += vgettsc(tsc_timestamp, );
ns >>= gtod->clock.shift;
ns += gtod->boot_ns;
} while (unlikely(read_seqcount_retry(>seq, seq)));
@@ -1635,7 +1678,7 @@ static int do_monotonic_boot(s64 *t, u64 *cycle_now)
return mode;
 }
 
-static int do_realtime(struct timespec *ts, 

[PATCH v3 7/7] x86/kvm: support Hyper-V reenlightenment

2018-01-16 Thread Vitaly Kuznetsov
When we run nested KVM on Hyper-V guests we need to update masterclocks for
all guests when L1 migrates to a host with different TSC frequency.
Implement the procedure in the following way:
- Pause all guests.
- Tell our host (Hyper-V) to stop emulating TSC accesses.
- Update our gtod copy, recompute clocks.
- Unpause all guests.

This is somewhat similar to cpufreq but we have two important differences:
we can only disable TSC emulation globally (on all CPUs) and we don't know
the new TSC frequency until we turn the emulation off so we can't
'prepare' ourselves to the event.

Signed-off-by: Vitaly Kuznetsov 
Acked-by: Paolo Bonzini 
---
 arch/x86/kvm/x86.c | 45 +
 1 file changed, 45 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f14e0129c8f5..94f28e6002b2 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -68,6 +68,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define CREATE_TRACE_POINTS
 #include "trace.h"
@@ -5932,6 +5933,43 @@ static void tsc_khz_changed(void *data)
__this_cpu_write(cpu_tsc_khz, khz);
 }
 
+void kvm_hyperv_tsc_notifier(void)
+{
+#ifdef CONFIG_X86_64
+   struct kvm *kvm;
+   struct kvm_vcpu *vcpu;
+   int cpu;
+
+   spin_lock(_lock);
+   list_for_each_entry(kvm, _list, vm_list)
+   kvm_make_mclock_inprogress_request(kvm);
+
+   hyperv_stop_tsc_emulation();
+
+   /* TSC frequency always matches when on Hyper-V */
+   for_each_present_cpu(cpu)
+   per_cpu(cpu_tsc_khz, cpu) = tsc_khz;
+   kvm_max_guest_tsc_khz = tsc_khz;
+
+   list_for_each_entry(kvm, _list, vm_list) {
+   struct kvm_arch *ka = >arch;
+
+   spin_lock(>pvclock_gtod_sync_lock);
+
+   pvclock_update_vm_gtod_copy(kvm);
+
+   kvm_for_each_vcpu(cpu, vcpu, kvm)
+   kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
+
+   kvm_for_each_vcpu(cpu, vcpu, kvm)
+   kvm_clear_request(KVM_REQ_MCLOCK_INPROGRESS, vcpu);
+
+   spin_unlock(>pvclock_gtod_sync_lock);
+   }
+   spin_unlock(_lock);
+#endif
+}
+
 static int kvmclock_cpufreq_notifier(struct notifier_block *nb, unsigned long 
val,
 void *data)
 {
@@ -6217,6 +6255,9 @@ int kvm_arch_init(void *opaque)
kvm_lapic_init();
 #ifdef CONFIG_X86_64
pvclock_gtod_register_notifier(_gtod_notifier);
+
+   if (x86_hyper_type == X86_HYPER_MS_HYPERV)
+   set_hv_tscchange_cb(kvm_hyperv_tsc_notifier);
 #endif
 
return 0;
@@ -6229,6 +6270,10 @@ int kvm_arch_init(void *opaque)
 
 void kvm_arch_exit(void)
 {
+#ifdef CONFIG_X86_64
+   if (x86_hyper_type == X86_HYPER_MS_HYPERV)
+   clear_hv_tscchange_cb();
+#endif
kvm_lapic_exit();
perf_unregister_guest_info_callbacks(_guest_cbs);
 
-- 
2.14.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 2/7] x86/hyper-v: add a function to read both TSC and TSC page value simulateneously

2018-01-16 Thread Vitaly Kuznetsov
This is going to be used from KVM code where we need to get both
TSC and TSC page value.

Nobody is supposed to use the function when Hyper-V code is compiled out,
just BUG().

Signed-off-by: Vitaly Kuznetsov 
---
 arch/x86/hyperv/hv_init.c   |  1 +
 arch/x86/include/asm/mshyperv.h | 23 +++
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 21f9d53d9f00..1a6c63f721bc 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -37,6 +37,7 @@ struct ms_hyperv_tsc_page *hv_get_tsc_page(void)
 {
return tsc_pg;
 }
+EXPORT_SYMBOL_GPL(hv_get_tsc_page);
 
 static u64 read_hv_clock_tsc(struct clocksource *arg)
 {
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 8bf450b13d9f..6b1d4ea78270 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -325,9 +325,10 @@ static inline void hyperv_setup_mmu_ops(void) {}
 
 #ifdef CONFIG_HYPERV_TSCPAGE
 struct ms_hyperv_tsc_page *hv_get_tsc_page(void);
-static inline u64 hv_read_tsc_page(const struct ms_hyperv_tsc_page *tsc_pg)
+static inline u64 hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg,
+  u64 *cur_tsc)
 {
-   u64 scale, offset, cur_tsc;
+   u64 scale, offset;
u32 sequence;
 
/*
@@ -358,7 +359,7 @@ static inline u64 hv_read_tsc_page(const struct 
ms_hyperv_tsc_page *tsc_pg)
 
scale = READ_ONCE(tsc_pg->tsc_scale);
offset = READ_ONCE(tsc_pg->tsc_offset);
-   cur_tsc = rdtsc_ordered();
+   *cur_tsc = rdtsc_ordered();
 
/*
 * Make sure we read sequence after we read all other values
@@ -368,7 +369,14 @@ static inline u64 hv_read_tsc_page(const struct 
ms_hyperv_tsc_page *tsc_pg)
 
} while (READ_ONCE(tsc_pg->tsc_sequence) != sequence);
 
-   return mul_u64_u64_shr(cur_tsc, scale, 64) + offset;
+   return mul_u64_u64_shr(*cur_tsc, scale, 64) + offset;
+}
+
+static inline u64 hv_read_tsc_page(const struct ms_hyperv_tsc_page *tsc_pg)
+{
+   u64 cur_tsc;
+
+   return hv_read_tsc_page_tsc(tsc_pg, _tsc);
 }
 
 #else
@@ -376,5 +384,12 @@ static inline struct ms_hyperv_tsc_page 
*hv_get_tsc_page(void)
 {
return NULL;
 }
+
+static inline u64 hv_read_tsc_page_tsc(const struct ms_hyperv_tsc_page *tsc_pg,
+  u64 *cur_tsc)
+{
+   BUG();
+   return U64_MAX;
+}
 #endif
 #endif
-- 
2.14.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 4/7] x86/hyper-v: redirect reenlightment notifications on CPU offlining

2018-01-16 Thread Vitaly Kuznetsov
It is very unlikely for CPUs to get offlined when we run on Hyper-V as
we have a protection in vmbus module which prevents it when we have any
VMBus devices assigned. This, however,  may change in future if an option
to reassign an already active channel will be added. It is also possible
to run without any Hyper-V devices of have a CPU with no assigned channels.

Reassign reenlightenment notifications to some other active CPU when
the CPU which is assigned to get them goes offline.

Signed-off-by: Vitaly Kuznetsov 
---
v2-> v3:
- Drop spinlock protection from hv_cpu_die() as cpu hotplug is already
  serialized [Thomas Gleixner]
- Use cpumask_any_but() in hv_cpu_die() [Thomas Gleixner]
---
 arch/x86/hyperv/hv_init.c | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 712ac40081f7..e4377e2f2a10 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -191,6 +191,26 @@ void clear_hv_tscchange_cb(void)
 }
 EXPORT_SYMBOL_GPL(clear_hv_tscchange_cb);
 
+static int hv_cpu_die(unsigned int cpu)
+{
+   struct hv_reenlightenment_control re_ctrl;
+   unsigned int new_cpu;
+
+   if (hv_reenlightenment_cb == NULL)
+   return 0;
+
+   rdmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)_ctrl));
+   if (re_ctrl.target_vp == hv_vp_index[cpu]) {
+   /* Reassign to some other online CPU */
+   new_cpu = cpumask_any_but(cpu_online_mask, cpu);
+
+   re_ctrl.target_vp = hv_vp_index[new_cpu];
+   wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)_ctrl));
+   }
+
+   return 0;
+}
+
 /*
  * This function is to be invoked early in the boot sequence after the
  * hypervisor has been detected.
@@ -220,7 +240,7 @@ void hyperv_init(void)
return;
 
if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/hyperv_init:online",
- hv_cpu_init, NULL) < 0)
+ hv_cpu_init, hv_cpu_die) < 0)
goto free_vp_index;
 
/*
-- 
2.14.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 5/7] x86/irq: Count Hyper-V reenlightenment interrupts

2018-01-16 Thread Vitaly Kuznetsov
Hyper-V reenlightenment interrupts arrive when the VM is migrated, we're
not supposed to see many of them. However, it may be important to know
that the event has happened in case we have L2 nested guests.

Signed-off-by: Vitaly Kuznetsov 
---
 arch/x86/hyperv/hv_init.c  | 2 ++
 arch/x86/include/asm/hardirq.h | 3 +++
 arch/x86/kernel/irq.c  | 9 +
 3 files changed, 14 insertions(+)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index e4377e2f2a10..a3adece392f1 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -147,6 +147,8 @@ __visible void __irq_entry 
hyperv_reenlightenment_intr(struct pt_regs *regs)
 {
entering_ack_irq();
 
+   inc_irq_stat(irq_hv_reenlightenment_count);
+
schedule_delayed_work(_reenlightenment_work, HZ/10);
 
exiting_irq();
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 51cc979dd364..7c341a74ec8c 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -38,6 +38,9 @@ typedef struct {
 #if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN)
unsigned int irq_hv_callback_count;
 #endif
+#if IS_ENABLED(CONFIG_HYPERV)
+   unsigned int irq_hv_reenlightenment_count;
+#endif
 } cacheline_aligned irq_cpustat_t;
 
 DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 68e1867cca80..45fb4d2565f8 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -141,6 +141,15 @@ int arch_show_interrupts(struct seq_file *p, int prec)
   irq_stats(j)->irq_hv_callback_count);
seq_puts(p, "  Hypervisor callback interrupts\n");
}
+#endif
+#if IS_ENABLED(CONFIG_HYPERV)
+   if (test_bit(HYPERV_REENLIGHTENMENT_VECTOR, system_vectors)) {
+   seq_printf(p, "%*s: ", prec, "HRE");
+   for_each_online_cpu(j)
+   seq_printf(p, "%10u ",
+  irq_stats(j)->irq_hv_reenlightenment_count);
+   seq_puts(p, "  Hyper-V reenlightenment interrupts\n");
+   }
 #endif
seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(_err_count));
 #if defined(CONFIG_X86_IO_APIC)
-- 
2.14.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 3/7] x86/hyper-v: reenlightenment notifications support

2018-01-16 Thread Vitaly Kuznetsov
Hyper-V supports Live Migration notification. This is supposed to be used
in conjunction with TSC emulation: when we are migrated to a host with
different TSC frequency for some short period host emulates our accesses
to TSC and sends us an interrupt to notify about the event. When we're
done updating everything we can disable TSC emulation and everything will
start working fast again.

We didn't need these notifications before as Hyper-V guests are not
supposed to use TSC as a clocksource: in Linux we even mark it as unstable
on boot. Guests normally use 'tsc page' clocksouce and host updates its
values on migrations automatically.

Things change when we want to run nested virtualization: even when we pass
through PV clocksources (kvm-clock or tsc page) to our guests we need to
know TSC frequency and when it changes.

Hyper-V Top Level Functional Specification (as of v5.0b) wrongly specifies
EAX:BIT(12) of CPUID:0x4009 as the feature identification bit. The
right one to check is EAX:BIT(13) of CPUID:0x4003. I was assured that
the fix in on the way.

Signed-off-by: Vitaly Kuznetsov 
---
v2 -> v3:
- add __visible and __irq_entry [Thomas Gleixner]
---
 arch/x86/entry/entry_32.S  |  3 ++
 arch/x86/entry/entry_64.S  |  3 ++
 arch/x86/hyperv/hv_init.c  | 89 ++
 arch/x86/include/asm/irq_vectors.h |  7 ++-
 arch/x86/include/asm/mshyperv.h| 10 +
 arch/x86/include/uapi/asm/hyperv.h | 27 
 arch/x86/kernel/cpu/mshyperv.c |  6 +++
 7 files changed, 144 insertions(+), 1 deletion(-)

diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index a1f28a54f23a..4041608cd208 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -883,6 +883,9 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, 
HYPERVISOR_CALLBACK_VECTOR,
 BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
 hyperv_vector_handler)
 
+BUILD_INTERRUPT3(hyperv_reenlightenment_vector, HYPERV_REENLIGHTENMENT_VECTOR,
+hyperv_reenlightenment_intr)
+
 #endif /* CONFIG_HYPERV */
 
 ENTRY(page_fault)
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 4f8e1d35a97c..7da977b8d1dd 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1233,6 +1233,9 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
 #if IS_ENABLED(CONFIG_HYPERV)
 apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
hyperv_callback_vector hyperv_vector_handler
+
+apicinterrupt3 HYPERV_REENLIGHTENMENT_VECTOR \
+   hyperv_reenlightenment_vector hyperv_reenlightenment_intr
 #endif /* CONFIG_HYPERV */
 
 idtentry debug do_debughas_error_code=0
paranoid=1 shift_ist=DEBUG_STACK
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 1a6c63f721bc..712ac40081f7 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -18,6 +18,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -102,6 +104,93 @@ static int hv_cpu_init(unsigned int cpu)
return 0;
 }
 
+static void (*hv_reenlightenment_cb)(void);
+
+static void hv_reenlightenment_notify(struct work_struct *dummy)
+{
+   struct hv_tsc_emulation_status emu_status;
+
+   rdmsrl(HV_X64_MSR_TSC_EMULATION_STATUS, *(u64 *)_status);
+
+   /* Don't issue the callback if TSC accesses are not emulated */
+   if (hv_reenlightenment_cb && emu_status.inprogress)
+   hv_reenlightenment_cb();
+}
+static DECLARE_DELAYED_WORK(hv_reenlightenment_work, 
hv_reenlightenment_notify);
+
+void hyperv_stop_tsc_emulation(void)
+{
+   u64 freq;
+   struct hv_tsc_emulation_status emu_status;
+
+   rdmsrl(HV_X64_MSR_TSC_EMULATION_STATUS, *(u64 *)_status);
+   emu_status.inprogress = 0;
+   wrmsrl(HV_X64_MSR_TSC_EMULATION_STATUS, *(u64 *)_status);
+
+   rdmsrl(HV_X64_MSR_TSC_FREQUENCY, freq);
+   tsc_khz = div64_u64(freq, 1000);
+}
+EXPORT_SYMBOL_GPL(hyperv_stop_tsc_emulation);
+
+static inline bool hv_reenlightenment_available(void)
+{
+   /*
+* Check for required features and priviliges to make TSC frequency
+* change notifications work.
+*/
+   return ms_hyperv.features & HV_X64_ACCESS_FREQUENCY_MSRS &&
+   ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE &&
+   ms_hyperv.features & HV_X64_ACCESS_REENLIGHTENMENT;
+}
+
+__visible void __irq_entry hyperv_reenlightenment_intr(struct pt_regs *regs)
+{
+   entering_ack_irq();
+
+   schedule_delayed_work(_reenlightenment_work, HZ/10);
+
+   exiting_irq();
+}
+
+void set_hv_tscchange_cb(void (*cb)(void))
+{
+   struct hv_reenlightenment_control re_ctrl = {
+   .vector = HYPERV_REENLIGHTENMENT_VECTOR,
+   .enabled = 1,
+   .target_vp = hv_vp_index[smp_processor_id()]
+   };
+   struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1};

[PATCH v3 1/7] x86/hyper-v: check for required priviliges in hyperv_init()

2018-01-16 Thread Vitaly Kuznetsov
In hyperv_init() we presume we always have access to VP index and hypercall
MSRs while according to the specification we should check if we're allowed
to access the corresponding MSRs before accessing them.

Signed-off-by: Vitaly Kuznetsov 
Reviewed-by: Thomas Gleixner 
---
 arch/x86/hyperv/hv_init.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 189a398290db..21f9d53d9f00 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -110,12 +110,19 @@ static int hv_cpu_init(unsigned int cpu)
  */
 void hyperv_init(void)
 {
-   u64 guest_id;
+   u64 guest_id, required_msrs;
union hv_x64_msr_hypercall_contents hypercall_msr;
 
if (x86_hyper_type != X86_HYPER_MS_HYPERV)
return;
 
+   /* Absolutely required MSRs */
+   required_msrs = HV_X64_MSR_HYPERCALL_AVAILABLE |
+   HV_X64_MSR_VP_INDEX_AVAILABLE;
+
+   if ((ms_hyperv.features & required_msrs) != required_msrs)
+   return;
+
/* Allocate percpu VP index */
hv_vp_index = kmalloc_array(num_possible_cpus(), sizeof(*hv_vp_index),
GFP_KERNEL);
-- 
2.14.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 0/7] x86/kvm/hyperv: stable clocksorce for L2 guests when running nested KVM on Hyper-V

2018-01-16 Thread Vitaly Kuznetsov
Changes since v2:
- Add Paolo's Acked-by to PATCH6-7
- Add Thomas' Reviewed-by to PATCH1
- Update the description of PATCH2 to match the reality [Thomas Gleixner]
- Add __visible and __irq_entry annotations to hyperv_reenlightenment_intr()
  [Thomas Gleixner]
- Drop spinlock protection and use cpumask_any_but() in PATCH4
  [Thomas Gleixner]

Original description:

Currently, KVM passes PVCLOCK_TSC_STABLE_BIT to its guests when running in
so called 'masterclock' mode and this is only possible when the clocksource
on the host is TSC. When running nested on Hyper-V we're using a different
clocksource in L1 (Hyper-V TSC Page) which can actually be used for
masterclock. This series brings the required support.

Making KVM work with TSC page clocksource is relatively easy, it is done in
PATCH 6 of the series. All the rest is required to support L1 migration
when TSC frequency changes, we use a special feature from Hyper-V to do
the job.

Vitaly Kuznetsov (7):
  x86/hyper-v: check for required priviliges in hyperv_init()
  x86/hyper-v: add a function to read both TSC and TSC page value
simulateneously
  x86/hyper-v: reenlightenment notifications support
  x86/hyper-v: redirect reenlightment notifications on CPU offlining
  x86/irq: Count Hyper-V reenlightenment interrupts
  x86/kvm: pass stable clocksource to guests when running nested on
Hyper-V
  x86/kvm: support Hyper-V reenlightenment

 arch/x86/entry/entry_32.S  |   3 +
 arch/x86/entry/entry_64.S  |   3 +
 arch/x86/hyperv/hv_init.c  | 123 -
 arch/x86/include/asm/hardirq.h |   3 +
 arch/x86/include/asm/irq_vectors.h |   7 +-
 arch/x86/include/asm/mshyperv.h|  33 +++--
 arch/x86/include/uapi/asm/hyperv.h |  27 
 arch/x86/kernel/cpu/mshyperv.c |   6 ++
 arch/x86/kernel/irq.c  |   9 +++
 arch/x86/kvm/x86.c | 138 ++---
 10 files changed, 320 insertions(+), 32 deletions(-)

-- 
2.14.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: Fix avoid intensive reconnecting for ko2iblnd patch

2018-01-16 Thread Eremin, Dmitry
The logic of the original commit 4d99b2581eff ("staging: lustre: avoid 
intensive reconnecting for ko2iblnd")
was assumed conditional free of struct kib_conn if the second argument 
free_conn in function
kiblnd_destroy_conn(struct kib_conn *conn, bool free_conn) is true. But this 
hunk of code was dropped
from original commit. As result the logic works wrong and current code use 
struct kib_conn after
free.

> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
>   3317  kiblnd_destroy_conn(conn, !peer);
>  Freed always (but 
> should be conditionally)
>   3318
>   3319  spin_lock_irqsave(lock, flags);
>   3320  if (!peer)
>   3321  continue;
>   3322
>   3323  conn->ibc_peer = peer;
> ^ Use after free
>   3324  if (peer->ibp_reconnected < 
> KIB_RECONN_HIGH_RACE)
>   3325  list_add_tail(>ibc_list,
>
> 
>   3326
> _data.kib_reconn_list);
>   3327  else
>   3328  list_add_tail(>ibc_list,
> 
> 
>   3329
> _data.kib_reconn_wait);

After attached patch this code will use struct kib_conn only when it was not 
freed.

Signed-off-by: Dmitry Eremin 
---
 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 2ebc484..a15a625 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -890,7 +890,8 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool 
free_conn)
atomic_dec(>ibn_nconns);
}
 
-   kfree(conn);
+   if (free_conn)
+   kfree(conn);
 }
 
 int kiblnd_close_peer_conns_locked(struct kib_peer *peer, int why)
-- 
1.8.3.1



Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park,
17 Krylatskaya Str., Bldg 4, Moscow 121614,
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: fsl-mc: Convert documentation to rst format

2018-01-16 Thread Ioana Radulescu
Update the doc file to comply with the rst format.

It's not integrated into the documentation build structure yet,
since it's still located in drivers/staging.

Signed-off-by: Ioana Radulescu 
---
v2: patch generated with -M option

 .../staging/fsl-mc/{README.txt => overview.rst}| 655 +++--
 1 file changed, 336 insertions(+), 319 deletions(-)
 rename drivers/staging/fsl-mc/{README.txt => overview.rst} (14%)

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/overview.rst
similarity index 14%
rename from drivers/staging/fsl-mc/README.txt
rename to drivers/staging/fsl-mc/overview.rst
index 0ea5cd7..79fede4 100644
--- a/drivers/staging/fsl-mc/README.txt
+++ b/drivers/staging/fsl-mc/overview.rst
@@ -1,24 +1,16 @@
-Copyright (C) 2015 Freescale Semiconductor Inc.
+.. include:: 
 
 DPAA2 (Data Path Acceleration Architecture Gen2) Overview
--
+=
+
+:Copyright: |copy| 2015 Freescale Semiconductor Inc.
+:Copyright: |copy| 2018 NXP
 
 This document provides an overview of the Freescale DPAA2 architecture
 and how it is integrated into the Linux kernel.
 
-Contents summary
-   -DPAA2 overview
-   -Overview of DPAA2 objects
-   -DPAA2 Linux driver architecture overview
--bus driver
--DPRC driver
--allocator
--DPIO driver
--Ethernet
--MAC
-
 Introduction
-
+
 
 DPAA2 is a hardware architecture designed for high-speeed network
 packet processing.  DPAA2 consists of sophisticated mechanisms for
@@ -29,48 +21,47 @@ autonomous L2 switching, virtual Ethernet bridging, and 
accelerator
 A DPAA2 hardware component called the Management Complex (or MC) manages the
 DPAA2 hardware resources.  The MC provides an object-based abstraction for
 software drivers to use the DPAA2 hardware.
-
 The MC uses DPAA2 hardware resources such as queues, buffer pools, and
 network ports to create functional objects/devices such as network
 interfaces, an L2 switch, or accelerator instances.
-
 The MC provides memory-mapped I/O command interfaces (MC portals)
 which DPAA2 software drivers use to operate on DPAA2 objects.
 
 The diagram below shows an overview of the DPAA2 resource management
-architecture:
-
- +--+
- |  OS  |
- |DPAA2 drivers |
- | ||
- +-|+
-   |
-   | (create,discover,connect
-   |  config,use,destroy)
-   |
- DPAA2 |
- +| mc portal |-+
- | ||
- |   +- - - - - - - - - - - - -V- - -+  |
- |   |   |  |
- |   |   Management Complex (MC) |  |
- |   |   |  |
- |   +- - - - - - - - - - - - - - - -+  |
- |  |
- | Hardware  Hardware   |
- | Resources Objects|
- | - ---|
- | -queues   -DPRC  |
- | -buffer pools -DPMCP |
- | -Eth MACs/ports   -DPIO  |
- | -network interface-DPNI  |
- |  profiles -DPMAC |
- | -queue portals-DPBP  |
- | -MC portals...   |
- |  ... |
- |  |
- +--+
+architecture::
+
+   +--+
+   |  OS  |
+   |DPAA2 drivers |
+   | ||
+   +-|+
+ |
+ | (create,discover,connect
+ |  config,use,destroy)
+ |
+DPAA2|
+   +| mc portal |-+
+   | ||
+   |   +- - - - - - - - - - - - -V- - -+  |
+   |   |   |  |
+   |   |   Management Complex (MC) |  |
+   |   |   |  |
+   |   +- - - - - - - - - - - - - - - -+  |
+   |  |
+   | Hardware  Hardware   |
+   | Resources Objects|
+   | - ---|
+  

Re: [PATCH] staging: lustre: Fix avoid intensive reconnecting for ko2iblnd patch

2018-01-16 Thread Greg Kroah-Hartman
On Tue, Jan 16, 2018 at 03:01:49PM +, Eremin, Dmitry wrote:
> In the original commit 4d99b2581effe115376402e710fbcb1c3c073769

Please use the documented way to write this:
4d99b2581eff ("staging: lustre: avoid intensive reconnecting for 
ko2iblnd")

> was missed one hunk. Added it now to avoid issue with use after free.

And I do not understand this commit message at all.

> 
> Signed-off-by: Dmitry Eremin 
> ---
>  drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
> b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
> index 2ebc484..a15a625 100644
> --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
> +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
> @@ -890,7 +890,8 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool 
> free_conn)
>   atomic_dec(>ibn_nconns);
>   }
>  
> - kfree(conn);
> + if (free_conn)
> + kfree(conn);

This looks really odd, don't you think?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 8/8] staging: fsl-mc: Convert documentation to rst format

2018-01-16 Thread Greg KH
On Tue, Jan 16, 2018 at 03:40:18PM +, Ruxandra Ioana Ciocoi Radulescu wrote:
> > -Original Message-
> > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > Sent: Tuesday, January 16, 2018 5:14 PM
> > To: Bogdan Purcareata 
> > Cc: Laurentiu Tudor ; Ruxandra Ioana Ciocoi
> > Radulescu ; de...@driverdev.osuosl.org;
> > r...@kernel.org; stuyo...@gmail.com; a...@arndb.de;
> > marc.zyng...@arm.com; Roy Pledge ; Ioana Ciornei
> > ; linux-ker...@vger.kernel.org; Horia Geantă
> > ; Nipun Gupta ;
> > t...@linutronix.de; linux-arm-ker...@lists.infradead.org;
> > ja...@lakedaemon.net
> > Subject: Re: [PATCH 8/8] staging: fsl-mc: Convert documentation to rst
> > format
> > 
> > On Tue, Jan 16, 2018 at 03:19:10PM +0200, Bogdan Purcareata wrote:
> > > From: Ioana Radulescu 
> > >
> > > Update the doc file to comply with the rst format.
> > >
> > > It's not integrated into the documentation build structure yet,
> > > since it's still located in drivers/staging.
> > >
> > > Signed-off-by: Ioana Radulescu 
> > > Reviewed-by: Laurentiu Tudor 
> > > ---
> > >  drivers/staging/fsl-mc/README.txt   | 387 
> > > --
> > >  drivers/staging/fsl-mc/overview.rst | 404
> > 
> > >  2 files changed, 404 insertions(+), 387 deletions(-)
> > >  delete mode 100644 drivers/staging/fsl-mc/README.txt
> > >  create mode 100644 drivers/staging/fsl-mc/overview.rst
> > 
> > Please generate patches with the -M option to git format-patch, so we
> > can see the file move, not just get removed and added as a brand new
> > one.
> 
> Sure, I can do this.
> 
> Even with -M, the diff is rather large since the indenting changes for most
> of the lines in the file. Would it be better to make two patches, with
> the first changing just line indenting and the second one, where the file is
> moved, only updating rst specific markups?

Nah, just use -M and we can take it from there.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: staging: lustre: lnet: convert selftest to use workqueues

2018-01-16 Thread Greg Kroah-Hartman
On Tue, Jan 16, 2018 at 03:59:58PM +, Colin Ian King wrote:
> Hi,
> 
> CoverityScan detected a couple of issues, one of which was introduced
> with the following commit:
> 
> commit 6106c0f82481e686b337ee0c403821fb5c3c17ef
> Author: NeilBrown 
> Date:   Thu Jan 11 15:06:40 2018 +1100
> 
> CoverityScan CID#1464078 ("Uninitialized scalar variable")
> 
> I'm not sure what the expected error return for these conditions are, so
> I've not fixed these as I didn't want to hazard a guess.
> 
> static int
> lnet_selftest_init(void)
> {
> int nscheds;
> int rc;
> 
> // note here rc is not initialized
> 
> int i;
> 
> lst_serial_wq = alloc_ordered_workqueue("lst_s", 0);
> if (!lst_serial_wq) {
> CERROR("Failed to create serial WI scheduler for LST\n");
> return rc;
> 
> // garbage value in rc is returned
> 
> }
> lst_init_step = LST_INIT_WI_SERIAL;
> 
> nscheds = cfs_cpt_number(lnet_cpt_table());
> lst_test_wq = kvmalloc_array(nscheds, sizeof(lst_test_wq[0]),
> GFP_KERNEL | __GFP_ZERO);
> if (!lst_test_wq)
> goto error;
> 
> // this also returns garbage in rc

Already fixed in my tree by a patch from Arnd and me :)

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: most: replace function name to __func__

2018-01-16 Thread Sidong Yang
Fix checkpatch.pl warning message about logging code. Previous code
contains hard coded function name. Fix this code by using __func__
macro.

Signed-off-by: Sidong Yang 
---
 drivers/staging/most/dim2/dim2.c   |  2 +-
 drivers/staging/most/video/video.c | 24 
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 21e3fb48bdb4..f9bc7dea75b8 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -151,7 +151,7 @@ void dimcb_io_write(u32 __iomem *ptr32, u32 value)
  */
 void dimcb_on_error(u8 error_id, const char *error_message)
 {
-   pr_err("dimcb_on_error: error_id - %d, error_message - %s\n", error_id,
+   pr_err("%s: error_id - %d, error_message - %s\n", __func__, error_id,
   error_message);
 }
 
diff --git a/drivers/staging/most/video/video.c 
b/drivers/staging/most/video/video.c
index 098873851646..22d9b1fc622f 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -73,7 +73,7 @@ static int comp_vdev_open(struct file *filp)
struct most_video_dev *mdev = video_drvdata(filp);
struct comp_fh *fh;
 
-   v4l2_info(>v4l2_dev, "comp_vdev_open()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
switch (vdev->vfl_type) {
case VFL_TYPE_GRABBER:
@@ -122,7 +122,7 @@ static int comp_vdev_close(struct file *filp)
struct most_video_dev *mdev = fh->mdev;
struct mbo *mbo, *tmp;
 
-   v4l2_info(>v4l2_dev, "comp_vdev_close()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
/*
 * We need to put MBOs back before we call most_stop_channel()
@@ -250,7 +250,7 @@ static int vidioc_querycap(struct file *file, void *priv,
struct comp_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   v4l2_info(>v4l2_dev, "vidioc_querycap()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
strlcpy(cap->driver, "v4l2_component", sizeof(cap->driver));
strlcpy(cap->card, "MOST", sizeof(cap->card));
@@ -270,7 +270,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void 
*priv,
struct comp_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   v4l2_info(>v4l2_dev, "vidioc_enum_fmt_vid_cap() %d\n", f->index);
+   v4l2_info(>v4l2_dev, "%s() %d\n", __func__, f->index);
 
if (f->index)
return -EINVAL;
@@ -289,7 +289,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void 
*priv,
struct comp_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   v4l2_info(>v4l2_dev, "vidioc_g_fmt_vid_cap()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
comp_set_format_struct(f);
return 0;
@@ -318,7 +318,7 @@ static int vidioc_g_std(struct file *file, void *priv, 
v4l2_std_id *norm)
struct comp_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   v4l2_info(>v4l2_dev, "vidioc_g_std()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
*norm = V4L2_STD_UNKNOWN;
return 0;
@@ -355,7 +355,7 @@ static int vidioc_s_input(struct file *file, void *priv, 
unsigned int index)
struct comp_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   v4l2_info(>v4l2_dev, "vidioc_s_input(%d)\n", index);
+   v4l2_info(>v4l2_dev, "%s(%d)\n", __func__, index);
 
if (index >= V4L2_CMP_MAX_INPUT)
return -EINVAL;
@@ -435,7 +435,7 @@ static int comp_register_videodev(struct most_video_dev 
*mdev)
 {
int ret;
 
-   v4l2_info(>v4l2_dev, "comp_register_videodev()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
init_waitqueue_head(>wait_data);
 
@@ -465,7 +465,7 @@ static int comp_register_videodev(struct most_video_dev 
*mdev)
 
 static void comp_unregister_videodev(struct most_video_dev *mdev)
 {
-   v4l2_info(>v4l2_dev, "comp_unregister_videodev()\n");
+   v4l2_info(>v4l2_dev, "%s()\n", __func__);
 
video_unregister_device(mdev->vdev);
 }
@@ -485,7 +485,7 @@ static int comp_probe_channel(struct most_interface *iface, 
int channel_idx,
int ret;
struct most_video_dev *mdev = get_comp_dev(iface, channel_idx);
 
-   pr_info("comp_probe_channel(%s)\n", name);
+   pr_info("%s(%s)\n", __func__, name);
 
if (mdev) {
pr_err("channel already linked\n");
@@ -531,7 +531,7 @@ static int comp_probe_channel(struct most_interface *iface, 
int channel_idx,
spin_lock_irq(_lock);
list_add(>list, _devices);
spin_unlock_irq(_lock);
-   v4l2_info(>v4l2_dev, "comp_probe_channel() done\n");
+   v4l2_info(>v4l2_dev, "%s() done\n", __func__);
return 0;
 
 err_unreg:
@@ -550,7 +550,7 @@ static int comp_disconnect_channel(struct most_interface 
*iface,
return -ENOENT;
}
 
-   v4l2_info(>v4l2_dev, 

Re: staging: lustre: lnet: convert selftest to use workqueues

2018-01-16 Thread Colin Ian King
Hi,

CoverityScan detected a couple of issues, one of which was introduced
with the following commit:

commit 6106c0f82481e686b337ee0c403821fb5c3c17ef
Author: NeilBrown 
Date:   Thu Jan 11 15:06:40 2018 +1100

CoverityScan CID#1464078 ("Uninitialized scalar variable")

I'm not sure what the expected error return for these conditions are, so
I've not fixed these as I didn't want to hazard a guess.

static int
lnet_selftest_init(void)
{
int nscheds;
int rc;

// note here rc is not initialized

int i;

lst_serial_wq = alloc_ordered_workqueue("lst_s", 0);
if (!lst_serial_wq) {
CERROR("Failed to create serial WI scheduler for LST\n");
return rc;

// garbage value in rc is returned

}
lst_init_step = LST_INIT_WI_SERIAL;

nscheds = cfs_cpt_number(lnet_cpt_table());
lst_test_wq = kvmalloc_array(nscheds, sizeof(lst_test_wq[0]),
GFP_KERNEL | __GFP_ZERO);
if (!lst_test_wq)
goto error;

// this also returns garbage in rc
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 8/8] staging: fsl-mc: Convert documentation to rst format

2018-01-16 Thread Ruxandra Ioana Ciocoi Radulescu
> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, January 16, 2018 5:14 PM
> To: Bogdan Purcareata 
> Cc: Laurentiu Tudor ; Ruxandra Ioana Ciocoi
> Radulescu ; de...@driverdev.osuosl.org;
> r...@kernel.org; stuyo...@gmail.com; a...@arndb.de;
> marc.zyng...@arm.com; Roy Pledge ; Ioana Ciornei
> ; linux-ker...@vger.kernel.org; Horia Geantă
> ; Nipun Gupta ;
> t...@linutronix.de; linux-arm-ker...@lists.infradead.org;
> ja...@lakedaemon.net
> Subject: Re: [PATCH 8/8] staging: fsl-mc: Convert documentation to rst
> format
> 
> On Tue, Jan 16, 2018 at 03:19:10PM +0200, Bogdan Purcareata wrote:
> > From: Ioana Radulescu 
> >
> > Update the doc file to comply with the rst format.
> >
> > It's not integrated into the documentation build structure yet,
> > since it's still located in drivers/staging.
> >
> > Signed-off-by: Ioana Radulescu 
> > Reviewed-by: Laurentiu Tudor 
> > ---
> >  drivers/staging/fsl-mc/README.txt   | 387 
> > --
> >  drivers/staging/fsl-mc/overview.rst | 404
> 
> >  2 files changed, 404 insertions(+), 387 deletions(-)
> >  delete mode 100644 drivers/staging/fsl-mc/README.txt
> >  create mode 100644 drivers/staging/fsl-mc/overview.rst
> 
> Please generate patches with the -M option to git format-patch, so we
> can see the file move, not just get removed and added as a brand new
> one.

Sure, I can do this.

Even with -M, the diff is rather large since the indenting changes for most
of the lines in the file. Would it be better to make two patches, with
the first changing just line indenting and the second one, where the file is
moved, only updating rst specific markups?

Thanks,
Ioana
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 02/10] include: Move compat_timespec/ timeval to compat_time.h

2018-01-16 Thread Steven Rostedt
On Mon, 15 Jan 2018 18:18:10 -0800
Deepa Dinamani  wrote:

> diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
> index 09ad88572746..db25aa15b705 100644
> --- a/arch/x86/include/asm/ftrace.h
> +++ b/arch/x86/include/asm/ftrace.h

Acked-by: Steven Rostedt (VMware) 

-- Steve

> @@ -49,7 +49,7 @@ int ftrace_int3_handler(struct pt_regs *regs);
>  #if !defined(__ASSEMBLY__) && !defined(COMPILE_OFFSETS)
>  
>  #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_IA32_EMULATION)
> -#include 
> +#include 
>  
>  /*
>   * Because ia32 syscalls do not map to x86_64 syscall numbers
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 00/10] posix_clocks: Prepare syscalls for 64 bit time_t conversion

2018-01-16 Thread Arnd Bergmann
On Tue, Jan 16, 2018 at 3:18 AM, Deepa Dinamani  wrote:
> The series is a preparation series for individual architectures
> to use 64 bit time_t syscalls in compat and 32 bit emulation modes.
>
> This is a follow up to the series Arnd Bergmann posted:
> https://sourceware.org/ml/libc-alpha/2015-05/msg00070.html [1]
>
> Big picture is as per the lwn article:
> https://lwn.net/Articles/643234/ [2]
>
> The series is directed at converting posix clock syscalls:
> clock_gettime, clock_settime, clock_getres and clock_nanosleep
> to use a new data structure __kernel_timespec at syscall boundaries.
> __kernel_timespec maintains 64 bit time_t across all execution modes.
>
> vdso will be handled as part of each architecture when they enable
> support for 64 bit time_t.
>
> The compat syscalls are repurposed to provide backward compatibility
> by using them as native syscalls as well for 32 bit architectures.
> They will continue to use timespec at syscall boundaries.
>
> CONFIG_64_BIT_TIME controls whether the syscalls use __kernel_timespec
> or timespec at syscall boundaries.
>
> The series does the following:
> 1. Enable compat syscalls on 32 bit architectures.
> 2. Add a new __kernel_timespec type to be used as the data structure
>for all the new syscalls.
> 3. Add new config CONFIG_64BIT_TIME(intead of the CONFIG_COMPAT_TIME in
>[1] and [2] to switch to new definition of __kernel_timespec. It is
>the same as struct timespec otherwise.
> 4. Add new CONFIG_32BIT_TIME to conditionally compile compat syscalls.

This looks all good to me. I think we should have this included in linux-next as
soon as possible, but this probably means after -rc1 at the current point, since
it's a bit late for 4.16.

I'll pick up the series into my randconfig build tree again to find
possible build
time regressions. Otherwise the way I'd stage it out is to put it into my y2038
branch after -rc1 and then send a pull request to Thomas for the tip tree
a week later. It seems unlikely that any major problems come up, so we could
plan to address additional requests for changes by adding commits on top
once it's in linux-next.

   Arnd
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 8/8] staging: fsl-mc: Convert documentation to rst format

2018-01-16 Thread Greg KH
On Tue, Jan 16, 2018 at 03:19:10PM +0200, Bogdan Purcareata wrote:
> From: Ioana Radulescu 
> 
> Update the doc file to comply with the rst format.
> 
> It's not integrated into the documentation build structure yet,
> since it's still located in drivers/staging.
> 
> Signed-off-by: Ioana Radulescu 
> Reviewed-by: Laurentiu Tudor 
> ---
>  drivers/staging/fsl-mc/README.txt   | 387 --
>  drivers/staging/fsl-mc/overview.rst | 404 
> 
>  2 files changed, 404 insertions(+), 387 deletions(-)
>  delete mode 100644 drivers/staging/fsl-mc/README.txt
>  create mode 100644 drivers/staging/fsl-mc/overview.rst

Please generate patches with the -M option to git format-patch, so we
can see the file move, not just get removed and added as a brand new
one.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers

2018-01-16 Thread Greg KH
On Tue, Jan 16, 2018 at 03:19:05PM +0200, Bogdan Purcareata wrote:
> diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
> b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
> index 5904836..1ac8ec6 100644
> --- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
> +++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
> @@ -1,33 +1,8 @@
> +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */

Hm, I don't think you want to do that.  How can a Linux driver subsytem
that wraps calls to the kernel's driver core (which are GPL-only), be
accessed by BSD-3 code?

If I didn't know any better, I would think you were trying to create a
"GPL Condom" here :)

Anyway, why all of the BSD-3 stuff here?  That makes no sense for kernel
code at all, and this is a relicensing of the file, have you gotten
legal approval of everyone that has modified the file while it was under
the GPL-v2 only text to be able to change it to BSD-3 as well?

Careful, this is a _VERY_ tricky thing to do right.  I need a
signed-off-by on this type of patch from your legal council to ensure
that they know exactly what you are doing, and have reviewed it
properly, before I can take it.

Hint, stick to the existing license in the files, it makes more sense,
you are not going to be taking this code out of Linux and putting it
anywhere.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] scsi: storvsc: missing error code in storvsc_probe()

2018-01-16 Thread KY Srinivasan


> -Original Message-
> From: Cathy Avery [mailto:cav...@redhat.com]
> Sent: Tuesday, January 16, 2018 6:36 AM
> To: Dan Carpenter ; KY Srinivasan
> 
> Cc: Haiyang Zhang ; Stephen Hemminger
> ; James E.J. Bottomley
> ; Martin K. Petersen
> ; de...@linuxdriverproject.org; linux-
> s...@vger.kernel.org; kernel-janit...@vger.kernel.org
> Subject: Re: [PATCH] scsi: storvsc: missing error code in storvsc_probe()
> 
> On 01/16/2018 05:40 AM, Dan Carpenter wrote:
> > We should set the error code if fc_remote_port_add() fails.
> >
> > Fixes: daf0cd445a21 ("scsi: storvsc: Add support for FC rport.")
> > Signed-off-by: Dan Carpenter 
> >
> > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
> > index 3b3d1d050cac..40fc7a590e81 100644
> > --- a/drivers/scsi/storvsc_drv.c
> > +++ b/drivers/scsi/storvsc_drv.c
> > @@ -1834,8 +1834,10 @@ static int storvsc_probe(struct hv_device
> *device,
> > fc_host_node_name(host) = stor_device->node_name;
> > fc_host_port_name(host) = stor_device->port_name;
> > stor_device->rport = fc_remote_port_add(host, 0, );
> > -   if (!stor_device->rport)
> > +   if (!stor_device->rport) {
> > +   ret = -ENOMEM;
> > goto err_out4;
> > +   }
> > }
> >   #endif
> > return 0;
> 
> Reviewed-by: Cathy Avery 
Acked-by: K. Y. Srinivasan 
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: netlogic: platform_net: Fixed '(' at the EOL

2018-01-16 Thread Greg KH
On Tue, Jan 16, 2018 at 07:33:03PM +0530, Naveen Panwar wrote:
> Hi Guys,
> 
> I submitted a new patch with the suggestions from Al Viro, did you guys
> check it?

I do not see any patch from my in my queue :(

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: Fix avoid intensive reconnecting for ko2iblnd patch

2018-01-16 Thread Eremin, Dmitry
In the original commit 4d99b2581effe115376402e710fbcb1c3c073769
was missed one hunk. Added it now to avoid issue with use after free.

Signed-off-by: Dmitry Eremin 
---
 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 2ebc484..a15a625 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -890,7 +890,8 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool 
free_conn)
atomic_dec(>ibn_nconns);
}
 
-   kfree(conn);
+   if (free_conn)
+   kfree(conn);
 }
 
 int kiblnd_close_peer_conns_locked(struct kib_peer *peer, int why)
-- 
1.8.3.1



Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park,
17 Krylatskaya Str., Bldg 4, Moscow 121614,
Russian Federation

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] scsi: storvsc: missing error code in storvsc_probe()

2018-01-16 Thread Cathy Avery

On 01/16/2018 05:40 AM, Dan Carpenter wrote:

We should set the error code if fc_remote_port_add() fails.

Fixes: daf0cd445a21 ("scsi: storvsc: Add support for FC rport.")
Signed-off-by: Dan Carpenter 

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 3b3d1d050cac..40fc7a590e81 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1834,8 +1834,10 @@ static int storvsc_probe(struct hv_device *device,
fc_host_node_name(host) = stor_device->node_name;
fc_host_port_name(host) = stor_device->port_name;
stor_device->rport = fc_remote_port_add(host, 0, );
-   if (!stor_device->rport)
+   if (!stor_device->rport) {
+   ret = -ENOMEM;
goto err_out4;
+   }
}
  #endif
return 0;


Reviewed-by: Cathy Avery 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/13] staging: wilc1000: rename wilc_wfi_p2pListenParams struct and its member variable

2018-01-16 Thread Ajay Singh
This is a cleanup patch to avoid the use of camelCase for variable names.
In this patch, "Avoid camelCase" issue found by checkpatch.pl is fixed.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 28 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 12 +-
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 175c64f..d6ff989 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1525,9 +1525,9 @@ static void WILC_WFI_RemainOnChannelReady(void *pUserVoid)
priv->p2p_listen_state = true;
 
cfg80211_ready_on_channel(priv->wdev,
- priv->remain_on_ch_params.u64ListenCookie,
- priv->remain_on_ch_params.pstrListenChan,
- priv->remain_on_ch_params.u32ListenDuration,
+ priv->remain_on_ch_params.listen_cookie,
+ priv->remain_on_ch_params.listen_ch,
+ priv->remain_on_ch_params.listen_duration,
  GFP_KERNEL);
 }
 
@@ -1537,12 +1537,12 @@ static void WILC_WFI_RemainOnChannelExpired(void 
*pUserVoid, u32 u32SessionID)
 
priv = pUserVoid;
 
-   if (u32SessionID == priv->remain_on_ch_params.u32ListenSessionID) {
+   if (u32SessionID == priv->remain_on_ch_params.listen_session_id) {
priv->p2p_listen_state = false;
 
cfg80211_remain_on_channel_expired(priv->wdev,
-  
priv->remain_on_ch_params.u64ListenCookie,
-  
priv->remain_on_ch_params.pstrListenChan,
+  
priv->remain_on_ch_params.listen_cookie,
+  
priv->remain_on_ch_params.listen_ch,
   GFP_KERNEL);
}
 }
@@ -1566,13 +1566,13 @@ static int remain_on_channel(struct wiphy *wiphy,
 
curr_channel = chan->hw_value;
 
-   priv->remain_on_ch_params.pstrListenChan = chan;
-   priv->remain_on_ch_params.u64ListenCookie = *cookie;
-   priv->remain_on_ch_params.u32ListenDuration = duration;
-   priv->remain_on_ch_params.u32ListenSessionID++;
+   priv->remain_on_ch_params.listen_ch = chan;
+   priv->remain_on_ch_params.listen_cookie = *cookie;
+   priv->remain_on_ch_params.listen_duration = duration;
+   priv->remain_on_ch_params.listen_session_id++;
 
return wilc_remain_on_channel(vif,
-   priv->remain_on_ch_params.u32ListenSessionID,
+   priv->remain_on_ch_params.listen_session_id,
duration, chan->hw_value,
WILC_WFI_RemainOnChannelExpired,
WILC_WFI_RemainOnChannelReady, (void *)priv);
@@ -1589,7 +1589,7 @@ static int cancel_remain_on_channel(struct wiphy *wiphy,
vif = netdev_priv(priv->dev);
 
return wilc_listen_state_expired(vif,
-   priv->remain_on_ch_params.u32ListenSessionID);
+   priv->remain_on_ch_params.listen_session_id);
 }
 
 static int mgmt_tx(struct wiphy *wiphy,
@@ -1718,8 +1718,8 @@ static int mgmt_tx_cancel_wait(struct wiphy *wiphy,
 
if (!priv->p2p_listen_state) {
cfg80211_remain_on_channel_expired(priv->wdev,
-  
priv->remain_on_ch_params.u64ListenCookie,
-  
priv->remain_on_ch_params.pstrListenChan,
+  
priv->remain_on_ch_params.listen_cookie,
+  
priv->remain_on_ch_params.listen_ch,
   GFP_KERNEL);
}
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 2046bb9..0a936a4 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -90,19 +90,19 @@ struct sta_info {
 };
 
 /*Parameters needed for host interface for  remaining on channel*/
-struct wilc_wfi_p2pListenParams {
-   struct ieee80211_channel *pstrListenChan;
+struct wilc_wfi_p2p_listen_params {
+   struct ieee80211_channel *listen_ch;
enum nl80211_channel_type tenuChannelType;
-   u32 u32ListenDuration;
-   u64 u64ListenCookie;
-   u32 u32ListenSessionID;
+   u32 listen_duration;
+   u64 listen_cookie;
+   u32 listen_session_id;
 };
 
 struct wilc_priv {
struct wireless_dev *wdev;
struct cfg80211_scan_request 

[PATCH 07/13] staging: wilc1000: rename camelCase used in functions start with WILC_WFI_Cfg

2018-01-16 Thread Ajay Singh
This is cleanup patch, to fix the camelCase issue reported by
checkpatch.pl.
In this patch remane the function starts with "WILC_WFI_Cfg" to avoid
camelCase names.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 34 +++
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 15d7e14..ec079cc 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1346,7 +1346,7 @@ static int flush_pmksa(struct wiphy *wiphy, struct 
net_device *netdev)
return 0;
 }
 
-static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
+static void wilc_wfi_cfg_parse_rx_action(u8 *buf, u32 len)
 {
u32 index = 0;
u32 i = 0, j = 0;
@@ -1382,7 +1382,7 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len)
}
 }
 
-static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 
iftype)
+static void wilc_wfi_cfg_parse_tx_action(u8 *buf, u32 len, bool oper_ch, u8 
iftype)
 {
u32 index = 0;
u32 i = 0, j = 0;
@@ -1403,7 +1403,7 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, 
bool bOperChan, u8 iftyp
op_channel_attr_index = index;
index += buf[index + 1] + 3;
}
-   if (wlan_channel != INVALID_CHANNEL && bOperChan) {
+   if (wlan_channel != INVALID_CHANNEL && oper_ch) {
if (channel_list_attr_index) {
for (i = channel_list_attr_index + 3; i < 
((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) {
if (buf[i] == 0x51) {
@@ -1481,7 +1481,7 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, 
u32 size)
 
buff[P2P_PUB_ACTION_SUBTYPE] == P2P_INV_REQ || buff[P2P_PUB_ACTION_SUBTYPE] == 
P2P_INV_RSP)) {
for (i = 
P2P_PUB_ACTION_SUBTYPE + 2; i < size; i++) {
if 
(buff[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, [i + 2], 4))) {
-   
WILC_WFI_CfgParseRxAction([i + 6], size - (i + 6));
+   
wilc_wfi_cfg_parse_rx_action([i + 6], size - (i + 6));

break;
}
}
@@ -1508,7 +1508,7 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, 
u32 size)
}
 }
 
-static void WILC_WFI_mgmt_tx_complete(void *priv, int status)
+static void wilc_wfi_mgmt_tx_complete(void *priv, int status)
 {
struct p2p_mgmt_data *pv_data = priv;
 
@@ -1516,11 +1516,11 @@ static void WILC_WFI_mgmt_tx_complete(void *priv, int 
status)
kfree(pv_data);
 }
 
-static void WILC_WFI_RemainOnChannelReady(void *pUserVoid)
+static void wilc_wfi_remain_on_channel_ready(void *priv_data)
 {
struct wilc_priv *priv;
 
-   priv = pUserVoid;
+   priv = priv_data;
 
priv->p2p_listen_state = true;
 
@@ -1531,13 +1531,13 @@ static void WILC_WFI_RemainOnChannelReady(void 
*pUserVoid)
  GFP_KERNEL);
 }
 
-static void WILC_WFI_RemainOnChannelExpired(void *pUserVoid, u32 u32SessionID)
+static void wilc_wfi_remain_on_channel_expired(void *data, u32 session_id)
 {
struct wilc_priv *priv;
 
-   priv = pUserVoid;
+   priv = data;
 
-   if (u32SessionID == priv->remain_on_ch_params.listen_session_id) {
+   if (session_id == priv->remain_on_ch_params.listen_session_id) {
priv->p2p_listen_state = false;
 
cfg80211_remain_on_channel_expired(priv->wdev,
@@ -1574,8 +1574,8 @@ static int remain_on_channel(struct wiphy *wiphy,
return wilc_remain_on_channel(vif,
priv->remain_on_ch_params.listen_session_id,
duration, chan->hw_value,
-   WILC_WFI_RemainOnChannelExpired,
-   WILC_WFI_RemainOnChannelReady, (void *)priv);
+   wilc_wfi_remain_on_channel_expired,
+   wilc_wfi_remain_on_channel_ready, (void *)priv);
 }
 
 static int cancel_remain_on_channel(struct wiphy *wiphy,
@@ -1665,9 +1665,9 @@ static int mgmt_tx(struct wiphy *wiphy,
for (i = 
P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) {
if 
(buf[i] == P2PELEM_ATTR_ID && !(memcmp(p2p_oui, [i + 

[PATCH 11/13] staging: wilc1000: rename strStaParams variable to avoid camelCase

2018-01-16 Thread Ajay Singh
This is a cleanup patch to rename strStaParams to sta_params to avoid
camelCase.
Changes fix "Avoid camelCase" issue reported by checkpatch.pl
script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 44 +++
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index b68f46c..81f943d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1959,7 +1959,7 @@ static int add_station(struct wiphy *wiphy, struct 
net_device *dev,
 {
s32 ret = 0;
struct wilc_priv *priv;
-   struct add_sta_param strStaParams = { {0} };
+   struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif;
 
if (!wiphy)
@@ -1969,23 +1969,23 @@ static int add_station(struct wiphy *wiphy, struct 
net_device *dev,
vif = netdev_priv(dev);
 
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
-   memcpy(strStaParams.bssid, mac, ETH_ALEN);
+   memcpy(sta_params.bssid, mac, ETH_ALEN);
memcpy(priv->assoc_stainfo.sta_associated_bss[params->aid], 
mac, ETH_ALEN);
-   strStaParams.aid = params->aid;
-   strStaParams.rates_len = params->supported_rates_len;
-   strStaParams.rates = params->supported_rates;
+   sta_params.aid = params->aid;
+   sta_params.rates_len = params->supported_rates_len;
+   sta_params.rates = params->supported_rates;
 
if (!params->ht_capa) {
-   strStaParams.ht_supported = false;
+   sta_params.ht_supported = false;
} else {
-   strStaParams.ht_supported = true;
-   strStaParams.ht_capa = *params->ht_capa;
+   sta_params.ht_supported = true;
+   sta_params.ht_capa = *params->ht_capa;
}
 
-   strStaParams.flags_mask = params->sta_flags_mask;
-   strStaParams.flags_set = params->sta_flags_set;
+   sta_params.flags_mask = params->sta_flags_mask;
+   sta_params.flags_set = params->sta_flags_set;
 
-   ret = wilc_add_station(vif, );
+   ret = wilc_add_station(vif, _params);
if (ret)
netdev_err(dev, "Host add station fail\n");
}
@@ -2025,7 +2025,7 @@ static int change_station(struct wiphy *wiphy, struct 
net_device *dev,
 {
s32 ret = 0;
struct wilc_priv *priv;
-   struct add_sta_param strStaParams = { {0} };
+   struct add_sta_param sta_params = { {0} };
struct wilc_vif *vif;
 
if (!wiphy)
@@ -2035,22 +2035,22 @@ static int change_station(struct wiphy *wiphy, struct 
net_device *dev,
vif = netdev_priv(dev);
 
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
-   memcpy(strStaParams.bssid, mac, ETH_ALEN);
-   strStaParams.aid = params->aid;
-   strStaParams.rates_len = params->supported_rates_len;
-   strStaParams.rates = params->supported_rates;
+   memcpy(sta_params.bssid, mac, ETH_ALEN);
+   sta_params.aid = params->aid;
+   sta_params.rates_len = params->supported_rates_len;
+   sta_params.rates = params->supported_rates;
 
if (!params->ht_capa) {
-   strStaParams.ht_supported = false;
+   sta_params.ht_supported = false;
} else {
-   strStaParams.ht_supported = true;
-   strStaParams.ht_capa = *params->ht_capa;
+   sta_params.ht_supported = true;
+   sta_params.ht_capa = *params->ht_capa;
}
 
-   strStaParams.flags_mask = params->sta_flags_mask;
-   strStaParams.flags_set = params->sta_flags_set;
+   sta_params.flags_mask = params->sta_flags_mask;
+   sta_params.flags_set = params->sta_flags_set;
 
-   ret = wilc_edit_station(vif, );
+   ret = wilc_edit_station(vif, _params);
if (ret)
netdev_err(dev, "Host edit station fail\n");
}
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 13/13] staging: wilc1000: rename strStatistics & tenuAuth_type to avoid camelCase

2018-01-16 Thread Ajay Singh
This is a cleanup patch to avoid using camelCase for variable names.
Changes fix "Avoid camelCase" issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 30 +++
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0570b2d..47c7e2e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -653,7 +653,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
u32 i;
u32 sel_bssi_idx = UINT_MAX;
u8 u8security = NO_ENCRYPT;
-   enum AUTHTYPE tenuAuth_type = ANY;
+   enum AUTHTYPE auth_type = ANY;
 
struct wilc_priv *priv;
struct host_if_drv *wfi_drv;
@@ -763,11 +763,11 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
 
switch (sme->auth_type) {
case NL80211_AUTHTYPE_OPEN_SYSTEM:
-   tenuAuth_type = OPEN_SYSTEM;
+   auth_type = OPEN_SYSTEM;
break;
 
case NL80211_AUTHTYPE_SHARED_KEY:
-   tenuAuth_type = SHARED_KEY;
+   auth_type = SHARED_KEY;
break;
 
default:
@@ -777,7 +777,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
if (sme->crypto.n_akm_suites) {
switch (sme->crypto.akm_suites[0]) {
case WLAN_AKM_SUITE_8021X:
-   tenuAuth_type = IEEE8021;
+   auth_type = IEEE8021;
break;
 
default:
@@ -795,7 +795,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
ret = wilc_set_join_req(vif, pstrNetworkInfo->bssid, sme->ssid,
 sme->ssid_len, sme->ie, sme->ie_len,
 cfg_connect_result, (void *)priv,
-u8security, tenuAuth_type,
+u8security, auth_type,
 pstrNetworkInfo->ch,
 pstrNetworkInfo->join_params);
if (ret != 0) {
@@ -1200,9 +1200,9 @@ static int get_station(struct wiphy *wiphy, struct 
net_device *dev,
}
 
if (vif->iftype == STATION_MODE) {
-   struct rf_info strStatistics;
+   struct rf_info stats;
 
-   wilc_get_statistics(vif, );
+   wilc_get_statistics(vif, );
 
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |

BIT(NL80211_STA_INFO_RX_PACKETS) |
@@ -1210,16 +1210,16 @@ static int get_station(struct wiphy *wiphy, struct 
net_device *dev,
BIT(NL80211_STA_INFO_TX_FAILED) 
|

BIT(NL80211_STA_INFO_TX_BITRATE);
 
-   sinfo->signal = strStatistics.rssi;
-   sinfo->rx_packets = strStatistics.rx_cnt;
-   sinfo->tx_packets = strStatistics.tx_cnt + 
strStatistics.tx_fail_cnt;
-   sinfo->tx_failed = strStatistics.tx_fail_cnt;
-   sinfo->txrate.legacy = strStatistics.link_speed * 10;
+   sinfo->signal = stats.rssi;
+   sinfo->rx_packets = stats.rx_cnt;
+   sinfo->tx_packets = stats.tx_cnt + stats.tx_fail_cnt;
+   sinfo->tx_failed = stats.tx_fail_cnt;
+   sinfo->txrate.legacy = stats.link_speed * 10;
 
-   if ((strStatistics.link_speed > 
TCP_ACK_FILTER_LINK_SPEED_THRESH) &&
-   (strStatistics.link_speed != DEFAULT_LINK_SPEED))
+   if ((stats.link_speed > TCP_ACK_FILTER_LINK_SPEED_THRESH) &&
+   (stats.link_speed != DEFAULT_LINK_SPEED))
wilc_enable_tcp_ack_filter(true);
-   else if (strStatistics.link_speed != DEFAULT_LINK_SPEED)
+   else if (stats.link_speed != DEFAULT_LINK_SPEED)
wilc_enable_tcp_ack_filter(false);
}
return 0;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/13] staging: wilc1000: rename pstrWFIDrv to wfi_drv to avoid camelCase naming

2018-01-16 Thread Ajay Singh
This is cleanup patch, it fixes "Avoid CamelCase: "
issue found by checkpatch.pl

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 36 +++
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ec079cc..1c5782e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -656,19 +656,19 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
enum AUTHTYPE tenuAuth_type = ANY;
 
struct wilc_priv *priv;
-   struct host_if_drv *pstrWFIDrv;
+   struct host_if_drv *wfi_drv;
struct network_info *pstrNetworkInfo = NULL;
struct wilc_vif *vif;
 
wilc_connecting = 1;
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
-   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
+   wfi_drv = (struct host_if_drv *)priv->hif_drv;
 
if (!(strncmp(sme->ssid, "DIRECT-", 7)))
-   pstrWFIDrv->p2p_connect = 1;
+   wfi_drv->p2p_connect = 1;
else
-   pstrWFIDrv->p2p_connect = 0;
+   wfi_drv->p2p_connect = 0;
 
for (i = 0; i < last_scanned_cnt; i++) {
if ((sme->ssid_len == last_scanned_shadow[i].ssid_len) &&
@@ -787,7 +787,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
 
curr_channel = pstrNetworkInfo->ch;
 
-   if (!pstrWFIDrv->p2p_connect)
+   if (!wfi_drv->p2p_connect)
wlan_channel = pstrNetworkInfo->ch;
 
wilc_wlan_set_bssid(dev, pstrNetworkInfo->bssid, STATION_MODE);
@@ -812,7 +812,7 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
 {
s32 ret = 0;
struct wilc_priv *priv;
-   struct host_if_drv *pstrWFIDrv;
+   struct host_if_drv *wfi_drv;
struct wilc_vif *vif;
struct wilc *wilc;
u8 NullBssid[ETH_ALEN] = {0};
@@ -831,15 +831,15 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
return 0;
}
 
-   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
-   if (!pstrWFIDrv->p2p_connect)
+   wfi_drv = (struct host_if_drv *)priv->hif_drv;
+   if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
wilc_wlan_set_bssid(priv->dev, NullBssid, STATION_MODE);
 
p2p_local_random = 0x01;
p2p_recv_random = 0x00;
wilc_ie = false;
-   pstrWFIDrv->p2p_timeout = 0;
+   wfi_drv->p2p_timeout = 0;
 
ret = wilc_disconnect(vif, reason_code);
if (ret != 0) {
@@ -1425,12 +1425,12 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, 
u32 size)
 {
struct wilc_priv *priv;
u32 header, pkt_offset;
-   struct host_if_drv *pstrWFIDrv;
+   struct host_if_drv *wfi_drv;
u32 i = 0;
s32 s32Freq;
 
priv = wiphy_priv(dev->ieee80211_ptr->wiphy);
-   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
+   wfi_drv = (struct host_if_drv *)priv->hif_drv;
 
memcpy(, (buff - HOST_HDR_OFFSET), HOST_HDR_OFFSET);
 
@@ -1451,7 +1451,7 @@ void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, 
u32 size)
s32Freq = ieee80211_channel_to_frequency(curr_channel, 
NL80211_BAND_2GHZ);
 
if (ieee80211_is_action(buff[FRAME_TYPE_ID])) {
-   if (priv->cfg_scanning && time_after_eq(jiffies, 
(unsigned long)pstrWFIDrv->p2p_timeout)) {
+   if (priv->cfg_scanning && time_after_eq(jiffies, 
(unsigned long)wfi_drv->p2p_timeout)) {
netdev_dbg(dev, "Receiving action wrong ch\n");
return;
}
@@ -1604,14 +1604,14 @@ static int mgmt_tx(struct wiphy *wiphy,
const struct ieee80211_mgmt *mgmt;
struct p2p_mgmt_data *mgmt_tx;
struct wilc_priv *priv;
-   struct host_if_drv *pstrWFIDrv;
+   struct host_if_drv *wfi_drv;
u32 i;
struct wilc_vif *vif;
u32 buf_len = len + sizeof(p2p_vendor_spec) + sizeof(p2p_local_random);
 
vif = netdev_priv(wdev->netdev);
priv = wiphy_priv(wiphy);
-   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
+   wfi_drv = (struct host_if_drv *)priv->hif_drv;
 
*cookie = (unsigned long)buf;
priv->tx_cookie = *cookie;
@@ -1695,7 +1695,7 @@ static int mgmt_tx(struct wiphy *wiphy,
}
}
 
-   pstrWFIDrv->p2p_timeout = (jiffies + 
msecs_to_jiffies(wait));
+   wfi_drv->p2p_timeout = (jiffies + 
msecs_to_jiffies(wait));
}
 
wilc_wlan_txq_add_mgmt_pkt(wdev->netdev, mgmt_tx,
@@ -1710,11 +1710,11 @@ static int mgmt_tx_cancel_wait(struct wiphy 

[PATCH 10/13] staging: wilc1000: rename variables using camelCase in add_key()

2018-01-16 Thread Ajay Singh
This is a cleanup patch to avoid using camelCase for variable
names.
Changes fix "Avoid camelCase" issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 56 +++
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ae8df88..b68f46c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -855,14 +855,14 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
   const u8 *mac_addr, struct key_params *params)
 
 {
-   s32 ret = 0, KeyLen = params->key_len;
+   s32 ret = 0, keylen = params->key_len;
struct wilc_priv *priv;
-   const u8 *pu8RxMic = NULL;
-   const u8 *pu8TxMic = NULL;
+   const u8 *rx_mic = NULL;
+   const u8 *tx_mic = NULL;
u8 u8mode = NO_ENCRYPT;
u8 u8gmode = NO_ENCRYPT;
u8 u8pmode = NO_ENCRYPT;
-   enum AUTHTYPE tenuAuth_type = ANY;
+   enum AUTHTYPE auth_type = ANY;
struct wilc *wl;
struct wilc_vif *vif;
 
@@ -877,7 +877,7 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
priv->WILC_WFI_wep_key_len[key_index] = params->key_len;
memcpy(priv->WILC_WFI_wep_key[key_index], params->key, 
params->key_len);
 
-   tenuAuth_type = OPEN_SYSTEM;
+   auth_type = OPEN_SYSTEM;
 
if (params->cipher == WLAN_CIPHER_SUITE_WEP40)
u8mode = ENCRYPT_ENABLED | WEP;
@@ -886,7 +886,7 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
 
wilc_add_wep_key_bss_ap(vif, params->key,
params->key_len, key_index,
-   u8mode, tenuAuth_type);
+   u8mode, auth_type);
break;
}
if (memcmp(params->key, priv->WILC_WFI_wep_key[key_index], 
params->key_len)) {
@@ -922,9 +922,9 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
priv->wilc_groupkey = u8gmode;
 
if (params->key_len > 16 && params->cipher == 
WLAN_CIPHER_SUITE_TKIP) {
-   pu8TxMic = params->key + 24;
-   pu8RxMic = params->key + 16;
-   KeyLen = params->key_len - 16;
+   tx_mic = params->key + 24;
+   rx_mic = params->key + 16;
+   keylen = params->key_len - 16;
}
kfree(priv->wilc_gtk[key_index]->key);
 
@@ -941,10 +941,10 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
priv->wilc_gtk[key_index]->key_len = 
params->key_len;
priv->wilc_gtk[key_index]->seq_len = 
params->seq_len;
 
-   wilc_add_rx_gtk(vif, params->key, KeyLen,
+   wilc_add_rx_gtk(vif, params->key, keylen,
key_index, params->seq_len,
-   params->seq, pu8RxMic,
-   pu8TxMic, AP_MODE, u8gmode);
+   params->seq, rx_mic,
+   tx_mic, AP_MODE, u8gmode);
 
} else {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
@@ -953,9 +953,9 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
u8pmode = priv->wilc_groupkey | AES;
 
if (params->key_len > 16 && params->cipher == 
WLAN_CIPHER_SUITE_TKIP) {
-   pu8TxMic = params->key + 24;
-   pu8RxMic = params->key + 16;
-   KeyLen = params->key_len - 16;
+   tx_mic = params->key + 24;
+   rx_mic = params->key + 16;
+   keylen = params->key_len - 16;
}
 
kfree(priv->wilc_ptk[key_index]->key);
@@ -976,8 +976,8 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
priv->wilc_ptk[key_index]->key_len = 

[PATCH 12/13] staging: wilc1000: rename pstrCfgParamVal varaible in set_wiphy_params()

2018-01-16 Thread Ajay Singh
This is a cleanup patch to fix camelCase issue found by checkpatch.pl
script.
In this patch, renamed pstrCfgParamVal to cfg_param_val to avoid
camelCase for variable name.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 81f943d..0570b2d 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1234,34 +1234,34 @@ static int change_bss(struct wiphy *wiphy, struct 
net_device *dev,
 static int set_wiphy_params(struct wiphy *wiphy, u32 changed)
 {
s32 ret = 0;
-   struct cfg_param_attr pstrCfgParamVal;
+   struct cfg_param_attr cfg_param_val;
struct wilc_priv *priv;
struct wilc_vif *vif;
 
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
 
-   pstrCfgParamVal.flag = 0;
+   cfg_param_val.flag = 0;
 
if (changed & WIPHY_PARAM_RETRY_SHORT) {
-   pstrCfgParamVal.flag  |= RETRY_SHORT;
-   pstrCfgParamVal.short_retry_limit = 
priv->dev->ieee80211_ptr->wiphy->retry_short;
+   cfg_param_val.flag  |= RETRY_SHORT;
+   cfg_param_val.short_retry_limit = 
priv->dev->ieee80211_ptr->wiphy->retry_short;
}
if (changed & WIPHY_PARAM_RETRY_LONG) {
-   pstrCfgParamVal.flag |= RETRY_LONG;
-   pstrCfgParamVal.long_retry_limit = 
priv->dev->ieee80211_ptr->wiphy->retry_long;
+   cfg_param_val.flag |= RETRY_LONG;
+   cfg_param_val.long_retry_limit = 
priv->dev->ieee80211_ptr->wiphy->retry_long;
}
if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
-   pstrCfgParamVal.flag |= FRAG_THRESHOLD;
-   pstrCfgParamVal.frag_threshold = 
priv->dev->ieee80211_ptr->wiphy->frag_threshold;
+   cfg_param_val.flag |= FRAG_THRESHOLD;
+   cfg_param_val.frag_threshold = 
priv->dev->ieee80211_ptr->wiphy->frag_threshold;
}
 
if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
-   pstrCfgParamVal.flag |= RTS_THRESHOLD;
-   pstrCfgParamVal.rts_threshold = 
priv->dev->ieee80211_ptr->wiphy->rts_threshold;
+   cfg_param_val.flag |= RTS_THRESHOLD;
+   cfg_param_val.rts_threshold = 
priv->dev->ieee80211_ptr->wiphy->rts_threshold;
}
 
-   ret = wilc_hif_set_cfg(vif, );
+   ret = wilc_hif_set_cfg(vif, _param_val);
if (ret)
netdev_err(priv->dev, "Error in setting WIPHY PARAMS\n");
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/13] staging: wilc1000: remove unused element in wilc_wfi_p2p_listen_params struct

2018-01-16 Thread Ajay Singh
This is cleanup patch, to remove the unused "tenuChannelType" element
from wilc_wfi_p2p_listen_params structure.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index a4c193e..3337fb2 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -92,7 +92,6 @@ struct sta_info {
 /*Parameters needed for host interface for  remaining on channel*/
 struct wilc_wfi_p2p_listen_params {
struct ieee80211_channel *listen_ch;
-   enum nl80211_channel_type tenuChannelType;
u32 listen_duration;
u64 listen_cookie;
u32 listen_session_id;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/13] staging: wilc1000: rename s32Error variable to avoid camelCase notation

2018-01-16 Thread Ajay Singh
This is cleanup patch, rename "s32Error" to fix
"Avoid CamelCase: " found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 138 +++---
 1 file changed, 69 insertions(+), 69 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 7dfb230..2ca703c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -585,7 +585,7 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
 {
struct wilc_priv *priv;
u32 i;
-   s32 s32Error = 0;
+   s32 ret = 0;
u8 au8ScanChanList[MAX_NUM_SCANNED_NETWORKS];
struct hidden_network strHiddenNetwork;
struct wilc_vif *vif;
@@ -622,14 +622,14 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
strHiddenNetwork.n_ssids -= 1;
}
}
-   s32Error = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
+   ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
 au8ScanChanList,
 request->n_channels,
 (const u8 *)request->ie,
 request->ie_len, CfgScanResult,
 (void *)priv, );
} else {
-   s32Error = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
+   ret = wilc_scan(vif, USER_SCAN, ACTIVE_SCAN,
 au8ScanChanList,
 request->n_channels,
 (const u8 *)request->ie,
@@ -640,16 +640,16 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
netdev_err(priv->dev, "Requested scanned channels over\n");
}
 
-   if (s32Error != 0)
-   s32Error = -EBUSY;
+   if (ret != 0)
+   ret = -EBUSY;
 
-   return s32Error;
+   return ret;
 }
 
 static int connect(struct wiphy *wiphy, struct net_device *dev,
   struct cfg80211_connect_params *sme)
 {
-   s32 s32Error = 0;
+   s32 ret = 0;
u32 i;
u32 sel_bssi_idx = UINT_MAX;
u8 u8security = NO_ENCRYPT;
@@ -694,9 +694,9 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
if (sel_bssi_idx < last_scanned_cnt) {
pstrNetworkInfo = _scanned_shadow[sel_bssi_idx];
} else {
-   s32Error = -ENOENT;
+   ret = -ENOENT;
wilc_connecting = 0;
-   return s32Error;
+   return ret;
}
 
memset(priv->WILC_WFI_wep_key, 0, sizeof(priv->WILC_WFI_wep_key));
@@ -744,10 +744,10 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
else
u8security = ENCRYPT_ENABLED | WPA | AES;
} else {
-   s32Error = -ENOTSUPP;
+   ret = -ENOTSUPP;
netdev_err(dev, "Not supported cipher\n");
wilc_connecting = 0;
-   return s32Error;
+   return ret;
}
}
 
@@ -792,25 +792,25 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
 
wilc_wlan_set_bssid(dev, pstrNetworkInfo->bssid, STATION_MODE);
 
-   s32Error = wilc_set_join_req(vif, pstrNetworkInfo->bssid, sme->ssid,
+   ret = wilc_set_join_req(vif, pstrNetworkInfo->bssid, sme->ssid,
 sme->ssid_len, sme->ie, sme->ie_len,
 CfgConnectResult, (void *)priv,
 u8security, tenuAuth_type,
 pstrNetworkInfo->ch,
 pstrNetworkInfo->join_params);
-   if (s32Error != 0) {
+   if (ret != 0) {
netdev_err(dev, "wilc_set_join_req(): Error\n");
-   s32Error = -ENOENT;
+   ret = -ENOENT;
wilc_connecting = 0;
-   return s32Error;
+   return ret;
}
 
-   return s32Error;
+   return ret;
 }
 
 static int disconnect(struct wiphy *wiphy, struct net_device *dev, u16 
reason_code)
 {
-   s32 s32Error = 0;
+   s32 ret = 0;
struct wilc_priv *priv;
struct host_if_drv *pstrWFIDrv;
struct wilc_vif *vif;
@@ -841,13 +841,13 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
wilc_ie = false;
pstrWFIDrv->p2p_timeout = 0;
 
-   s32Error = wilc_disconnect(vif, reason_code);

[PATCH 06/13] staging: wilc1000: rename CfgConnectResult() and its local variable names

2018-01-16 Thread Ajay Singh
This is cleanup patch,to avoid use of camelCase for variable name
and function names in CfgConnectResult().

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 74 +++
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 2ca703c..15d7e14 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -469,92 +469,92 @@ static void CfgScanResult(enum scan_event scan_event,
 
 int wilc_connecting;
 
-static void CfgConnectResult(enum conn_event enuConnDisconnEvent,
-struct connect_info *pstrConnectInfo,
-u8 u8MacStatus,
-struct disconnect_info *pstrDisconnectNotifInfo,
-void *pUserVoid)
+static void cfg_connect_result(enum conn_event conn_disconn_evt,
+struct connect_info *conn_info,
+u8 mac_status,
+struct disconnect_info *disconn_info,
+void *priv_data)
 {
struct wilc_priv *priv;
struct net_device *dev;
-   struct host_if_drv *pstrWFIDrv;
-   u8 NullBssid[ETH_ALEN] = {0};
+   struct host_if_drv *wfi_drv;
+   u8 null_bssid[ETH_ALEN] = {0};
struct wilc *wl;
struct wilc_vif *vif;
 
wilc_connecting = 0;
 
-   priv = pUserVoid;
+   priv = priv_data;
dev = priv->dev;
vif = netdev_priv(dev);
wl = vif->wilc;
-   pstrWFIDrv = (struct host_if_drv *)priv->hif_drv;
+   wfi_drv = (struct host_if_drv *)priv->hif_drv;
 
-   if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
-   u16 u16ConnectStatus;
+   if (conn_disconn_evt == CONN_DISCONN_EVENT_CONN_RESP) {
+   u16 connect_status;
 
-   u16ConnectStatus = pstrConnectInfo->status;
+   connect_status = conn_info->status;
 
-   if ((u8MacStatus == MAC_DISCONNECTED) &&
-   (pstrConnectInfo->status == SUCCESSFUL_STATUSCODE)) {
-   u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE;
-   wilc_wlan_set_bssid(priv->dev, NullBssid,
+   if ((mac_status == MAC_DISCONNECTED) &&
+   (conn_info->status == SUCCESSFUL_STATUSCODE)) {
+   connect_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
+   wilc_wlan_set_bssid(priv->dev, null_bssid,
STATION_MODE);
eth_zero_addr(wilc_connected_ssid);
 
-   if (!pstrWFIDrv->p2p_connect)
+   if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
 
netdev_err(dev, "Unspecified failure\n");
}
 
-   if (u16ConnectStatus == WLAN_STATUS_SUCCESS) {
-   bool bNeedScanRefresh = false;
+   if (connect_status == WLAN_STATUS_SUCCESS) {
+   bool scan_refresh = false;
u32 i;
 
-   memcpy(priv->associated_bss, pstrConnectInfo->bssid, 
ETH_ALEN);
+   memcpy(priv->associated_bss, conn_info->bssid, 
ETH_ALEN);
 
for (i = 0; i < last_scanned_cnt; i++) {
if (memcmp(last_scanned_shadow[i].bssid,
-  pstrConnectInfo->bssid,
+  conn_info->bssid,
   ETH_ALEN) == 0) {
unsigned long now = jiffies;
 
if (time_after(now,
   
last_scanned_shadow[i].time_scan_cached +
   (unsigned 
long)(nl80211_SCAN_RESULT_EXPIRE - (1 * HZ
-   bNeedScanRefresh = true;
+   scan_refresh = true;
 
break;
}
}
 
-   if (bNeedScanRefresh)
+   if (scan_refresh)
refresh_scan(priv, true);
}
 
-   cfg80211_connect_result(dev, pstrConnectInfo->bssid,
-   pstrConnectInfo->req_ies, 
pstrConnectInfo->req_ies_len,
-   pstrConnectInfo->resp_ies, 
pstrConnectInfo->resp_ies_len,
-   u16ConnectStatus, GFP_KERNEL);
-   } else if (enuConnDisconnEvent == CONN_DISCONN_EVENT_DISCONN_NOTIF){
+   

[PATCH 09/13] staging: wilc1000: rename NullBssid to null_bssid to avoid camelCase variable name

2018-01-16 Thread Ajay Singh
This is cleanup patch, it fixes "Avoid CamelCase: " found
by checkpatch.pl.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1c5782e..ae8df88 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -815,7 +815,7 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
struct host_if_drv *wfi_drv;
struct wilc_vif *vif;
struct wilc *wilc;
-   u8 NullBssid[ETH_ALEN] = {0};
+   u8 null_bssid[ETH_ALEN] = {0};
 
wilc_connecting = 0;
priv = wiphy_priv(wiphy);
@@ -834,7 +834,7 @@ static int disconnect(struct wiphy *wiphy, struct 
net_device *dev, u16 reason_co
wfi_drv = (struct host_if_drv *)priv->hif_drv;
if (!wfi_drv->p2p_connect)
wlan_channel = INVALID_CHANNEL;
-   wilc_wlan_set_bssid(priv->dev, NullBssid, STATION_MODE);
+   wilc_wlan_set_bssid(priv->dev, null_bssid, STATION_MODE);
 
p2p_local_random = 0x01;
p2p_recv_random = 0x00;
@@ -1936,7 +1936,7 @@ static int stop_ap(struct wiphy *wiphy, struct net_device 
*dev)
s32 ret = 0;
struct wilc_priv *priv;
struct wilc_vif *vif;
-   u8 NullBssid[ETH_ALEN] = {0};
+   u8 null_bssid[ETH_ALEN] = {0};
 
if (!wiphy)
return -EFAULT;
@@ -1944,7 +1944,7 @@ static int stop_ap(struct wiphy *wiphy, struct net_device 
*dev)
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
 
-   wilc_wlan_set_bssid(dev, NullBssid, AP_MODE);
+   wilc_wlan_set_bssid(dev, null_bssid, AP_MODE);
 
ret = wilc_del_beacon(vif);
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/13] staging: wilc1000: rename au8Sta_AssociatedBss element sta_info structure

2018-01-16 Thread Ajay Singh
This is a cleanup patch, to rename au8Sta_AssociatedBss element of
sta_info structure.
The changes fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index d6ff989..7dfb230 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1182,7 +1182,7 @@ static int get_station(struct wiphy *wiphy, struct 
net_device *dev,
 
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
for (i = 0; i < NUM_STA_ASSOCIATED; i++) {
-   if (!(memcmp(mac, 
priv->assoc_stainfo.au8Sta_AssociatedBss[i], ETH_ALEN))) {
+   if (!(memcmp(mac, 
priv->assoc_stainfo.sta_associated_bss[i], ETH_ALEN))) {
associatedsta = i;
break;
}
@@ -1837,7 +1837,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
vif->iftype = STATION_MODE;
wilc_set_operation_mode(vif, STATION_MODE);
 
-   memset(priv->assoc_stainfo.au8Sta_AssociatedBss, 0, MAX_NUM_STA 
* ETH_ALEN);
+   memset(priv->assoc_stainfo.sta_associated_bss, 0, MAX_NUM_STA * 
ETH_ALEN);
 
wilc_enable_ps = true;
wilc_set_power_mgmt(vif, 1, 0);
@@ -1970,7 +1970,7 @@ static int add_station(struct wiphy *wiphy, struct 
net_device *dev,
 
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
memcpy(strStaParams.bssid, mac, ETH_ALEN);
-   memcpy(priv->assoc_stainfo.au8Sta_AssociatedBss[params->aid], 
mac, ETH_ALEN);
+   memcpy(priv->assoc_stainfo.sta_associated_bss[params->aid], 
mac, ETH_ALEN);
strStaParams.aid = params->aid;
strStaParams.rates_len = params->supported_rates_len;
strStaParams.rates = params->supported_rates;
@@ -2010,7 +2010,7 @@ static int del_station(struct wiphy *wiphy, struct 
net_device *dev,
if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
if (!mac)
s32Error = wilc_del_allstation(vif,
-priv->assoc_stainfo.au8Sta_AssociatedBss);
+priv->assoc_stainfo.sta_associated_bss);
 
s32Error = wilc_del_station(vif, mac);
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 0a936a4..a4c193e 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -86,7 +86,7 @@ struct wilc_wfi_wep_key {
 };
 
 struct sta_info {
-   u8 au8Sta_AssociatedBss[MAX_NUM_STA][ETH_ALEN];
+   u8 sta_associated_bss[MAX_NUM_STA][ETH_ALEN];
 };
 
 /*Parameters needed for host interface for  remaining on channel*/
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/13] Changes to avoid CamelCase and removed unused variable

2018-01-16 Thread Ajay Singh
This patch series contains changes to avoid use of CamelCase for variable names.
Also removed the unused variable in wilc_wfi_p2p_listen_params struct.

Ajay Singh (13):
  staging: wilc1000: rename elements of wilc_priv struct to avoid using
camelCase
  staging: wilc1000: rename wilc_wfi_p2pListenParams struct and its
member variable
  staging: wilc1000: rename au8Sta_AssociatedBss element sta_info
structure
  staging: wilc1000: remove unused element in wilc_wfi_p2p_listen_params
struct
  staging: wilc1000: rename s32Error variable to avoid camelCase
notation
  staging: wilc1000: rename CfgConnectResult() and its local variable
names
  staging: wilc1000: rename camelCase used in functions start with
WILC_WFI_Cfg
  staging: wilc1000: rename pstrWFIDrv to wfi_drv to avoid camelCase
naming
  staging: wilc1000: rename NullBssid to null_bssid to avoid camelCase
variable name
  staging: wilc1000: rename variables using camelCase in add_key()
  staging: wilc1000: rename strStaParams variable to avoid camelCase
  staging: wilc1000: rename pstrCfgParamVal varaible in
set_wiphy_params()
  staging: wilc1000: rename strStatistics & tenuAuth_type to avoid
camelCase

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 526 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  29 +-
 2 files changed, 277 insertions(+), 278 deletions(-)

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/13] staging: wilc1000: rename elements of wilc_priv struct to avoid using camelCase

2018-01-16 Thread Ajay Singh
This is cleanup patch, to avoid the use of camelCase for "wilc_priv"
structure member variables.
The changes fix the camelCase issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 90 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h | 16 ++--
 2 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 028da1d..175c64f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -379,7 +379,7 @@ static void CfgScanResult(enum scan_event scan_event,
struct cfg80211_bss *bss = NULL;
 
priv = user_void;
-   if (priv->bCfgScanning) {
+   if (priv->cfg_scanning) {
if (scan_event == SCAN_EVENT_NETWORK_FOUND) {
wiphy = priv->dev->ieee80211_ptr->wiphy;
 
@@ -399,8 +399,8 @@ static void CfgScanResult(enum scan_event scan_event,
return;
 
if (network_info->new_network) {
-   if (priv->u32RcvdChCount < 
MAX_NUM_SCANNED_NETWORKS) {
-   priv->u32RcvdChCount++;
+   if (priv->rcvd_ch_cnt < 
MAX_NUM_SCANNED_NETWORKS) {
+   priv->rcvd_ch_cnt++;
 

add_network_to_shadow(network_info, priv, join_params);
 
@@ -422,7 +422,7 @@ static void CfgScanResult(enum scan_event scan_event,
} else {
u32 i;
 
-   for (i = 0; i < priv->u32RcvdChCount; 
i++) {
+   for (i = 0; i < priv->rcvd_ch_cnt; i++) 
{
if 
(memcmp(last_scanned_shadow[i].bssid, network_info->bssid, 6) == 0) {

last_scanned_shadow[i].rssi = network_info->rssi;

last_scanned_shadow[i].time_scan = jiffies;
@@ -436,21 +436,21 @@ static void CfgScanResult(enum scan_event scan_event,
 
mutex_lock(>scan_req_lock);
 
-   if (priv->pstrScanReq) {
+   if (priv->scan_req) {
struct cfg80211_scan_info info = {
.aborted = false,
};
 
-   cfg80211_scan_done(priv->pstrScanReq, );
-   priv->u32RcvdChCount = 0;
-   priv->bCfgScanning = false;
-   priv->pstrScanReq = NULL;
+   cfg80211_scan_done(priv->scan_req, );
+   priv->rcvd_ch_cnt = 0;
+   priv->cfg_scanning = false;
+   priv->scan_req = NULL;
}
mutex_unlock(>scan_req_lock);
} else if (scan_event == SCAN_EVENT_ABORTED) {
mutex_lock(>scan_req_lock);
 
-   if (priv->pstrScanReq) {
+   if (priv->scan_req) {
struct cfg80211_scan_info info = {
.aborted = false,
};
@@ -458,9 +458,9 @@ static void CfgScanResult(enum scan_event scan_event,
update_scan_time();
refresh_scan(priv, false);
 
-   cfg80211_scan_done(priv->pstrScanReq, );
-   priv->bCfgScanning = false;
-   priv->pstrScanReq = NULL;
+   cfg80211_scan_done(priv->scan_req, );
+   priv->cfg_scanning = false;
+   priv->scan_req = NULL;
}
mutex_unlock(>scan_req_lock);
}
@@ -512,7 +512,7 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
bool bNeedScanRefresh = false;
u32 i;
 
-   memcpy(priv->au8AssociatedBss, pstrConnectInfo->bssid, 
ETH_ALEN);
+   memcpy(priv->associated_bss, pstrConnectInfo->bssid, 
ETH_ALEN);
 
for (i = 0; i < last_scanned_cnt; i++) {
if (memcmp(last_scanned_shadow[i].bssid,
@@ -542,7 +542,7 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
p2p_local_random = 0x01;
p2p_recv_random = 0x00;
wilc_ie = false;
-  

[PATCH 0/8] staging: fsl-mc: Cleanup

2018-01-16 Thread Bogdan Purcareata
The patchset aims to address most of the feedback gathered at the latest
attempt to move it out of staging. You can find the discussion here [1].

Patches 1-2 remove unused code and consolidate the fsl-mc core bus
infrastructure header files into fsl-mc-private.h.

Patch 3 removes full license text and adds SPDX tags to files under
staging/fsl-mc.

Patches 4-6 cleanup the fsl-mc msi/irq code, updating the initialization
routine and removing code that's no longer needed.

Patches 7-8 cleanup the fsl-mc bus documentation and convert it to be
compatible with the kernel documentation build process (.rst).

[1] https://patchwork.kernel.org/patch/10081731/

Bogdan Purcareata (3):
  staging: fsl-mc: Cleanup dprc and dpmcp header files
  staging: fsl-mc: Consolidate bus core header files
  staging: fsl-mc: Add SPDX license identifiers

Ioana Radulescu (5):
  staging: fsl-mc: Remove dead code
  staging: fsl-mc: Remove unnecessary dependency
  staging: fsl-mc: Update include header
  staging: fsl-mc: README cleanup
  staging: fsl-mc: Convert documentation to rst format

 drivers/staging/fsl-mc/Kconfig |   1 +
 drivers/staging/fsl-mc/Makefile|   1 +
 drivers/staging/fsl-mc/README.txt  | 386 --
 drivers/staging/fsl-mc/bus/Kconfig |   3 +-
 drivers/staging/fsl-mc/bus/Makefile|   3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  |  29 +-
 drivers/staging/fsl-mc/bus/dpbp.c  |  29 +-
 drivers/staging/fsl-mc/bus/dpcon-cmd.h |  29 +-
 drivers/staging/fsl-mc/bus/dpcon.c |  33 +-
 drivers/staging/fsl-mc/bus/dpio/Makefile   |   1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h |  30 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  |  29 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c |  29 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c |  30 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.h |  30 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c |  29 +-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h |  29 +-
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |  56 ---
 drivers/staging/fsl-mc/bus/dpmcp.c |  64 +--
 drivers/staging/fsl-mc/bus/dpmcp.h |  60 ---
 drivers/staging/fsl-mc/bus/dpmng-cmd.h |  58 ---
 drivers/staging/fsl-mc/bus/dprc-cmd.h  | 451 -
 drivers/staging/fsl-mc/bus/dprc-driver.c   |   6 +-
 drivers/staging/fsl-mc/bus/dprc.c  | 257 +---
 drivers/staging/fsl-mc/bus/dprc.h  | 268 
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  10 +-
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  14 +-
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|   5 +-
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 380 -
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  26 +-
 drivers/staging/fsl-mc/bus/mc-io.c |  31 +-
 drivers/staging/fsl-mc/bus/mc-sys.c|  31 +-
 drivers/staging/fsl-mc/include/dpaa2-fd.h  |  29 +-
 drivers/staging/fsl-mc/include/dpaa2-global.h  |  29 +-
 drivers/staging/fsl-mc/include/dpaa2-io.h  |  29 +-
 drivers/staging/fsl-mc/include/dpbp.h  |  30 +-
 drivers/staging/fsl-mc/include/dpcon.h |  33 +-
 drivers/staging/fsl-mc/include/mc.h|   5 +-
 drivers/staging/fsl-mc/overview.rst| 404 ++
 39 files changed, 840 insertions(+), 2157 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/README.txt
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmng-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.h
 create mode 100644 drivers/staging/fsl-mc/overview.rst

-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 8/8] staging: fsl-mc: Convert documentation to rst format

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Update the doc file to comply with the rst format.

It's not integrated into the documentation build structure yet,
since it's still located in drivers/staging.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/README.txt   | 387 --
 drivers/staging/fsl-mc/overview.rst | 404 
 2 files changed, 404 insertions(+), 387 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/README.txt
 create mode 100644 drivers/staging/fsl-mc/overview.rst

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/README.txt
deleted file mode 100644
index 0ea5cd7..000
--- a/drivers/staging/fsl-mc/README.txt
+++ /dev/null
@@ -1,387 +0,0 @@
-Copyright (C) 2015 Freescale Semiconductor Inc.
-
-DPAA2 (Data Path Acceleration Architecture Gen2) Overview
--
-
-This document provides an overview of the Freescale DPAA2 architecture
-and how it is integrated into the Linux kernel.
-
-Contents summary
-   -DPAA2 overview
-   -Overview of DPAA2 objects
-   -DPAA2 Linux driver architecture overview
--bus driver
--DPRC driver
--allocator
--DPIO driver
--Ethernet
--MAC
-
-Introduction
-
-
-DPAA2 is a hardware architecture designed for high-speeed network
-packet processing.  DPAA2 consists of sophisticated mechanisms for
-processing Ethernet packets, queue management, buffer management,
-autonomous L2 switching, virtual Ethernet bridging, and accelerator
-(e.g. crypto) sharing.
-
-A DPAA2 hardware component called the Management Complex (or MC) manages the
-DPAA2 hardware resources.  The MC provides an object-based abstraction for
-software drivers to use the DPAA2 hardware.
-
-The MC uses DPAA2 hardware resources such as queues, buffer pools, and
-network ports to create functional objects/devices such as network
-interfaces, an L2 switch, or accelerator instances.
-
-The MC provides memory-mapped I/O command interfaces (MC portals)
-which DPAA2 software drivers use to operate on DPAA2 objects.
-
-The diagram below shows an overview of the DPAA2 resource management
-architecture:
-
- +--+
- |  OS  |
- |DPAA2 drivers |
- | ||
- +-|+
-   |
-   | (create,discover,connect
-   |  config,use,destroy)
-   |
- DPAA2 |
- +| mc portal |-+
- | ||
- |   +- - - - - - - - - - - - -V- - -+  |
- |   |   |  |
- |   |   Management Complex (MC) |  |
- |   |   |  |
- |   +- - - - - - - - - - - - - - - -+  |
- |  |
- | Hardware  Hardware   |
- | Resources Objects|
- | - ---|
- | -queues   -DPRC  |
- | -buffer pools -DPMCP |
- | -Eth MACs/ports   -DPIO  |
- | -network interface-DPNI  |
- |  profiles -DPMAC |
- | -queue portals-DPBP  |
- | -MC portals...   |
- |  ... |
- |  |
- +--+
-
-The MC mediates operations such as create, discover,
-connect, configuration, and destroy.  Fast-path operations
-on data, such as packet transmit/receive, are not mediated by
-the MC and are done directly using memory mapped regions in
-DPIO objects.
-
-Overview of DPAA2 Objects
--
-The section provides a brief overview of some key DPAA2 objects.
-A simple scenario is described illustrating the objects involved
-in creating a network interfaces.
-
--DPRC (Datapath Resource Container)
-
-A DPRC is a container object that holds all the other
-types of DPAA2 objects.  In the example diagram below there
-are 8 objects of 5 types (DPMCP, DPIO, DPBP, DPNI, and DPMAC)
-in the container.
-
-+-+
-| DPRC|
-| |
-|  +---+  +---+  +---+  +---+  +---+  |
-|  | DPMCP |  | DPIO  |  | DPBP  |  | DPNI  |  | DPMAC |  |
-|  +---+  

[PATCH 7/8] staging: fsl-mc: README cleanup

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Minor cosmetic changes to the DPAA2 overview documentation file.
Add a reference to the mc-bus driver sysfs documentation.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/README.txt | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/README.txt
index 524eda1..0ea5cd7 100644
--- a/drivers/staging/fsl-mc/README.txt
+++ b/drivers/staging/fsl-mc/README.txt
@@ -1,7 +1,7 @@
 Copyright (C) 2015 Freescale Semiconductor Inc.
 
-DPAA2 (Data Path Acceleration Architecture Gen2)
-
+DPAA2 (Data Path Acceleration Architecture Gen2) Overview
+-
 
 This document provides an overview of the Freescale DPAA2 architecture
 and how it is integrated into the Linux kernel.
@@ -17,8 +17,8 @@ Contents summary
 -Ethernet
 -MAC
 
-DPAA2 Overview
---
+Introduction
+
 
 DPAA2 is a hardware architecture designed for high-speeed network
 packet processing.  DPAA2 consists of sophisticated mechanisms for
@@ -35,7 +35,7 @@ network ports to create functional objects/devices such as 
network
 interfaces, an L2 switch, or accelerator instances.
 
 The MC provides memory-mapped I/O command interfaces (MC portals)
-which DPAA2 software drivers use to operate on DPAA2 objects:
+which DPAA2 software drivers use to operate on DPAA2 objects.
 
 The diagram below shows an overview of the DPAA2 resource management
 architecture:
@@ -130,8 +130,7 @@ in creating a network interfaces.
 level.
 
 DPRCs can be defined statically and populated with objects
-via a config file passed to the MC when firmware starts
-it.
+via a config file passed to the MC when firmware starts it.
 
 -DPAA2 Objects for an Ethernet Network Interface
 
@@ -217,8 +216,8 @@ in creating a network interfaces.
-IRQs: command completion
-commands: IRQ config, enable, reset
 
-Object Connections
---
+Object Connections
+--
 Some objects have explicit relationships that must
 be configured:
 
@@ -242,8 +241,8 @@ in creating a network interfaces.
   Ethernet driver configures the DPBPs associated with
   the network interface.
 
-Interrupts
---
+Interrupts
+--
 All interrupts generated by DPAA2 objects are message
 interrupts.  At the hardware level message interrupts
 generated by devices will normally have 3 components--
@@ -255,8 +254,8 @@ in creating a network interfaces.
 For ARM-based SoC this is the same as the stream ID.
 
 
-DPAA2 Linux Driver Overview

+DPAA2 Linux Drivers Overview
+
 
 This section provides an overview of the Linux kernel drivers for
 DPAA2-- 1) the bus driver and associated "DPAA2 infrastructure"
@@ -291,7 +290,7 @@ of each driver follows.
   ++--+ |  +--+---+
   |   MC-bus driver   | |  | PHY  |
   |   | |  |driver|
-  | /soc/fsl-mc   | |  +--+---+
+  | /bus/fsl-mc   | |  +--+---+
   +---+ | |
 | |
   HARDWARE =|=|==
@@ -322,6 +321,8 @@ A brief description of each driver is provided below.
 a bind of the root DPRC to the DPRC driver
 The binding for the MC-bus device-tree node can be consulted here:
 Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt
+The sysfs bind/unbind interfaces for the MC-bus can be consulted here:
+Documentation/ABI/testing/sysfs-bus-fsl-mc*
 
 DPRC driver
 ---
@@ -366,8 +367,8 @@ A brief description of each driver is provided below.
 active in the kernel--  Ethernet, crypto, compression,
 etc.
 
-Ethernet
-
+Ethernet driver
+---
 The Ethernet driver is bound to a DPNI and implements the kernel
 interfaces needed to connect the DPAA2 network interface to
 the network stack.
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 6/8] staging: fsl-mc: Update include header

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

With the declarations of its_fsl_mc_msi_init/cleanup() now removed
from fsl-mc-private.h, irq-gic-v3-its-fsl-mc-msi.c only needs a
couple of definitions from mc.h, so include that header directly.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 506fce1..12734dd 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -14,7 +14,7 @@
 #include 
 #include 
 #include 
-#include "fsl-mc-private.h"
+#include "../include/mc.h"
 
 static struct irq_chip its_msi_irq_chip = {
.name = "ITS-fMSI",
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/8] staging: fsl-mc: Add SPDX license identifiers

2018-01-16 Thread Bogdan Purcareata
The fsl-mc bus and dpio driver files use a combination of GPL-2.0 and
GPL-2.0+ OR BSD-3-Clause licenses. Update to latter for all files. Add SPDX
tags and delete the full license text. Update copyright information.

Signed-off-by: Bogdan Purcareata 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/Kconfig |  1 +
 drivers/staging/fsl-mc/Makefile|  1 +
 drivers/staging/fsl-mc/bus/Kconfig |  3 +-
 drivers/staging/fsl-mc/bus/Makefile|  3 +-
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  | 29 ++-
 drivers/staging/fsl-mc/bus/dpbp.c  | 29 ++-
 drivers/staging/fsl-mc/bus/dpcon-cmd.h | 29 ++-
 drivers/staging/fsl-mc/bus/dpcon.c | 33 +++---
 drivers/staging/fsl-mc/bus/dpio/Makefile   |  1 +
 drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c  | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/dpio.c | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/dpio.h | 30 ++--
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 29 ++-
 drivers/staging/fsl-mc/bus/dpio/qbman-portal.h | 29 ++-
 drivers/staging/fsl-mc/bus/dpmcp.c | 29 ++-
 drivers/staging/fsl-mc/bus/dprc-driver.c   |  5 ++--
 drivers/staging/fsl-mc/bus/dprc.c  | 29 ++-
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c|  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c|  5 ++--
 drivers/staging/fsl-mc/bus/fsl-mc-private.h|  5 ++--
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |  5 ++--
 drivers/staging/fsl-mc/bus/mc-io.c | 29 ++-
 drivers/staging/fsl-mc/bus/mc-sys.c| 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-fd.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-global.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpaa2-io.h  | 29 ++-
 drivers/staging/fsl-mc/include/dpbp.h  | 30 ++--
 drivers/staging/fsl-mc/include/dpcon.h | 33 +++---
 drivers/staging/fsl-mc/include/mc.h|  5 ++--
 32 files changed, 63 insertions(+), 573 deletions(-)

diff --git a/drivers/staging/fsl-mc/Kconfig b/drivers/staging/fsl-mc/Kconfig
index 32df07b..d4bab69 100644
--- a/drivers/staging/fsl-mc/Kconfig
+++ b/drivers/staging/fsl-mc/Kconfig
@@ -1 +1,2 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 source "drivers/staging/fsl-mc/bus/Kconfig"
diff --git a/drivers/staging/fsl-mc/Makefile b/drivers/staging/fsl-mc/Makefile
index 9c6a001..d717b41 100644
--- a/drivers/staging/fsl-mc/Makefile
+++ b/drivers/staging/fsl-mc/Makefile
@@ -1,2 +1,3 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 # Freescale Management Complex (MC) bus drivers
 obj-$(CONFIG_FSL_MC_BUS)   += bus/
diff --git a/drivers/staging/fsl-mc/bus/Kconfig 
b/drivers/staging/fsl-mc/bus/Kconfig
index 504c987..9adb2a6 100644
--- a/drivers/staging/fsl-mc/bus/Kconfig
+++ b/drivers/staging/fsl-mc/bus/Kconfig
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 #
 # DPAA2 fsl-mc bus
 #
 # Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 
 config FSL_MC_BUS
bool "QorIQ DPAA2 fsl-mc bus driver"
diff --git a/drivers/staging/fsl-mc/bus/Makefile 
b/drivers/staging/fsl-mc/bus/Makefile
index 6df407e..cdf319f 100644
--- a/drivers/staging/fsl-mc/bus/Makefile
+++ b/drivers/staging/fsl-mc/bus/Makefile
@@ -1,10 +1,9 @@
+# SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
 #
 # Freescale Management Complex (MC) bus drivers
 #
 # Copyright (C) 2014 Freescale Semiconductor, Inc.
 #
-# This file is released under the GPLv2
-#
 obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o
 
 mc-bus-driver-objs := fsl-mc-bus.o \
diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 5904836..1ac8ec6 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -1,33 +1,8 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
 /*
  * Copyright 2013-2016 Freescale Semiconductor Inc.
+ * Copyright 2016-2017 NXP
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must 

[PATCH 5/8] staging: fsl-mc: Remove unnecessary dependency

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

The function that enables fsl-mc msi interrupts doesn't need
to be explicitly called from the fsl-mc bus driver initialization
routine.

Mark it to be independently called at system init; this is in line
with how things are handled by other GICv3 irqchip users.

Due to this change we now have an unused cleanup function, so
remove it.

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  | 5 -
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c| 7 ---
 drivers/staging/fsl-mc/bus/fsl-mc-private.h| 4 
 drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 ++
 4 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index 041d341..b9f5a56 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -647,8 +647,3 @@ int __init fsl_mc_allocator_driver_init(void)
 {
return fsl_mc_driver_register(_mc_allocator_driver);
 }
-
-void fsl_mc_allocator_driver_exit(void)
-{
-   fsl_mc_driver_unregister(_mc_allocator_driver);
-}
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 0d010aa..9cb08c2 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -932,15 +932,8 @@ static int __init fsl_mc_bus_driver_init(void)
if (error < 0)
goto error_cleanup_dprc_driver;
 
-   error = its_fsl_mc_msi_init();
-   if (error < 0)
-   goto error_cleanup_mc_allocator;
-
return 0;
 
-error_cleanup_mc_allocator:
-   fsl_mc_allocator_driver_exit();
-
 error_cleanup_dprc_driver:
dprc_driver_exit();
 
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h 
b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
index a74186e..7e50cd4 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
@@ -439,8 +439,6 @@ void dprc_driver_exit(void);
 
 int __init fsl_mc_allocator_driver_init(void);
 
-void fsl_mc_allocator_driver_exit(void);
-
 void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
 
 void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
@@ -457,8 +455,6 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev,
 
 void fsl_mc_msi_domain_free_irqs(struct device *dev);
 
-int __init its_fsl_mc_msi_init(void);
-
 int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
   struct irq_domain **mc_msi_domain);
 
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index 097c401f..506fce1 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -97,3 +97,5 @@ int __init its_fsl_mc_msi_init(void)
 
return 0;
 }
+
+early_initcall(its_fsl_mc_msi_init);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/8] staging: fsl-mc: Remove dead code

2018-01-16 Thread Bogdan Purcareata
From: Ioana Radulescu 

Remove one unused function from irq-gic-v3-its-fsl-mc-msi.c

Signed-off-by: Ioana Radulescu 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-private.h   |  2 --
 .../staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c| 19 ---
 2 files changed, 21 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h 
b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
index 4023c4f..a74186e 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
@@ -459,8 +459,6 @@ void fsl_mc_msi_domain_free_irqs(struct device *dev);
 
 int __init its_fsl_mc_msi_init(void);
 
-void its_fsl_mc_msi_cleanup(void);
-
 int fsl_mc_find_msi_domain(struct device *mc_platform_dev,
   struct irq_domain **mc_msi_domain);
 
diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
index bbef06f..097c401f 100644
--- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c
@@ -97,22 +97,3 @@ int __init its_fsl_mc_msi_init(void)
 
return 0;
 }
-
-void its_fsl_mc_msi_cleanup(void)
-{
-   struct device_node *np;
-
-   for (np = of_find_matching_node(NULL, its_device_id); np;
-np = of_find_matching_node(np, its_device_id)) {
-   struct irq_domain *mc_msi_domain = irq_find_matching_host(
-   np,
-   DOMAIN_BUS_FSL_MC_MSI);
-
-   if (!of_property_read_bool(np, "msi-controller"))
-   continue;
-
-   if (mc_msi_domain &&
-   mc_msi_domain->host_data == _fsl_mc_msi_domain_info)
-   irq_domain_remove(mc_msi_domain);
-   }
-}
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/8] staging: fsl-mc: Consolidate bus core header files

2018-01-16 Thread Bogdan Purcareata
The DPAA2 objects involved (DPMNG, DPMCP, DPRC) are used by the fsl-mc
bus infrastructure only, so group the APIs and structs into
fsl-mc-private.h.

Signed-off-by: Bogdan Purcareata 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h  |  54 
 drivers/staging/fsl-mc/bus/dpmcp.c  |   3 +-
 drivers/staging/fsl-mc/bus/dpmcp.h  |  55 -
 drivers/staging/fsl-mc/bus/dpmng-cmd.h  |  58 -
 drivers/staging/fsl-mc/bus/dprc-cmd.h   | 188 --
 drivers/staging/fsl-mc/bus/dprc-driver.c|   1 -
 drivers/staging/fsl-mc/bus/dprc.c   |   4 +-
 drivers/staging/fsl-mc/bus/dprc.h   | 203 ---
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c |   2 -
 drivers/staging/fsl-mc/bus/fsl-mc-private.h | 369 +++-
 drivers/staging/fsl-mc/bus/mc-io.c  |   2 -
 drivers/staging/fsl-mc/bus/mc-sys.c |   2 +-
 12 files changed, 371 insertions(+), 570 deletions(-)
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmcp.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dpmng-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc-cmd.h
 delete mode 100644 drivers/staging/fsl-mc/bus/dprc.h

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
deleted file mode 100644
index 60fff6f..000
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2013-2016 Freescale Semiconductor Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the above-listed copyright holders nor the
- * names of any contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * ALTERNATIVELY, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") as published by the Free Software
- * Foundation, either version 2 of that License or (at your option) any
- * later version.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _FSL_DPMCP_CMD_H
-#define _FSL_DPMCP_CMD_H
-
-/* Minimal supported DPMCP Version */
-#define DPMCP_MIN_VER_MAJOR3
-#define DPMCP_MIN_VER_MINOR0
-
-/* Command versioning */
-#define DPMCP_CMD_BASE_VERSION 1
-#define DPMCP_CMD_ID_OFFSET4
-
-#define DPMCP_CMD(id)  (((id) << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION)
-
-/* Command IDs */
-#define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
-#define DPMCP_CMDID_OPEN   DPMCP_CMD(0x80b)
-#define DPMCP_CMDID_RESET  DPMCP_CMD(0x005)
-
-struct dpmcp_cmd_open {
-   __le32 dpmcp_id;
-};
-
-#endif /* _FSL_DPMCP_CMD_H */
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index 2989cc4..63b967c 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -32,8 +32,7 @@
 #include 
 #include "../include/mc.h"
 
-#include "dpmcp.h"
-#include "dpmcp-cmd.h"
+#include "fsl-mc-private.h"
 
 /**
  * dpmcp_open() - Open a control session for the specified object.
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
deleted file mode 100644
index 873a4d0..000
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2016 Freescale Semiconductor Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * 

[PATCH 1/8] staging: fsl-mc: Cleanup dprc and dpmcp header files

2018-01-16 Thread Bogdan Purcareata
A lot of API and associated structures are not used by current code, so
remove them.

Signed-off-by: Bogdan Purcareata 
Reviewed-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |   2 -
 drivers/staging/fsl-mc/bus/dpmcp.c |  32 
 drivers/staging/fsl-mc/bus/dpmcp.h |   5 -
 drivers/staging/fsl-mc/bus/dprc-cmd.h  | 263 -
 drivers/staging/fsl-mc/bus/dprc.c  | 224 
 drivers/staging/fsl-mc/bus/dprc.h  |  65 
 6 files changed, 591 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
index 861b2a7..60fff6f 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
@@ -45,8 +45,6 @@
 /* Command IDs */
 #define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
 #define DPMCP_CMDID_OPEN   DPMCP_CMD(0x80b)
-#define DPMCP_CMDID_GET_API_VERSIONDPMCP_CMD(0xa0b)
-
 #define DPMCP_CMDID_RESET  DPMCP_CMD(0x005)
 
 struct dpmcp_cmd_open {
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index eea42f6..2989cc4 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -124,35 +124,3 @@ int dpmcp_reset(struct fsl_mc_io *mc_io,
/* send command to mc*/
return mc_send_command(mc_io, );
 }
-
-/**
- * dpmcp_get_api_version - Get Data Path Management Command Portal API version
- * @mc_io: Pointer to Mc portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: Major version of Data Path Management Command Portal API
- * @minor_ver: Minor version of Data Path Management Command Portal API
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmcp_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver)
-{
-   struct mc_command cmd = { 0 };
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPMCP_CMDID_GET_API_VERSION,
- cmd_flags, 0);
-
-   /* send command to mc */
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   mc_cmd_read_api_version(, major_ver, minor_ver);
-
-   return 0;
-}
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.h 
b/drivers/staging/fsl-mc/bus/dpmcp.h
index f616031..873a4d0 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp.h
@@ -48,11 +48,6 @@ int dpmcp_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token);
 
-int dpmcp_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver);
-
 int dpmcp_reset(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token);
diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h 
b/drivers/staging/fsl-mc/bus/dprc-cmd.h
index d9b2dcd..ab13175 100644
--- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
@@ -58,56 +58,21 @@
 #define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
 
 #define DPRC_CMDID_SET_IRQ  DPRC_CMD(0x010)
-#define DPRC_CMDID_GET_IRQ  DPRC_CMD(0x011)
 #define DPRC_CMDID_SET_IRQ_ENABLE   DPRC_CMD(0x012)
-#define DPRC_CMDID_GET_IRQ_ENABLE   DPRC_CMD(0x013)
 #define DPRC_CMDID_SET_IRQ_MASK DPRC_CMD(0x014)
-#define DPRC_CMDID_GET_IRQ_MASK DPRC_CMD(0x015)
 #define DPRC_CMDID_GET_IRQ_STATUS   DPRC_CMD(0x016)
 #define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
 
 #define DPRC_CMDID_GET_CONT_ID  DPRC_CMD(0x830)
 #define DPRC_CMDID_GET_OBJ_COUNTDPRC_CMD(0x159)
 #define DPRC_CMDID_GET_OBJ  DPRC_CMD(0x15A)
-#define DPRC_CMDID_GET_RES_COUNTDPRC_CMD(0x15B)
 #define DPRC_CMDID_GET_OBJ_REG  DPRC_CMD(0x15E)
 #define DPRC_CMDID_SET_OBJ_IRQ  DPRC_CMD(0x15F)
-#define DPRC_CMDID_GET_OBJ_IRQ  DPRC_CMD(0x160)
 
 struct dprc_cmd_open {
__le32 container_id;
 };
 
-struct dprc_cmd_create_container {
-   /* cmd word 0 */
-   __le32 options;
-   __le16 icid;
-   __le16 pad0;
-   /* cmd word 1 */
-   __le32 pad1;
-   __le32 portal_id;
-   /* cmd words 2-3 */
-   u8 label[16];
-};
-
-struct dprc_rsp_create_container {
-   /* response word 0 */
-   __le64 pad0;
-   /* response word 1 */
-   __le32 child_container_id;
-   __le32 pad1;
-   /* response word 2 */
-   __le64 child_portal_addr;
-};
-
-struct dprc_cmd_destroy_container {
-   __le32 child_container_id;

[PATCH] scsi: storvsc: missing error code in storvsc_probe()

2018-01-16 Thread Dan Carpenter
We should set the error code if fc_remote_port_add() fails.

Fixes: daf0cd445a21 ("scsi: storvsc: Add support for FC rport.")
Signed-off-by: Dan Carpenter 

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 3b3d1d050cac..40fc7a590e81 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1834,8 +1834,10 @@ static int storvsc_probe(struct hv_device *device,
fc_host_node_name(host) = stor_device->node_name;
fc_host_port_name(host) = stor_device->port_name;
stor_device->rport = fc_remote_port_add(host, 0, );
-   if (!stor_device->rport)
+   if (!stor_device->rport) {
+   ret = -ENOMEM;
goto err_out4;
+   }
}
 #endif
return 0;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: lnet: avoid uninitialized return value

2018-01-16 Thread Arnd Bergmann
gcc warns that the latest workqueue change leads to returning an
uninitialized variable:

drivers/staging/lustre/lnet/selftest/module.c: In function 'lnet_selftest_init':
drivers/staging/lustre/lnet/selftest/module.c:98:10: error: 'rc' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]

A failure from alloc_ordered_workqueue() tends to indicate an
out-of-memory condition, so return -ENOMEM in both cases.
The second error path was a preexisting bug, where we always
returned zero after a kvmalloc_array() failure.

Fixes: 6106c0f82481 ("staging: lustre: lnet: convert selftest to use 
workqueues")
Signed-off-by: Arnd Bergmann 
---
 drivers/staging/lustre/lnet/selftest/module.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/module.c 
b/drivers/staging/lustre/lnet/selftest/module.c
index aa6bfd5baf2f..c8d999e64f28 100644
--- a/drivers/staging/lustre/lnet/selftest/module.c
+++ b/drivers/staging/lustre/lnet/selftest/module.c
@@ -95,15 +95,17 @@ lnet_selftest_init(void)
lst_serial_wq = alloc_ordered_workqueue("lst_s", 0);
if (!lst_serial_wq) {
CERROR("Failed to create serial WI scheduler for LST\n");
-   return rc;
+   return -ENOMEM;
}
lst_init_step = LST_INIT_WI_SERIAL;
 
nscheds = cfs_cpt_number(lnet_cpt_table());
lst_test_wq = kvmalloc_array(nscheds, sizeof(lst_test_wq[0]),
GFP_KERNEL | __GFP_ZERO);
-   if (!lst_test_wq)
+   if (!lst_test_wq) {
+   rc = -ENOMEM;
goto error;
+   }
 
lst_init_step = LST_INIT_WI_TEST;
for (i = 0; i < nscheds; i++) {
@@ -116,6 +118,7 @@ lnet_selftest_init(void)
if (!lst_test_wq[i]) {
CWARN("Failed to create CPU partition affinity WI 
scheduler %d for LST\n",
  i);
+   rc = -ENOMEM;
goto error;
}
attrs.nice = 0;
-- 
2.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 02/10] include: Move compat_timespec/ timeval to compat_time.h

2018-01-16 Thread Catalin Marinas
On Mon, Jan 15, 2018 at 06:18:10PM -0800, Deepa Dinamani wrote:
> All the current architecture specific defines for these
> are the same. Refactor these common defines to a common
> header file.
> 
> The new common linux/compat_time.h is also useful as it
> will eventually be used to hold all the defines that
> are needed for compat time types that support non y2038
> safe types. New architectures need not have to define these
> new types as they will only use new y2038 safe syscalls.
> This file can be deleted after y2038 when we stop supporting
> non y2038 safe syscalls.

For arm64:

Acked-by: Catalin Marinas 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [lustre-devel] [bug report] staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.

2018-01-16 Thread Dan Carpenter
On Mon, Jan 15, 2018 at 06:27:26PM +, Eremin, Dmitry wrote:
> Hello Dan,
> 
> The function kiblnd_destroy_conn() is conditionally free the conn pointer.
> 
> void kiblnd_destroy_conn(kib_conn_t *conn, bool free_conn)
> {
> […]
> if (free_conn)
>LIBCFS_FREE(conn, sizeof(*conn));

This check is not there in the kernel.org kernel.  In the upstream
kernel it frees it unconditionally.  The "free_conn" parameter was added
in commit 4d99b2581eff ("staging: lustre: avoid intensive reconnecting
for ko2iblnd") but that line must have been left out.

regards,
dan carpenter



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel