[PATCH v3] staging: lustre: o2iblnd: Enable Multiple OPA Endpoints between Nodes

2018-05-07 Thread Doug Oucharek
OPA driver optimizations are based on the MPI model where it is
expected to have multiple endpoints between two given nodes. To
enable this optimization for Lustre, we need to make it possible,
via an LND-specific tuneable, to create multiple endpoints and to
balance the traffic over them.

Both sides of a connection must have this patch for it to work.
Only the active side of the connection (usually the client)
needs to have the new tuneable set > 1.

Signed-off-by: Doug Oucharek 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8943
Reviewed-on: https://review.whamcloud.com/25168
Reviewed-by: Amir Shehata 
Reviewed-by: Dmitry Eremin 
Reviewed-by: James Simmons 
Reviewed-by: Oleg Drokin 
Signed-off-by: Doug Oucharek 
---
Changes in v1: Original patch
Changes in v2: Fixed checkpatch issues
Changes in v3: Properly added version change log

 .../lustre/include/uapi/linux/lnet/lnet-dlc.h  |  3 ++-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h| 17 ---
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 25 +++---
 .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c  |  9 
 4 files changed, 42 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h 
b/drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h
index e45d828..c1619f4 100644
--- a/drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h
+++ b/drivers/staging/lustre/include/uapi/linux/lnet/lnet-dlc.h
@@ -53,7 +53,8 @@ struct lnet_ioctl_config_o2iblnd_tunables {
__u32 lnd_fmr_pool_size;
__u32 lnd_fmr_flush_trigger;
__u32 lnd_fmr_cache;
-   __u32 pad;
+   __u16 lnd_conns_per_peer;
+   __u16 pad;
 };
 
 struct lnet_ioctl_config_lnd_tunables {
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
index ca6e09d..bb663d6 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h
@@ -568,6 +568,8 @@ struct kib_peer {
lnet_nid_t   ibp_nid; /* who's on the other end(s) */
struct lnet_ni  *ibp_ni; /* LNet interface */
struct list_head ibp_conns;   /* all active connections */
+   struct kib_conn *ibp_next_conn;  /* next connection to send on for
+ * round robin */
struct list_head ibp_tx_queue;/* msgs waiting for a conn */
__u64ibp_incarnation; /* incarnation of peer */
/* when (in jiffies) I was last alive */
@@ -581,7 +583,7 @@ struct kib_peer {
/* current active connection attempts */
unsigned short  ibp_connecting;
/* reconnect this peer later */
-   unsigned short  ibp_reconnecting:1;
+   unsigned char   ibp_reconnecting;
/* counter of how many times we triggered a conn race */
unsigned char   ibp_races;
/* # consecutive reconnection attempts to this peer */
@@ -744,10 +746,19 @@ struct kib_peer {
 static inline struct kib_conn *
 kiblnd_get_conn_locked(struct kib_peer *peer)
 {
+   struct list_head *next;
+
LASSERT(!list_empty(&peer->ibp_conns));
 
-   /* just return the first connection */
-   return list_entry(peer->ibp_conns.next, struct kib_conn, ibc_list);
+   /* Advance to next connection, be sure to skip the head node */
+   if (!peer->ibp_next_conn ||
+   peer->ibp_next_conn->ibc_list.next == &peer->ibp_conns)
+   next = peer->ibp_conns.next;
+   else
+   next = peer->ibp_next_conn->ibc_list.next;
+   peer->ibp_next_conn = list_entry(next, struct kib_conn, ibc_list);
+
+   return peer->ibp_next_conn;
 }
 
 static inline int
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index b4a182d..77b3ae6 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -1250,7 +1250,6 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid,
 
LASSERT(net);
LASSERT(peer->ibp_connecting > 0);
-   LASSERT(!peer->ibp_reconnecting);
 
cmid = kiblnd_rdma_create_id(kiblnd_cm_callback, peer, RDMA_PS_TCP,
 IB_QPT_RC);
@@ -1332,7 +1331,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid,
 
LASSERT(!peer->ibp_accepting && !peer->ibp_connecting &&
list_empty(&peer->ibp_conns));
-   peer->ibp_reconnecting = 0;
+   peer->ibp_reconnecting--;
 
if (!kiblnd_peer_active(peer)) {
list_splice_init(&peer->ibp_tx_queue, &txs);
@@ -1365,6 +1364,8 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid,
rwlock_t *g_lock = &kiblnd_data.kib_global_lock;
unsigned long flags;
int rc;
+   inti;
+   struct lnet_ioctl_config

Re: [PATH V2 4/4] staging: mt7621-eth: Alignment should match open parenthesis

2018-05-07 Thread NeilBrown
On Mon, May 07 2018, Kamal Heib wrote:

> Fix alignment issues reported by checkpatch.pl.
>
> Signed-off-by: Kamal Heib 

Signed-off-by: NeilBrown 

Thanks - your solution is probably better than the two I suggested!

NeilBrown

> ---
>  drivers/staging/mt7621-eth/mtk_eth_soc.c | 24 
>  1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c 
> b/drivers/staging/mt7621-eth/mtk_eth_soc.c
> index c44a2f8a841c..863d7a08359e 100644
> --- a/drivers/staging/mt7621-eth/mtk_eth_soc.c
> +++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c
> @@ -315,7 +315,7 @@ static int mtk_dma_rx_alloc(struct mtk_eth *eth, struct 
> mtk_rx_ring *ring)
>   ring->rx_buf_size = mtk_max_buf_size(ring->frag_size);
>   ring->rx_ring_size = eth->soc->dma_ring_size;
>   ring->rx_data = kcalloc(ring->rx_ring_size, sizeof(*ring->rx_data),
> - GFP_KERNEL);
> + GFP_KERNEL);
>   if (!ring->rx_data)
>   goto no_rx_mem;
>  
> @@ -325,10 +325,10 @@ static int mtk_dma_rx_alloc(struct mtk_eth *eth, struct 
> mtk_rx_ring *ring)
>   goto no_rx_mem;
>   }
>  
> - ring->rx_dma = dma_alloc_coherent(eth->dev,
> - ring->rx_ring_size * sizeof(*ring->rx_dma),
> - &ring->rx_phys,
> - GFP_ATOMIC | __GFP_ZERO);
> + ring->rx_dma =
> + dma_alloc_coherent(eth->dev,
> +ring->rx_ring_size * sizeof(*ring->rx_dma),
> +&ring->rx_phys, GFP_ATOMIC | __GFP_ZERO);
>   if (!ring->rx_dma)
>   goto no_rx_mem;
>  
> @@ -1351,14 +1351,14 @@ static int mtk_pdma_tx_alloc(struct mtk_eth *eth)
> MAX_SKB_FRAGS);
>  
>   ring->tx_buf = kcalloc(ring->tx_ring_size, sizeof(*ring->tx_buf),
> - GFP_KERNEL);
> +GFP_KERNEL);
>   if (!ring->tx_buf)
>   goto no_tx_mem;
>  
> - ring->tx_dma = dma_alloc_coherent(eth->dev,
> - ring->tx_ring_size * sizeof(*ring->tx_dma),
> - &ring->tx_phys,
> - GFP_ATOMIC | __GFP_ZERO);
> + ring->tx_dma =
> + dma_alloc_coherent(eth->dev,
> +ring->tx_ring_size * sizeof(*ring->tx_dma),
> +&ring->tx_phys, GFP_ATOMIC | __GFP_ZERO);
>   if (!ring->tx_dma)
>   goto no_tx_mem;
>  
> @@ -2013,8 +2013,8 @@ static int mtk_add_mac(struct mtk_eth *eth, struct 
> device_node *np)
>  
>   if (mtk_reg_table[MTK_REG_MTK_COUNTER_BASE]) {
>   mac->hw_stats = devm_kzalloc(eth->dev,
> -   sizeof(*mac->hw_stats),
> -   GFP_KERNEL);
> +  sizeof(*mac->hw_stats),
> +  GFP_KERNEL);
>   if (!mac->hw_stats)
>   return -ENOMEM;
>   spin_lock_init(&mac->hw_stats->stats_lock);
> -- 
> 2.14.3


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


Re: [PATH V2 1/4] staging: mt7621-eth: Fix compilation error

2018-05-07 Thread NeilBrown
On Mon, May 07 2018, Kamal Heib wrote:

> Fix the following comilation error by making sure that "phy_ring_head" is
> defined as "dma_addr_t" and change "phy_ring_tail" to match it as both
> should be "dma_addr_t".
>
> error: passing argument 3 of ‘dma_alloc_coherent’ from incompatible pointer 
> type
>
> Signed-off-by: Kamal Heib 

Reviewed-by: NeilBrown 

thanks,
NeilBrown


> ---
>  drivers/staging/mt7621-eth/mtk_eth_soc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c 
> b/drivers/staging/mt7621-eth/mtk_eth_soc.c
> index cbc7339843a5..c44a2f8a841c 100644
> --- a/drivers/staging/mt7621-eth/mtk_eth_soc.c
> +++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c
> @@ -768,9 +768,8 @@ static int mtk_pdma_tx_map(struct sk_buff *skb, struct 
> net_device *dev,
>  /* the qdma core needs scratch memory to be setup */
>  static int mtk_init_fq_dma(struct mtk_eth *eth)
>  {
> - unsigned int phy_ring_head, phy_ring_tail;
> + dma_addr_t dma_addr, phy_ring_head, phy_ring_tail;
>   int cnt = eth->soc->dma_ring_size;
> - dma_addr_t dma_addr;
>   int i;
>  
>   eth->scratch_ring = dma_alloc_coherent(eth->dev,
> -- 
> 2.14.3


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


[PATCH char-misc 2/2] Drivers: hv: vmbus: Make TLFS #define names architecture neutral

2018-05-07 Thread mhkelley58
From: Michael Kelley 

The Hyper-V feature and hint flags in hyperv-tlfs.h are all defined
with the string "X64" in the name.  Some of these flags are indeed
x86/x64 specific, but others are not.  For the ones that are used
in architecture independent Hyper-V driver code, or will be used in
the upcoming support for Hyper-V for ARM64, this patch removes the
"X64" from the name.

This patch changes the flags that are currently known to be
used on multiple architectures. Hyper-V for ARM64 is still a
work-in-progress and the Top Level Functional Spec (TLFS) has not
been separated into x86/x64 and ARM64 areas.  So additional flags
may need to be updated later.

This patch only changes symbol names.  There are no functional
changes.

Signed-off-by: Michael Kelley 
---
 arch/x86/hyperv/hv_init.c  |  4 ++--
 arch/x86/include/asm/hyperv-tlfs.h | 12 ++--
 arch/x86/kernel/cpu/mshyperv.c |  4 ++--
 drivers/hv/hv.c| 10 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index cfecc22..3db8729 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -302,7 +302,7 @@ void hyperv_init(void)
 * Register Hyper-V specific clocksource.
 */
 #ifdef CONFIG_HYPERV_TSCPAGE
-   if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
+   if (ms_hyperv.features & HV_MSR_REFERENCE_TSC_AVAILABLE) {
union hv_x64_msr_hypercall_contents tsc_msr;
 
tsc_pg = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL);
@@ -331,7 +331,7 @@ void hyperv_init(void)
 */
 
hyperv_cs = &hyperv_cs_msr;
-   if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
+   if (ms_hyperv.features & HV_MSR_TIME_REF_COUNT_AVAILABLE)
clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100);
 
return;
diff --git a/arch/x86/include/asm/hyperv-tlfs.h 
b/arch/x86/include/asm/hyperv-tlfs.h
index 416cb0e..44657e0 100644
--- a/arch/x86/include/asm/hyperv-tlfs.h
+++ b/arch/x86/include/asm/hyperv-tlfs.h
@@ -35,9 +35,9 @@
 /* VP Runtime (HV_X64_MSR_VP_RUNTIME) available */
 #define HV_X64_MSR_VP_RUNTIME_AVAILABLE(1 << 0)
 /* Partition Reference Counter (HV_X64_MSR_TIME_REF_COUNT) available*/
-#define HV_X64_MSR_TIME_REF_COUNT_AVAILABLE(1 << 1)
+#define HV_MSR_TIME_REF_COUNT_AVAILABLE(1 << 1)
 /* Partition reference TSC MSR is available */
-#define HV_X64_MSR_REFERENCE_TSC_AVAILABLE  (1 << 9)
+#define HV_MSR_REFERENCE_TSC_AVAILABLE (1 << 9)
 
 /* A partition's reference time stamp counter (TSC) page */
 #define HV_X64_MSR_REFERENCE_TSC   0x4021
@@ -60,7 +60,7 @@
  * Synthetic Timer MSRs (HV_X64_MSR_STIMER0_CONFIG through
  * HV_X64_MSR_STIMER3_COUNT) available
  */
-#define HV_X64_MSR_SYNTIMER_AVAILABLE  (1 << 3)
+#define HV_MSR_SYNTIMER_AVAILABLE  (1 << 3)
 /*
  * APIC access MSRs (HV_X64_MSR_EOI, HV_X64_MSR_ICR and HV_X64_MSR_TPR)
  * are available
@@ -86,7 +86,7 @@
 #define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE (1 << 10)
 
 /* stimer Direct Mode is available */
-#define HV_X64_STIMER_DIRECT_MODE_AVAILABLE(1 << 19)
+#define HV_STIMER_DIRECT_MODE_AVAILABLE(1 << 19)
 
 /*
  * Feature identification: EBX indicates which flags were specified at
@@ -160,9 +160,9 @@
 #define HV_X64_RELAXED_TIMING_RECOMMENDED  (1 << 5)
 
 /*
- * Virtual APIC support
+ * Recommend not using Auto End-Of-Interrupt feature
  */
-#define HV_X64_DEPRECATING_AEOI_RECOMMENDED(1 << 9)
+#define HV_DEPRECATING_AEOI_RECOMMENDED(1 << 9)
 
 /* Recommend using the newer ExProcessorMasks interface */
 #define HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED  (1 << 11)
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 031082c..f99ce9d 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -50,7 +50,7 @@ void hyperv_vector_handler(struct pt_regs *regs)
if (vmbus_handler)
vmbus_handler();
 
-   if (ms_hyperv.hints & HV_X64_DEPRECATING_AEOI_RECOMMENDED)
+   if (ms_hyperv.hints & HV_DEPRECATING_AEOI_RECOMMENDED)
ack_APIC_irq();
 
exiting_irq();
@@ -300,7 +300,7 @@ static void __init ms_hyperv_init_platform(void)
hyperv_reenlightenment_vector);
 
/* Setup the IDT for stimer0 */
-   if (ms_hyperv.misc_features & HV_X64_STIMER_DIRECT_MODE_AVAILABLE)
+   if (ms_hyperv.misc_features & HV_STIMER_DIRECT_MODE_AVAILABLE)
alloc_intr_gate(HYPERV_STIMER0_VECTOR,
hv_stimer0_callback_vector);
 #endif
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 96c403a..c72e8d7 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -64,7 +64,7 @@ int hv_init(void)
return -ENOMEM;
 
direct_mode_enabled = ms_hyperv.misc_features &
-

[PATCH char-misc 1/2] Drivers: hv: vmbus: Remove x86 MSR refs in arch independent code

2018-05-07 Thread mhkelley58
From: Michael Kelley 

In architecture independent code for manipulating Hyper-V synthetic timers
and synthetic interrupts, pass in an ordinal number identifying the timer
or interrupt, rather than an actual MSR register address.  Then in
x86/x64 specific code, map the ordinal number to the appropriate MSR.
This change facilitates the introduction of an ARM64 version of Hyper-V,
which uses the same synthetic timers and interrupts, but a different
mechanism for accessing them.

Signed-off-by: Michael Kelley 
---
 arch/x86/include/asm/mshyperv.h | 12 
 drivers/hv/hv.c | 20 
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index b90e796..caf9035 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -75,8 +75,10 @@ static inline void vmbus_signal_eom(struct hv_message *msg, 
u32 old_msg_type)
}
 }
 
-#define hv_init_timer(timer, tick) wrmsrl(timer, tick)
-#define hv_init_timer_config(config, val) wrmsrl(config, val)
+#define hv_init_timer(timer, tick) \
+   wrmsrl(HV_X64_MSR_STIMER0_COUNT + (2*timer), tick)
+#define hv_init_timer_config(timer, val) \
+   wrmsrl(HV_X64_MSR_STIMER0_CONFIG + (2*timer), val)
 
 #define hv_get_simp(val) rdmsrl(HV_X64_MSR_SIMP, val)
 #define hv_set_simp(val) wrmsrl(HV_X64_MSR_SIMP, val)
@@ -89,8 +91,10 @@ static inline void vmbus_signal_eom(struct hv_message *msg, 
u32 old_msg_type)
 
 #define hv_get_vp_index(index) rdmsrl(HV_X64_MSR_VP_INDEX, index)
 
-#define hv_get_synint_state(int_num, val) rdmsrl(int_num, val)
-#define hv_set_synint_state(int_num, val) wrmsrl(int_num, val)
+#define hv_get_synint_state(int_num, val) \
+   rdmsrl(HV_X64_MSR_SINT0 + int_num, val)
+#define hv_set_synint_state(int_num, val) \
+   wrmsrl(HV_X64_MSR_SINT0 + int_num, val)
 
 void hyperv_callback_vector(void);
 void hyperv_reenlightenment_vector(void);
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 9b82549..96c403a 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -127,14 +127,14 @@ static int hv_ce_set_next_event(unsigned long delta,
 
current_tick = hyperv_cs->read(NULL);
current_tick += delta;
-   hv_init_timer(HV_X64_MSR_STIMER0_COUNT, current_tick);
+   hv_init_timer(0, current_tick);
return 0;
 }
 
 static int hv_ce_shutdown(struct clock_event_device *evt)
 {
-   hv_init_timer(HV_X64_MSR_STIMER0_COUNT, 0);
-   hv_init_timer_config(HV_X64_MSR_STIMER0_CONFIG, 0);
+   hv_init_timer(0, 0);
+   hv_init_timer_config(0, 0);
if (direct_mode_enabled)
hv_disable_stimer0_percpu_irq(stimer0_irq);
 
@@ -164,7 +164,7 @@ static int hv_ce_set_oneshot(struct clock_event_device *evt)
timer_cfg.direct_mode = 0;
timer_cfg.sintx = VMBUS_MESSAGE_SINT;
}
-   hv_init_timer_config(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64);
+   hv_init_timer_config(0, timer_cfg.as_uint64);
return 0;
 }
 
@@ -298,8 +298,7 @@ int hv_synic_init(unsigned int cpu)
hv_set_siefp(siefp.as_uint64);
 
/* Setup the shared SINT. */
-   hv_get_synint_state(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT,
-   shared_sint.as_uint64);
+   hv_get_synint_state(VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
 
shared_sint.vector = HYPERVISOR_CALLBACK_VECTOR;
shared_sint.masked = false;
@@ -308,8 +307,7 @@ int hv_synic_init(unsigned int cpu)
else
shared_sint.auto_eoi = true;
 
-   hv_set_synint_state(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT,
-   shared_sint.as_uint64);
+   hv_set_synint_state(VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
 
/* Enable the global synic bit */
hv_get_synic_state(sctrl.as_uint64);
@@ -405,15 +403,13 @@ int hv_synic_cleanup(unsigned int cpu)
put_cpu_ptr(hv_cpu);
}
 
-   hv_get_synint_state(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT,
-   shared_sint.as_uint64);
+   hv_get_synint_state(VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
 
shared_sint.masked = 1;
 
/* Need to correctly cleanup in the case of SMP!!! */
/* Disable the interrupt */
-   hv_set_synint_state(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT,
-   shared_sint.as_uint64);
+   hv_set_synint_state(VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
 
hv_get_simp(simp.as_uint64);
simp.simp_enabled = 0;
-- 
2.7.4

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


[PATCH char-misc 0/2] Drivers: hv: vmbus: Remove x86-isms in arch independent code

2018-05-07 Thread mhkelley58
From: Michael Kelley 

More changes to cleanly separate architecture independent code from
architecture dependent code.  The first patch moves x86-specific code
out of the Hyper-V architecture independent drivers and into the arch/x86
directory.  The second patch removes the string "X64" from symbol names
that aren't x86/x64-specific.

These changes are preparation for supporting Hyper-V on ARM64.

Michael Kelley (2):
  Drivers: hv: vmbus: Remove x86 MSR refs in arch independent code
  Drivers: hv: vmbus: Make TLFS #define names architecture neutral

 arch/x86/hyperv/hv_init.c  |  4 ++--
 arch/x86/include/asm/hyperv-tlfs.h | 12 ++--
 arch/x86/include/asm/mshyperv.h| 12 
 arch/x86/kernel/cpu/mshyperv.c |  4 ++--
 drivers/hv/hv.c| 30 +-
 5 files changed, 31 insertions(+), 31 deletions(-)

-- 
2.7.4

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


[PATCHv2] staging: speakup: Add pause command used on switching to graphical mode

2018-05-07 Thread Samuel Thibault
For software speech syntheses to be able to manage concurrent audio card
access, they need to know when speakup stops emitting text to be spoken
because the console has switched to graphical mode.  This introduces a
PAUSE command to do so.

Signed-off-by: Samuel Thibault 

---
Difference from v1: fix codestyle issues.

 drivers/staging/speakup/buffers.c   |4 
 drivers/staging/speakup/main.c  |6 ++
 drivers/staging/speakup/speakup.h   |3 ++-
 drivers/staging/speakup/speakup_dummy.c |1 +
 drivers/staging/speakup/speakup_soft.c  |3 ++-
 drivers/staging/speakup/spk_types.h |2 +-
 drivers/staging/speakup/varhandlers.c   |1 +
 7 files changed, 17 insertions(+), 3 deletions(-)

--- a/drivers/staging/speakup/speakup_dummy.c
+++ b/drivers/staging/speakup/speakup_dummy.c
@@ -21,6 +21,7 @@
 static struct var_t vars[] = {
{ CAPS_START, .u.s = {"CAPS_START\n" } },
{ CAPS_STOP, .u.s = {"CAPS_STOP\n" } },
+   { PAUSE, .u.s = {"PAUSE\n"} },
{ RATE, .u.n = {"RATE %d\n", 8, 1, 16, 0, 0, NULL } },
{ PITCH, .u.n = {"PITCH %d\n", 8, 0, 16, 0, 0, NULL } },
{ VOL, .u.n = {"VOL %d\n", 8, 0, 16, 0, 0, NULL } },
--- a/drivers/staging/speakup/speakup_soft.c
+++ b/drivers/staging/speakup/speakup_soft.c
@@ -35,6 +35,7 @@ static int misc_registered;
 static struct var_t vars[] = {
{ CAPS_START, .u.s = {"\x01+3p" } },
{ CAPS_STOP, .u.s = {"\x01-3p" } },
+   { PAUSE, .u.n = {"\x01P" } },
{ RATE, .u.n = {"\x01%ds", 2, 0, 9, 0, 0, NULL } },
{ PITCH, .u.n = {"\x01%dp", 5, 0, 9, 0, 0, NULL } },
{ VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } },
@@ -154,7 +155,7 @@ static char *get_initstring(void)
var = synth_soft.vars;
while (var->var_id != MAXVARS) {
if (var->var_id != CAPS_START && var->var_id != CAPS_STOP &&
-   var->var_id != DIRECT)
+   var->var_id != PAUSE && var->var_id != DIRECT)
cp = cp + sprintf(cp, var->u.n.synth_fmt,
  var->u.n.value);
var++;
--- a/drivers/staging/speakup/spk_types.h
+++ b/drivers/staging/speakup/spk_types.h
@@ -42,7 +42,7 @@ enum var_id_t {
SAY_CONTROL, SAY_WORD_CTL, NO_INTERRUPT, KEY_ECHO,
SPELL_DELAY, PUNC_LEVEL, READING_PUNC,
ATTRIB_BLEEP, BLEEPS,
-   RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT,
+   RATE, PITCH, VOL, TONE, PUNCT, VOICE, FREQUENCY, LANG, DIRECT, PAUSE,
CAPS_START, CAPS_STOP, CHARTAB,
MAXVARS
 };
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -45,6 +45,7 @@ static struct st_var_header var_headers[
{ "lang", LANG, VAR_NUM, NULL, NULL },
{ "chartab", CHARTAB, VAR_PROC, NULL, NULL },
{ "direct", DIRECT, VAR_NUM, NULL, NULL },
+   { "pause", PAUSE, VAR_STRING, spk_str_pause, NULL },
 };
 
 static struct st_var_header *var_ptrs[MAXVARS] = { NULL, NULL, NULL };
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -67,6 +67,8 @@ short spk_punc_mask;
 int spk_punc_level, spk_reading_punc;
 char spk_str_caps_start[MAXVARLEN + 1] = "\0";
 char spk_str_caps_stop[MAXVARLEN + 1] = "\0";
+char spk_str_pause[MAXVARLEN + 1] = "\0";
+bool spk_paused;
 const struct st_bits_data spk_punc_info[] = {
{"none", "", 0},
{"some", "/$%&@", SOME},
@@ -1780,6 +1782,10 @@ static void speakup_con_update(struct vc
/* Speakup output, discard */
return;
speakup_date(vc);
+   if (vc->vc_mode == KD_GRAPHICS && !spk_paused && spk_str_pause[0]) {
+   synth_printf("%s", spk_str_pause);
+   spk_paused = 1;
+   }
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 }
 
--- a/drivers/staging/speakup/speakup.h
+++ b/drivers/staging/speakup/speakup.h
@@ -94,7 +94,8 @@ extern struct spk_synth *synth;
 extern char spk_pitch_buff[];
 extern u_char *spk_our_keys[];
 extern short spk_punc_masks[];
-extern char spk_str_caps_start[], spk_str_caps_stop[];
+extern char spk_str_caps_start[], spk_str_caps_stop[], spk_str_pause[];
+extern bool spk_paused;
 extern const struct st_bits_data spk_punc_info[];
 extern u_char spk_key_buf[600];
 extern char *spk_characters[];
--- a/drivers/staging/speakup/buffers.c
+++ b/drivers/staging/speakup/buffers.c
@@ -77,6 +77,10 @@ void synth_buffer_add(u16 ch)
*buff_in++ = ch;
if (buff_in > buffer_end)
buff_in = synth_buffer;
+   /* We have written something to the speech synthesis, so we are not
+* paused any more.
+*/
+   spk_paused = 0;
 }
 
 u16 synth_buffer_getc(void)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/7] staging: ks7010: Remove unused variables

2018-05-07 Thread Nathan Chancellor
On Sun, May 06, 2018 at 03:02:59PM -0700, Nathan Chancellor wrote:
> GCC warns these variables are all set but never used so remove them.
> 
> Signed-off-by: Nathan Chancellor 
> ---
>  drivers/staging/ks7010/ks_hostif.c | 12 +---
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks_hostif.c 
> b/drivers/staging/ks7010/ks_hostif.c
> index c0a9a67dc0b4..4c2f8f710c6e 100644
> --- a/drivers/staging/ks7010/ks_hostif.c
> +++ b/drivers/staging/ks7010/ks_hostif.c
> @@ -354,7 +354,6 @@ void hostif_data_indication(struct ks_wlan_private *priv)
>   unsigned short auth_type;
>   unsigned char temp[256];
>   struct ether_hdr *eth_hdr;
> - unsigned short eth_proto;
>   struct ieee802_1x_hdr *aa1x_hdr;
>   size_t size;
>   int ret;
> @@ -369,7 +368,6 @@ void hostif_data_indication(struct ks_wlan_private *priv)
>   get_word(priv); /* Reserve Area */
>  
>   eth_hdr = (struct ether_hdr *)(priv->rxp);
> - eth_proto = ntohs(eth_hdr->h_proto);
>  
>   /* source address check */
>   if (ether_addr_equal(&priv->eth_addr[0], eth_hdr->h_source)) {
> @@ -464,13 +462,9 @@ void hostif_mib_get_confirm(struct ks_wlan_private *priv)
>   struct net_device *dev = priv->net_dev;
>   u32 mib_status;
>   u32 mib_attribute;
> - u16 mib_val_size;
> - u16 mib_val_type;
>  
>   mib_status = get_dword(priv);   /* MIB status */
>   mib_attribute = get_dword(priv);/* MIB atttibute */
> - mib_val_size = get_word(priv);  /* MIB value size */
> - mib_val_type = get_word(priv);  /* MIB value type */
>  
>   if (mib_status) {
>   netdev_err(priv->net_dev, "attribute=%08X, status=%08X\n",
> @@ -792,9 +786,6 @@ void hostif_ps_adhoc_set_confirm(struct ks_wlan_private 
> *priv)
>  static
>  void hostif_infrastructure_set_confirm(struct ks_wlan_private *priv)
>  {
> - u16 result_code;
> -
> - result_code = get_word(priv);
>   priv->infra_status = 1; /* infrastructure mode set */
>   hostif_sme_enqueue(priv, SME_MODE_SET_CONFIRM);
>  }
> @@ -872,14 +863,13 @@ static
>  void hostif_phy_information_confirm(struct ks_wlan_private *priv)
>  {
>   struct iw_statistics *wstats = &priv->wstats;
> - unsigned char rssi, signal, noise;
> + unsigned char rssi, signal;
>   unsigned char link_speed;
>   unsigned int transmitted_frame_count, received_fragment_count;
>   unsigned int failed_count, fcs_error_count;
>  
>   rssi = get_byte(priv);
>   signal = get_byte(priv);
> - noise = get_byte(priv);
>   link_speed = get_byte(priv);
>   transmitted_frame_count = get_dword(priv);
>   received_fragment_count = get_dword(priv);
> -- 
> 2.17.0
> 

On second glance, I did not realize most of these functions involve
pointer semantics. Please do not apply this. I can send a v2 series if
necessary although every other patch is fine.

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


Re: [PATCH 1/2] staging: android: ion: Fix license identifier comment format

2018-05-07 Thread Laura Abbott

On 05/07/2018 07:40 AM, Nathan Chancellor wrote:

On Mon, May 07, 2018 at 06:37:52AM -0700, Laura Abbott wrote:

On 05/06/2018 06:18 PM, Nathan Chancellor wrote:

checkpatch.pl complains these are invalid because the rules in
Documentation/process/license-rules.rst state that C headers should
have "/* */" style comments.



The SPDX markings are special, but I don't see anything from a
quick read of the SPDX specification that says they have to use //.
I think this is going to generate a lot of possible noise so it
might be worth adjusting checkpatch.

Thanks,
Laura


Under section 2 of "License identifier syntax" in the license rules
file, it shows the preferred style for each type of file. Apparently
there was some build breakage with // in header files so I assume they
want /* */ for uniformity sake.

Thanks!
Nathan



Ah thanks for pointing me to that. I parsed your commit text completely
wrong. My biggest concern is being consistent and not breaking anything
so assuming this patch aligns with that:

Acked-by: Laura Abbott 




Signed-off-by: Nathan Chancellor 
---
   drivers/staging/android/ion/ion.h  | 2 +-
   drivers/staging/android/uapi/ion.h | 2 +-
   2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index ea0897812780..16cbd38a7160 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
   /*
* drivers/staging/android/ion/ion.h
*
diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index 825d3e95ccd3..5d7009884c13 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
   /*
* drivers/staging/android/uapi/ion.h
*





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


[PATCH v3 13/14] media: imx7.rst: add documentation for i.MX7 media driver

2018-05-07 Thread Rui Miguel Silva
Add rst document to describe the i.MX7 media driver and also a working example
from the Warp7 board usage with a OV2680 sensor.

Signed-off-by: Rui Miguel Silva 
---
 Documentation/media/v4l-drivers/imx7.rst  | 157 ++
 Documentation/media/v4l-drivers/index.rst |   1 +
 2 files changed, 158 insertions(+)
 create mode 100644 Documentation/media/v4l-drivers/imx7.rst

diff --git a/Documentation/media/v4l-drivers/imx7.rst 
b/Documentation/media/v4l-drivers/imx7.rst
new file mode 100644
index ..64b97b442277
--- /dev/null
+++ b/Documentation/media/v4l-drivers/imx7.rst
@@ -0,0 +1,157 @@
+i.MX7 Video Capture Driver
+==
+
+Introduction
+
+
+The i.MX7 contrary to the i.MX5/6 family does not contain an Image Processing
+Unit (IPU), because of that the capabilities to perform operations or
+manipulation of the capture frames is less feature rich.
+
+For image capture the i.MX7 have three units:
+- CMOS Sensor Interface (CSI)
+- Video Multiplexer
+- MIPI CSI-2 Receiver
+
+::
+   |\
+   MIPI Camera Input ---> MIPI CSI-2 --- > | \
+   |  \
+   | M |
+   | U | -->  CSI ---> Capture
+   | X |
+   |  /
+   Parallel Camera Input > | /
+   |/
+
+For additional information, please refer to the latest versions of the i.MX7
+reference manual [#f1]_.
+
+Entities
+
+
+imx7-mipi-csi2
+--
+
+This is the MIPI CSI-2 recevier entity. It has one sink pad to receive the 
pixel
+data from MIPI CSI-2 camera sensor. It has one source pad, corresponding to the
+virtual channel 0. This module is compliant to previous version of Samsung
+D-phy, and support two D-PHY Rx Data lanes.
+
+csi_mux
+---
+
+This is the video multiplexer. It has two sink pads to select from either 
camera
+sensors with a parallel interface or from MIPI CSI-2 virtual channel 0.  It has
+a single source pad that routes to the CSI.
+
+csi
+---
+
+The CSI enables the chip to connect directly to external CMOS image sensor. CSI
+can interfaces directly with Parallel and MIPI CSI-2 buses. It has 256 x 64 
FIFO
+to store received image pixel data and embedded DMA controllers to transfer 
data
+from the FIFO through AHB bus.
+
+This entity has one sink pad that receive from the csi_mux entity and a single
+source pad that route video frames directly to memory buffers, this pad is
+routed to a capture device node.
+
+Usage Notes
+---
+
+To aid in configuration and for backward compatibility with V4L2 applications
+that access controls only from video device nodes, the capture device 
interfaces
+inherit controls from the active entities in the current pipeline, so controls
+can be accessed either directly from the subdev or from the active capture
+device interface. For example, the sensor controls are available either from 
the
+sensor subdevs or from the active capture device.
+
+Warp7 with OV2680
+-
+
+On this platform an OV2680 MIPI CSI-2 module is connected to the internal MIPI
+CSI-2 receiver. The following example configures a video capture pipeline with
+an output of 800x600, and BGGR 10 bit bayer format:
+
+.. code-block:: none
+   # Setup links
+   media-ctl -l "'ov2680 1-0036':0 -> 'imx7-mipi-csis.0':0[1]"
+   media-ctl -l "'imx7-mipi-csis.0':1 -> 'csi_mux':1[1]"
+   media-ctl -l "'csi_mux':2 -> 'csi':0[1]"
+   media-ctl -l "'csi':1 -> 'csi capture':0[1]"
+
+   # Configure pads for pipeline
+   media-ctl -V "'ov2680 1-0036':0 [fmt:SBGGR10_1X10/800x600 field:none]"
+   media-ctl -V "'csi_mux':1 [fmt:SBGGR10_1X10/800x600 field:none]"
+   media-ctl -V "'csi_mux':2 [fmt:SBGGR10_1X10/800x600 field:none]"
+   media-ctl -V "'imx7-mipi-csis.0':0 [fmt:SBGGR10_1X10/800x600 field:none]"
+   media-ctl -V "'csi':0 [fmt:SBGGR10_1X10/800x600 field:none]"
+
+After this streaming can start, the v4l2-ctl tool can be used to select any of
+the resolutions supported by the sensor.
+
+.. code-block:: none
+root@imx7s-warp:~# media-ctl -p
+Media controller API version 4.17.0
+
+Media device information
+
+driver  imx-media
+model   imx-media
+serial
+bus info
+hw revision 0x0
+driver version  4.17.0
+
+Device topology
+- entity 1: csi (2 pads, 2 links)
+   type V4L2 subdev subtype Unknown flags 0
+   device node name /dev/v4l-subdev0
+   pad0: Sink
+   [fmt:SBGGR10_1X10/800x600 field:none]
+   <- "csi_mux":2 [ENABLED]
+   pad1: Source
+   [fmt:SBGGR10_1X10/800x600 field:none]
+   -> "csi capture":0 [ENABLED]
+
+- entity 4: csi capture (1 pad, 1 link)
+   type Node subtype V4

[PATCH v3 12/14] ARM: dts: imx7s-warp: add ov2680 sensor node

2018-05-07 Thread Rui Miguel Silva
Warp7 comes with a Omnivision OV2680 sensor, add the node here to make complete
the camera data path for this system. Add the needed regulator to the analog
voltage supply.

Signed-off-by: Rui Miguel Silva 
---
 arch/arm/boot/dts/imx7s-warp.dts | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s-warp.dts b/arch/arm/boot/dts/imx7s-warp.dts
index ffd170ae925a..10df24c05b76 100644
--- a/arch/arm/boot/dts/imx7s-warp.dts
+++ b/arch/arm/boot/dts/imx7s-warp.dts
@@ -91,6 +91,14 @@
regulator-always-on;
};
 
+   reg_peri_3p15v: regulator-peri-3p15v {
+   compatible = "regulator-fixed";
+   regulator-name = "peri_3p15v_reg";
+   regulator-min-microvolt = <315>;
+   regulator-max-microvolt = <315>;
+   regulator-always-on;
+   };
+
sound {
compatible = "simple-audio-card";
simple-audio-card,name = "imx7-sgtl5000";
@@ -218,6 +226,25 @@
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
+
+   ov2680: camera@36 {
+   compatible = "ovti,ov2680";
+   reg = <0x36>;
+   clocks = <&osc>;
+   clock-names = "xvclk";
+   reset-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
+   DOVDD-supply = <&sw2_reg>;
+   DVDD-supply = <&sw2_reg>;
+   AVDD-supply = <®_peri_3p15v>;
+
+   port {
+   ov2680_to_mipi: endpoint {
+   remote-endpoint = <&mipi_from_sensor>;
+   clock-lanes = <0>;
+   data-lanes = <1>;
+   };
+   };
+   };
 };
 
 &i2c4 {
-- 
2.17.0

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


[PATCH v3 10/14] ARM: dts: imx7: Add video mux, csi and mipi_csi and connections

2018-05-07 Thread Rui Miguel Silva
This patch adds the device tree nodes for csi, video multiplexer and mipi-csi
besides the graph connecting the necessary endpoints to make the media capture
entities to work in imx7 Warp board.

Also add the pin control related with the mipi_csi in that board.

Signed-off-by: Rui Miguel Silva 
---
 arch/arm/boot/dts/imx7s-warp.dts | 78 
 arch/arm/boot/dts/imx7s.dtsi | 28 
 2 files changed, 106 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s-warp.dts b/arch/arm/boot/dts/imx7s-warp.dts
index 8a30b148534d..ffd170ae925a 100644
--- a/arch/arm/boot/dts/imx7s-warp.dts
+++ b/arch/arm/boot/dts/imx7s-warp.dts
@@ -310,6 +310,77 @@
status = "okay";
 };
 
+&gpr {
+   csi_mux {
+   compatible = "video-mux";
+   mux-controls = <&mux 0>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   csi_mux_from_parallel_sensor: endpoint {
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   csi_mux_from_mipi_vc0: endpoint {
+   remote-endpoint = <&mipi_vc0_to_csi_mux>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+
+   csi_mux_to_csi: endpoint {
+   remote-endpoint = <&csi_from_csi_mux>;
+   };
+   };
+   };
+};
+
+&csi {
+   status = "okay";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   csi_from_csi_mux: endpoint {
+   remote-endpoint = <&csi_mux_to_csi>;
+   };
+   };
+};
+
+&mipi_csi {
+   clock-frequency = <16600>;
+   status = "okay";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   fsl,csis-hs-settle = <3>;
+
+   port@0 {
+   reg = <0>;
+
+   mipi_from_sensor: endpoint {
+   remote-endpoint = <&ov2680_to_mipi>;
+   data-lanes = <1>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   mipi_vc0_to_csi_mux: endpoint {
+   remote-endpoint = <&csi_mux_from_mipi_vc0>;
+   };
+   };
+};
+
 &wdog1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_wdog>;
@@ -357,6 +428,13 @@
>;
};
 
+   pinctrl_mipi_csi: mipi_csi {
+   fsl,pins = <
+   MX7D_PAD_LPSR_GPIO1_IO03__GPIO1_IO3 0x14
+   MX7D_PAD_ENET1_RGMII_TD0__GPIO7_IO6 0x14
+   >;
+   };
+
pinctrl_sai1: sai1grp {
fsl,pins = <
MX7D_PAD_SAI1_RX_DATA__SAI1_RX_DATA00x1f
diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 3590dab529f9..0bae41f2944c 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "imx7d-pinfunc.h"
 
 / {
@@ -738,6 +739,17 @@
status = "disabled";
};
 
+   csi: csi@3071 {
+   compatible = "fsl,imx7-csi";
+   reg = <0x3071 0x1>;
+   interrupts = ;
+   clocks = <&clks IMX7D_CLK_DUMMY>,
+   <&clks IMX7D_CSI_MCLK_ROOT_CLK>,
+   <&clks IMX7D_CLK_DUMMY>;
+   clock-names = "axi", "mclk", "dcic";
+   status = "disabled";
+   };
+
lcdif: lcdif@3073 {
compatible = "fsl,imx7d-lcdif", 
"fsl,imx28-lcdif";
reg = <0x3073 0x1>;
@@ -747,6 +759,22 @@
clock-names = "pix", "axi";
status = "disabled";
};
+
+   mipi_csi: mipi-csi@3075 {
+   compatible = "fsl,imx7-mipi-csi2";
+   reg = <0x3075 0x1>;
+   interrupts = ;
+   clocks = <&clks IMX7D_IPG_ROOT_CLK>,
+   <&clks IMX7D_MIPI_CSI_ROOT_CLK>,
+   <&clks 
IMX7D_MIPI_DPHY_ROOT_CLK>;
+   clock-names = "pclk", "wrap", "phy";
+   power-domains = <&pgc_mipi_phy>;
+   phy-supply = <®_1p0d>;
+   resets = <&src IMX7_RESET_MIPI_PHY_MRST>;
+   

[PATCH v3 06/14] media: staging/imx: add imx7 capture subsystem

2018-05-07 Thread Rui Miguel Silva
Add imx7 capture subsystem to imx-media core to allow the use some of the
existing modules for i.MX5/6 with i.MX7 SoC.

Since i.MX7 does not have an IPU, add driver data with unset ipu_present flag
that change some runtime behaviors.

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/imx-media-dev.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/media/imx/imx-media-dev.c 
b/drivers/staging/media/imx/imx-media-dev.c
index b019dcefccd6..55fe0321edc0 100644
--- a/drivers/staging/media/imx/imx-media-dev.c
+++ b/drivers/staging/media/imx/imx-media-dev.c
@@ -561,8 +561,13 @@ static const struct imx_media_driver_data imx6_drvdata = {
.ipu_present = true,
 };
 
+static const struct imx_media_driver_data imx7_drvdata = {
+   .ipu_present = false,
+};
+
 static const struct of_device_id imx_media_dt_ids[] = {
{ .compatible = "fsl,imx-capture-subsystem", .data = &imx6_drvdata },
+   { .compatible = "fsl,imx7-capture-subsystem", .data = &imx7_drvdata },
{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, imx_media_dt_ids);
-- 
2.17.0

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


[PATCH v3 03/14] clk: imx7d: fix mipi dphy div parent

2018-05-07 Thread Rui Miguel Silva
Fix the mipi dphy root divider to mipi_dphy_pre_div, this would remove a orphan
clock and set the correct parent.

before:
cat clk_orphan_summary
 enable  prepare  protect
   clock  countcountcountrate   
accuracy   phase

 mipi_dphy_post_div   110   0  
0 0
mipi_dphy_root_clk110   0  
0 0

cat clk_dump | grep mipi_dphy
mipi_dphy_post_div110   0  
0 0
mipi_dphy_root_clk110   0  
0 0

after:
cat clk_dump | grep mipi_dphy
   mipi_dphy_src 1102400  0 0
   mipi_dphy_cg  1102400  0 0
  mipi_dphy_pre_div  1102400  0 0
 mipi_dphy_post_div  1102400  0 0
mipi_dphy_root_clk   1102400  0 0

Fixes: 8f6d8094b215 ("ARM: imx: add imx7d clk tree support")

Cc: linux-...@vger.kernel.org
Acked-by: Dong Aisheng 
Signed-off-by: Rui Miguel Silva 

---
 drivers/clk/imx/clk-imx7d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
index 975a20d3cc94..f7f4db2e6fa6 100644
--- a/drivers/clk/imx/clk-imx7d.c
+++ b/drivers/clk/imx/clk-imx7d.c
@@ -729,7 +729,7 @@ static void __init imx7d_clocks_init(struct device_node 
*ccm_node)
clks[IMX7D_LCDIF_PIXEL_ROOT_DIV] = 
imx_clk_divider2("lcdif_pixel_post_div", "lcdif_pixel_pre_div", base + 0xa300, 
0, 6);
clks[IMX7D_MIPI_DSI_ROOT_DIV] = imx_clk_divider2("mipi_dsi_post_div", 
"mipi_dsi_pre_div", base + 0xa380, 0, 6);
clks[IMX7D_MIPI_CSI_ROOT_DIV] = imx_clk_divider2("mipi_csi_post_div", 
"mipi_csi_pre_div", base + 0xa400, 0, 6);
-   clks[IMX7D_MIPI_DPHY_ROOT_DIV] = imx_clk_divider2("mipi_dphy_post_div", 
"mipi_csi_dphy_div", base + 0xa480, 0, 6);
+   clks[IMX7D_MIPI_DPHY_ROOT_DIV] = imx_clk_divider2("mipi_dphy_post_div", 
"mipi_dphy_pre_div", base + 0xa480, 0, 6);
clks[IMX7D_SAI1_ROOT_DIV] = imx_clk_divider2("sai1_post_div", 
"sai1_pre_div", base + 0xa500, 0, 6);
clks[IMX7D_SAI2_ROOT_DIV] = imx_clk_divider2("sai2_post_div", 
"sai2_pre_div", base + 0xa580, 0, 6);
clks[IMX7D_SAI3_ROOT_DIV] = imx_clk_divider2("sai3_post_div", 
"sai3_pre_div", base + 0xa600, 0, 6);
-- 
2.17.0

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


[PATCH v3 14/14] media: staging/imx: add i.MX7 entries to TODO file

2018-05-07 Thread Rui Miguel Silva
Add some i.MX7 related entries to TODO file.

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/TODO | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/staging/media/imx/TODO b/drivers/staging/media/imx/TODO
index aeeb15494a49..6f29b5ca5324 100644
--- a/drivers/staging/media/imx/TODO
+++ b/drivers/staging/media/imx/TODO
@@ -45,3 +45,12 @@
 
  Which means a port must not contain mixed-use endpoints, they
  must all refer to media links between V4L2 subdevices.
+
+- i.MX7: all of the above, since it uses the imx media core
+
+- i.MX7: use Frame Interval Monitor
+
+- i.MX7: runtime testing with parallel sensor, links setup and streaming
+
+- i.MX7: runtime testing with different formats, for the time only 10-bit bayer
+  is tested
-- 
2.17.0

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


[PATCH v3 04/14] clk: imx7d: reset parent for mipi csi root

2018-05-07 Thread Rui Miguel Silva
To guarantee that we do not get Overflow in image FIFO the outer bandwidth has
to be faster than inputer bandwidth. For that it must be possible to set a
faster frequency clock. So set new parent to sys_pfd3 clock for the mipi csi
block.

Cc: linux-...@vger.kernel.org
Acked-by: Shawn Guo 
Signed-off-by: Rui Miguel Silva 
---
 drivers/clk/imx/clk-imx7d.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
index f7f4db2e6fa6..27877d05faa2 100644
--- a/drivers/clk/imx/clk-imx7d.c
+++ b/drivers/clk/imx/clk-imx7d.c
@@ -891,6 +891,8 @@ static void __init imx7d_clocks_init(struct device_node 
*ccm_node)
clk_set_parent(clks[IMX7D_PLL_AUDIO_MAIN_BYPASS], 
clks[IMX7D_PLL_AUDIO_MAIN]);
clk_set_parent(clks[IMX7D_PLL_VIDEO_MAIN_BYPASS], 
clks[IMX7D_PLL_VIDEO_MAIN]);
 
+   clk_set_parent(clks[IMX7D_MIPI_CSI_ROOT_SRC], 
clks[IMX7D_PLL_SYS_PFD3_CLK]);
+
/* use old gpt clk setting, gpt1 root clk must be twice as gpt counter 
freq */
clk_set_parent(clks[IMX7D_GPT1_ROOT_SRC], clks[IMX7D_OSC_24M_CLK]);
 
-- 
2.17.0

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


Re: [PATCH v2 08/15] media: dt-bindings: add bindings for i.MX7 media driver

2018-05-07 Thread Rui Miguel Silva

Hi Rob,
Thanks for the review and sorry for the late reply.
Meanwhile I have send v3 of this series with some of yours 
comments
incorporated. 


On Fri 27 Apr 2018 at 19:06, Rob Herring wrote:
On Mon, Apr 23, 2018 at 02:47:43PM +0100, Rui Miguel Silva 
wrote:

Add bindings documentation for i.MX7 media drivers.

Signed-off-by: Rui Miguel Silva 
---
 .../devicetree/bindings/media/imx7.txt| 158 
 ++

 1 file changed, 158 insertions(+)
 create mode 100644 
 Documentation/devicetree/bindings/media/imx7.txt


diff --git a/Documentation/devicetree/bindings/media/imx7.txt 
b/Documentation/devicetree/bindings/media/imx7.txt

new file mode 100644
index ..7e058ea25102
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/imx7.txt
@@ -0,0 +1,158 @@
+Freescale i.MX7 Media Video Device
+==
+
+Video Media Controller node
+---
+
+This is the media controller node for video capture support. 
It is a
+virtual device that lists the camera serial interface nodes 
that the

+media device will control.
+
+Required properties:
+- compatible : "fsl,imx7-capture-subsystem";
+- ports  : Should contain a list of phandles pointing to 
camera

+   sensor interface port of CSI
+
+example:
+
+capture-subsystem {
+   compatible = "fsl,imx7-capture-subsystem";
+   ports = <&csi>;


Why do you need this node? Just have the driver match on the CSI 
node.


This is for the parsing of the nodes done in imx media core, see 
also

the imx.txt file.




+};
+
+
+mipi_csi2 node
+--
+
+This is the device node for the MIPI CSI-2 receiver core in 
i.MX7 SoC. It is

+compatible with previous version of Samsung D-phy.


Compatible with Samsung?


+
+Required properties:
+
+- compatible: "fsl,imx7-mipi-csi2";
+- reg   : base address and length of the register set 
for the device;

+- interrupts: should contain MIPI CSIS interrupt;
+- clocks: list of clock specifiers, see
+ 
Documentation/devicetree/bindings/clock/clock-bindings.txt for 
details;
+- clock-names   : must contain "mipi" and "phy" entries, 
matching entries in the

+  clock property;
+- power-domains : a phandle to the power domain, see
+ 
Documentation/devicetree/bindings/power/power_domain.txt for 
details.

+- reset-names   : should include following entry "mrst";
+- resets: a list of phandle, should contain reset 
entry of

+  reset-names;
+- phy-supply: from the generic phy bindings, a phandle to 
a regulator that

+ provides power to VBUS;


VBUS? Copy-n-paste from USB something?


yeah, c-n-p error.



+- bus-width : maximum number of data lanes supported (SoC 
specific);


Don't we have a standard lanes property for CSI (or DSI)? 
bus-width is 
for parallel buses and goes in endpoint nodes. (But maybe it got 
used 
here too).



+
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency 
in Hz, default
+		value when this property is not specified is 
166 MHz;

+
+port node
+-
+
+- reg		  : (required) can take the values 0 or 1, 
where 0 is the
+ related sink port and port 1 should be 
the source one;

+
+endpoint node
+-
+
+- data-lanes: (required) an array specifying active 
physical MIPI-CSI2
+		data input lanes and their mapping to logical 
lanes; the
+		array's content is unused, only its length is 
meaningful;


Ah yes, like this. :) So why do you need bus-width too?


To guarantee that the active lanes are not bigger that the ones
supported in the specific SoC. So, the bus-width defines the lanes
supported and this the active ones.




+
+- csis-hs-settle : (optional) differential receiver (HS-RX) 
settle time;


units?


+- csis-clk-settle : (optional) D-PHY control register;
+- csis-wclk : CSI-2 wrapper clock selection. If this 
property is present
+		  external clock from CMU will be used, or the bus 
clock if

+ if it's not specified.


boolean?


I dropped this in v3.



These 3 need vendor properties.


Sure, added in v3




+
+example:
+
+   mipi_csi: mipi-csi@3075 {
+clock-frequency = <16600>;
+status = "okay";
+#address-cells = <1>;
+#size-cells = <0>;
+
+   compatible = "fsl,imx7-mipi-csi2";
+   reg = <0x3075 0x1>;
+   interrupts = ;
+   clocks = <&clks IMX7D_MIPI_CSI_ROOT_CLK>,
+   <&clks IMX7D_MIPI_DPHY_ROOT_CLK>;
+   clock-names = "mipi", "phy";
+   power-domains = <&pgc_mipi_phy>;
+   phy-supply = <®_1p0d>;
+   resets = <&src IMX7_RESET_MIPI_PHY_MRST>;
+   reset-names = "mrst";
+   bus-width = <4>;
+   status = "disabled";
+
+port@0 {
+reg = <0>;
+
+

[PATCH v3 01/14] media: staging/imx: add support to media dev for no IPU systems

2018-05-07 Thread Rui Miguel Silva
Some i.MX SoC do not have IPU, like the i.MX7, add to the the media device
infrastructure support to be used in this type of systems that do not have
internal subdevices besides the CSI.

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/imx-media-dev.c | 38 ---
 .../staging/media/imx/imx-media-internal-sd.c |  3 ++
 drivers/staging/media/imx/imx-media.h |  3 ++
 3 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-dev.c 
b/drivers/staging/media/imx/imx-media-dev.c
index f67ec8e27093..b019dcefccd6 100644
--- a/drivers/staging/media/imx/imx-media-dev.c
+++ b/drivers/staging/media/imx/imx-media-dev.c
@@ -27,6 +27,12 @@
 #include 
 #include "imx-media.h"
 
+static const struct of_device_id imx_media_dt_ids[];
+
+struct imx_media_driver_data {
+   bool ipu_present;
+};
+
 static inline struct imx_media_dev *notifier2dev(struct v4l2_async_notifier *n)
 {
return container_of(n, struct imx_media_dev, notifier);
@@ -92,6 +98,9 @@ static int imx_media_get_ipu(struct imx_media_dev *imxmd,
struct ipu_soc *ipu;
int ipu_id;
 
+   if (!imxmd->ipu_present)
+   return 0;
+
ipu = dev_get_drvdata(csi_sd->dev->parent);
if (!ipu) {
v4l2_err(&imxmd->v4l2_dev,
@@ -440,6 +449,8 @@ static const struct media_device_ops imx_media_md_ops = {
 
 static int imx_media_probe(struct platform_device *pdev)
 {
+   const struct imx_media_driver_data *drvdata;
+   const struct of_device_id *of_id;
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
struct imx_media_dev *imxmd;
@@ -481,16 +492,29 @@ static int imx_media_probe(struct platform_device *pdev)
goto notifier_cleanup;
}
 
-   ret = imx_media_add_internal_subdevs(imxmd);
-   if (ret) {
-   v4l2_err(&imxmd->v4l2_dev,
-"add_internal_subdevs failed with %d\n", ret);
+   of_id = of_match_device(imx_media_dt_ids, &pdev->dev);
+   if (!of_id) {
+   v4l2_err(&imxmd->v4l2_dev, "failed to find driver data\n");
goto notifier_cleanup;
}
 
+   drvdata = of_id->data;
+
+   imxmd->ipu_present = drvdata->ipu_present;
+
+   if (imxmd->ipu_present) {
+   ret = imx_media_add_internal_subdevs(imxmd);
+   if (ret) {
+   v4l2_err(&imxmd->v4l2_dev,
+"add_internal_subdevs failed with %d\n", ret);
+   goto notifier_cleanup;
+   }
+   }
+
/* no subdevs? just bail */
if (imxmd->notifier.num_subdevs == 0) {
ret = -ENODEV;
+   v4l2_err(&imxmd->v4l2_dev, "no subdevs\n");
goto notifier_cleanup;
}
 
@@ -533,8 +557,12 @@ static int imx_media_remove(struct platform_device *pdev)
return 0;
 }
 
+static const struct imx_media_driver_data imx6_drvdata = {
+   .ipu_present = true,
+};
+
 static const struct of_device_id imx_media_dt_ids[] = {
-   { .compatible = "fsl,imx-capture-subsystem" },
+   { .compatible = "fsl,imx-capture-subsystem", .data = &imx6_drvdata },
{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, imx_media_dt_ids);
diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c 
b/drivers/staging/media/imx/imx-media-internal-sd.c
index 0fdc45dbfb76..2bcdc232369a 100644
--- a/drivers/staging/media/imx/imx-media-internal-sd.c
+++ b/drivers/staging/media/imx/imx-media-internal-sd.c
@@ -238,6 +238,9 @@ int imx_media_create_internal_links(struct imx_media_dev 
*imxmd,
struct media_pad *pad;
int i, j, ret;
 
+   if (!imxmd->ipu_present)
+   return 0;
+
intsd = find_intsd_by_grp_id(sd->grp_id);
if (!intsd)
return -ENODEV;
diff --git a/drivers/staging/media/imx/imx-media.h 
b/drivers/staging/media/imx/imx-media.h
index 44532cd5b812..d40538ecf176 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -147,6 +147,9 @@ struct imx_media_dev {
 
/* for async subdev registration */
struct v4l2_async_notifier notifier;
+
+   /* indicator to if the system has IPU */
+   bool ipu_present;
 };
 
 enum codespace_sel {
-- 
2.17.0

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


[PATCH v3 00/14] media: staging/imx7: add i.MX7 media driver

2018-05-07 Thread Rui Miguel Silva
Hi,
This series introduces the Media driver to work with the i.MX7 SoC. it uses the
already existing imx media core drivers but since the i.MX7, contrary to
i.MX5/6, do not have an IPU and because of that some changes in the imx media
core are made along this series to make it support that case.

This patches adds CSI and MIPI-CSI2 drivers for i.MX7, along with several
configurations changes for this to work as a capture subsystem. Some bugs are
also fixed along the line. And necessary documentation.

For a more detailed view of the capture paths, pads links in the i.MX7 please
take a look at the documentation in PATCH 14.

The system used to test and develop this was the Warp7 board with an OV2680
sensor, which output format is 10-bit bayer. So, only MIPI interface was
tested, a scenario with an parallel input would nice to have.

*Important note*, this code depends on Steve Longerbeam series [0]:
[PATCH v3 00/13] media: imx: Switch to subdev notifiers
which the merging status is not clear to me, but the changes in there make
senses to this series

Bellow goes an example of the output of the pads and links and the output of
v4l2-compliance testing.

The v4l-utils version used is:
v4l2-compliance SHA   : 47d43b130dc6e9e0edc900759fb37649208371e4 from Apr 4th.

The Media Driver fail some tests but this failures are coming from code out of
scope of this series (video-mux, imx-capture), and some from the sensor OV2680
but that I think not related with the sensor driver but with the testing and
core.

The csi and mipi-csi entities pass all compliance tests.

Cheers,
Rui
[0]: https://www.mail-archive.com/linux-media@vger.kernel.org/msg128015.html

v2->v3:
Philipp Zabel:
 - use of_match_device in imx-media-dev instead of of_device_match
 - fix number of data lanes from 4 to 2
 - change the clock definitions and use of mipi
 - move hs-settle from endpoint

Rob Herring:
 - fix phy-supply description
 - add vendor properties
 - fix examples indentations

Stephen Boyd: patch 3/14
 - fix double sign-off
 - add fixes tag

Dong Aisheng: patch 3/14
 - fix double sign-off
 - add Acked-by tag

Shawn Guo:
patch 4/14
 - remove line breakage in parent redifiniton
 - added Acked-by tag

 - dropped CMA area increase and add more verbose information in case of
   dma allocation failure
patch 9/14
 - remove extra line between cells and reg masks

Myself:
 - rework on frame end in csi
 - add rxcount in csi driver
 - add power supplies to ov2680 node and fix gpio polarity

v1->v2:
Dan Carpenter:
 - fix return paths and codes;
 - fix clk_frequency validation and return code;
 - handle the csi remove (release resources that was missing)
 - revert the logic arround the ipu_present flag

Philipp Zabel:
 - drop patch that changed the rgb formats and address the pixel/bus format in
   mipi_csis code.

MySelf:
 - add patch that add ov2680 node to the warp7 dts, so the all data path is
   complete.
 - add linux-clk mailing list to the clock patches cc:

 media-ctl -p
Media controller API version 4.17.0

Media device information

driver  imx-media
model   imx-media
serial
bus info
hw revision 0x0
driver version  4.17.0

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev0
pad0: Sink
[fmt:SBGGR10_1X10/800x600 field:none]
<- "csi_mux":2 [ENABLED]
pad1: Source
[fmt:SBGGR10_1X10/800x600 field:none]
-> "csi capture":0 [ENABLED]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "csi":1 [ENABLED]

- entity 10: csi_mux (3 pads, 2 links)
 type V4L2 subdev subtype Unknown flags 0
 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:unknown/0x0]
pad1: Sink
[fmt:SBGGR10_1X10/800x600 field:none]
<- "imx7-mipi-csis.0":1 [ENABLED]
pad2: Source
[fmt:SBGGR10_1X10/800x600 field:none]
-> "csi":0 [ENABLED]

- entity 14: imx7-mipi-csis.0 (2 pads, 2 links)
 type V4L2 subdev subtype Unknown flags 0
 device node name /dev/v4l-subdev2
pad0: Sink
[fmt:SBGGR10_1X10/800x600 field:none]
<- "ov2680 1-0036":0 [ENABLED]
pad1: Source
[fmt:SBGGR10_1X10/800x600 field:none]
-> "csi_mux":1 [ENABLED]

- entity 17: ov2680 1-0036 (1 pad, 1 link)
 type V4L2 subdev subtype Sensor flags 0
 device node name /dev/v4l-subdev3
pad0: Source
[fmt:SBGGR10_1X10/800x600 field:none]
-> "imx7-mipi-csis.0":0 [ENABLED]

compliance tests:
v4l2-compliance SHA   : 47d43b130dc6e9e0edc900759fb37649208371e4

Compliance test for device /dev/media0:

Media Driver Info:
Driver n

[PATCH v3 02/14] media: staging/imx7: add imx7 CSI subdev driver

2018-05-07 Thread Rui Miguel Silva
This add the media entity subdevice and control driver for the i.MX7 CMOS Sensor
Interface.

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/Kconfig  |9 +-
 drivers/staging/media/imx/Makefile |2 +
 drivers/staging/media/imx/imx7-media-csi.c | 1332 
 3 files changed, 1342 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/media/imx/imx7-media-csi.c

diff --git a/drivers/staging/media/imx/Kconfig 
b/drivers/staging/media/imx/Kconfig
index bfc17de56b17..40a11f988fc6 100644
--- a/drivers/staging/media/imx/Kconfig
+++ b/drivers/staging/media/imx/Kconfig
@@ -11,7 +11,7 @@ config VIDEO_IMX_MEDIA
  driver for the i.MX5/6 SOC.
 
 if VIDEO_IMX_MEDIA
-menu "i.MX5/6 Media Sub devices"
+menu "i.MX5/6/7 Media Sub devices"
 
 config VIDEO_IMX_CSI
tristate "i.MX5/6 Camera Sensor Interface driver"
@@ -20,5 +20,12 @@ config VIDEO_IMX_CSI
---help---
  A video4linux camera sensor interface driver for i.MX5/6.
 
+config VIDEO_IMX7_CSI
+   tristate "i.MX7 Camera Sensor Interface driver"
+   depends on VIDEO_IMX_MEDIA && VIDEO_DEV && I2C
+   default y
+   ---help---
+ A video4linux camera sensor interface driver for i.MX7.
+
 endmenu
 endif
diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index 698a4210316e..771846717146 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -11,3 +11,5 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-ic.o
 
 obj-$(CONFIG_VIDEO_IMX_CSI) += imx-media-csi.o
 obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
+
+obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
b/drivers/staging/media/imx/imx7-media-csi.c
new file mode 100644
index ..a3fb4adc631a
--- /dev/null
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -0,0 +1,1332 @@
+// SPDX-License-Identifier: GPL
+/*
+ * V4L2 Capture CSI Subdev for Freescale i.MX7 SOC
+ *
+ * Copyright (c) 2018 Linaro Ltd
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include "imx-media.h"
+
+#define IMX7_CSI_PAD_SINK  0
+#define IMX7_CSI_PAD_SRC   1
+#define IMX7_CSI_PADS_NUM  2
+
+/* reset values */
+#define CSICR1_RESET_VAL   0x4800
+#define CSICR2_RESET_VAL   0x0
+#define CSICR3_RESET_VAL   0x0
+
+/* csi control reg 1 */
+#define BIT_SWAP16_EN  BIT(31)
+#define BIT_EXT_VSYNC  BIT(30)
+#define BIT_EOF_INT_EN BIT(29)
+#define BIT_PRP_IF_EN  BIT(28)
+#define BIT_CCIR_MODE  BIT(27)
+#define BIT_COF_INT_EN BIT(26)
+#define BIT_SF_OR_INTENBIT(25)
+#define BIT_RF_OR_INTENBIT(24)
+#define BIT_SFF_DMA_DONE_INTEN  BIT(22)
+#define BIT_STATFF_INTEN   BIT(21)
+#define BIT_FB2_DMA_DONE_INTEN  BIT(20)
+#define BIT_FB1_DMA_DONE_INTEN  BIT(19)
+#define BIT_RXFF_INTEN BIT(18)
+#define BIT_SOF_POLBIT(17)
+#define BIT_SOF_INTEN  BIT(16)
+#define BIT_MCLKDIV(0xF << 12)
+#define BIT_HSYNC_POL  BIT(11)
+#define BIT_CCIR_ENBIT(10)
+#define BIT_MCLKEN BIT(9)
+#define BIT_FCCBIT(8)
+#define BIT_PACK_DIR   BIT(7)
+#define BIT_CLR_STATFIFO   BIT(6)
+#define BIT_CLR_RXFIFO BIT(5)
+#define BIT_GCLK_MODE  BIT(4)
+#define BIT_INV_DATA   BIT(3)
+#define BIT_INV_PCLK   BIT(2)
+#define BIT_REDGE  BIT(1)
+#define BIT_PIXEL_BIT  BIT(0)
+
+#define SHIFT_MCLKDIV  12
+
+/* control reg 3 */
+#define BIT_FRMCNT (0x << 16)
+#define BIT_FRMCNT_RST BIT(15)
+#define BIT_DMA_REFLASH_RFFBIT(14)
+#define BIT_DMA_REFLASH_SFFBIT(13)
+#define BIT_DMA_REQ_EN_RFF BIT(12)
+#define BIT_DMA_REQ_EN_SFF BIT(11)
+#define BIT_STATFF_LEVEL   (0x7 << 8)
+#define BIT_HRESP_ERR_EN   BIT(7)
+#define BIT_RXFF_LEVEL (0x7 << 4)
+#define BIT_TWO_8BIT_SENSORBIT(3)
+#define BIT_ZERO_PACK_EN   BIT(2)
+#define BIT_ECC_INT_EN BIT(1)
+#define BIT_ECC_AUTO_ENBIT(0)
+
+#define SHIFT_FRMCNT   16
+#define SHIFT_RXFIFO_LEVEL 4
+
+/* csi status reg */
+#define BIT_ADDR_CH_ERR_INTBIT(28)
+#define BIT_FIELD0_INT BIT(27)
+#define BIT_FIELD1_INT BIT(26)
+#define BIT_SFF_OR_INT BIT(25)
+#define BIT_RFF_OR_INT BIT(24)
+#define BIT_DMA_TSF_DONE_SFF   BIT(22)
+#define BIT_STATFF_INT BIT(21)
+#define BIT_DMA_TSF_DONE_FB2   BIT(20)
+#define BIT_DMA_TSF_DONE_FB1   BIT(19)
+#define BIT_RXFF_INT   BIT(18)
+#define BIT_EOF_INTBIT(17)
+#define BIT_SOF_INTBIT(16)
+#define BIT_F2_INT BIT(15)
+#define BIT_F1_INT BIT(14)
+#define BIT_COF_INTBIT

[PATCH v3 07/14] media: dt-bindings: add bindings for i.MX7 media driver

2018-05-07 Thread Rui Miguel Silva
Add bindings documentation for i.MX7 media drivers.

Signed-off-by: Rui Miguel Silva 
---
 .../devicetree/bindings/media/imx7.txt| 152 ++
 1 file changed, 152 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/imx7.txt

diff --git a/Documentation/devicetree/bindings/media/imx7.txt 
b/Documentation/devicetree/bindings/media/imx7.txt
new file mode 100644
index ..06d723d6354d
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/imx7.txt
@@ -0,0 +1,152 @@
+Freescale i.MX7 Media Video Device
+==
+
+Video Media Controller node
+---
+
+This is the media controller node for video capture support. It is a
+virtual device that lists the camera serial interface nodes that the
+media device will control.
+
+Required properties:
+- compatible : "fsl,imx7-capture-subsystem";
+- ports  : Should contain a list of phandles pointing to camera
+   sensor interface port of CSI
+
+example:
+
+capture-subsystem {
+   compatible = "fsl,imx7-capture-subsystem";
+   ports = <&csi>;
+};
+
+
+mipi_csi2 node
+--
+
+This is the device node for the MIPI CSI-2 receiver core in i.MX7 SoC. It is
+compatible with previous version of Samsung D-phy.
+
+Required properties:
+
+- compatible: "fsl,imx7-mipi-csi2";
+- reg   : base address and length of the register set for the device;
+- interrupts: should contain MIPI CSIS interrupt;
+- clocks: list of clock specifiers, see
+Documentation/devicetree/bindings/clock/clock-bindings.txt for details;
+- clock-names   : must contain "pclk", "wrap" and "phy" entries, matching
+  entries in the clock property;
+- power-domains : a phandle to the power domain, see
+  Documentation/devicetree/bindings/power/power_domain.txt for details.
+- reset-names   : should include following entry "mrst";
+- resets: a list of phandle, should contain reset entry of
+  reset-names;
+- phy-supply: from the generic phy bindings, a phandle to a regulator that
+ provides power to MIPI CSIS core;
+- bus-width : maximum number of data lanes supported (SoC specific);
+
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
+   value when this property is not specified is 166 MHz;
+
+port node
+-
+
+- reg: (required) can take the values 0 or 1, where 0 is the
+ related sink port and port 1 should be the source one;
+
+endpoint node
+-
+
+- data-lanes: (required) an array specifying active physical MIPI-CSI2
+   data input lanes and their mapping to logical lanes; the
+   array's content is unused, only its length is meaningful;
+
+- fsl,csis-hs-settle : (optional) differential receiver (HS-RX) settle time;
+
+example:
+
+mipi_csi: mipi-csi@3075 {
+#address-cells = <1>;
+#size-cells = <0>;
+
+compatible = "fsl,imx7-mipi-csi2";
+reg = <0x3075 0x1>;
+interrupts = ;
+clocks = <&clks IMX7D_IPG_ROOT_CLK>,
+<&clks IMX7D_MIPI_CSI_ROOT_CLK>,
+<&clks IMX7D_MIPI_DPHY_ROOT_CLK>;
+clock-names = "pclk", "wrap", "phy";
+clock-names = "mipi", "phy";
+clock-frequency = <16600>;
+power-domains = <&pgc_mipi_phy>;
+phy-supply = <®_1p0d>;
+resets = <&src IMX7_RESET_MIPI_PHY_MRST>;
+reset-names = "mrst";
+bus-width = <4>;
+fsl,csis-hs-settle = <3>;
+fsl,csis-clk-settle = <0>;
+
+port@0 {
+reg = <0>;
+
+mipi_from_sensor: endpoint {
+remote-endpoint = <&ov2680_to_mipi>;
+data-lanes = <1>;
+};
+};
+
+port@1 {
+reg = <1>;
+
+mipi_vc0_to_csi_mux: endpoint {
+remote-endpoint = <&csi_mux_from_mipi_vc0>;
+};
+};
+};
+
+
+csi node
+
+
+This is device node for the CMOS Sensor Interface (CSI) which enables the chip
+to connect directly to external CMOS image sensors.
+
+Required properties:
+
+- compatible: "fsl,imx7-csi";
+- reg   : base address and length of the register set for the device;
+- interrupts: should contain CSI interrupt;
+- clocks: list of clock specifiers, see
+Documentation/devicetree/bindings/clock/clock-bindings.txt for details;
+- clock-names   : must contain "axi", "mclk" and "dcic" entries, matching
+ entries in the clock property;

[PATCH v3 09/14] ARM: dts: imx7s: add multiplexer controls

2018-05-07 Thread Rui Miguel Silva
The IOMUXC General Purpose Register has bitfield to control video bus
multiplexer to control the CSI input between the MIPI-CSI2 and parallel
interface. Add that register and mask.

Signed-off-by: Rui Miguel Silva 
---
 arch/arm/boot/dts/imx7s.dtsi | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 67450ad89940..3590dab529f9 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -520,8 +520,14 @@
 
gpr: iomuxc-gpr@3034 {
compatible = "fsl,imx7d-iomuxc-gpr",
-   "fsl,imx6q-iomuxc-gpr", "syscon";
+   "fsl,imx6q-iomuxc-gpr", "syscon", 
"simple-mfd";
reg = <0x3034 0x1>;
+
+   mux: mux-controller {
+   compatible = "mmio-mux";
+   #mux-control-cells = <1>;
+   mux-reg-masks = <0x14 0x0010>;
+   };
};
 
ocotp: ocotp-ctrl@3035 {
-- 
2.17.0

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


[PATCH v3 05/14] media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7

2018-05-07 Thread Rui Miguel Silva
Adds MIPI CSI-2 subdev for i.MX7 to connect with sensors with a MIPI CSI-2
interface.

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/Makefile |1 +
 drivers/staging/media/imx/imx7-mipi-csis.c | 1154 
 2 files changed, 1155 insertions(+)
 create mode 100644 drivers/staging/media/imx/imx7-mipi-csis.c

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index 771846717146..c11d51259af1 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -13,3 +13,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx-media-csi.o
 obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
 
 obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
+obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-mipi-csis.o
diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c 
b/drivers/staging/media/imx/imx7-mipi-csis.c
new file mode 100644
index ..7992e5ff6d49
--- /dev/null
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -0,0 +1,1154 @@
+// SPDX-License-Identifier: GPL
+/*
+ * Freescale i.MX7 SoC series MIPI-CSI V3.3 receiver driver
+ *
+ * Copyright (C) 2018 Linaro Ltd
+ * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "imx-media.h"
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "Debug level (0-2)");
+
+#define CSIS_DRIVER_NAME   "imx7-mipi-csis"
+#define CSIS_SUBDEV_NAME   CSIS_DRIVER_NAME
+
+#define CSIS_PAD_SINK  0
+#define CSIS_PAD_SOURCE1
+#define CSIS_PADS_NUM  2
+
+#define MIPI_CSIS_DEF_PIX_WIDTH640
+#define MIPI_CSIS_DEF_PIX_HEIGHT   480
+
+/* Register map definition */
+
+/* CSIS common control */
+#define MIPI_CSIS_CMN_CTRL 0x04
+#define MIPI_CSIS_CMN_CTRL_UPDATE_SHADOW   BIT(16)
+#define MIPI_CSIS_CMN_CTRL_INTER_MODE  BIT(10)
+#define MIPI_CSIS_CMN_CTRL_UPDATE_SHADOW_CTRL  BIT(2)
+#define MIPI_CSIS_CMN_CTRL_RESET   BIT(1)
+#define MIPI_CSIS_CMN_CTRL_ENABLE  BIT(0)
+
+#define MIPI_CSIS_CMN_CTRL_LANE_NR_OFFSET  8
+#define MIPI_CSIS_CMN_CTRL_LANE_NR_MASK(3 << 8)
+
+/* CSIS clock control */
+#define MIPI_CSIS_CLK_CTRL 0x08
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH3(x)(x << 28)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH2(x)(x << 24)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH1(x)(x << 20)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_TRAIL_CH0(x)(x << 16)
+#define MIPI_CSIS_CLK_CTRL_CLKGATE_EN_MSK  (0xf << 4)
+#define MIPI_CSIS_CLK_CTRL_WCLK_SRCBIT(0)
+
+/* CSIS Interrupt mask */
+#define MIPI_CSIS_INTMSK   0x10
+#define MIPI_CSIS_INTMSK_EVEN_BEFORE   BIT(31)
+#define MIPI_CSIS_INTMSK_EVEN_AFTERBIT(30)
+#define MIPI_CSIS_INTMSK_ODD_BEFOREBIT(29)
+#define MIPI_CSIS_INTMSK_ODD_AFTER BIT(28)
+#define MIPI_CSIS_INTMSK_FRAME_START   BIT(24)
+#define MIPI_CSIS_INTMSK_FRAME_END BIT(20)
+#define MIPI_CSIS_INTMSK_ERR_SOT_HSBIT(16)
+#define MIPI_CSIS_INTMSK_ERR_LOST_FS   BIT(12)
+#define MIPI_CSIS_INTMSK_ERR_LOST_FE   BIT(8)
+#define MIPI_CSIS_INTMSK_ERR_OVER  BIT(4)
+#define MIPI_CSIS_INTMSK_ERR_WRONG_CFG BIT(3)
+#define MIPI_CSIS_INTMSK_ERR_ECC   BIT(2)
+#define MIPI_CSIS_INTMSK_ERR_CRC   BIT(1)
+#define MIPI_CSIS_INTMSK_ERR_UNKNOWN   BIT(0)
+
+/* CSIS Interrupt source */
+#define MIPI_CSIS_INTSRC   0x14
+#define MIPI_CSIS_INTSRC_EVEN_BEFORE   BIT(31)
+#define MIPI_CSIS_INTSRC_EVEN_AFTERBIT(30)
+#define MIPI_CSIS_INTSRC_EVEN  BIT(30)
+#define MIPI_CSIS_INTSRC_ODD_BEFOREBIT(29)
+#define MIPI_CSIS_INTSRC_ODD_AFTER BIT(28)
+#define MIPI_CSIS_INTSRC_ODD   (0x3 << 28)
+#define MIPI_CSIS_INTSRC_NON_IMAGE_DATA(0xf << 28)
+#define MIPI_CSIS_INTSRC_FRAME_START   BIT(24)
+#define MIPI_CSIS_INTSRC_FRAME_END BIT(20)
+#define MIPI_CSIS_INTSRC_ERR_SOT_HSBIT(16)
+#define MIPI_CSIS_INTSRC_ERR_LOST_FS   BIT(12)
+#define MIPI_CSIS_INTSRC_ERR_LOST_FE   BIT(8)
+#define MIPI_CSIS_INTSRC_ERR_OVER  BIT(4)
+#define MIPI_CSIS_INTSRC_ERR_WRONG_CFG BIT(3)
+#define MIPI_CSIS_INTSRC_ERR_ECC   BIT(2)
+#define MIPI_CSIS_INTSRC_ERR_CRC   BIT(1)
+#define MIPI_CSIS_INTSRC_ERR_UNKNOWN   BIT(0)
+#define MIPI_CSIS_INTSRC_ERRORS0xf
+
+/* D-PHY status control */
+#define MIPI_CSIS_DPHYSTATUS   0x20
+#define MIPI_CSIS_DPHYSTATUS_ULPS_DAT  BIT(8)
+#define MIPI_CSIS_DPHYSTATUS_STOPSTATE_DAT BIT(4)
+#define MIPI_CSIS_DPHYSTATUS_ULPS_CLK  BIT(1)
+#define MIPI_CSIS_DPHYSTATUS_STOPSTATE_CLK BIT(0)
+
+/* D-PHY common control */
+#define MIPI_CSIS_DPHYCTRL 0x24
+#define MIP

[PATCH v3 11/14] ARM: dts: imx7s: add capture subsystem

2018-05-07 Thread Rui Miguel Silva
Add media capture subsystem device to i.MX7 definitions.

Signed-off-by: Rui Miguel Silva 
---
 arch/arm/boot/dts/imx7s.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 0bae41f2944c..058e0cbf8ee7 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -1175,4 +1175,9 @@
assigned-clock-parents = <&clks 
IMX7D_PLL_ENET_MAIN_500M_CLK>;
};
};
+
+   capture-subsystem {
+   compatible = "fsl,imx7-capture-subsystem";
+   ports = <&csi>;
+   };
 };
-- 
2.17.0

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


[PATCH v3 08/14] ARM: dts: imx7s: add mipi phy power domain

2018-05-07 Thread Rui Miguel Silva
Add power domain index 0 related with mipi-phy to imx7s.

Signed-off-by: Rui Miguel Silva 
---
 arch/arm/boot/dts/imx7s.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 4d42335c0dee..67450ad89940 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -636,6 +636,12 @@
#address-cells = <1>;
#size-cells = <0>;
 
+   pgc_mipi_phy: pgc-power-domain@0 {
+   #power-domain-cells = <0>;
+   reg = <0>;
+   power-supply = <®_1p0d>;
+   };
+
pgc_pcie_phy: pgc-power-domain@1 {
#power-domain-cells = <0>;
reg = <1>;
-- 
2.17.0

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


Re: [PATCH v4 1/3] resource: Use list_head to link sibling resource

2018-05-07 Thread kbuild test robot
Hi Baoquan,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17-rc4 next-20180504]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180507-144345
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   arch/arm/plat-samsung/pm-check.c: In function 's3c_pm_run_res':
>> arch/arm/plat-samsung/pm-check.c:49:18: error: invalid operands to binary != 
>> (have 'struct list_head' and 'void *')
  if (ptr->child != NULL)
  ~~ ^~
>> arch/arm/plat-samsung/pm-check.c:50:19: error: incompatible type for 
>> argument 1 of 's3c_pm_run_res'
   s3c_pm_run_res(ptr->child, fn, arg);
  ^~~
   arch/arm/plat-samsung/pm-check.c:46:13: note: expected 'struct resource *' 
but argument is of type 'struct list_head'
static void s3c_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg)
^~
>> arch/arm/plat-samsung/pm-check.c:60:7: error: incompatible types when 
>> assigning to type 'struct resource *' from type 'struct list_head'
  ptr = ptr->sibling;
  ^

vim +49 arch/arm/plat-samsung/pm-check.c

549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  45  
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  46  static 
void s3c_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg)
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  47  {
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  48 while 
(ptr != NULL) {
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12 @49 
if (ptr->child != NULL)
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12 @50 
s3c_pm_run_res(ptr->child, fn, arg);
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  51  
05fee7cf arch/arm/plat-samsung/pm-check.c Toshi Kani 2016-01-26  52 
if ((ptr->flags & IORESOURCE_SYSTEM_RAM)
05fee7cf arch/arm/plat-samsung/pm-check.c Toshi Kani 2016-01-26  53 
== IORESOURCE_SYSTEM_RAM) {
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  54 
S3C_PMDBG("Found system RAM at %08lx..%08lx\n",
840eeeb8 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  55 
  (unsigned long)ptr->start,
840eeeb8 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  56 
  (unsigned long)ptr->end);
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  57 
arg = (fn)(ptr, arg);
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  58 
}
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  59  
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12 @60 
ptr = ptr->sibling;
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  61 }
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  62  }
549c7e33 arch/arm/plat-s3c/pm-check.c Ben Dooks  2008-12-12  63  

:: The code at line 49 was first introduced by commit
:: 549c7e33aeb9bfe441ecf68639d2227bb90978e7 [ARM] S3C: Split the resume 
memory check code from pm.c

:: TO: Ben Dooks 
:: CC: Ben Dooks 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: A few questions about warnings in the ion driver

2018-05-07 Thread Nathan Chancellor
On Mon, May 07, 2018 at 06:46:23AM -0700, Laura Abbott wrote:
> On 05/06/2018 06:43 PM, Nathan Chancellor wrote:
> > Hi everyone,
> > 
> > I compiled the ion driver with W=1 where I encountered the two following
> > warnings and I had a couple of questions about solving them.
> > 
> > 
> > 1.
> > 
> > drivers/staging/android/ion/ion.c: In function 
> > ‘ion_dma_buf_begin_cpu_access’:
> > drivers/staging/android/ion/ion.c:316:8: warning: variable ‘vaddr’ set but 
> > not used [-Wunused-but-set-variable]
> > 
> > which concerns the following function:
> > 
> > static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
> >  enum dma_data_direction direction)
> > {
> >  struct ion_buffer *buffer = dmabuf->priv;
> >  void *vaddr;
> >  struct ion_dma_buf_attachment *a;
> > 
> >  /*
> >   * TODO: Move this elsewhere because we don't always need a vaddr
> >   */
> >  if (buffer->heap->ops->map_kernel) {
> >  mutex_lock(&buffer->lock);
> >  vaddr = ion_buffer_kmap_get(buffer);
> >  mutex_unlock(&buffer->lock);
> >  }
> > 
> >  mutex_lock(&buffer->lock);
> >  list_for_each_entry(a, &buffer->attachments, list) {
> >  dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
> >  direction);
> >  }
> >  mutex_unlock(&buffer->lock);
> > 
> >  return 0;
> > }
> > 
> > Can vaddr be removed and just have ion_buffer_kmap_get remain, since it is 
> > never used again in the function?
> > 
> 
> I think a better solution is to check the return value of vaddr
> and error out if it fails.
> 

Something like this? I was unsure if -ENOMEM or -EINVAL was a better
error return code in this context.

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index d10b60fe4a29..d1c149bb15c3 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -315,6 +315,7 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
struct ion_buffer *buffer = dmabuf->priv;
void *vaddr;
struct ion_dma_buf_attachment *a;
+   int ret = 0;

/*
 * TODO: Move this elsewhere because we don't always need a vaddr
@@ -322,6 +323,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
if (buffer->heap->ops->map_kernel) {
mutex_lock(&buffer->lock);
vaddr = ion_buffer_kmap_get(buffer);
+   if (IS_ERR(vaddr)) {
+   ret = -ENOMEM;
+   goto unlock;
+   }
mutex_unlock(&buffer->lock);
}

@@ -330,9 +335,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
direction);
}
-   mutex_unlock(&buffer->lock);

-   return 0;
+unlock:
+   mutex_unlock(&buffer->lock);
+   return ret;
 }

 static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,

> > 
> > 2.
> > 
> > drivers/staging/android/ion/ion_carveout_heap.c:106:18: warning: no 
> > previous prototype for ‘ion_carveout_heap_create’ [-Wmissing-prototypes]
> > drivers/staging/android/ion/ion_chunk_heap.c:111:18: warning: no previous 
> > prototype for ‘ion_chunk_heap_create’ [-Wmissing-prototypes]
> > 
> > It appears neither of these functions are used since commit 2f87f50b2340
> > ("staging: android: ion: Rework heap registration/enumeration"). Ultimately,
> > removing the whole file fixes this warning; is there still a need to rework
> > them or can they be removed?
> > 
> 
> I'd still like to delete it. I haven't seen anyone come out to re-work it.
> That said, I think my preference is still to keep it for now until
> we do another round of updates.
> 

Understood, I figured it probably isn't wise to remove stuff in the
middle of a release cycle but hey, never know. I will leave it alone
for now.

Thanks!
Nathan

> Thanks for looking at these.
> 
> Laura
> 
> > 
> > If any part of this email was formatted incorrectly or could be done better,
> > please let me know!
> > 
> > Thank you,
> > Nathan Chancellor
> > 
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: android: ion: Fix license identifier comment format

2018-05-07 Thread Nathan Chancellor
On Mon, May 07, 2018 at 06:37:52AM -0700, Laura Abbott wrote:
> On 05/06/2018 06:18 PM, Nathan Chancellor wrote:
> > checkpatch.pl complains these are invalid because the rules in
> > Documentation/process/license-rules.rst state that C headers should
> > have "/* */" style comments.
> > 
> 
> The SPDX markings are special, but I don't see anything from a
> quick read of the SPDX specification that says they have to use //.
> I think this is going to generate a lot of possible noise so it
> might be worth adjusting checkpatch.
> 
> Thanks,
> Laura

Under section 2 of "License identifier syntax" in the license rules
file, it shows the preferred style for each type of file. Apparently
there was some build breakage with // in header files so I assume they
want /* */ for uniformity sake.

Thanks!
Nathan

> 
> > Signed-off-by: Nathan Chancellor 
> > ---
> >   drivers/staging/android/ion/ion.h  | 2 +-
> >   drivers/staging/android/uapi/ion.h | 2 +-
> >   2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/android/ion/ion.h 
> > b/drivers/staging/android/ion/ion.h
> > index ea0897812780..16cbd38a7160 100644
> > --- a/drivers/staging/android/ion/ion.h
> > +++ b/drivers/staging/android/ion/ion.h
> > @@ -1,4 +1,4 @@
> > -// SPDX-License-Identifier: GPL-2.0
> > +/* SPDX-License-Identifier: GPL-2.0 */
> >   /*
> >* drivers/staging/android/ion/ion.h
> >*
> > diff --git a/drivers/staging/android/uapi/ion.h 
> > b/drivers/staging/android/uapi/ion.h
> > index 825d3e95ccd3..5d7009884c13 100644
> > --- a/drivers/staging/android/uapi/ion.h
> > +++ b/drivers/staging/android/uapi/ion.h
> > @@ -1,4 +1,4 @@
> > -// SPDX-License-Identifier: GPL-2.0
> > +/* SPDX-License-Identifier: GPL-2.0 */
> >   /*
> >* drivers/staging/android/uapi/ion.h
> >*
> > 
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: A few questions about warnings in the ion driver

2018-05-07 Thread Laura Abbott

On 05/06/2018 06:43 PM, Nathan Chancellor wrote:

Hi everyone,

I compiled the ion driver with W=1 where I encountered the two following
warnings and I had a couple of questions about solving them.


1.

drivers/staging/android/ion/ion.c: In function ‘ion_dma_buf_begin_cpu_access’:
drivers/staging/android/ion/ion.c:316:8: warning: variable ‘vaddr’ set but not 
used [-Wunused-but-set-variable]

which concerns the following function:

static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
 enum dma_data_direction direction)
{
 struct ion_buffer *buffer = dmabuf->priv;
 void *vaddr;
 struct ion_dma_buf_attachment *a;

 /*
  * TODO: Move this elsewhere because we don't always need a vaddr
  */
 if (buffer->heap->ops->map_kernel) {
 mutex_lock(&buffer->lock);
 vaddr = ion_buffer_kmap_get(buffer);
 mutex_unlock(&buffer->lock);
 }

 mutex_lock(&buffer->lock);
 list_for_each_entry(a, &buffer->attachments, list) {
 dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
 direction);
 }
 mutex_unlock(&buffer->lock);

 return 0;
}

Can vaddr be removed and just have ion_buffer_kmap_get remain, since it is 
never used again in the function?



I think a better solution is to check the return value of vaddr
and error out if it fails.



2.

drivers/staging/android/ion/ion_carveout_heap.c:106:18: warning: no previous 
prototype for ‘ion_carveout_heap_create’ [-Wmissing-prototypes]
drivers/staging/android/ion/ion_chunk_heap.c:111:18: warning: no previous 
prototype for ‘ion_chunk_heap_create’ [-Wmissing-prototypes]

It appears neither of these functions are used since commit 2f87f50b2340
("staging: android: ion: Rework heap registration/enumeration"). Ultimately,
removing the whole file fixes this warning; is there still a need to rework
them or can they be removed?



I'd still like to delete it. I haven't seen anyone come out to re-work it.
That said, I think my preference is still to keep it for now until
we do another round of updates.

Thanks for looking at these.

Laura



If any part of this email was formatted incorrectly or could be done better,
please let me know!

Thank you,
Nathan Chancellor



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


Re: [PATCH 2/2] staging: android: ion: Remove unnecessary blank line

2018-05-07 Thread Laura Abbott

On 05/06/2018 06:18 PM, Nathan Chancellor wrote:

Fixes a checkpatch.pl warning.

Signed-off-by: Nathan Chancellor 
---
  drivers/staging/android/ion/ion.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 269a431646be..d10b60fe4a29 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -95,7 +95,6 @@ static struct ion_buffer *ion_buffer_create(struct ion_heap 
*heap,
goto err1;
}
  
-

INIT_LIST_HEAD(&buffer->attachments);
mutex_init(&buffer->lock);
mutex_lock(&dev->buffer_lock);



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


Re: [PATCH 1/2] staging: android: ion: Fix license identifier comment format

2018-05-07 Thread Laura Abbott

On 05/06/2018 06:18 PM, Nathan Chancellor wrote:

checkpatch.pl complains these are invalid because the rules in
Documentation/process/license-rules.rst state that C headers should
have "/* */" style comments.



The SPDX markings are special, but I don't see anything from a
quick read of the SPDX specification that says they have to use //.
I think this is going to generate a lot of possible noise so it
might be worth adjusting checkpatch.

Thanks,
Laura


Signed-off-by: Nathan Chancellor 
---
  drivers/staging/android/ion/ion.h  | 2 +-
  drivers/staging/android/uapi/ion.h | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index ea0897812780..16cbd38a7160 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
  /*
   * drivers/staging/android/ion/ion.h
   *
diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index 825d3e95ccd3..5d7009884c13 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
  /*
   * drivers/staging/android/uapi/ion.h
   *



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


Re: [PATCH 4/4] staging: lustre: obdclass: change object lookup to no wait mode

2018-05-07 Thread Greg Kroah-Hartman
On Wed, May 02, 2018 at 02:21:48PM -0400, James Simmons wrote:
> From: Lai Siyao 
> 
> Currently we set LU_OBJECT_HEARD_BANSHEE on object when we want
> to remove object from cache, but this may lead to deadlock, because
> when other process lookup such object, it needs to wait for this
> object until release (done at last refcount put), while that process
> maybe already hold an LDLM lock.
> 
> Now that current code can handle dying object correctly, we can just
> return such object in lookup, thus the above deadlock can be avoided.
> 
> Signed-off-by: Lai Siyao 
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9049
> Reviewed-on: https://review.whamcloud.com/26965
> Reviewed-by: Alex Zhuravlev 
> Tested-by: Cliff White 
> Reviewed-by: Fan Yong 
> Reviewed-by: Oleg Drokin 
> Signed-off-by: James Simmons 
> ---
>  drivers/staging/lustre/lustre/include/lu_object.h  |  2 +-
>  drivers/staging/lustre/lustre/obdclass/lu_object.c | 82 
> +-
>  2 files changed, 36 insertions(+), 48 deletions(-)

Patch does not apply to my tree :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: most: video: use __func__ instead of function name

2018-05-07 Thread Greg KH
On Thu, May 03, 2018 at 03:51:05PM +0530, Abdun Nihaal wrote:
> This fixes the following checkpatch warning in video.c:
> 
> WARNING: Prefer using '\"%s...\", __func__' to using function's name
> in a string
> 
> Signed-off-by: Abdun Nihaal 
> ---
>  drivers/staging/most/video/video.c | 24 
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/most/video/video.c 
> b/drivers/staging/most/video/video.c
> index 9d7e747519d9..c85e289275a9 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(&mdev->v4l2_dev, "comp_vdev_open()\n");
> + v4l2_info(&mdev->v4l2_dev, "%s()\n", __func__);

All of these should just be deleted.  It's debugging code and if someone
needs/wants to see tracing, they can use ftrace.

Please just drop them all.

thanks,

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


Re: [PATCH v2] staging: lustre: o2iblnd: Enable Multiple OPA Endpoints between Nodes

2018-05-07 Thread Greg Kroah-Hartman
On Thu, May 03, 2018 at 08:33:05AM -0700, Doug Oucharek wrote:
> OPA driver optimizations are based on the MPI model where it is
> expected to have multiple endpoints between two given nodes. To
> enable this optimization for Lustre, we need to make it possible,
> via an LND-specific tuneable, to create multiple endpoints and to
> balance the traffic over them.
> 
> Both sides of a connection must have this patch for it to work.
> Only the active side of the connection (usually the client)
> needs to have the new tuneable set > 1.
> 
> Signed-off-by: Doug Oucharek 
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8943
> Reviewed-on: https://review.whamcloud.com/25168
> Reviewed-by: Amir Shehata 
> Reviewed-by: Dmitry Eremin 
> Reviewed-by: James Simmons 
> Reviewed-by: Oleg Drokin 
> Signed-off-by: Doug Oucharek 
> ---
>  .../lustre/include/uapi/linux/lnet/lnet-dlc.h  |  3 ++-
>  .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h| 17 ---
>  .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 25 
> +++---
>  .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c  |  9 
>  4 files changed, 42 insertions(+), 12 deletions(-)

Always put below the --- line what changed in each version.  I have no
idea what is different here from v1.

Please fix up and resend v3.

thanks,

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


Re: [PATCH] staging: speakup: Add pause command used on switching to graphical mode

2018-05-07 Thread Dan Carpenter
Please use scripts/checkpatch.pl

regards,
dan carpenter

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


Re: [PATCH v4 1/3] resource: Use list_head to link sibling resource

2018-05-07 Thread kbuild test robot
Hi Baoquan,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17-rc4 next-20180504]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Baoquan-He/resource-Use-list_head-to-link-sibling-resource/20180507-144345
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc 

All errors (new ones prefixed by >>):

   arch/powerpc/kernel/pci-common.c: In function 'pci_process_bridge_OF_ranges':
>> arch/powerpc/kernel/pci-common.c:764:44: error: incompatible types when 
>> assigning to type 'struct list_head' from type 'void *'
   res->parent = res->child = res->sibling = NULL;
   ^
   arch/powerpc/kernel/pci-common.c: In function 'reparent_resources':
>> arch/powerpc/kernel/pci-common.c:1100:10: error: assignment from 
>> incompatible pointer type [-Werror=incompatible-pointer-types]
 for (pp = &parent->child; (p = *pp) != NULL; pp = &p->sibling) {
 ^
   arch/powerpc/kernel/pci-common.c:1100:50: error: assignment from 
incompatible pointer type [-Werror=incompatible-pointer-types]
 for (pp = &parent->child; (p = *pp) != NULL; pp = &p->sibling) {
 ^
>> arch/powerpc/kernel/pci-common.c:1113:13: error: incompatible types when 
>> assigning to type 'struct list_head' from type 'struct resource *'
 res->child = *firstpp;
^
   arch/powerpc/kernel/pci-common.c:1114:15: error: incompatible types when 
assigning to type 'struct list_head' from type 'struct resource *'
 res->sibling = *pp;
  ^
>> arch/powerpc/kernel/pci-common.c:1117:9: error: incompatible types when 
>> assigning to type 'struct resource *' from type 'struct list_head'
 for (p = res->child; p != NULL; p = p->sibling) {
^
   arch/powerpc/kernel/pci-common.c:1117:36: error: incompatible types when 
assigning to type 'struct resource *' from type 'struct list_head'
 for (p = res->child; p != NULL; p = p->sibling) {
   ^
   cc1: all warnings being treated as errors

vim +764 arch/powerpc/kernel/pci-common.c

13dccb9e Benjamin Herrenschmidt 2007-12-11  642  
13dccb9e Benjamin Herrenschmidt 2007-12-11  643  /**
13dccb9e Benjamin Herrenschmidt 2007-12-11  644   * 
pci_process_bridge_OF_ranges - Parse PCI bridge resources from device tree
13dccb9e Benjamin Herrenschmidt 2007-12-11  645   * @hose: newly allocated 
pci_controller to be setup
13dccb9e Benjamin Herrenschmidt 2007-12-11  646   * @dev: device node of the 
host bridge
13dccb9e Benjamin Herrenschmidt 2007-12-11  647   * @primary: set if primary 
bus (32 bits only, soon to be deprecated)
13dccb9e Benjamin Herrenschmidt 2007-12-11  648   *
13dccb9e Benjamin Herrenschmidt 2007-12-11  649   * This function will parse 
the "ranges" property of a PCI host bridge device
13dccb9e Benjamin Herrenschmidt 2007-12-11  650   * node and setup the resource 
mapping of a pci controller based on its
13dccb9e Benjamin Herrenschmidt 2007-12-11  651   * content.
13dccb9e Benjamin Herrenschmidt 2007-12-11  652   *
13dccb9e Benjamin Herrenschmidt 2007-12-11  653   * Life would be boring if it 
wasn't for a few issues that we have to deal
13dccb9e Benjamin Herrenschmidt 2007-12-11  654   * with here:
13dccb9e Benjamin Herrenschmidt 2007-12-11  655   *
13dccb9e Benjamin Herrenschmidt 2007-12-11  656   *   - We can only cope with 
one IO space range and up to 3 Memory space
13dccb9e Benjamin Herrenschmidt 2007-12-11  657   * ranges. However, some 
machines (thanks Apple !) tend to split their
13dccb9e Benjamin Herrenschmidt 2007-12-11  658   * space into lots of 
small contiguous ranges. So we have to coalesce.
13dccb9e Benjamin Herrenschmidt 2007-12-11  659   *
13dccb9e Benjamin Herrenschmidt 2007-12-11  660   *   - Some busses have IO 
space not starting at 0, which causes trouble with
13dccb9e Benjamin Herrenschmidt 2007-12-11  661   * the way we do our IO 
resource renumbering. The code somewhat deals with
13dccb9e Benjamin Herrenschmidt 2007-12-11  662   * it for 64 bits but I 
would expect problems on 32 bits.
13dccb9e Benjamin Herrenschmidt 2007-12-11  663   *
13dccb9e Benjamin Herrenschmidt 2007-12-11  664   *   - Some 32 bits platforms 
such as 4xx can have physical space larger than
13dccb9e Benj

[PATH V2 0/4] Few fixes for the mt7621-eth driver

2018-05-07 Thread Kamal Heib
This patches fixes an compilation error and cleanup few errors reported
by checkpatch.pl script.

Cc: NeilBrown 
Cc: Greg Kroah-Hartman 

Changes from v1:
- patch1: Change phy_ring_{head/tail} to be dma_addr_t.
- patch4: Fix aliment based on Neil feedback.

Kamal Heib (4):
  staging: mt7621-eth: Fix compilation error
  staging: mt7621-eth: Remove unnecessary blank lines
  staging: mt7621-eth: Add missing blank lines after declarations
  staging: mt7621-eth: Alignment should match open parenthesis

 drivers/staging/mt7621-eth/ethtool.c |  1 -
 drivers/staging/mt7621-eth/gsw_mt7621.c  |  3 +--
 drivers/staging/mt7621-eth/mdio.c|  2 ++
 drivers/staging/mt7621-eth/mtk_eth_soc.c | 27 +--
 drivers/staging/mt7621-eth/soc_mt7621.c  |  1 -
 5 files changed, 16 insertions(+), 18 deletions(-)

-- 
2.14.3

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


[PATH V2 1/4] staging: mt7621-eth: Fix compilation error

2018-05-07 Thread Kamal Heib
Fix the following comilation error by making sure that "phy_ring_head" is
defined as "dma_addr_t" and change "phy_ring_tail" to match it as both
should be "dma_addr_t".

error: passing argument 3 of ‘dma_alloc_coherent’ from incompatible pointer type

Signed-off-by: Kamal Heib 
---
 drivers/staging/mt7621-eth/mtk_eth_soc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c 
b/drivers/staging/mt7621-eth/mtk_eth_soc.c
index cbc7339843a5..c44a2f8a841c 100644
--- a/drivers/staging/mt7621-eth/mtk_eth_soc.c
+++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c
@@ -768,9 +768,8 @@ static int mtk_pdma_tx_map(struct sk_buff *skb, struct 
net_device *dev,
 /* the qdma core needs scratch memory to be setup */
 static int mtk_init_fq_dma(struct mtk_eth *eth)
 {
-   unsigned int phy_ring_head, phy_ring_tail;
+   dma_addr_t dma_addr, phy_ring_head, phy_ring_tail;
int cnt = eth->soc->dma_ring_size;
-   dma_addr_t dma_addr;
int i;
 
eth->scratch_ring = dma_alloc_coherent(eth->dev,
-- 
2.14.3

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


[PATH V2 4/4] staging: mt7621-eth: Alignment should match open parenthesis

2018-05-07 Thread Kamal Heib
Fix alignment issues reported by checkpatch.pl.

Signed-off-by: Kamal Heib 
---
 drivers/staging/mt7621-eth/mtk_eth_soc.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c 
b/drivers/staging/mt7621-eth/mtk_eth_soc.c
index c44a2f8a841c..863d7a08359e 100644
--- a/drivers/staging/mt7621-eth/mtk_eth_soc.c
+++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c
@@ -315,7 +315,7 @@ static int mtk_dma_rx_alloc(struct mtk_eth *eth, struct 
mtk_rx_ring *ring)
ring->rx_buf_size = mtk_max_buf_size(ring->frag_size);
ring->rx_ring_size = eth->soc->dma_ring_size;
ring->rx_data = kcalloc(ring->rx_ring_size, sizeof(*ring->rx_data),
-   GFP_KERNEL);
+   GFP_KERNEL);
if (!ring->rx_data)
goto no_rx_mem;
 
@@ -325,10 +325,10 @@ static int mtk_dma_rx_alloc(struct mtk_eth *eth, struct 
mtk_rx_ring *ring)
goto no_rx_mem;
}
 
-   ring->rx_dma = dma_alloc_coherent(eth->dev,
-   ring->rx_ring_size * sizeof(*ring->rx_dma),
-   &ring->rx_phys,
-   GFP_ATOMIC | __GFP_ZERO);
+   ring->rx_dma =
+   dma_alloc_coherent(eth->dev,
+  ring->rx_ring_size * sizeof(*ring->rx_dma),
+  &ring->rx_phys, GFP_ATOMIC | __GFP_ZERO);
if (!ring->rx_dma)
goto no_rx_mem;
 
@@ -1351,14 +1351,14 @@ static int mtk_pdma_tx_alloc(struct mtk_eth *eth)
  MAX_SKB_FRAGS);
 
ring->tx_buf = kcalloc(ring->tx_ring_size, sizeof(*ring->tx_buf),
-   GFP_KERNEL);
+  GFP_KERNEL);
if (!ring->tx_buf)
goto no_tx_mem;
 
-   ring->tx_dma = dma_alloc_coherent(eth->dev,
-   ring->tx_ring_size * sizeof(*ring->tx_dma),
-   &ring->tx_phys,
-   GFP_ATOMIC | __GFP_ZERO);
+   ring->tx_dma =
+   dma_alloc_coherent(eth->dev,
+  ring->tx_ring_size * sizeof(*ring->tx_dma),
+  &ring->tx_phys, GFP_ATOMIC | __GFP_ZERO);
if (!ring->tx_dma)
goto no_tx_mem;
 
@@ -2013,8 +2013,8 @@ static int mtk_add_mac(struct mtk_eth *eth, struct 
device_node *np)
 
if (mtk_reg_table[MTK_REG_MTK_COUNTER_BASE]) {
mac->hw_stats = devm_kzalloc(eth->dev,
- sizeof(*mac->hw_stats),
- GFP_KERNEL);
+sizeof(*mac->hw_stats),
+GFP_KERNEL);
if (!mac->hw_stats)
return -ENOMEM;
spin_lock_init(&mac->hw_stats->stats_lock);
-- 
2.14.3

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


[PATH V2 2/4] staging: mt7621-eth: Remove unnecessary blank lines

2018-05-07 Thread Kamal Heib
Remove un-necessary blank lines to solve errors found by checkpatch.pl.

Signed-off-by: Kamal Heib 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-eth/ethtool.c| 1 -
 drivers/staging/mt7621-eth/gsw_mt7621.c | 2 --
 drivers/staging/mt7621-eth/soc_mt7621.c | 1 -
 3 files changed, 4 deletions(-)

diff --git a/drivers/staging/mt7621-eth/ethtool.c 
b/drivers/staging/mt7621-eth/ethtool.c
index 5268c5ca097d..7c059cd94e56 100644
--- a/drivers/staging/mt7621-eth/ethtool.c
+++ b/drivers/staging/mt7621-eth/ethtool.c
@@ -63,7 +63,6 @@ static int mtk_set_link_ksettings(struct net_device *dev,
}
 
return phy_ethtool_ksettings_set(mac->phy_dev, cmd);
-
 }
 
 static void mtk_get_drvinfo(struct net_device *dev,
diff --git a/drivers/staging/mt7621-eth/gsw_mt7621.c 
b/drivers/staging/mt7621-eth/gsw_mt7621.c
index ce8d7d7577c7..04af39c757bd 100644
--- a/drivers/staging/mt7621-eth/gsw_mt7621.c
+++ b/drivers/staging/mt7621-eth/gsw_mt7621.c
@@ -208,13 +208,11 @@ static void mt7621_hw_init(struct mtk_eth *eth, struct 
mt7620_gsw *gsw,
 
for (i = 0; i < MT7530_NUM_PORTS; i++)
mt7530_mdio_w32(gsw, REG_ESW_PORT_PVC(i), 0x81c0);
-
}
 
/* enable irq */
mt7530_mdio_m32(gsw, 0, 3 << 16, MT7530_TOP_SIG_CTRL);
mt7530_mdio_w32(gsw, MT7530_SYS_INT_EN, 0x1f);
-
 }
 
 static const struct of_device_id mediatek_gsw_match[] = {
diff --git a/drivers/staging/mt7621-eth/soc_mt7621.c 
b/drivers/staging/mt7621-eth/soc_mt7621.c
index 743c0eed89b6..3dd7d8d893de 100644
--- a/drivers/staging/mt7621-eth/soc_mt7621.c
+++ b/drivers/staging/mt7621-eth/soc_mt7621.c
@@ -50,7 +50,6 @@
 #define GSW_REG_GDMA2_MAC_ADRL 0x1508
 #define GSW_REG_GDMA2_MAC_ADRH 0x150C
 
-
 #define MT7621_MTK_RST_GL  0x04
 #define MT7620_MTK_INT_STATUS2 0x08
 
-- 
2.14.3

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


[PATH V2 3/4] staging: mt7621-eth: Add missing blank lines after declarations

2018-05-07 Thread Kamal Heib
Add missing blank lines after declarations to solve checkpatch.pl errors.

Signed-off-by: Kamal Heib 
Reviewed-by: NeilBrown 
---
 drivers/staging/mt7621-eth/gsw_mt7621.c | 1 +
 drivers/staging/mt7621-eth/mdio.c   | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/staging/mt7621-eth/gsw_mt7621.c 
b/drivers/staging/mt7621-eth/gsw_mt7621.c
index 04af39c757bd..86138a36f525 100644
--- a/drivers/staging/mt7621-eth/gsw_mt7621.c
+++ b/drivers/staging/mt7621-eth/gsw_mt7621.c
@@ -201,6 +201,7 @@ static void mt7621_hw_init(struct mtk_eth *eth, struct 
mt7620_gsw *gsw,
/* This is copied from mt7530_apply_config in libreCMC driver */
{
int i;
+
for (i = 0; i < MT7530_NUM_PORTS; i++)
mt7530_mdio_w32(gsw, REG_ESW_PORT_PCR(i), 0x0040);
 
diff --git a/drivers/staging/mt7621-eth/mdio.c 
b/drivers/staging/mt7621-eth/mdio.c
index 9d713078ef90..ac4df9cfd1b2 100644
--- a/drivers/staging/mt7621-eth/mdio.c
+++ b/drivers/staging/mt7621-eth/mdio.c
@@ -130,6 +130,7 @@ static int mtk_phy_connect(struct mtk_mac *mac)
}
} else if (eth->mii_bus) {
struct phy_device *phy;
+
phy = mdiobus_get_phy(eth->mii_bus, i);
if (phy) {
phy_init(eth, mac, phy);
@@ -161,6 +162,7 @@ static void mtk_phy_disconnect(struct mtk_mac *mac)
phy_disconnect(eth->phy->phy[i]);
} else if (eth->mii_bus) {
struct phy_device *phy = mdiobus_get_phy(eth->mii_bus, 
i);
+
if (phy)
phy_detach(phy);
}
-- 
2.14.3

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


[PATCH 21/30] staging: wilc1000: fix line over 80 chars in scan()

2018-05-07 Thread Ajay Singh
Fix line over 80 characters issues found by checkpatch.pl script with
the help of local variable.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 20ba9cc..ec4fa1c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -633,8 +633,11 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
 
priv->cfg_scanning = true;
if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) {
-   for (i = 0; i < request->n_channels; i++)
-   scan_ch_list[i] = 
(u8)ieee80211_frequency_to_channel(request->channels[i]->center_freq);
+   for (i = 0; i < request->n_channels; i++) {
+   u16 freq = request->channels[i]->center_freq;
+
+   scan_ch_list[i] = ieee80211_frequency_to_channel(freq);
+   }
 
if (request->n_ssids >= 1) {
if (wilc_wfi_cfg_alloc_fill_ssid(request,
-- 
2.7.4

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


[PATCH 27/30] staging: wilc1000: remove 'flag' argument from wilc_mac_indicate()

2018-05-07 Thread Ajay Singh
Remove 'flag' function parameter in wilc_mac_indicate() as only one
condition was handled using that parameter. Also removed unnecessary
call to wilc_mac_indicate() as no operation was performed in that
function call.
After above changes below macro are not required.

This changes also helped in resolving the line over 80 chars issue
found by checkatpch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 17 +++--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 drivers/staging/wilc1000/wilc_wlan.c  |  7 +--
 drivers/staging/wilc1000/wilc_wlan_if.h   |  3 ---
 4 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 7b883c0..02e6b13 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -176,19 +176,16 @@ static void deinit_irq(struct net_device *dev)
}
 }
 
-void wilc_mac_indicate(struct wilc *wilc, int flag)
+void wilc_mac_indicate(struct wilc *wilc)
 {
int status;
 
-   if (flag == WILC_MAC_INDICATE_STATUS) {
-   wilc_wlan_cfg_get_val(WID_STATUS,
- (unsigned char *)&status, 4);
-   if (wilc->mac_status == MAC_STATUS_INIT) {
-   wilc->mac_status = status;
-   complete(&wilc->sync_event);
-   } else {
-   wilc->mac_status = status;
-   }
+   wilc_wlan_cfg_get_val(WID_STATUS, (unsigned char *)&status, 4);
+   if (wilc->mac_status == MAC_STATUS_INIT) {
+   wilc->mac_status = status;
+   complete(&wilc->sync_event);
+   } else {
+   wilc->mac_status = status;
}
 }
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 8849924..607dae0 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -182,7 +182,7 @@ struct wilc_wfi_mon_priv {
 };
 
 void wilc_frmw_to_linux(struct wilc *wilc, u8 *buff, u32 size, u32 pkt_offset);
-void wilc_mac_indicate(struct wilc *wilc, int flag);
+void wilc_mac_indicate(struct wilc *wilc);
 void wilc_netdev_cleanup(struct wilc *wilc);
 int wilc_netdev_init(struct wilc **wilc, struct device *dev, int io_type,
 int gpio, const struct wilc_hif_func *ops);
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 7147e0c..d4ebbf6 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -816,12 +816,7 @@ static void wilc_wlan_handle_rx_buff(struct wilc *wilc, u8 
*buffer, int size)
if (wilc->cfg_seq_no == rsp.seq_no)
complete(&wilc->cfg_event);
} else if (rsp.type == WILC_CFG_RSP_STATUS) {
-   wilc_mac_indicate(wilc,
- 
WILC_MAC_INDICATE_STATUS);
-
-   } else if (rsp.type == WILC_CFG_RSP_SCAN) {
-   wilc_mac_indicate(wilc,
- 
WILC_MAC_INDICATE_SCAN);
+   wilc_mac_indicate(wilc);
}
}
}
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index aa0731e..e4a7bf5 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -47,9 +47,6 @@ struct sdio_cmd53 {
u32 block_size;
 };
 
-#define WILC_MAC_INDICATE_STATUS   0x1
-#define WILC_MAC_INDICATE_SCAN 0x2
-
 #define MAC_STATUS_INIT-1
 #define MAC_STATUS_CONNECTED   1
 #define MAC_STATUS_DISCONNECTED0
-- 
2.7.4

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


[PATCH 25/30] staging: wilc1000: fix line over 80 chars in wilc_sdio struct

2018-05-07 Thread Ajay Singh
Fix line over 80 chars issue found by checkpatch.pl script by placing
the comment message above the macro preprocessor.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_sdio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 211be73..4ab43f9 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -26,7 +26,8 @@ struct wilc_sdio {
bool irq_gpio;
u32 block_size;
int nint;
-#define MAX_NUN_INT_THRPT_ENH2 (5) /* Max num interrupts allowed in registers 
0xf7, 0xf8 */
+/* Max num interrupts allowed in registers 0xf7, 0xf8 */
+#define MAX_NUN_INT_THRPT_ENH2 (5)
int has_thrpt_enh3;
 };
 
-- 
2.7.4

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


[PATCH 29/30] staging: wilc1000: remove unused 'lock' varible in 'wilc_priv' structure

2018-05-07 Thread Ajay Singh
Cleanup patch to remove the unused variable from 'wilc_priv' 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 e517768..3875065 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -78,7 +78,6 @@ struct wilc_priv {
u8 monitor_flag;
int status;
struct sk_buff *skb;
-   spinlock_t lock;
struct net_device *dev;
struct host_if_drv *hif_drv;
struct host_if_pmkid_attr pmkid_list;
-- 
2.7.4

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


[PATCH 23/30] staging: wilc1000: rename u8security to avoid datatype in variable name

2018-05-07 Thread Ajay Singh
Cleanup patch to avoid use of datatype in variable name to follow as
per linux coding style.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 00381c9..4600f4a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -674,7 +674,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
s32 ret = 0;
u32 i;
u32 sel_bssi_idx = UINT_MAX;
-   u8 u8security = NO_ENCRYPT;
+   u8 security = NO_ENCRYPT;
enum AUTHTYPE auth_type = ANY;
u32 cipher_group;
struct wilc_priv *priv;
@@ -727,7 +727,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
cipher_group = sme->crypto.cipher_group;
if (cipher_group != NO_ENCRYPT) {
if (cipher_group == WLAN_CIPHER_SUITE_WEP40) {
-   u8security = ENCRYPT_ENABLED | WEP;
+   security = ENCRYPT_ENABLED | WEP;
 
priv->wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->wep_key[sme->key_idx], sme->key,
@@ -737,7 +737,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
 sme->key_idx);
} else if (cipher_group == WLAN_CIPHER_SUITE_WEP104) {
-   u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
+   security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
 
priv->wep_key_len[sme->key_idx] = sme->key_len;
memcpy(priv->wep_key[sme->key_idx], sme->key,
@@ -748,14 +748,14 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
 sme->key_idx);
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
-   u8security = ENCRYPT_ENABLED | WPA2 | TKIP;
+   security = ENCRYPT_ENABLED | WPA2 | TKIP;
else
-   u8security = ENCRYPT_ENABLED | WPA2 | AES;
+   security = ENCRYPT_ENABLED | WPA2 | AES;
} else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) {
if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
-   u8security = ENCRYPT_ENABLED | WPA | TKIP;
+   security = ENCRYPT_ENABLED | WPA | TKIP;
else
-   u8security = ENCRYPT_ENABLED | WPA | AES;
+   security = ENCRYPT_ENABLED | WPA | AES;
} else {
ret = -ENOTSUPP;
netdev_err(dev, "Not supported cipher\n");
@@ -770,9 +770,9 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
u32 ciphers_pairwise = sme->crypto.ciphers_pairwise[i];
 
if (ciphers_pairwise == WLAN_CIPHER_SUITE_TKIP)
-   u8security = u8security | TKIP;
+   security = security | TKIP;
else
-   u8security = u8security | AES;
+   security = security | AES;
}
}
 
@@ -804,7 +804,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
ret = wilc_set_join_req(vif, nw_info->bssid, sme->ssid,
sme->ssid_len, sme->ie, sme->ie_len,
cfg_connect_result, (void *)priv,
-   u8security, auth_type,
+   security, auth_type,
nw_info->ch,
nw_info->join_params);
if (ret != 0) {
-- 
2.7.4

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


[PATCH 30/30] staging: wilc1000: rename s8idxarray to avoid datatype in variable name

2018-05-07 Thread Ajay Singh
Cleanup patch to have variable names as per linux coding style.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index ad9270e..e27010c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1543,7 +1543,7 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
struct wid wid;
struct wid wid_list[5];
u8 *key_buf;
-   s8 s8idxarray[1];
+   s8 idxarray[1];
struct host_if_drv *hif_drv = vif->hif_drv;
 
switch (hif_key->type) {
@@ -1610,8 +1610,8 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
wid.id = (u16)WID_REMOVE_WEP_KEY;
wid.type = WID_STR;
 
-   s8idxarray[0] = (s8)hif_key->attr.wep.index;
-   wid.val = s8idxarray;
+   idxarray[0] = (s8)hif_key->attr.wep.index;
+   wid.val = idxarray;
wid.size = 1;
 
result = wilc_send_config_pkt(vif, SET_CFG,
-- 
2.7.4

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


[PATCH 28/30] staging: wilc1000: added comments for mutex and spinlock_t

2018-05-07 Thread Ajay Singh
Added comments for mutex and spinlock_t to avoid checkpatch.pl script.

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

diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 7a26f34..5e00dde 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -271,7 +271,7 @@ struct host_if_drv {
 
u8 assoc_bssid[ETH_ALEN];
struct cfg_param_attr cfg_values;
-
+/*lock to protect concurrent setting of cfg params*/
struct mutex cfg_values_lock;
struct completion comp_test_key_block;
struct completion comp_test_disconn_block;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index 607dae0..e517768 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -131,10 +131,11 @@ struct wilc {
u8 vif_num;
struct wilc_vif *vif[NUM_CONCURRENT_IFC];
u8 open_ifcs;
-
+/*protect head of transmit queue*/
struct mutex txq_add_to_head_cs;
+/*protect txq_entry_t transmit queue*/
spinlock_t txq_spinlock;
-
+/*protect rxq_entry_t receiver queue*/
struct mutex rxq_cs;
struct mutex hif_cs;
 
-- 
2.7.4

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


[PATCH 22/30] staging: wilc1000: fix line over 80 chars issue in connect()

2018-05-07 Thread Ajay Singh
Fix line over 80 characters in connect() by using temporary variables.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ec4fa1c..00381c9 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -676,7 +676,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
u32 sel_bssi_idx = UINT_MAX;
u8 u8security = NO_ENCRYPT;
enum AUTHTYPE auth_type = ANY;
-
+   u32 cipher_group;
struct wilc_priv *priv;
struct host_if_drv *wfi_drv;
struct network_info *nw_info = NULL;
@@ -724,32 +724,35 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
memset(priv->wep_key, 0, sizeof(priv->wep_key));
memset(priv->wep_key_len, 0, sizeof(priv->wep_key_len));
 
-   if (sme->crypto.cipher_group != NO_ENCRYPT) {
-   if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP40) {
+   cipher_group = sme->crypto.cipher_group;
+   if (cipher_group != NO_ENCRYPT) {
+   if (cipher_group == WLAN_CIPHER_SUITE_WEP40) {
u8security = ENCRYPT_ENABLED | WEP;
 
priv->wep_key_len[sme->key_idx] = sme->key_len;
-   memcpy(priv->wep_key[sme->key_idx], sme->key, 
sme->key_len);
+   memcpy(priv->wep_key[sme->key_idx], sme->key,
+  sme->key_len);
 
wilc_set_wep_default_keyid(vif, sme->key_idx);
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
 sme->key_idx);
-   } else if (sme->crypto.cipher_group == 
WLAN_CIPHER_SUITE_WEP104)   {
+   } else if (cipher_group == WLAN_CIPHER_SUITE_WEP104) {
u8security = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
 
priv->wep_key_len[sme->key_idx] = sme->key_len;
-   memcpy(priv->wep_key[sme->key_idx], sme->key, 
sme->key_len);
+   memcpy(priv->wep_key[sme->key_idx], sme->key,
+  sme->key_len);
 
wilc_set_wep_default_keyid(vif, sme->key_idx);
wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len,
 sme->key_idx);
-   } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)   {
-   if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP)
+   } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
+   if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
u8security = ENCRYPT_ENABLED | WPA2 | TKIP;
else
u8security = ENCRYPT_ENABLED | WPA2 | AES;
-   } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1)   {
-   if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP)
+   } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) {
+   if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
u8security = ENCRYPT_ENABLED | WPA | TKIP;
else
u8security = ENCRYPT_ENABLED | WPA | AES;
@@ -764,14 +767,16 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) ||
(sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)) {
for (i = 0; i < sme->crypto.n_ciphers_pairwise; i++) {
-   if (sme->crypto.ciphers_pairwise[i] == 
WLAN_CIPHER_SUITE_TKIP)
+   u32 ciphers_pairwise = sme->crypto.ciphers_pairwise[i];
+
+   if (ciphers_pairwise == WLAN_CIPHER_SUITE_TKIP)
u8security = u8security | TKIP;
else
u8security = u8security | AES;
}
}
 
-   switch (sme->auth_type) {
+   switch (sme->auth_type) {
case NL80211_AUTHTYPE_OPEN_SYSTEM:
auth_type = OPEN_SYSTEM;
break;
-- 
2.7.4

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


[PATCH 24/30] staging: wilc1000: refactor del_station() to avoid parenthesis misalignment

2018-05-07 Thread Ajay Singh
Refactor the code to fix open parenthesis alignment issue reported by
checkpatch.pl script in del_station().

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 4600f4a..7f49d60 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1997,6 +1997,7 @@ static int del_station(struct wiphy *wiphy, struct 
net_device *dev,
s32 ret = 0;
struct wilc_priv *priv;
struct wilc_vif *vif;
+   struct sta_info *info;
 
if (!wiphy)
return -EFAULT;
@@ -2004,16 +2005,17 @@ static int del_station(struct wiphy *wiphy, struct 
net_device *dev,
priv = wiphy_priv(wiphy);
vif = netdev_priv(dev);
 
-   if (vif->iftype == AP_MODE || vif->iftype == GO_MODE) {
-   if (!mac)
-   ret = wilc_del_allstation(vif,
-priv->assoc_stainfo.sta_associated_bss);
+   if (!(vif->iftype == AP_MODE || vif->iftype == GO_MODE))
+   return ret;
 
-   ret = wilc_del_station(vif, mac);
+   info = &priv->assoc_stainfo;
 
-   if (ret)
-   netdev_err(dev, "Host delete station fail\n");
-   }
+   if (!mac)
+   ret = wilc_del_allstation(vif, info->sta_associated_bss);
+
+   ret = wilc_del_station(vif, mac);
+   if (ret)
+   netdev_err(dev, "Host delete station fail\n");
return ret;
 }
 
-- 
2.7.4

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


[PATCH 26/30] staging: wilc1000: added #define for setting radiotap header

2018-05-07 Thread Ajay Singh
Added new macro to resolve below checkpatch issues in linux_mon.

"Lines should not end with a '('"

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

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index c372e0f..1c7e6e1 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -22,6 +22,9 @@ static u8 bssid[6];
 #define IEEE80211_RADIOTAP_F_TX_FAIL   0x0001  /* failed due to excessive*/
 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
 
+#define TX_RADIOTAP_PRESENT ((1 << IEEE80211_RADIOTAP_RATE) |  \
+(1 << IEEE80211_RADIOTAP_TX_FLAGS))
+
 void wilc_wfi_monitor_rx(u8 *buff, u32 size)
 {
u32 header, pkt_offset;
@@ -59,9 +62,7 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
 
cb_hdr->hdr.it_len = cpu_to_le16(sizeof(*cb_hdr));
 
-   cb_hdr->hdr.it_present = cpu_to_le32(
-   (1 << IEEE80211_RADIOTAP_RATE) |
-   (1 << IEEE80211_RADIOTAP_TX_FLAGS));
+   cb_hdr->hdr.it_present = cpu_to_le32(TX_RADIOTAP_PRESENT);
 
cb_hdr->rate = 5; /* txrate->bitrate / 5; */
 
@@ -177,9 +178,7 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
 
cb_hdr->hdr.it_len = cpu_to_le16(sizeof(*cb_hdr));
 
-   cb_hdr->hdr.it_present = cpu_to_le32(
-   (1 << IEEE80211_RADIOTAP_RATE) |
-   (1 << IEEE80211_RADIOTAP_TX_FLAGS));
+   cb_hdr->hdr.it_present = cpu_to_le32(TX_RADIOTAP_PRESENT);
 
cb_hdr->rate = 5; /* txrate->bitrate / 5; */
cb_hdr->tx_flags = 0x0004;
-- 
2.7.4

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


[PATCH 20/30] staging: wilc1000: fix line over 80 characters in add_key()

2018-05-07 Thread Ajay Singh
Fix line over 80 character issue found by checkpatch.pl script in
add_key().

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 3deef5b..20ba9cc 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -905,8 +905,7 @@ static int wilc_wfi_cfg_copy_wpa_info(struct wilc_wfi_key 
*key_info,
 }
 
 static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 
key_index,
-  bool pairwise,
-  const u8 *mac_addr, struct key_params *params)
+  bool pairwise, const u8 *mac_addr, struct key_params *params)
 
 {
s32 ret = 0, keylen = params->key_len;
@@ -954,6 +953,8 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP ||
priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
+   struct wilc_wfi_key *key;
+
ret = wilc_wfi_cfg_allocate_wpa_entry(priv, key_index);
if (ret)
return -ENOMEM;
@@ -973,21 +974,19 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
 
priv->wilc_groupkey = mode;
 
-   ret = 
wilc_wfi_cfg_copy_wpa_info(priv->wilc_gtk[key_index],
-params);
-   if (ret)
-   return -ENOMEM;
+   key = priv->wilc_gtk[key_index];
} else {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
mode = ENCRYPT_ENABLED | WPA | TKIP;
else
mode = priv->wilc_groupkey | AES;
 
-   ret = 
wilc_wfi_cfg_copy_wpa_info(priv->wilc_ptk[key_index],
-params);
-   if (ret)
-   return -ENOMEM;
+   key = priv->wilc_ptk[key_index];
}
+   ret = wilc_wfi_cfg_copy_wpa_info(key, params);
+   if (ret)
+   return -ENOMEM;
+
op_mode = AP_MODE;
} else {
if (params->key_len > 16 &&
-- 
2.7.4

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


[PATCH 19/30] staging: wilc1000: fix line over 80 chars in wilc_create_wiphy() declaration

2018-05-07 Thread Ajay Singh
Fix line over 80 characters issue found by checkpatch.pl script in
function declaration.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index c1a2421..a69103b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -3,7 +3,8 @@
 #define NM_WFI_CFGOPERATIONS
 #include "wilc_wfi_netdevice.h"
 
-struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device 
*dev);
+struct wireless_dev *wilc_create_wiphy(struct net_device *net,
+  struct device *dev);
 void wilc_free_wiphy(struct net_device *net);
 int wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
-- 
2.7.4

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


[PATCH 10/30] staging: wilc1000: fix line over 80 chars in linux_mon

2018-05-07 Thread Ajay Singh
Fix line over 80 char issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_mon.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 2f4b3f5..c372e0f 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -46,18 +46,18 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
if (pkt_offset & IS_MANAGMEMENT_CALLBACK) {
/* hostapd callback mgmt frame */
 
-   skb = dev_alloc_skb(size + sizeof(struct 
wilc_wfi_radiotap_cb_hdr));
+   skb = dev_alloc_skb(size + sizeof(*cb_hdr));
if (!skb)
return;
 
skb_put_data(skb, buff, size);
 
cb_hdr = skb_push(skb, sizeof(*cb_hdr));
-   memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr));
+   memset(cb_hdr, 0, sizeof(*cb_hdr));
 
cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
 
-   cb_hdr->hdr.it_len = cpu_to_le16(sizeof(struct 
wilc_wfi_radiotap_cb_hdr));
+   cb_hdr->hdr.it_len = cpu_to_le16(sizeof(*cb_hdr));
 
cb_hdr->hdr.it_present = cpu_to_le32(
(1 << IEEE80211_RADIOTAP_RATE) |
@@ -73,7 +73,7 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
}
 
} else {
-   skb = dev_alloc_skb(size + sizeof(struct 
wilc_wfi_radiotap_hdr));
+   skb = dev_alloc_skb(size + sizeof(*hdr));
 
if (!skb)
return;
@@ -82,7 +82,7 @@ void wilc_wfi_monitor_rx(u8 *buff, u32 size)
hdr = skb_push(skb, sizeof(*hdr));
memset(hdr, 0, sizeof(struct wilc_wfi_radiotap_hdr));
hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
-   hdr->hdr.it_len = cpu_to_le16(sizeof(struct 
wilc_wfi_radiotap_hdr));
+   hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr));
hdr->hdr.it_present = cpu_to_le32
(1 << IEEE80211_RADIOTAP_RATE); /* | */
hdr->rate = 5; /* txrate->bitrate / 5; */
@@ -164,7 +164,7 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
skb_pull(skb, rtap_len);
 
if (skb->data[0] == 0xc0 && is_broadcast_ether_addr(&skb->data[4])) {
-   skb2 = dev_alloc_skb(skb->len + sizeof(struct 
wilc_wfi_radiotap_cb_hdr));
+   skb2 = dev_alloc_skb(skb->len + sizeof(*cb_hdr));
if (!skb2)
return -ENOMEM;
 
@@ -175,7 +175,7 @@ static netdev_tx_t wilc_wfi_mon_xmit(struct sk_buff *skb,
 
cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
 
-   cb_hdr->hdr.it_len = cpu_to_le16(sizeof(struct 
wilc_wfi_radiotap_cb_hdr));
+   cb_hdr->hdr.it_len = cpu_to_le16(sizeof(*cb_hdr));
 
cb_hdr->hdr.it_present = cpu_to_le32(
(1 << IEEE80211_RADIOTAP_RATE) |
-- 
2.7.4

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


[PATCH 14/30] staging: wilc1000: fix line over 80 chars in add_network_to_shadow()

2018-05-07 Thread Ajay Singh
Fix line over 80 characters issue reported by checkpatch in
add_network_to_shadow() by using temporary variable.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index f1ebaea..0ae2065 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -300,6 +300,7 @@ static void add_network_to_shadow(struct network_info 
*nw_info,
int ap_found = is_network_in_shadow(nw_info, user_void);
u32 ap_index = 0;
u8 rssi_index = 0;
+   struct network_info *shadow_nw_info;
 
if (last_scanned_cnt >= MAX_NUM_SCANNED_NETWORKS_SHADOW)
return;
@@ -310,37 +311,34 @@ static void add_network_to_shadow(struct network_info 
*nw_info,
} else {
ap_index = ap_found;
}
-   rssi_index = last_scanned_shadow[ap_index].rssi_history.index;
-   last_scanned_shadow[ap_index].rssi_history.samples[rssi_index++] = 
nw_info->rssi;
+   shadow_nw_info = &last_scanned_shadow[ap_index];
+   rssi_index = shadow_nw_info->rssi_history.index;
+   shadow_nw_info->rssi_history.samples[rssi_index++] = nw_info->rssi;
if (rssi_index == NUM_RSSI) {
rssi_index = 0;
-   last_scanned_shadow[ap_index].rssi_history.full = true;
-   }
-   last_scanned_shadow[ap_index].rssi_history.index = rssi_index;
-   last_scanned_shadow[ap_index].rssi = nw_info->rssi;
-   last_scanned_shadow[ap_index].cap_info = nw_info->cap_info;
-   last_scanned_shadow[ap_index].ssid_len = nw_info->ssid_len;
-   memcpy(last_scanned_shadow[ap_index].ssid,
-  nw_info->ssid, nw_info->ssid_len);
-   memcpy(last_scanned_shadow[ap_index].bssid,
-  nw_info->bssid, ETH_ALEN);
-   last_scanned_shadow[ap_index].beacon_period = nw_info->beacon_period;
-   last_scanned_shadow[ap_index].dtim_period = nw_info->dtim_period;
-   last_scanned_shadow[ap_index].ch = nw_info->ch;
-   last_scanned_shadow[ap_index].ies_len = nw_info->ies_len;
-   last_scanned_shadow[ap_index].tsf_hi = nw_info->tsf_hi;
+   shadow_nw_info->rssi_history.full = true;
+   }
+   shadow_nw_info->rssi_history.index = rssi_index;
+   shadow_nw_info->rssi = nw_info->rssi;
+   shadow_nw_info->cap_info = nw_info->cap_info;
+   shadow_nw_info->ssid_len = nw_info->ssid_len;
+   memcpy(shadow_nw_info->ssid, nw_info->ssid, nw_info->ssid_len);
+   memcpy(shadow_nw_info->bssid, nw_info->bssid, ETH_ALEN);
+   shadow_nw_info->beacon_period = nw_info->beacon_period;
+   shadow_nw_info->dtim_period = nw_info->dtim_period;
+   shadow_nw_info->ch = nw_info->ch;
+   shadow_nw_info->ies_len = nw_info->ies_len;
+   shadow_nw_info->tsf_hi = nw_info->tsf_hi;
if (ap_found != -1)
-   kfree(last_scanned_shadow[ap_index].ies);
-   last_scanned_shadow[ap_index].ies = kmalloc(nw_info->ies_len,
-   GFP_KERNEL);
-   memcpy(last_scanned_shadow[ap_index].ies,
-  nw_info->ies, nw_info->ies_len);
-   last_scanned_shadow[ap_index].time_scan = jiffies;
-   last_scanned_shadow[ap_index].time_scan_cached = jiffies;
-   last_scanned_shadow[ap_index].found = 1;
+   kfree(shadow_nw_info->ies);
+   shadow_nw_info->ies = kmalloc(nw_info->ies_len, GFP_KERNEL);
+   memcpy(shadow_nw_info->ies, nw_info->ies, nw_info->ies_len);
+   shadow_nw_info->time_scan = jiffies;
+   shadow_nw_info->time_scan_cached = jiffies;
+   shadow_nw_info->found = 1;
if (ap_found != -1)
-   kfree(last_scanned_shadow[ap_index].join_params);
-   last_scanned_shadow[ap_index].join_params = join_params;
+   kfree(shadow_nw_info->join_params);
+   shadow_nw_info->join_params = join_params;
 }
 
 static void cfg_scan_result(enum scan_event scan_event,
-- 
2.7.4

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


[PATCH 18/30] staging: wilc1000: fix line over 80 chars in get_station()

2018-05-07 Thread Ajay Singh
Fix line over 80 characters issue in get_station().

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 8dea414..3deef5b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1124,7 +1124,9 @@ 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.sta_associated_bss[i], ETH_ALEN))) {
+   if (!(memcmp(mac,
+priv->assoc_stainfo.sta_associated_bss[i],
+ETH_ALEN))) {
associatedsta = i;
break;
}
-- 
2.7.4

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


[PATCH 17/30] staging: wilc1000: fix line over 80 chars in wilc_wfi_cfg_tx_vendor_spec()

2018-05-07 Thread Ajay Singh
Fix line over 80 characters issues reported by checkpatch.pl script in
wilc_wfi_cfg_tx_vendor_spec() by using temporary variable. Simplified
'if else' condition with 'if'.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 4f35178..8dea414 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1573,14 +1573,14 @@ static void wilc_wfi_cfg_tx_vendor_spec(struct 
p2p_mgmt_data *mgmt_tx,
for (i = P2P_PUB_ACTION_SUBTYPE + 2; i < len; i++) {
if (buf[i] == P2PELEM_ATTR_ID &&
!memcmp(p2p_oui, &buf[i + 2], 4)) {
+   bool oper_ch = false;
+   u8 *tx_buff = &mgmt_tx->buff[i + 6];
+
if (subtype == P2P_INV_REQ || subtype == P2P_INV_RSP)
-   wilc_wfi_cfg_parse_tx_action(&mgmt_tx->buff[i + 
6],
-len - (i + 6),
-true, iftype);
-   else
-   wilc_wfi_cfg_parse_tx_action(&mgmt_tx->buff[i + 
6],
-len - (i + 6),
-false, iftype);
+   oper_ch = true;
+
+   wilc_wfi_cfg_parse_tx_action(tx_buff, len - (i + 6),
+oper_ch, iftype);
 
break;
}
-- 
2.7.4

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


[PATCH 16/30] staging: wilc1000: fix line over 80 charas in wilc_wfi_remain_on_channel_expired()

2018-05-07 Thread Ajay Singh
Refactor wilc_wfi_remain_on_channel_expired() to avoid line over 80
character issue reported by checkpatch.pl script. Also assigned value in the
variable at the time of declaration.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index ca221f1..4f35178 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1490,18 +1490,16 @@ static void wilc_wfi_remain_on_channel_ready(void 
*priv_data)
 
 static void wilc_wfi_remain_on_channel_expired(void *data, u32 session_id)
 {
-   struct wilc_priv *priv;
+   struct wilc_priv *priv = data;
+   struct wilc_wfi_p2p_listen_params *params = &priv->remain_on_ch_params;
 
-   priv = data;
+   if (session_id != params->listen_session_id)
+   return;
 
-   if (session_id == priv->remain_on_ch_params.listen_session_id) {
-   priv->p2p_listen_state = false;
+   priv->p2p_listen_state = false;
 
-   cfg80211_remain_on_channel_expired(priv->wdev,
-  
priv->remain_on_ch_params.listen_cookie,
-  
priv->remain_on_ch_params.listen_ch,
-  GFP_KERNEL);
-   }
+   cfg80211_remain_on_channel_expired(priv->wdev, params->listen_cookie,
+  params->listen_ch, GFP_KERNEL);
 }
 
 static int remain_on_channel(struct wiphy *wiphy,
-- 
2.7.4

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


[PATCH 12/30] staging: wilc1000: use kmalloc(sizeof(*mgmt_tx)...) in mgmt_tx()

2018-05-07 Thread Ajay Singh
Fix below checkpatch issue found in mgmt_tx()

Prefer kmalloc(sizeof(*mgmt_tx)...) over kmalloc(sizeof(struct
p2p_mgmt_data)...)

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 102facd..d0fb31a 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1628,7 +1628,7 @@ static int mgmt_tx(struct wiphy *wiphy,
if (!ieee80211_is_mgmt(mgmt->frame_control))
goto out;
 
-   mgmt_tx = kmalloc(sizeof(struct p2p_mgmt_data), GFP_KERNEL);
+   mgmt_tx = kmalloc(sizeof(*mgmt_tx), GFP_KERNEL);
if (!mgmt_tx) {
ret = -ENOMEM;
goto out;
-- 
2.7.4

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


[PATCH 15/30] staging: wilc1000: use kmemdup instead of kmalloc in add_network_to_shadow()

2018-05-07 Thread Ajay Singh
Use kmemdup instead of kmalloc & memcpy in add_network_to_shadow().

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0ae2065..ca221f1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -331,8 +331,8 @@ static void add_network_to_shadow(struct network_info 
*nw_info,
shadow_nw_info->tsf_hi = nw_info->tsf_hi;
if (ap_found != -1)
kfree(shadow_nw_info->ies);
-   shadow_nw_info->ies = kmalloc(nw_info->ies_len, GFP_KERNEL);
-   memcpy(shadow_nw_info->ies, nw_info->ies, nw_info->ies_len);
+   shadow_nw_info->ies = kmemdup(nw_info->ies, nw_info->ies_len,
+ GFP_KERNEL);
shadow_nw_info->time_scan = jiffies;
shadow_nw_info->time_scan_cached = jiffies;
shadow_nw_info->found = 1;
-- 
2.7.4

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


[PATCH 13/30] staging: wilc1000: rename clear_duringIP() to avoid camelCase issue

2018-05-07 Thread Ajay Singh
Rename clear_duringIP() function to avoid camelCase issue reported by
checkpatch.pl script.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index d0fb31a..f1ebaea 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -269,7 +269,7 @@ static void remove_network_from_shadow(struct timer_list 
*unused)
mod_timer(&aging_timer, jiffies + msecs_to_jiffies(AGING_TIME));
 }
 
-static void clear_duringIP(struct timer_list *unused)
+static void clear_duringip(struct timer_list *unused)
 {
wilc_optaining_ip = false;
 }
@@ -2272,7 +2272,7 @@ int wilc_init_host_int(struct net_device *net)
priv = wdev_priv(net->ieee80211_ptr);
if (op_ifcs == 0) {
timer_setup(&aging_timer, remove_network_from_shadow, 0);
-   timer_setup(&wilc_during_ip_timer, clear_duringIP, 0);
+   timer_setup(&wilc_during_ip_timer, clear_duringip, 0);
}
op_ifcs++;
 
-- 
2.7.4

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


[PATCH 11/30] staging: wilc1000: use sizeof(*wdev) to allocate memory in wilc_wfi_cfg_alloc()

2018-05-07 Thread Ajay Singh
Fix below reported checkpatch issues in wilc_wfi_cfg_alloc().
kzalloc(sizeof(*wdev)...) over kzalloc(sizeof(struct wireless_dev)

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 8be3c4c..102facd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2194,7 +2194,7 @@ static struct wireless_dev *wilc_wfi_cfg_alloc(void)
 {
struct wireless_dev *wdev;
 
-   wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
+   wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
if (!wdev)
goto _fail_;
 
-- 
2.7.4

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


[PATCH 08/30] staging: wilc1000: fix line over 80 chars in host_int_parse_assoc_resp_info()

2018-05-07 Thread Ajay Singh
Fix line over 80 characters issue in host_int_parse_assoc_resp_info() by
using shorter name for the local variable.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c9c5d352..b1f67a7 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1320,18 +1320,19 @@ static inline void 
host_int_parse_assoc_resp_info(struct wilc_vif *vif,
memset(&conn_info, 0, sizeof(struct connect_info));
 
if (mac_status == MAC_STATUS_CONNECTED) {
-   u32 rcvd_assoc_resp_info_len;
+   u32 assoc_resp_info_len;
 
memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE);
 
host_int_get_assoc_res_info(vif, rcv_assoc_resp,
MAX_ASSOC_RESP_FRAME_SIZE,
-   &rcvd_assoc_resp_info_len);
+   &assoc_resp_info_len);
 
-   if (rcvd_assoc_resp_info_len != 0) {
+   if (assoc_resp_info_len != 0) {
s32 err = 0;
 
-   err = wilc_parse_assoc_resp_info(rcv_assoc_resp, 
rcvd_assoc_resp_info_len,
+   err = wilc_parse_assoc_resp_info(rcv_assoc_resp,
+assoc_resp_info_len,
 &connect_resp_info);
if (err)
netdev_err(vif->ndev,
-- 
2.7.4

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


[PATCH 09/30] staging: wilc1000: rename kmalloc with kmemdup() in handle_connect_timeout()

2018-05-07 Thread Ajay Singh
Instead of kmalloc and memcpy use kmemdup in handle_connect_timeout().
Also return -ENOMEM incase of failure to allocate the memory.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index b1f67a7..ad9270e 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1166,10 +1166,11 @@ static s32 handle_connect_timeout(struct wilc_vif *vif)
 
if (hif_drv->usr_conn_req.ies) {
info.req_ies_len = hif_drv->usr_conn_req.ies_len;
-   info.req_ies = kmalloc(hif_drv->usr_conn_req.ies_len, 
GFP_KERNEL);
-   memcpy(info.req_ies,
-  hif_drv->usr_conn_req.ies,
-  hif_drv->usr_conn_req.ies_len);
+   info.req_ies = kmemdup(hif_drv->usr_conn_req.ies,
+  hif_drv->usr_conn_req.ies_len,
+  GFP_KERNEL);
+   if (!info.req_ies)
+   return -ENOMEM;
}
 
hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP,
-- 
2.7.4

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


[PATCH 05/30] staging: wilc1000: fix line over 80 chars in host_int_parse_assoc_resp_info()

2018-05-07 Thread Ajay Singh
Fix line over 80 characters issue reported by checkpatch.pl in
host_int_parse_assoc_resp_info().

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 55a61d5..a341ff1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1293,6 +1293,23 @@ static inline void host_int_free_user_conn_req(struct 
host_if_drv *hif_drv)
hif_drv->usr_conn_req.ies = NULL;
 }
 
+static void host_int_copy_conn_info(struct connect_resp_info *conn_resp_info,
+   struct connect_info *conn_info)
+{
+   conn_info->status = conn_resp_info->status;
+
+   if (conn_info->status == SUCCESSFUL_STATUSCODE && conn_resp_info->ies) {
+   conn_info->resp_ies = kmemdup(conn_resp_info->ies,
+ conn_resp_info->ies_len,
+ GFP_KERNEL);
+   if (conn_info->resp_ies)
+   conn_info->resp_ies_len = conn_resp_info->ies_len;
+   }
+
+   kfree(conn_resp_info->ies);
+   kfree(conn_resp_info);
+}
+
 static inline void host_int_parse_assoc_resp_info(struct wilc_vif *vif,
  u8 mac_status)
 {
@@ -1316,25 +1333,13 @@ static inline void 
host_int_parse_assoc_resp_info(struct wilc_vif *vif,
 
err = wilc_parse_assoc_resp_info(rcv_assoc_resp, 
rcvd_assoc_resp_info_len,
 &connect_resp_info);
-   if (err) {
+   if (err)
netdev_err(vif->ndev,
   "wilc_parse_assoc_resp_info() 
returned error %d\n",
   err);
-   } else {
-   conn_info.status = connect_resp_info->status;
-
-   if (conn_info.status == SUCCESSFUL_STATUSCODE &&
-   connect_resp_info->ies) {
-   conn_info.resp_ies = 
kmemdup(connect_resp_info->ies,
-
connect_resp_info->ies_len,
-
GFP_KERNEL);
-   if (conn_info.resp_ies)
-   conn_info.resp_ies_len = 
connect_resp_info->ies_len;
-   }
-
-   kfree(connect_resp_info->ies);
-   kfree(connect_resp_info);
-   }
+   else
+   host_int_copy_conn_info(connect_resp_info,
+   &conn_info);
}
}
 
-- 
2.7.4

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


[PATCH 00/30] staging: wilc1000: checkpatch fixes and code cleanup

2018-05-07 Thread Ajay Singh
This patch series contains modification to remove checkpatch related issues,
mainly related to 'line over 80 chars'.

We are left with around '5' checkpatch warnings in WILC1000.

Also code cleanup related change to follow as per linux coding style are
included in this patch series.

Ajay Singh (30):
  staging: wilc1000: added complete() call for error scenario in
handle_key()
  staging: wilc1000: remove 'ret' variable in handle_key()
  staging: wilc1000: fix line over 80 chars in handle_key()
  staging: wilc1000: fix line over 80 characters issue in
handle_connect()
  staging: wilc1000: fix line over 80 chars in
host_int_parse_assoc_resp_info()
  staging: wilc1000: fix line over 80 chars issue in
host_int_handle_disconnect()
  staging: wilc1000: fix line over 80 characters in
host_int_parse_join_bss_param()
  staging: wilc1000: fix line over 80 chars in
host_int_parse_assoc_resp_info()
  staging: wilc1000: rename kmalloc with kmemdup() in
handle_connect_timeout()
  staging: wilc1000: fix line over 80 chars in linux_mon
  staging: wilc1000: use sizeof(*wdev) to allocate memory in
wilc_wfi_cfg_alloc()
  staging: wilc1000: use kmalloc(sizeof(*mgmt_tx)...) in mgmt_tx()
  staging: wilc1000: rename clear_duringIP() to avoid camelCase issue
  staging: wilc1000: fix line over 80 chars in add_network_to_shadow()
  staging: wilc1000: use kmemdup instead of kmalloc in
add_network_to_shadow()
  staging: wilc1000: fix line over 80 charas in
wilc_wfi_remain_on_channel_expired()
  staging: wilc1000: fix line over 80 chars in
wilc_wfi_cfg_tx_vendor_spec()
  staging: wilc1000: fix line over 80 chars in get_station()
  staging: wilc1000: fix line over 80 chars in wilc_create_wiphy()
declaration
  staging: wilc1000: fix line over 80 characters in add_key()
  staging: wilc1000: fix line over 80 chars in scan()
  staging: wilc1000: fix line over 80 chars issue in connect()
  staging: wilc1000: rename u8security to avoid datatype in variable
name
  staging: wilc1000: refactor del_station() to avoid parenthesis
misalignment
  staging: wilc1000: fix line over 80 chars in wilc_sdio struct
  staging: wilc1000: added #define for setting radiotap header
  staging: wilc1000: remove 'flag' argument from wilc_mac_indicate()
  staging: wilc1000: added comments for mutex and spinlock_t
  staging: wilc1000: remove unused 'lock' varible in 'wilc_priv'
structure
  staging: wilc1000: rename s8idxarray to avoid datatype in variable
name

 drivers/staging/wilc1000/host_interface.c | 417 --
 drivers/staging/wilc1000/host_interface.h |   2 +-
 drivers/staging/wilc1000/linux_mon.c  |  25 +-
 drivers/staging/wilc1000/linux_wlan.c |  17 +-
 drivers/staging/wilc1000/wilc_sdio.c  |   3 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 187 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |   3 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   8 +-
 drivers/staging/wilc1000/wilc_wlan.c  |   7 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   |   3 -
 10 files changed, 350 insertions(+), 322 deletions(-)

-- 
2.7.4

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


[PATCH 01/30] staging: wilc1000: added complete() call for error scenario in handle_key()

2018-05-07 Thread Ajay Singh
During memory allocation failure in handle_key() the complete() was not
called for comp_test_key_block event. So now added the code to call
complete() for event during error scenario.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 28edd90..d903ae5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1525,8 +1525,10 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
 
key_buf = kmalloc(hif_key->attr.wep.key_len + 2,
  GFP_KERNEL);
-   if (!key_buf)
-   return -ENOMEM;
+   if (!key_buf) {
+   result = -ENOMEM;
+   goto out_wep;
+   }
 
key_buf[0] = hif_key->attr.wep.index;
key_buf[1] = hif_key->attr.wep.key_len;
@@ -1547,8 +1549,10 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
kfree(key_buf);
} else if (hif_key->action & ADDKEY) {
key_buf = kmalloc(hif_key->attr.wep.key_len + 2, 
GFP_KERNEL);
-   if (!key_buf)
-   return -ENOMEM;
+   if (!key_buf) {
+   result = -ENOMEM;
+   goto out_wep;
+   }
key_buf[0] = hif_key->attr.wep.index;
memcpy(key_buf + 1, &hif_key->attr.wep.key_len, 1);
memcpy(key_buf + 2, hif_key->attr.wep.key,
@@ -1585,6 +1589,7 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
  &wid, 1,
  wilc_get_vif_idx(vif));
}
+out_wep:
complete(&hif_drv->comp_test_key_block);
break;
 
@@ -1619,7 +1624,6 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
  wilc_get_vif_idx(vif));
 
kfree(key_buf);
-   complete(&hif_drv->comp_test_key_block);
} else if (hif_key->action & ADDKEY) {
key_buf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (!key_buf) {
@@ -1648,9 +1652,9 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
  wilc_get_vif_idx(vif));
 
kfree(key_buf);
-   complete(&hif_drv->comp_test_key_block);
}
 out_wpa_rx_gtk:
+   complete(&hif_drv->comp_test_key_block);
kfree(hif_key->attr.wpa.key);
kfree(hif_key->attr.wpa.seq);
if (ret)
@@ -1686,7 +1690,6 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
  wid_list, 2,
  wilc_get_vif_idx(vif));
kfree(key_buf);
-   complete(&hif_drv->comp_test_key_block);
} else if (hif_key->action & ADDKEY) {
key_buf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
if (!key_buf) {
@@ -1708,10 +1711,10 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
  &wid, 1,
  wilc_get_vif_idx(vif));
kfree(key_buf);
-   complete(&hif_drv->comp_test_key_block);
}
 
 out_wpa_ptk:
+   complete(&hif_drv->comp_test_key_block);
kfree(hif_key->attr.wpa.key);
if (ret)
return ret;
-- 
2.7.4

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


[PATCH 07/30] staging: wilc1000: fix line over 80 characters in host_int_parse_join_bss_param()

2018-05-07 Thread Ajay Singh
Split host_int_parse_join_bss_param() to avoid the line over 80
character issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 247 --
 1 file changed, 131 insertions(+), 116 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0d84af9..c9c5d352 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3856,150 +3856,165 @@ int wilc_setup_multicast_filter(struct wilc_vif *vif, 
bool enabled,
return result;
 }
 
-static void *host_int_parse_join_bss_param(struct network_info *info)
+static void host_int_fill_join_bss_param(struct join_bss_param *param, u8 *ies,
+u16 *out_index, u8 *pcipher_tc,
+u8 *auth_total_cnt, u32 tsf_lo)
 {
-   struct join_bss_param *param = NULL;
-   u8 *ies;
-   u16 ies_len;
-   u16 index = 0;
u8 rates_no = 0;
u8 ext_rates_no;
u16 offset;
u8 pcipher_cnt;
u8 auth_cnt;
-   u8 pcipher_total_cnt = 0;
-   u8 auth_total_cnt = 0;
u8 i, j;
+   u16 index = *out_index;
 
-   ies = info->ies;
-   ies_len = info->ies_len;
+   if (ies[index] == SUPP_RATES_IE) {
+   rates_no = ies[index + 1];
+   param->supp_rates[0] = rates_no;
+   index += 2;
 
-   param = kzalloc(sizeof(*param), GFP_KERNEL);
-   if (!param)
-   return NULL;
+   for (i = 0; i < rates_no; i++)
+   param->supp_rates[i + 1] = ies[index + i];
 
-   param->dtim_period = info->dtim_period;
-   param->beacon_period = info->beacon_period;
-   param->cap_info = info->cap_info;
-   memcpy(param->bssid, info->bssid, 6);
-   memcpy((u8 *)param->ssid, info->ssid, info->ssid_len + 1);
-   param->ssid_len = info->ssid_len;
-   memset(param->rsn_pcip_policy, 0xFF, 3);
-   memset(param->rsn_auth_policy, 0xFF, 3);
+   index += rates_no;
+   } else if (ies[index] == EXT_SUPP_RATES_IE) {
+   ext_rates_no = ies[index + 1];
+   if (ext_rates_no > (MAX_RATES_SUPPORTED - rates_no))
+   param->supp_rates[0] = MAX_RATES_SUPPORTED;
+   else
+   param->supp_rates[0] += ext_rates_no;
+   index += 2;
+   for (i = 0; i < (param->supp_rates[0] - rates_no); i++)
+   param->supp_rates[rates_no + i + 1] = ies[index + i];
+
+   index += ext_rates_no;
+   } else if (ies[index] == HT_CAPABILITY_IE) {
+   param->ht_capable = true;
+   index += ies[index + 1] + 2;
+   } else if ((ies[index] == WMM_IE) &&
+  (ies[index + 2] == 0x00) && (ies[index + 3] == 0x50) &&
+  (ies[index + 4] == 0xF2) && (ies[index + 5] == 0x02) &&
+  ((ies[index + 6] == 0x00) || (ies[index + 6] == 0x01)) &&
+  (ies[index + 7] == 0x01)) {
+   param->wmm_cap = true;
+
+   if (ies[index + 8] & BIT(7))
+   param->uapsd_cap = true;
+   index += ies[index + 1] + 2;
+   } else if ((ies[index] == P2P_IE) &&
+(ies[index + 2] == 0x50) && (ies[index + 3] == 0x6f) &&
+(ies[index + 4] == 0x9a) &&
+(ies[index + 5] == 0x09) && (ies[index + 6] == 0x0c)) {
+   u16 p2p_cnt;
+
+   param->tsf = tsf_lo;
+   param->noa_enabled = 1;
+   param->idx = ies[index + 9];
+
+   if (ies[index + 10] & BIT(7)) {
+   param->opp_enabled = 1;
+   param->ct_window = ies[index + 10];
+   } else {
+   param->opp_enabled = 0;
+   }
 
-   while (index < ies_len) {
-   if (ies[index] == SUPP_RATES_IE) {
-   rates_no = ies[index + 1];
-   param->supp_rates[0] = rates_no;
-   index += 2;
+   param->cnt = ies[index + 11];
+   p2p_cnt = index + 12;
 
-   for (i = 0; i < rates_no; i++)
-   param->supp_rates[i + 1] = ies[index + i];
+   memcpy(param->duration, ies + p2p_cnt, 4);
+   p2p_cnt += 4;
 
-   index += rates_no;
-   } else if (ies[index] == EXT_SUPP_RATES_IE) {
-   ext_rates_no = ies[index + 1];
-   if (ext_rates_no > (MAX_RATES_SUPPORTED - rates_no))
-   param->supp_rates[0] = MAX_RATES_SUPPORTED;
-   else
-   param->supp_rates[0] += ext_rates_no;
-   index += 2;
-   for (i = 0; i < (param->supp_rate

[PATCH 03/30] staging: wilc1000: fix line over 80 chars in handle_key()

2018-05-07 Thread Ajay Singh
Fix checkpatch reported issue of line over 80 char in handle_key().
Introduced new functions by spliting existing function to address the
checkpatch issue.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 4ba868c..29f9907 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1498,12 +1498,45 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif 
*vif,
return result;
 }
 
+static int wilc_pmksa_key_copy(struct wilc_vif *vif, struct key_attr *hif_key)
+{
+   int i;
+   int ret;
+   struct wid wid;
+   u8 *key_buf;
+
+   key_buf = kmalloc((hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1,
+ GFP_KERNEL);
+   if (!key_buf)
+   return -ENOMEM;
+
+   key_buf[0] = hif_key->attr.pmkid.numpmkid;
+
+   for (i = 0; i < hif_key->attr.pmkid.numpmkid; i++) {
+   memcpy(key_buf + ((PMKSA_KEY_LEN * i) + 1),
+  hif_key->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN);
+   memcpy(key_buf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1),
+  hif_key->attr.pmkid.pmkidlist[i].pmkid, PMKID_LEN);
+   }
+
+   wid.id = (u16)WID_PMKID_INFO;
+   wid.type = WID_STR;
+   wid.val = (s8 *)key_buf;
+   wid.size = (hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
+
+   ret = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
+  wilc_get_vif_idx(vif));
+
+   kfree(key_buf);
+
+   return ret;
+}
+
 static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
 {
int result = 0;
struct wid wid;
struct wid wid_list[5];
-   u8 i;
u8 *key_buf;
s8 s8idxarray[1];
struct host_if_drv *hif_drv = vif->hif_drv;
@@ -1547,7 +1580,8 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
  wilc_get_vif_idx(vif));
kfree(key_buf);
} else if (hif_key->action & ADDKEY) {
-   key_buf = kmalloc(hif_key->attr.wep.key_len + 2, 
GFP_KERNEL);
+   key_buf = kmalloc(hif_key->attr.wep.key_len + 2,
+ GFP_KERNEL);
if (!key_buf) {
result = -ENOMEM;
goto out_wep;
@@ -1715,26 +1749,7 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
break;
 
case PMKSA:
-   key_buf = kmalloc((hif_key->attr.pmkid.numpmkid * 
PMKSA_KEY_LEN) + 1, GFP_KERNEL);
-   if (!key_buf)
-   return -ENOMEM;
-
-   key_buf[0] = hif_key->attr.pmkid.numpmkid;
-
-   for (i = 0; i < hif_key->attr.pmkid.numpmkid; i++) {
-   memcpy(key_buf + ((PMKSA_KEY_LEN * i) + 1), 
hif_key->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN);
-   memcpy(key_buf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), 
hif_key->attr.pmkid.pmkidlist[i].pmkid, PMKID_LEN);
-   }
-
-   wid.id = (u16)WID_PMKID_INFO;
-   wid.type = WID_STR;
-   wid.val = (s8 *)key_buf;
-   wid.size = (hif_key->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1;
-
-   result = wilc_send_config_pkt(vif, SET_CFG, &wid, 1,
- wilc_get_vif_idx(vif));
-
-   kfree(key_buf);
+   result = wilc_pmksa_key_copy(vif, hif_key);
break;
}
 
-- 
2.7.4

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


[PATCH 06/30] staging: wilc1000: fix line over 80 chars issue in host_int_handle_disconnect()

2018-05-07 Thread Ajay Singh
Fix line over 80 char issue in host_int_handle_disconnect() by using
temp variable to hold the 'wilc_connect_result' function pointer.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index a341ff1..0d84af9 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1401,6 +1401,7 @@ static inline void host_int_handle_disconnect(struct 
wilc_vif *vif)
 {
struct disconnect_info disconn_info;
struct host_if_drv *hif_drv = vif->hif_drv;
+   wilc_connect_result conn_result = hif_drv->usr_conn_req.conn_result;
 
memset(&disconn_info, 0, sizeof(struct disconnect_info));
 
@@ -1413,13 +1414,12 @@ static inline void host_int_handle_disconnect(struct 
wilc_vif *vif)
disconn_info.ie = NULL;
disconn_info.ie_len = 0;
 
-   if (hif_drv->usr_conn_req.conn_result) {
+   if (conn_result) {
wilc_optaining_ip = false;
wilc_set_power_mgmt(vif, 0, 0);
 
-   
hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF,
- NULL, 0, &disconn_info,
- hif_drv->usr_conn_req.arg);
+   conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, 0,
+   &disconn_info, hif_drv->usr_conn_req.arg);
} else {
netdev_err(vif->ndev, "Connect result NULL\n");
}
-- 
2.7.4

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


[PATCH 02/30] staging: wilc1000: remove 'ret' variable in handle_key()

2018-05-07 Thread Ajay Singh
Remove the use of unnecessary 'ret' variable and use existing 'result'
variable to hold the status. Also changed type of 'result' from s32 to
int to confirm with the function return type.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d903ae5..4ba868c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1500,13 +1500,12 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif 
*vif,
 
 static int handle_key(struct wilc_vif *vif, struct key_attr *hif_key)
 {
-   s32 result = 0;
+   int result = 0;
struct wid wid;
struct wid wid_list[5];
u8 i;
u8 *key_buf;
s8 s8idxarray[1];
-   s8 ret = 0;
struct host_if_drv *hif_drv = vif->hif_drv;
 
switch (hif_key->type) {
@@ -1597,7 +1596,7 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
if (hif_key->action & ADDKEY_AP) {
key_buf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (!key_buf) {
-   ret = -ENOMEM;
+   result = -ENOMEM;
goto out_wpa_rx_gtk;
}
 
@@ -1627,7 +1626,7 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
} else if (hif_key->action & ADDKEY) {
key_buf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (!key_buf) {
-   ret = -ENOMEM;
+   result = -ENOMEM;
goto out_wpa_rx_gtk;
}
 
@@ -1657,16 +1656,13 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
complete(&hif_drv->comp_test_key_block);
kfree(hif_key->attr.wpa.key);
kfree(hif_key->attr.wpa.seq);
-   if (ret)
-   return ret;
-
break;
 
case WPA_PTK:
if (hif_key->action & ADDKEY_AP) {
key_buf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL);
if (!key_buf) {
-   ret = -ENOMEM;
+   result = -ENOMEM;
goto out_wpa_ptk;
}
 
@@ -1693,7 +1689,7 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
} else if (hif_key->action & ADDKEY) {
key_buf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL);
if (!key_buf) {
-   ret = -ENOMEM;
+   result = -ENOMEM;
goto out_wpa_ptk;
}
 
@@ -1716,9 +1712,6 @@ static int handle_key(struct wilc_vif *vif, struct 
key_attr *hif_key)
 out_wpa_ptk:
complete(&hif_drv->comp_test_key_block);
kfree(hif_key->attr.wpa.key);
-   if (ret)
-   return ret;
-
break;
 
case PMKSA:
-- 
2.7.4

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


[PATCH 04/30] staging: wilc1000: fix line over 80 characters issue in handle_connect()

2018-05-07 Thread Ajay Singh
Fix line over 80 character issue found by checkpatch.pl script by
aligning the input argument in function call.

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

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 29f9907..55a61d5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1117,10 +1117,8 @@ static s32 handle_connect(struct wilc_vif *vif,
}
 
conn_attr->result(CONN_DISCONN_EVENT_CONN_RESP,
-  &conn_info,
-  
MAC_STATUS_DISCONNECTED,
-  NULL,
-  conn_attr->arg);
+ &conn_info, MAC_STATUS_DISCONNECTED,
+ NULL, conn_attr->arg);
hif_drv->hif_state = HOST_IF_IDLE;
kfree(conn_info.req_ies);
conn_info.req_ies = NULL;
-- 
2.7.4

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


Re: [PATCH v3 12/20] media: Remove depends on HAS_DMA in case of platform dependency

2018-05-07 Thread Geert Uytterhoeven
Hi Mauro,

On Sat, May 5, 2018 at 2:47 PM, Mauro Carvalho Chehab
 wrote:
> Em Tue, 17 Apr 2018 19:49:12 +0200
> Geert Uytterhoeven  escreveu:
>
>> Remove dependencies on HAS_DMA where a Kconfig symbol depends on another
>> symbol that implies HAS_DMA, and, optionally, on "|| COMPILE_TEST".
>
> Applying a patch like that is hard, as there are lots of churn at
> the code. That's against latest media upstream:

[...]

I can rebase. What's your preferred target? media-next?

>> In most cases this other symbol is an architecture or platform specific
>> symbol, or PCI.
>>
>> Generic symbols and drivers without platform dependencies keep their
>> dependencies on HAS_DMA, to prevent compiling subsystems or drivers that
>> cannot work anyway.
>
> Actually, depends on HAS_DMA was introduced on media because builds
> were failing otherwise. We started adding it before the addition
> of COMPILE_TEST.

Indeed. Before the 5 commits below, a missing dependency on HAS_DMA
would cause the build to fail for NO_DMA platforms.

f29ab49b5388b2f8 dma-mapping: Convert NO_DMA get_dma_ops() into a real dummy
ab642e952f80c66c dma-coherent: Add NO_DMA dummies for managed DMA API
c1ce6c2beea38171 mm: Add NO_DMA dummies for DMA pool API
bff739b6559e2fce scsi: Add NO_DMA dummies for SCSI DMA mapping API
1f674e16f9ce6eb2 usb: gadget: Add NO_DMA dummies for DMA mapping API

> Can we just remove all HAS_DMA Kconfig dependencies as a hole from the
> entire media subsystem, with something like:
>
> $ for i in $(find drivers/media -name Kconfig) $(find 
> drivers/staging/media -name Kconfig); do sed '/depends on HAS_DMA/d;s/ && 
> HAS_DMA//g' -i $i; done
>
> Or would it cause build issues?

It should not cause build issues, but it would enable lots of drivers that
need DMA platform support on platforms where they wouldn't work, making the
life of distro configurators harder.

That's why my series removes HAS_DMA only for symbols that have a platform
dependency.

Thanks!

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [greybus-dev] [PATCH] staging: greybus: Remove unused local variable

2018-05-07 Thread Johan Hovold
On Mon, May 07, 2018 at 10:35:46AM +0530, Viresh Kumar wrote:
> On 05-05-18, 23:50, Nathan Chancellor wrote:
> > Fixes the following W=1 warning: variable ‘intf_id’ set but
> > not used [-Wunused-but-set-variable]
> > 
> > Signed-off-by: Nathan Chancellor 
> > ---
> >  drivers/staging/greybus/svc.c | 3 ---
> >  1 file changed, 3 deletions(-)
> > 
> > diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c
> > index a874fed761a1..a2bb7e1a3db3 100644
> > --- a/drivers/staging/greybus/svc.c
> > +++ b/drivers/staging/greybus/svc.c
> > @@ -1137,7 +1137,6 @@ static int gb_svc_intf_reset_recv(struct gb_operation 
> > *op)
> > struct gb_svc *svc = gb_connection_get_data(op->connection);
> > struct gb_message *request = op->request;
> > struct gb_svc_intf_reset_request *reset;
> > -   u8 intf_id;
> >  
> > if (request->payload_size < sizeof(*reset)) {
> > dev_warn(&svc->dev, "short reset request received (%zu < 
> > %zu)\n",
> > @@ -1146,8 +1145,6 @@ static int gb_svc_intf_reset_recv(struct gb_operation 
> > *op)
> > }
> > reset = request->payload;
> >  
> > -   intf_id = reset->intf_id;
> > -
> > /* FIXME Reset the interface here */
> >  
> > return 0;
> 
> Don't you get a new error after removing this, i.e "reset set but unused" ? Or
> the sizeof() operation on that suppresses those warnings ..

That was my initial reaction as well, but I failed to notice the sizeof
which prevents the new warning.

> Acked-by: Viresh Kumar 

Acked-by: Johan Hovold 

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