Re: [PATCH v4 3/5] staging: Introduce NVIDIA Tegra video decoder driver

2017-11-13 Thread Dan Carpenter
On Sat, Nov 11, 2017 at 04:06:52PM +0200, Vladimir Zapolskiy wrote:
> > +   if (!wait_dma)
> > +   return 0;
> > +
> > +   err = readl_relaxed_poll_timeout(vde->bsev + INTR_STATUS, value,
> > +!(value & BSE_DMA_BUSY), 1, 100);
> > +   if (err) {
> > +   dev_err(dev, "BSEV DMA timeout\n");
> > +   return err;
> > +   }
> > +
> > +   return 0;
> 
>   if (err)
>   dev_err(dev, "BSEV DMA timeout\n");
> 
>   return err;
> 
> is two lines shorter.
> 

This is fine, but just watch out because getting clever with a last if
statement is a common anti-pattern.  For example, you often see it where
people do success handling instead of failure handling.  And it leads
to static checker bugs, and makes the code slightly more subtle.

> > +   err = tegra_vde_attach_dmabuf(dev, source->aux_fd,
> > + source->aux_offset, csize,
> > + &frame->aux_dmabuf_attachment,
> > + &frame->aux_addr,
> > + &frame->aux_sgt,
> > + NULL, dma_dir);
> > +   if (err)
> > +   goto err_release_cr;
> > +   }
> > +
> > +   return 0;
> 
>   if (!err)
>   return 0;
> 
> and then remove a check above.
> 

Argh  Success handling.  Always do failure handling, never success
handling.

The rest of your comments I agree with, though.

regards,
dan carpenter


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


[PATCH] ANDROID: binder: fix transaction leak.

2017-11-13 Thread Martijn Coenen
If a call to put_user() fails, we failed to
properly free a transaction and send a failed
reply (if necessary).

Signed-off-by: Martijn Coenen 
---
 drivers/android/binder.c | 40 +++-
 1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 95a96a254e5d..e947b09607ed 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -1947,6 +1947,26 @@ static void binder_send_failed_reply(struct 
binder_transaction *t,
}
 }
 
+/**
+ * binder_cleanup_transaction() - cleans up undelivered transaction
+ * @t: transaction that needs to be cleaned up
+ * @reason:reason the transaction wasn't delivered
+ * @error_code:error to return to caller (if synchronous call)
+ */
+static void binder_cleanup_transaction(struct binder_transaction *t,
+  const char *reason,
+  uint32_t error_code)
+{
+   if (t->buffer->target_node && !(t->flags & TF_ONE_WAY)) {
+   binder_send_failed_reply(t, error_code);
+   } else {
+   binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
+   "undelivered transaction %d, %s\n",
+   t->debug_id, reason);
+   binder_free_transaction(t);
+   }
+}
+
 /**
  * binder_validate_object() - checks for a valid metadata object in a buffer.
  * @buffer:binder_buffer that we're parsing.
@@ -4015,12 +4035,20 @@ static int binder_thread_read(struct binder_proc *proc,
if (put_user(cmd, (uint32_t __user *)ptr)) {
if (t_from)
binder_thread_dec_tmpref(t_from);
+
+   binder_cleanup_transaction(t, "put_user failed",
+  BR_FAILED_REPLY);
+
return -EFAULT;
}
ptr += sizeof(uint32_t);
if (copy_to_user(ptr, &tr, sizeof(tr))) {
if (t_from)
binder_thread_dec_tmpref(t_from);
+
+   binder_cleanup_transaction(t, "copy_to_user failed",
+  BR_FAILED_REPLY);
+
return -EFAULT;
}
ptr += sizeof(tr);
@@ -4090,15 +4118,9 @@ static void binder_release_work(struct binder_proc *proc,
struct binder_transaction *t;
 
t = container_of(w, struct binder_transaction, work);
-   if (t->buffer->target_node &&
-   !(t->flags & TF_ONE_WAY)) {
-   binder_send_failed_reply(t, BR_DEAD_REPLY);
-   } else {
-   binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
-   "undelivered transaction %d\n",
-   t->debug_id);
-   binder_free_transaction(t);
-   }
+
+   binder_cleanup_transaction(t, "process died.",
+  BR_DEAD_REPLY);
} break;
case BINDER_WORK_RETURN_ERROR: {
struct binder_error *e = container_of(
-- 
2.15.0.448.gf294e3d99a-goog

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


[PATCH] ANDROID: binder: show high watermark of alloc->pages.

2017-11-13 Thread Martijn Coenen
Show the high watermark of the index into the alloc->pages
array, to facilitate sizing the buffer on a per-process
basis.

Signed-off-by: Martijn Coenen 
---
 drivers/android/binder_alloc.c | 4 
 drivers/android/binder_alloc.h | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
index 6f6f745605af..0dba2308125c 100644
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -281,6 +281,9 @@ static int binder_update_page_range(struct binder_alloc 
*alloc, int allocate,
goto err_vm_insert_page_failed;
}
 
+   if (index + 1 > alloc->pages_high)
+   alloc->pages_high = index + 1;
+
trace_binder_alloc_page_end(alloc, index);
/* vm_insert_page does not seem to increment the refcount */
}
@@ -853,6 +856,7 @@ void binder_alloc_print_pages(struct seq_file *m,
}
mutex_unlock(&alloc->mutex);
seq_printf(m, "  pages: %d:%d:%d\n", active, lru, free);
+   seq_printf(m, "  pages high watermark: %zu\n", alloc->pages_high);
 }
 
 /**
diff --git a/drivers/android/binder_alloc.h b/drivers/android/binder_alloc.h
index 2dd33b6df104..0b145307f1fd 100644
--- a/drivers/android/binder_alloc.h
+++ b/drivers/android/binder_alloc.h
@@ -92,6 +92,7 @@ struct binder_lru_page {
  * @pages:  array of binder_lru_page
  * @buffer_size:size of address space specified via mmap
  * @pid:pid for associated binder_proc (invariant after init)
+ * @pages_high: high watermark of offset in @pages
  *
  * Bookkeeping structure for per-proc address space management for binder
  * buffers. It is normally initialized during binder_init() and binder_mmap()
@@ -112,6 +113,7 @@ struct binder_alloc {
size_t buffer_size;
uint32_t buffer_free;
int pid;
+   size_t pages_high;
 };
 
 #ifdef CONFIG_ANDROID_BINDER_IPC_SELFTEST
-- 
2.15.0.448.gf294e3d99a-goog

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


Re: [PATCH] ANDROID: binder: show high watermark of alloc->pages.

2017-11-13 Thread Greg KH
On Mon, Nov 13, 2017 at 10:06:56AM +0100, Martijn Coenen wrote:
> Show the high watermark of the index into the alloc->pages
> array, to facilitate sizing the buffer on a per-process
> basis.
> 
> Signed-off-by: Martijn Coenen 
> ---
>  drivers/android/binder_alloc.c | 4 
>  drivers/android/binder_alloc.h | 2 ++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
> index 6f6f745605af..0dba2308125c 100644
> --- a/drivers/android/binder_alloc.c
> +++ b/drivers/android/binder_alloc.c
> @@ -281,6 +281,9 @@ static int binder_update_page_range(struct binder_alloc 
> *alloc, int allocate,
>   goto err_vm_insert_page_failed;
>   }
>  
> + if (index + 1 > alloc->pages_high)
> + alloc->pages_high = index + 1;
> +
>   trace_binder_alloc_page_end(alloc, index);
>   /* vm_insert_page does not seem to increment the refcount */
>   }
> @@ -853,6 +856,7 @@ void binder_alloc_print_pages(struct seq_file *m,
>   }
>   mutex_unlock(&alloc->mutex);
>   seq_printf(m, "  pages: %d:%d:%d\n", active, lru, free);
> + seq_printf(m, "  pages high watermark: %zu\n", alloc->pages_high);

Who can use this?  A userspace tool?  Or something else?

This is ok for 4.15-rc1, right?

thanks,

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


Re: [PATCH] ANDROID: binder: fix transaction leak.

2017-11-13 Thread Greg KH
On Mon, Nov 13, 2017 at 10:06:08AM +0100, Martijn Coenen wrote:
> If a call to put_user() fails, we failed to
> properly free a transaction and send a failed
> reply (if necessary).
> 
> Signed-off-by: Martijn Coenen 
> ---
>  drivers/android/binder.c | 40 +++-
>  1 file changed, 31 insertions(+), 9 deletions(-)

Is this relevant for 4.14 and any older kernels as well?

thanks,

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


Re: [PATCH] ANDROID: binder: fix transaction leak.

2017-11-13 Thread Martijn Coenen
On Mon, Nov 13, 2017 at 10:49 AM, Greg KH  wrote:
> Is this relevant for 4.14 and any older kernels as well?

The problem was introduced with fine-grained locking, which is 4.14 and up only.

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


Re: [PATCH] ANDROID: binder: show high watermark of alloc->pages.

2017-11-13 Thread Martijn Coenen
On Mon, Nov 13, 2017 at 10:49 AM, Greg KH  wrote:
> Who can use this?  A userspace tool?  Or something else?

The output is part of Android bugreports, it's not parsed
automatically but the information is very useful even to manually look
at. Since Treble, we have more processes using binder, and some 32-bit
Android targets run out of vmalloc space because every process using
binder allocates 1MB in vmalloc address space. 1MB is overkill for
many processes, and this helps us find out which processes that are.

> This is ok for 4.15-rc1, right?

Yes.

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


Re: [RFC] hv_netvsc: safer orderly shutdown

2017-11-13 Thread Vitaly Kuznetsov
Stephen Hemminger  writes:

>
> The NAPI disable is already handled by rndis close.

Sorry, but I'm probably missing something: I can only see
netif_napi_del() call in netvsc_device_remove() but this happens much
later. And I don see us doing napi_disable() anywhere on the path.
But I'm probably missing something.

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


Hello Dear...

2017-11-13 Thread M,Shakour Rosarita
Hello Dear...

I know that this message will come to you as a surprise. I hoped that
you will not expose or betray this trust and confident that I am about
to repose on you, my name is M, Shakour Rosarita. I am 19 years old
Girl, female, from Tartu Syria, (never married) 61 kg, white in
complexion, and I am currently living in the refugee camp here in
Abidjan Ivory Coast, My late beloved father M,Shakour Hassin was a
renowned businessman and owner of Natour Petrol Station in Syria, he
was killed in a stampede riot in Tartu, Syria.
When I got the news about my parents. I fled to a nearby country
Jordan before I joined a ferry to Africa and came to Abidjan capital
city Ivory Coast West Africa find safety here.
I came in 2015 to Abidjan and I now live in refugee camps here as
refugees are allowed freely to enter here without, My late father
deposited (US$6.200.000.00m) My late father kept the money at the bank
of Africa, I want you to help me transfer the money to your hand so
that you will help me bring me into your country for my continue
education.

I sent my pictures here for you to see. Who I am seriously looking for
a good-person in my life, so I want to hear from you soon and learn
more about you.

I am an open-minded and friendly girl to share a good time with you
and have fun and enjoy on the go, bird watching, the rest of our
lives. My Hobbies, tourism books, dance, music, soccer, tennis,
swimming and cinema.
I would just think about you, including your dose and doesn’t .I
believe we will do well together, and live like one family.
Thank you and God bless you, for you in your promise to help me here,
looking forward to your reply by the grace of God and have a good day.
I hope you send me your photos as well? I await your next reply in
faith please reply through my private email at
(mshakourrosarit...@gmail.com):
Thanks.
Ms Rosarita
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Hello Dear...

2017-11-13 Thread M,Shakour Rosarita
Hello Dear...

I know that this message will come to you as a surprise. I hoped that
you will not expose or betray this trust and confident that I am about
to repose on you, my name is M, Shakour Rosarita. I am 19 years old
Girl, female, from Tartu Syria, (never married) 61 kg, white in
complexion, and I am currently living in the refugee camp here in
Abidjan Ivory Coast, My late beloved father M,Shakour Hassin was a
renowned businessman and owner of Natour Petrol Station in Syria, he
was killed in a stampede riot in Tartu, Syria.
When I got the news about my parents. I fled to a nearby country
Jordan before I joined a ferry to Africa and came to Abidjan capital
city Ivory Coast West Africa find safety here.
I came in 2015 to Abidjan and I now live in refugee camps here as
refugees are allowed freely to enter here without, My late father
deposited (US$6.200.000.00m) My late father kept the money at the bank
of Africa, I want you to help me transfer the money to your hand so
that you will help me bring me into your country for my continue
education.

I sent my pictures here for you to see. Who I am seriously looking for
a good-person in my life, so I want to hear from you soon and learn
more about you.

I am an open-minded and friendly girl to share a good time with you
and have fun and enjoy on the go, bird watching, the rest of our
lives. My Hobbies, tourism books, dance, music, soccer, tennis,
swimming and cinema.
I would just think about you, including your dose and doesn’t .I
believe we will do well together, and live like one family.
Thank you and God bless you, for you in your promise to help me here,
looking forward to your reply by the grace of God and have a good day.
I hope you send me your photos as well? I await your next reply in
faith please reply through my private email at
(mshakourrosarit...@gmail.com):
Thanks.
Ms Rosarita
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/5] staging: speakup: Apply format_template attribute

2017-11-13 Thread Greg Kroah-Hartman
On Sun, Nov 12, 2017 at 10:19:09PM +0100, Rasmus Villemoes wrote:
> This serves as human-readable documentation as well as allowing the
> format_template plugin to complain about any static initializers of this
> struct member that do not have the same set of printf specifiers.
> 
> Signed-off-by: Rasmus Villemoes 
> ---
>  drivers/staging/speakup/spk_types.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/spk_types.h 
> b/drivers/staging/speakup/spk_types.h
> index c50de6035a9a..156000c0c4d3 100644
> --- a/drivers/staging/speakup/spk_types.h
> +++ b/drivers/staging/speakup/spk_types.h
> @@ -108,7 +108,7 @@ struct st_var_header {
>  };
>  
>  struct num_var_t {
> - char *synth_fmt;
> + char *synth_fmt __format_template("%d");
>   int default_val;
>   int low;
>   int high;
> -- 
> 2.11.0

Acked-by: Greg Kroah-Hartman 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 0/2] retire IPX and Netware file system

2017-11-13 Thread Greg KH
On Sun, Nov 12, 2017 at 11:22:25AM -0800, Stephen Hemminger wrote:
> Netware has bee dead for years. Time to deprecate IPX and the
> Novell file system.
> 
> Stephen Hemminger (2):
>   ipx: move Novell IPX protocol support into staging
>   ncpfs: move net/ncpfs to drivers/staging/ncpfs

Can you also add TODO files for these two new directories much like
staging/irda/TODO has?

If so, no objection from me at all for this!

thanks,

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


Re:

2017-11-13 Thread Amos Kalonzo
Attn:

I am wondering why You haven't respond to my email for some days now.
reference to my client's contract balance payment of (11.7M,USD)
Kindly get back to me for more details.

Best Regards

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


[PATCH 00/24] staging: ccree: more cleanup patches

2017-11-13 Thread Gilad Ben-Yossef
Another set of cleanup patches. 
This set goes on top of the previous fixes and cleanups patch set
sent to the list.

With this set of patches checkpatch now only reports one false
warning and a warning on device tree string being undocumented.

Gilad Ben-Yossef (24):
  staging: ccree: fix typos
  staging: ccree: alloc by instance not type
  staging: ccree: remove unnecessary parentheses
  staging: ccree: remove MIN/MAX macros
  staging: ccree: move logical cont. to 1st line
  staging: ccree: remove unneeded empty lines
  staging: ccree: remove unneeded cast
  staging: ccree: make mem barrier per request
  staging: ccree: replace open coded loop with for
  staging: ccree: document spinlock usage
  staging: ccree: constify help string
  staging: ccree: fix code indent
  staging: ccree: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  staging: ccree: replace macro with inline func
  staging: ccree: trim long lines for readability
  staging: ccree: remove dead defs and decls
  staging: ccree: refactor code with local vars
  staging: ccree: rename func for readability
  staging: ccree: rename long define for readability
  staging: ccree: remove unneeded wrapper function
  staging: ccree: remove unused field
  staging: ccree: replace msleep with a completion
  staging: ccree: use local vars for readability
  staging: ccree: drop unused macro

 drivers/staging/ccree/cc_hw_queue_defs.h |   2 -
 drivers/staging/ccree/ssi_aead.c | 195 ---
 drivers/staging/ccree/ssi_aead.h |  17 ++-
 drivers/staging/ccree/ssi_buffer_mgr.c   | 174 +++
 drivers/staging/ccree/ssi_cipher.c   | 100 ++--
 drivers/staging/ccree/ssi_cipher.h   |   5 +-
 drivers/staging/ccree/ssi_config.h   |   6 +-
 drivers/staging/ccree/ssi_driver.c   |  14 ++-
 drivers/staging/ccree/ssi_driver.h   |  23 ++--
 drivers/staging/ccree/ssi_fips.h |   3 +-
 drivers/staging/ccree/ssi_hash.c | 180 +---
 drivers/staging/ccree/ssi_hash.h |  14 ++-
 drivers/staging/ccree/ssi_ivgen.c|  13 ++-
 drivers/staging/ccree/ssi_ivgen.h|   3 +-
 drivers/staging/ccree/ssi_pm.c   |   6 +-
 drivers/staging/ccree/ssi_pm.h   |   2 +-
 drivers/staging/ccree/ssi_request_mgr.c  | 106 ++---
 drivers/staging/ccree/ssi_request_mgr.h  |   4 +-
 drivers/staging/ccree/ssi_sram_mgr.c |   2 +-
 drivers/staging/ccree/ssi_sysfs.c|  39 +--
 drivers/staging/ccree/ssi_sysfs.h|  23 
 21 files changed, 562 insertions(+), 369 deletions(-)

-- 
2.7.4

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


[PATCH 01/24] staging: ccree: fix typos

2017-11-13 Thread Gilad Ben-Yossef
Fix a bunch of comment typos.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_hash.c| 2 +-
 drivers/staging/ccree/ssi_hash.h| 2 +-
 drivers/staging/ccree/ssi_ivgen.c   | 2 +-
 drivers/staging/ccree/ssi_request_mgr.c | 2 +-
 drivers/staging/ccree/ssi_request_mgr.h | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index 472d3b7..6687027 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -2484,7 +2484,7 @@ static void ssi_hash_create_data_desc(struct 
ahash_req_ctx *areq_ctx,
  * \param drvdata
  * \param mode The Hash mode. Supported modes: MD5/SHA1/SHA224/SHA256
  *
- * \return u32 The address of the inital digest in SRAM
+ * \return u32 The address of the initial digest in SRAM
  */
 ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, u32 mode)
 {
diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h
index 2400e38..c884727 100644
--- a/drivers/staging/ccree/ssi_hash.h
+++ b/drivers/staging/ccree/ssi_hash.h
@@ -95,7 +95,7 @@ ssi_ahash_get_initial_digest_len_sram_addr(void *drvdata, u32 
mode);
  * \param drvdata
  * \param mode The Hash mode. Supported modes: 
MD5/SHA1/SHA224/SHA256/SHA384/SHA512
  *
- * \return u32 The address of the inital digest in SRAM
+ * \return u32 The address of the initial digest in SRAM
  */
 ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, u32 mode);
 
diff --git a/drivers/staging/ccree/ssi_ivgen.c 
b/drivers/staging/ccree/ssi_ivgen.c
index a33fd76..2f9201e 100644
--- a/drivers/staging/ccree/ssi_ivgen.c
+++ b/drivers/staging/ccree/ssi_ivgen.c
@@ -198,7 +198,7 @@ int ssi_ivgen_init(struct ssi_drvdata *drvdata)
 
ivgen_ctx = drvdata->ivgen_handle;
 
-   /* Allocate pool's header for intial enc. key/IV */
+   /* Allocate pool's header for initial enc. key/IV */
ivgen_ctx->pool_meta = dma_alloc_coherent(device, SSI_IVPOOL_META_SIZE,
  &ivgen_ctx->pool_meta_dma,
  GFP_KERNEL);
diff --git a/drivers/staging/ccree/ssi_request_mgr.c 
b/drivers/staging/ccree/ssi_request_mgr.c
index e9a09b3..597a71f 100644
--- a/drivers/staging/ccree/ssi_request_mgr.c
+++ b/drivers/staging/ccree/ssi_request_mgr.c
@@ -205,7 +205,7 @@ static inline int request_mgr_queues_status_check(
struct device *dev = drvdata_to_dev(drvdata);
 
/* SW queue is checked only once as it will not
-* be chaned during the poll becasue the spinlock_bh
+* be chaned during the poll because the spinlock_bh
 * is held by the thread
 */
if (unlikely(((req_mgr_h->req_queue_head + 1) &
diff --git a/drivers/staging/ccree/ssi_request_mgr.h 
b/drivers/staging/ccree/ssi_request_mgr.h
index ba44ab4..23883e2 100644
--- a/drivers/staging/ccree/ssi_request_mgr.h
+++ b/drivers/staging/ccree/ssi_request_mgr.h
@@ -36,7 +36,7 @@ int request_mgr_init(struct ssi_drvdata *drvdata);
  *   If "false": this function adds a dummy descriptor completion
  *   and waits upon completion signal.
  *
- * \return int Returns -EINPROGRESS if "is_dout=ture"; "0" if "is_dout=false"
+ * \return int Returns -EINPROGRESS if "is_dout=true"; "0" if "is_dout=false"
  */
 int send_request(
struct ssi_drvdata *drvdata, struct ssi_crypto_req *ssi_req,
-- 
2.7.4

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


[PATCH 02/24] staging: ccree: alloc by instance not type

2017-11-13 Thread Gilad Ben-Yossef
Allocation by instance is preferred to allocation by type.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_sram_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_sram_mgr.c 
b/drivers/staging/ccree/ssi_sram_mgr.c
index 2263433..b71460c 100644
--- a/drivers/staging/ccree/ssi_sram_mgr.c
+++ b/drivers/staging/ccree/ssi_sram_mgr.c
@@ -51,7 +51,7 @@ void ssi_sram_mgr_fini(struct ssi_drvdata *drvdata)
 int ssi_sram_mgr_init(struct ssi_drvdata *drvdata)
 {
/* Allocate "this" context */
-   drvdata->sram_mgr_handle = kzalloc(sizeof(struct ssi_sram_mgr_ctx),
+   drvdata->sram_mgr_handle = kzalloc(sizeof(*drvdata->sram_mgr_handle),
   GFP_KERNEL);
 
if (!drvdata->sram_mgr_handle)
-- 
2.7.4

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


[PATCH 04/24] staging: ccree: remove MIN/MAX macros

2017-11-13 Thread Gilad Ben-Yossef
The driver was using open coded MIN/MAX macros to
compute fixed defines. Remove them and use bigger
value always instead.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.h   | 2 +-
 drivers/staging/ccree/ssi_driver.h | 3 ---
 drivers/staging/ccree/ssi_hash.c   | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h
index e85bcd9..580fdb8 100644
--- a/drivers/staging/ccree/ssi_aead.h
+++ b/drivers/staging/ccree/ssi_aead.h
@@ -28,7 +28,7 @@
 /* mac_cmp - HW writes 8 B but all bytes hold the same value */
 #define ICV_CMP_SIZE 8
 #define CCM_CONFIG_BUF_SIZE (AES_BLOCK_SIZE * 3)
-#define MAX_MAC_SIZE MAX(SHA256_DIGEST_SIZE, AES_BLOCK_SIZE)
+#define MAX_MAC_SIZE SHA256_DIGEST_SIZE
 
 /* defines for AES GCM configuration buffer */
 #define GCM_BLOCK_LEN_SIZE 8
diff --git a/drivers/staging/ccree/ssi_driver.h 
b/drivers/staging/ccree/ssi_driver.h
index f4967ca..758268e 100644
--- a/drivers/staging/ccree/ssi_driver.h
+++ b/drivers/staging/ccree/ssi_driver.h
@@ -95,9 +95,6 @@
  * field in the HW descriptor. The DMA engine +8 that value.
  */
 
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-
 #define SSI_MAX_IVGEN_DMA_ADDRESSES3
 struct ssi_crypto_req {
void (*user_cb)(struct device *dev, void *req);
diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index 1fda84d..8414c25 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -32,7 +32,7 @@
 #include "ssi_sram_mgr.h"
 
 #define SSI_MAX_AHASH_SEQ_LEN 12
-#define SSI_MAX_HASH_OPAD_TMP_KEYS_SIZE MAX(SSI_MAX_HASH_BLCK_SIZE, 3 * 
AES_BLOCK_SIZE)
+#define SSI_MAX_HASH_OPAD_TMP_KEYS_SIZE SSI_MAX_HASH_BLCK_SIZE
 
 struct ssi_hash_handle {
ssi_sram_addr_t digest_len_sram_addr; /* const value in SRAM*/
-- 
2.7.4

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


[PATCH 06/24] staging: ccree: remove unneeded empty lines

2017-11-13 Thread Gilad Ben-Yossef
Remove uneeded empty lines that crept in to code.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_buffer_mgr.c | 1 -
 drivers/staging/ccree/ssi_hash.c   | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index cda5a30..684c934 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -691,7 +691,6 @@ void cc_unmap_aead_request(struct device *dev, struct 
aead_request *req)
if (drvdata->coherent &&
areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT &&
likely(req->src == req->dst)) {
-
/* copy back mac from temporary location to deal with possible
 * data memory overriding that caused by cache coherence 
problem.
 */
diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index 8414c25..66b011c 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -2064,7 +2064,6 @@ ssi_hash_create_alg(struct ssi_hash_template *template, 
struct device *dev,
if (!t_crypto_alg)
return ERR_PTR(-ENOMEM);
 
-
t_crypto_alg->ahash_alg = template->template_ahash;
halg = &t_crypto_alg->ahash_alg;
alg = &halg->halg.base;
-- 
2.7.4

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


[PATCH 03/24] staging: ccree: remove unnecessary parentheses

2017-11-13 Thread Gilad Ben-Yossef
Remove unnecessary parentheses in if statements across the driver.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c   | 36 +-
 drivers/staging/ccree/ssi_buffer_mgr.c | 28 +-
 drivers/staging/ccree/ssi_cipher.c | 34 
 drivers/staging/ccree/ssi_hash.c   | 16 +++
 drivers/staging/ccree/ssi_ivgen.c  |  4 ++--
 5 files changed, 59 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 9e24783..7abc352 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -391,9 +391,9 @@ static int validate_keys_sizes(struct ssi_aead_ctx *ctx)
case DRV_HASH_SHA256:
break;
case DRV_HASH_XCBC_MAC:
-   if ((ctx->auth_keylen != AES_KEYSIZE_128) &&
-   (ctx->auth_keylen != AES_KEYSIZE_192) &&
-   (ctx->auth_keylen != AES_KEYSIZE_256))
+   if (ctx->auth_keylen != AES_KEYSIZE_128 &&
+   ctx->auth_keylen != AES_KEYSIZE_192 &&
+   ctx->auth_keylen != AES_KEYSIZE_256)
return -ENOTSUPP;
break;
case DRV_HASH_NULL: /* Not authenc (e.g., CCM) - no auth_key) */
@@ -412,9 +412,9 @@ static int validate_keys_sizes(struct ssi_aead_ctx *ctx)
return -EINVAL;
}
} else { /* Default assumed to be AES ciphers */
-   if ((ctx->enc_keylen != AES_KEYSIZE_128) &&
-   (ctx->enc_keylen != AES_KEYSIZE_192) &&
-   (ctx->enc_keylen != AES_KEYSIZE_256)) {
+   if (ctx->enc_keylen != AES_KEYSIZE_128 &&
+   ctx->enc_keylen != AES_KEYSIZE_192 &&
+   ctx->enc_keylen != AES_KEYSIZE_256) {
dev_err(dev, "Invalid cipher(AES) key size: %u\n",
ctx->enc_keylen);
return -EINVAL;
@@ -676,8 +676,8 @@ static int ssi_aead_setauthsize(
struct device *dev = drvdata_to_dev(ctx->drvdata);
 
/* Unsupported auth. sizes */
-   if ((authsize == 0) ||
-   (authsize > crypto_aead_maxauthsize(authenc))) {
+   if (authsize == 0 ||
+   authsize > crypto_aead_maxauthsize(authenc)) {
return -ENOTSUPP;
}
 
@@ -744,8 +744,8 @@ ssi_aead_create_assoc_desc(
set_din_type(&desc[idx], DMA_DLLI, sg_dma_address(areq->src),
 areq->assoclen, NS_BIT); set_flow_mode(&desc[idx],
 flow_mode);
-   if ((ctx->auth_mode == DRV_HASH_XCBC_MAC) &&
-   (areq_ctx->cryptlen > 0))
+   if (ctx->auth_mode == DRV_HASH_XCBC_MAC &&
+   areq_ctx->cryptlen > 0)
set_din_not_last_indication(&desc[idx]);
break;
case SSI_DMA_BUF_MLLI:
@@ -754,8 +754,8 @@ ssi_aead_create_assoc_desc(
set_din_type(&desc[idx], DMA_MLLI, areq_ctx->assoc.sram_addr,
 areq_ctx->assoc.mlli_nents, NS_BIT);
set_flow_mode(&desc[idx], flow_mode);
-   if ((ctx->auth_mode == DRV_HASH_XCBC_MAC) &&
-   (areq_ctx->cryptlen > 0))
+   if (ctx->auth_mode == DRV_HASH_XCBC_MAC &&
+   areq_ctx->cryptlen > 0)
set_din_not_last_indication(&desc[idx]);
break;
case SSI_DMA_BUF_NULL:
@@ -1192,8 +1192,8 @@ static inline void ssi_aead_load_mlli_to_sram(
struct device *dev = drvdata_to_dev(ctx->drvdata);
 
if (unlikely(
-   (req_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI) ||
-   (req_ctx->data_buff_type == SSI_DMA_BUF_MLLI) ||
+   req_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI ||
+   req_ctx->data_buff_type == SSI_DMA_BUF_MLLI ||
!req_ctx->is_single_pass)) {
dev_dbg(dev, "Copy-to-sram: mlli_dma=%08x, mlli_size=%u\n",
(unsigned int)ctx->drvdata->mlli_sram_addr,
@@ -1350,15 +1350,15 @@ static int validate_data_size(struct ssi_aead_ctx *ctx,
unsigned int cipherlen = (direct == DRV_CRYPTO_DIRECTION_DECRYPT) ?
(req->cryptlen - ctx->authsize) : req->cryptlen;
 
-   if (unlikely((direct == DRV_CRYPTO_DIRECTION_DECRYPT) &&
-(req->cryptlen < ctx->authsize)))
+   if (unlikely(direct == DRV_CRYPTO_DIRECTION_DECRYPT &&
+req->cryptlen < ctx->authsize))
goto data_size_err;
 
areq_ctx->is_single_pass = true; /*defaulted to fast flow*/
 
switch (ctx->flow_mode) {
case S_DIN_to_AES:
-   if (unlikely((ctx->cipher_mode == DRV_CIPHER_CBC) &&
+   if (unlikely(ctx->cipher_mode == DRV_CIPHER_CBC &&
 !IS_ALIGNED(cip

[PATCH 05/24] staging: ccree: move logical cont. to 1st line

2017-11-13 Thread Gilad Ben-Yossef
Move logical continuations to first line for readability.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_buffer_mgr.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index 923a0df..cda5a30 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -1473,8 +1473,8 @@ int cc_map_hash_request_final(struct ssi_drvdata 
*drvdata, void *ctx,
   &dummy, &mapped_nents))) {
goto unmap_curr_buff;
}
-   if (src && mapped_nents == 1
-&& areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL) {
+   if (src && mapped_nents == 1 &&
+   areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL) {
memcpy(areq_ctx->buff_sg, src,
   sizeof(struct scatterlist));
areq_ctx->buff_sg->length = nbytes;
@@ -1590,8 +1590,8 @@ int cc_map_hash_request_update(struct ssi_drvdata 
*drvdata, void *ctx,
   &mapped_nents))) {
goto unmap_curr_buff;
}
-   if (mapped_nents == 1
-&& areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL) {
+   if (mapped_nents == 1 &&
+   areq_ctx->data_dma_buf_type == SSI_DMA_BUF_NULL) {
/* only one entry in the SG and no previous data */
memcpy(areq_ctx->buff_sg, src,
   sizeof(struct scatterlist));
-- 
2.7.4

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


[PATCH 08/24] staging: ccree: make mem barrier per request

2017-11-13 Thread Gilad Ben-Yossef
The driver was issuing a write memory barrier per each
HW descriptor written but these descriptors are written
in groups and we really only need one per group.

White at it, document memory barrier reason.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_request_mgr.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_request_mgr.c 
b/drivers/staging/ccree/ssi_request_mgr.c
index e23c656..f5041f7 100644
--- a/drivers/staging/ccree/ssi_request_mgr.c
+++ b/drivers/staging/ccree/ssi_request_mgr.c
@@ -172,7 +172,6 @@ static inline void enqueue_seq(
writel_relaxed(seq[i].word[2], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
writel_relaxed(seq[i].word[3], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
writel_relaxed(seq[i].word[4], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
-   wmb();
writel_relaxed(seq[i].word[5], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
 #ifdef DX_DUMP_DESCS
dev_dbg(dev, "desc[%02d]: 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 
0x%08X\n",
@@ -359,6 +358,12 @@ int send_request(
 #ifdef FLUSH_CACHE_ALL
flush_cache_all();
 #endif
+   /*
+* We are about to push command to the HW via the command registers
+* that may refernece hsot memory. We need to issue a memory barrier
+* to make sure there are no outstnading memory writes
+*/
+   wmb();
 
/* STAT_PHASE_4: Push sequence */
enqueue_seq(cc_base, iv_seq, iv_seq_len);
@@ -417,6 +422,12 @@ int send_request_init(
 
set_queue_last_ind(&desc[(len - 1)]);
 
+   /*
+* We are about to push command to the HW via the command registers
+* that may refernece hsot memory. We need to issue a memory barrier
+* to make sure there are no outstnading memory writes
+*/
+   wmb();
enqueue_seq(cc_base, desc, len);
 
/* Update the free slots in HW queue */
-- 
2.7.4

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


[PATCH 07/24] staging: ccree: remove unneeded cast

2017-11-13 Thread Gilad Ben-Yossef
Remove uneeded cast from writel_relaxed parameter.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_request_mgr.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/ccree/ssi_request_mgr.c 
b/drivers/staging/ccree/ssi_request_mgr.c
index 597a71f..e23c656 100644
--- a/drivers/staging/ccree/ssi_request_mgr.c
+++ b/drivers/staging/ccree/ssi_request_mgr.c
@@ -167,13 +167,13 @@ static inline void enqueue_seq(
int i;
 
for (i = 0; i < seq_len; i++) {
-   writel_relaxed(seq[i].word[0], (volatile void __iomem 
*)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
-   writel_relaxed(seq[i].word[1], (volatile void __iomem 
*)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
-   writel_relaxed(seq[i].word[2], (volatile void __iomem 
*)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
-   writel_relaxed(seq[i].word[3], (volatile void __iomem 
*)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
-   writel_relaxed(seq[i].word[4], (volatile void __iomem 
*)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
+   writel_relaxed(seq[i].word[0], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
+   writel_relaxed(seq[i].word[1], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
+   writel_relaxed(seq[i].word[2], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
+   writel_relaxed(seq[i].word[3], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
+   writel_relaxed(seq[i].word[4], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
wmb();
-   writel_relaxed(seq[i].word[5], (volatile void __iomem 
*)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
+   writel_relaxed(seq[i].word[5], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
 #ifdef DX_DUMP_DESCS
dev_dbg(dev, "desc[%02d]: 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 
0x%08X\n",
i, seq[i].word[0], seq[i].word[1], seq[i].word[2],
-- 
2.7.4

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


[PATCH 10/24] staging: ccree: document spinlock usage

2017-11-13 Thread Gilad Ben-Yossef
Document spinlock usage to protect against concurrent
access to HW register which must occur a single
request at a time.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_request_mgr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/ccree/ssi_request_mgr.c 
b/drivers/staging/ccree/ssi_request_mgr.c
index 65c4d9f..1d9c038 100644
--- a/drivers/staging/ccree/ssi_request_mgr.c
+++ b/drivers/staging/ccree/ssi_request_mgr.c
@@ -43,6 +43,9 @@ struct ssi_request_mgr_handle {
u32 req_queue_tail;
u32 axi_completed;
u32 q_free_slots;
+   /* This lock protects access to HW register
+* that must be single request at a time
+*/
spinlock_t hw_lock;
struct cc_hw_desc compl_desc;
u8 *dummy_comp_buff;
-- 
2.7.4

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


[PATCH 09/24] staging: ccree: replace open coded loop with for

2017-11-13 Thread Gilad Ben-Yossef
Replace open coded register writing loop with a for.
Further simplify code by using a local var to precompute
the register address for readability.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_request_mgr.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/ccree/ssi_request_mgr.c 
b/drivers/staging/ccree/ssi_request_mgr.c
index f5041f7..65c4d9f 100644
--- a/drivers/staging/ccree/ssi_request_mgr.c
+++ b/drivers/staging/ccree/ssi_request_mgr.c
@@ -164,15 +164,17 @@ static inline void enqueue_seq(
void __iomem *cc_base,
struct cc_hw_desc seq[], unsigned int seq_len)
 {
-   int i;
+   int i, w;
+   void * __iomem reg = cc_base + CC_REG(DSCRPTR_QUEUE_WORD0);
+
+   /*
+* We do indeed write all 6 command words to the same
+* register. The HW supports this.
+*/
 
for (i = 0; i < seq_len; i++) {
-   writel_relaxed(seq[i].word[0], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
-   writel_relaxed(seq[i].word[1], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
-   writel_relaxed(seq[i].word[2], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
-   writel_relaxed(seq[i].word[3], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
-   writel_relaxed(seq[i].word[4], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
-   writel_relaxed(seq[i].word[5], (cc_base + 
CC_REG(DSCRPTR_QUEUE_WORD0)));
+   for (w = 0; w <= 5; w++)
+   writel_relaxed(seq[i].word[w], reg);
 #ifdef DX_DUMP_DESCS
dev_dbg(dev, "desc[%02d]: 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 
0x%08X\n",
i, seq[i].word[0], seq[i].word[1], seq[i].word[2],
-- 
2.7.4

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


[PATCH 11/24] staging: ccree: constify help string

2017-11-13 Thread Gilad Ben-Yossef
Make help string static const

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_sysfs.c 
b/drivers/staging/ccree/ssi_sysfs.c
index 5d39f15..8d50382 100644
--- a/drivers/staging/ccree/ssi_sysfs.c
+++ b/drivers/staging/ccree/ssi_sysfs.c
@@ -47,7 +47,7 @@ static ssize_t ssi_sys_regdump_show(struct kobject *kobj,
 static ssize_t ssi_sys_help_show(struct kobject *kobj,
 struct kobj_attribute *attr, char *buf)
 {
-   char *help_str[] = {
+   static const char * const help_str[] = {
"cat reg_dump  ", "Print several of 
CC register values",
};
int i = 0, offset = 0;
-- 
2.7.4

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


[PATCH 13/24] staging: ccree: Replace CONFIG_PM_RUNTIME with CONFIG_PM

2017-11-13 Thread Gilad Ben-Yossef
After commit b2b49ccbdd54
("PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected")
PM_RUNTIME is always set if PM is set, so #ifdef blocks
depending on CONFIG_PM_RUNTIME may now be changed to depend on
CONFIG_PM.

Replace CONFIG_PM_RUNTIME with CONFIG_PM.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_driver.c  |  4 ++--
 drivers/staging/ccree/ssi_pm.c  |  6 +++---
 drivers/staging/ccree/ssi_pm.h  |  2 +-
 drivers/staging/ccree/ssi_request_mgr.c | 14 +++---
 drivers/staging/ccree/ssi_request_mgr.h |  2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/ccree/ssi_driver.c 
b/drivers/staging/ccree/ssi_driver.c
index 0d5c1a9..8d16823 100644
--- a/drivers/staging/ccree/ssi_driver.c
+++ b/drivers/staging/ccree/ssi_driver.c
@@ -495,13 +495,13 @@ static int cc7x_remove(struct platform_device *plat_dev)
return 0;
 }
 
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
 static const struct dev_pm_ops arm_cc7x_driver_pm = {
SET_RUNTIME_PM_OPS(cc_pm_suspend, cc_pm_resume, NULL)
 };
 #endif
 
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
 #defineDX_DRIVER_RUNTIME_PM(&arm_cc7x_driver_pm)
 #else
 #defineDX_DRIVER_RUNTIME_PMNULL
diff --git a/drivers/staging/ccree/ssi_pm.c b/drivers/staging/ccree/ssi_pm.c
index 86d403d..5e2ef5e 100644
--- a/drivers/staging/ccree/ssi_pm.c
+++ b/drivers/staging/ccree/ssi_pm.c
@@ -29,7 +29,7 @@
 #include "ssi_hash.h"
 #include "ssi_pm.h"
 
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
 
 #define POWER_DOWN_ENABLE 0x01
 #define POWER_DOWN_DISABLE 0x00
@@ -119,7 +119,7 @@ int cc_pm_put_suspend(struct device *dev)
 int cc_pm_init(struct ssi_drvdata *drvdata)
 {
int rc = 0;
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
struct device *dev = drvdata_to_dev(drvdata);
 
/* must be before the enabling to avoid resdundent suspending */
@@ -137,7 +137,7 @@ int cc_pm_init(struct ssi_drvdata *drvdata)
 
 void cc_pm_fini(struct ssi_drvdata *drvdata)
 {
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
pm_runtime_disable(drvdata_to_dev(drvdata));
 #endif
 }
diff --git a/drivers/staging/ccree/ssi_pm.h b/drivers/staging/ccree/ssi_pm.h
index 557ec98..50bcf03 100644
--- a/drivers/staging/ccree/ssi_pm.h
+++ b/drivers/staging/ccree/ssi_pm.h
@@ -29,7 +29,7 @@ int cc_pm_init(struct ssi_drvdata *drvdata);
 
 void cc_pm_fini(struct ssi_drvdata *drvdata);
 
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
 int cc_pm_suspend(struct device *dev);
 
 int cc_pm_resume(struct device *dev);
diff --git a/drivers/staging/ccree/ssi_request_mgr.c 
b/drivers/staging/ccree/ssi_request_mgr.c
index 1d9c038..ab18851 100644
--- a/drivers/staging/ccree/ssi_request_mgr.c
+++ b/drivers/staging/ccree/ssi_request_mgr.c
@@ -58,7 +58,7 @@ struct ssi_request_mgr_handle {
 #else
struct tasklet_struct comptask;
 #endif
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
bool is_runtime_suspended;
 #endif
 };
@@ -277,7 +277,7 @@ int send_request(
SSI_IVPOOL_SEQ_LEN) +
(!is_dout ? 1 : 0));
 
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
rc = cc_pm_get(dev);
if (rc) {
dev_err(dev, "ssi_power_mgr_runtime_get returned %x\n", rc);
@@ -304,7 +304,7 @@ int send_request(
/* Any error other than HW queue full
 * (SW queue is full)
 */
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
cc_pm_put_suspend(dev);
 #endif
return rc;
@@ -340,7 +340,7 @@ int send_request(
if (unlikely(rc)) {
dev_err(dev, "Failed to generate IV (rc=%d)\n", rc);
spin_unlock_bh(&req_mgr_h->hw_lock);
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
cc_pm_put_suspend(dev);
 #endif
return rc;
@@ -469,7 +469,7 @@ static void proc_completions(struct ssi_drvdata *drvdata)
struct device *dev = drvdata_to_dev(drvdata);
struct ssi_request_mgr_handle *request_mgr_handle =
drvdata->request_mgr_handle;
-#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
+#if defined(CONFIG_PM)
int rc = 0;
 #endif
 
@@ -513,7 +513,7 @@ static void proc_completions(struct ssi_drvdata *drvdata)
request_mgr_handle->req_queue_tail);
dev_dbg(dev, "Request completed. axi_completed=%d\n",
request_mgr_handle->axi_completed);
-#

[PATCH 12/24] staging: ccree: fix code indent

2017-11-13 Thread Gilad Ben-Yossef
Fix code ident not following the coding style.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_cipher.c | 2 +-
 drivers/staging/ccree/ssi_sysfs.c  | 6 --
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ccree/ssi_cipher.c 
b/drivers/staging/ccree/ssi_cipher.c
index 957138a..4c1080a 100644
--- a/drivers/staging/ccree/ssi_cipher.c
+++ b/drivers/staging/ccree/ssi_cipher.c
@@ -140,7 +140,7 @@ static int validate_data_size(struct ssi_ablkcipher_ctx 
*ctx_p, unsigned int siz
break;
case S_DIN_to_DES:
if (likely(IS_ALIGNED(size, DES_BLOCK_SIZE)))
-   return 0;
+   return 0;
break;
 #if SSI_CC_HAS_MULTI2
case S_DIN_to_MULTI2:
diff --git a/drivers/staging/ccree/ssi_sysfs.c 
b/drivers/staging/ccree/ssi_sysfs.c
index 8d50382..ed97dec 100644
--- a/drivers/staging/ccree/ssi_sysfs.c
+++ b/drivers/staging/ccree/ssi_sysfs.c
@@ -53,8 +53,10 @@ static ssize_t ssi_sys_help_show(struct kobject *kobj,
int i = 0, offset = 0;
 
offset += scnprintf(buf + offset, PAGE_SIZE - offset, "Usage:\n");
-   for (i = 0; i < ARRAY_SIZE(help_str); i += 2)
-  offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s\t\t%s\n", 
help_str[i], help_str[i + 1]);
+   for (i = 0; i < ARRAY_SIZE(help_str); i += 2) {
+   offset += scnprintf(buf + offset, PAGE_SIZE - offset,
+   "%s\t\t%s\n", help_str[i], help_str[i + 1]);
+   }
 
return offset;
 }
-- 
2.7.4

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


[PATCH 14/24] staging: ccree: replace macro with inline func

2017-11-13 Thread Gilad Ben-Yossef
Replace GET_DMA_BUFFER_TYPE with an inline function
variant with type checking.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_buffer_mgr.c | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index 684c934..5e01477 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -33,11 +33,6 @@
 #include "ssi_hash.h"
 #include "ssi_aead.h"
 
-#define GET_DMA_BUFFER_TYPE(buff_type) ( \
-   ((buff_type) == SSI_DMA_BUF_NULL) ? "BUF_NULL" : \
-   ((buff_type) == SSI_DMA_BUF_DLLI) ? "BUF_DLLI" : \
-   ((buff_type) == SSI_DMA_BUF_MLLI) ? "BUF_MLLI" : "BUF_INVALID")
-
 enum dma_buffer_type {
DMA_NULL_TYPE = -1,
DMA_SGL_TYPE = 1,
@@ -64,6 +59,20 @@ struct buffer_array {
u32 *mlli_nents[MAX_NUM_OF_BUFFERS_IN_MLLI];
 };
 
+static inline char *cc_dma_buf_type(enum ssi_req_dma_buf_type type)
+{
+   switch (type) {
+   case SSI_DMA_BUF_NULL:
+   return "BUF_NULL";
+   case SSI_DMA_BUF_DLLI:
+   return "BUF_DLLI";
+   case SSI_DMA_BUF_MLLI:
+   return "BUF_MLLI";
+   default:
+   return "BUF_INVALID";
+   }
+}
+
 /**
  * cc_copy_mac() - Copy MAC to temporary location
  *
@@ -594,7 +603,7 @@ int cc_map_blkcipher_request(
}
 
dev_dbg(dev, "areq_ctx->dma_buf_type = %s\n",
-   GET_DMA_BUFFER_TYPE(req_ctx->dma_buf_type));
+   cc_dma_buf_type(req_ctx->dma_buf_type));
 
return 0;
 
@@ -819,7 +828,7 @@ static inline int cc_aead_chain_assoc(
areq_ctx->assoc.nents = 0;
areq_ctx->assoc.mlli_nents = 0;
dev_dbg(dev, "Chain assoc of length 0: buff_type=%s nents=%u\n",
-   GET_DMA_BUFFER_TYPE(areq_ctx->assoc_buff_type),
+   cc_dma_buf_type(areq_ctx->assoc_buff_type),
areq_ctx->assoc.nents);
goto chain_assoc_exit;
}
@@ -871,7 +880,7 @@ static inline int cc_aead_chain_assoc(
if (unlikely((do_chain) ||
 areq_ctx->assoc_buff_type == SSI_DMA_BUF_MLLI)) {
dev_dbg(dev, "Chain assoc: buff_type=%s nents=%u\n",
-   GET_DMA_BUFFER_TYPE(areq_ctx->assoc_buff_type),
+   cc_dma_buf_type(areq_ctx->assoc_buff_type),
areq_ctx->assoc.nents);
cc_add_sg_entry(dev, sg_data, areq_ctx->assoc.nents, req->src,
req->assoclen, 0, is_last,
@@ -1496,7 +1505,7 @@ int cc_map_hash_request_final(struct ssi_drvdata 
*drvdata, void *ctx,
/* change the buffer index for the unmap function */
areq_ctx->buff_index = (areq_ctx->buff_index ^ 1);
dev_dbg(dev, "areq_ctx->data_dma_buf_type = %s\n",
-   GET_DMA_BUFFER_TYPE(areq_ctx->data_dma_buf_type));
+   cc_dma_buf_type(areq_ctx->data_dma_buf_type));
return 0;
 
 fail_unmap_din:
-- 
2.7.4

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


[PATCH 16/24] staging: ccree: remove dead defs and decls

2017-11-13 Thread Gilad Ben-Yossef
Remove no longer definitions of enums and forward declaration of functions
dealing with sysfs interface of the long removed ccree cycle counter.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_sysfs.h | 23 ---
 1 file changed, 23 deletions(-)

diff --git a/drivers/staging/ccree/ssi_sysfs.h 
b/drivers/staging/ccree/ssi_sysfs.h
index 44ae3d4..5124528 100644
--- a/drivers/staging/ccree/ssi_sysfs.h
+++ b/drivers/staging/ccree/ssi_sysfs.h
@@ -26,30 +26,7 @@
 /* forward declaration */
 struct ssi_drvdata;
 
-enum stat_phase {
-   STAT_PHASE_0 = 0,
-   STAT_PHASE_1,
-   STAT_PHASE_2,
-   STAT_PHASE_3,
-   STAT_PHASE_4,
-   STAT_PHASE_5,
-   STAT_PHASE_6,
-   MAX_STAT_PHASES,
-};
-
-enum stat_op {
-   STAT_OP_TYPE_NULL = 0,
-   STAT_OP_TYPE_ENCODE,
-   STAT_OP_TYPE_DECODE,
-   STAT_OP_TYPE_SETKEY,
-   STAT_OP_TYPE_GENERIC,
-   MAX_STAT_OP_TYPES,
-};
-
 int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata);
 void ssi_sysfs_fini(void);
-void update_host_stat(unsigned int op_type, unsigned int phase, cycles_t 
result);
-void update_cc_stat(unsigned int op_type, unsigned int phase, unsigned int 
elapsed_cycles);
-void display_all_stat_db(void);
 
 #endif /*__SSI_SYSFS_H__*/
-- 
2.7.4

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


[PATCH 15/24] staging: ccree: trim long lines for readability

2017-11-13 Thread Gilad Ben-Yossef
The ccree driver did not adhere to the kernel max 80 chars per line limit
making the code hard to follow. Fix this by breaking long lines and
in some cases, moving comments to a separate line from code.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c| 152 ++--
 drivers/staging/ccree/ssi_aead.h|  15 ++--
 drivers/staging/ccree/ssi_buffer_mgr.c  | 100 +
 drivers/staging/ccree/ssi_cipher.c  |  66 ++
 drivers/staging/ccree/ssi_cipher.h  |   5 +-
 drivers/staging/ccree/ssi_config.h  |   6 +-
 drivers/staging/ccree/ssi_driver.c  |   8 +-
 drivers/staging/ccree/ssi_driver.h  |  15 ++--
 drivers/staging/ccree/ssi_fips.h|   3 +-
 drivers/staging/ccree/ssi_hash.c| 131 +++
 drivers/staging/ccree/ssi_hash.h|  10 ++-
 drivers/staging/ccree/ssi_ivgen.c   |   7 +-
 drivers/staging/ccree/ssi_ivgen.h   |   3 +-
 drivers/staging/ccree/ssi_request_mgr.c |  45 ++
 drivers/staging/ccree/ssi_sysfs.c   |  33 +--
 15 files changed, 406 insertions(+), 193 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 7abc352..e2cdf52 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -100,7 +100,8 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
 
/* Unmap enckey buffer */
if (ctx->enckey) {
-   dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey, 
ctx->enckey_dma_addr);
+   dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey,
+ ctx->enckey_dma_addr);
dev_dbg(dev, "Freed enckey DMA buffer enckey_dma_addr=%pad\n",
&ctx->enckey_dma_addr);
ctx->enckey_dma_addr = 0;
@@ -259,12 +260,17 @@ static void ssi_aead_complete(struct device *dev, void 
*ssi_req)
   SSI_SG_FROM_BUF);
}
 
-   /* If an IV was generated, copy it back to the user provided 
buffer. */
+   /* If an IV was generated, copy it back to the user provided
+* buffer.
+*/
if (areq_ctx->backup_giv) {
if (ctx->cipher_mode == DRV_CIPHER_CTR)
-   memcpy(areq_ctx->backup_giv, areq_ctx->ctr_iv + 
CTR_RFC3686_NONCE_SIZE, CTR_RFC3686_IV_SIZE);
+   memcpy(areq_ctx->backup_giv, areq_ctx->ctr_iv +
+  CTR_RFC3686_NONCE_SIZE,
+  CTR_RFC3686_IV_SIZE);
else if (ctx->cipher_mode == DRV_CIPHER_CCM)
-   memcpy(areq_ctx->backup_giv, areq_ctx->ctr_iv + 
CCM_BLOCK_IV_OFFSET, CCM_BLOCK_IV_SIZE);
+   memcpy(areq_ctx->backup_giv, areq_ctx->ctr_iv +
+  CCM_BLOCK_IV_OFFSET, CCM_BLOCK_IV_SIZE);
}
}
 
@@ -275,8 +281,9 @@ static int xcbc_setkey(struct cc_hw_desc *desc, struct 
ssi_aead_ctx *ctx)
 {
/* Load the AES key */
hw_desc_init(&desc[0]);
-   /* We are using for the source/user key the same buffer as for the 
output keys,
-* because after this key loading it is not needed anymore
+   /* We are using for the source/user key the same buffer
+* as for the output keys, * because after this key loading it
+* is not needed anymore
 */
set_din_type(&desc[0], DMA_DLLI,
 ctx->auth_state.xcbc.xcbc_keys_dma_addr, ctx->auth_keylen,
@@ -428,7 +435,8 @@ static int validate_keys_sizes(struct ssi_aead_ctx *ctx)
  * (copy to intenral buffer or hash in case of key longer than block
  */
 static int
-ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key, unsigned int 
keylen)
+ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 *key,
+  unsigned int keylen)
 {
dma_addr_t key_dma_addr = 0;
struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
@@ -459,7 +467,8 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 
*key, unsigned int keyl
}
 
if (likely(keylen != 0)) {
-   key_dma_addr = dma_map_single(dev, (void *)key, keylen, 
DMA_TO_DEVICE);
+   key_dma_addr = dma_map_single(dev, (void *)key, keylen,
+ DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(dev, key_dma_addr))) {
dev_err(dev, "Mapping key va=0x%p len=%u for DMA 
failed\n",
key, keylen);
@@ -587,8 +596,9 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, 
unsigned int keylen)
/* Copy nonce from last 4 bytes in CTR key to
 *  first 4 bytes in CTR IV
 */
-   memcpy(ctx->ctr

[PATCH 17/24] staging: ccree: refactor code with local vars

2017-11-13 Thread Gilad Ben-Yossef
Refactor the queue handling loop using local variables for better
code readability.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_request_mgr.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ccree/ssi_request_mgr.c 
b/drivers/staging/ccree/ssi_request_mgr.c
index 001bbe9..a2a82ef 100644
--- a/drivers/staging/ccree/ssi_request_mgr.c
+++ b/drivers/staging/ccree/ssi_request_mgr.c
@@ -476,6 +476,8 @@ static void proc_completions(struct ssi_drvdata *drvdata)
struct device *dev = drvdata_to_dev(drvdata);
struct ssi_request_mgr_handle *request_mgr_handle =
drvdata->request_mgr_handle;
+   unsigned int *tail = &request_mgr_handle->req_queue_tail;
+   unsigned int *head = &request_mgr_handle->req_queue_head;
 #if defined(CONFIG_PM)
int rc = 0;
 #endif
@@ -484,18 +486,17 @@ static void proc_completions(struct ssi_drvdata *drvdata)
request_mgr_handle->axi_completed--;
 
/* Dequeue request */
-   if (unlikely(request_mgr_handle->req_queue_head ==
-request_mgr_handle->req_queue_tail)) {
+   if (unlikely(*head == *tail)) {
/* We are supposed to handle a completion but our
 * queue is empty. This is not normal. Return and
 * hope for the best.
 */
dev_err(dev, "Request queue is empty head == tail %u\n",
-   request_mgr_handle->req_queue_head);
+   *head);
break;
}
 
-   ssi_req = 
&request_mgr_handle->req_queue[request_mgr_handle->req_queue_tail];
+   ssi_req = &request_mgr_handle->req_queue[*tail];
 
 #ifdef FLUSH_CACHE_ALL
flush_cache_all();
@@ -516,11 +517,8 @@ static void proc_completions(struct ssi_drvdata *drvdata)
 
if (likely(ssi_req->user_cb))
ssi_req->user_cb(dev, ssi_req->user_arg);
-   request_mgr_handle->req_queue_tail =
-   (request_mgr_handle->req_queue_tail + 1) &
-   (MAX_REQUEST_QUEUE_SIZE - 1);
-   dev_dbg(dev, "Dequeue request tail=%u\n",
-   request_mgr_handle->req_queue_tail);
+   *tail = (*tail + 1) & (MAX_REQUEST_QUEUE_SIZE - 1);
+   dev_dbg(dev, "Dequeue request tail=%u\n", *tail);
dev_dbg(dev, "Request completed. axi_completed=%d\n",
request_mgr_handle->axi_completed);
 #if defined(CONFIG_PM)
-- 
2.7.4

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


[PATCH 19/24] staging: ccree: rename long define for readability

2017-11-13 Thread Gilad Ben-Yossef
Rename the too long  SSI_MAX_HASH_OPAD_TMP_KEYS_SIZE
to SSI_MAX_OPAD_KEYS_SIZE for better code readability.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_hash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index 0f67737..afdc44e 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -32,7 +32,7 @@
 #include "ssi_sram_mgr.h"
 
 #define SSI_MAX_AHASH_SEQ_LEN 12
-#define SSI_MAX_HASH_OPAD_TMP_KEYS_SIZE SSI_MAX_HASH_BLCK_SIZE
+#define SSI_MAX_OPAD_KEYS_SIZE SSI_MAX_HASH_BLCK_SIZE
 
 struct ssi_hash_handle {
ssi_sram_addr_t digest_len_sram_addr; /* const value in SRAM*/
@@ -94,7 +94,7 @@ struct ssi_hash_ctx {
 * the initial digest if HASH.
 */
u8 digest_buff[SSI_MAX_HASH_DIGEST_SIZE]  cacheline_aligned;
-   u8 opad_tmp_keys_buff[SSI_MAX_HASH_OPAD_TMP_KEYS_SIZE]  
cacheline_aligned;
+   u8 opad_tmp_keys_buff[SSI_MAX_OPAD_KEYS_SIZE]  cacheline_aligned;
 
dma_addr_t opad_tmp_keys_dma_addr  cacheline_aligned;
dma_addr_t digest_buff_dma_addr;
-- 
2.7.4

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


[PATCH 18/24] staging: ccree: rename func for readability

2017-11-13 Thread Gilad Ben-Yossef
Rename the insanely long ssi_ahash_get_larval_digest_sram_addr() func
to cc_larval_digest_addr() for better code readability

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c |  7 +++
 drivers/staging/ccree/ssi_hash.c | 13 ++---
 drivers/staging/ccree/ssi_hash.h |  2 +-
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index e2cdf52..fcff625 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -336,8 +336,8 @@ static int hmac_setkey(struct cc_hw_desc *desc, struct 
ssi_aead_ctx *ctx)
hw_desc_init(&desc[idx]);
set_cipher_mode(&desc[idx], hash_mode);
set_din_sram(&desc[idx],
-ssi_ahash_get_larval_digest_sram_addr(
-   ctx->drvdata, ctx->auth_mode),
+cc_larval_digest_addr(ctx->drvdata,
+  ctx->auth_mode),
 digest_size);
set_flow_mode(&desc[idx], S_DIN_to_HASH);
set_setup_mode(&desc[idx], SETUP_LOAD_STATE0);
@@ -441,8 +441,7 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 
*key,
dma_addr_t key_dma_addr = 0;
struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
struct device *dev = drvdata_to_dev(ctx->drvdata);
-   u32 larval_addr = ssi_ahash_get_larval_digest_sram_addr(
-   ctx->drvdata, ctx->auth_mode);
+   u32 larval_addr = cc_larval_digest_addr(ctx->drvdata, ctx->auth_mode);
struct ssi_crypto_req ssi_req = {};
unsigned int blocksize;
unsigned int digestsize;
diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index 4d7e565..0f67737 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -150,8 +150,8 @@ static int ssi_hash_map_request(struct device *dev,
struct ssi_hash_ctx *ctx)
 {
bool is_hmac = ctx->is_hmac;
-   ssi_sram_addr_t larval_digest_addr = 
ssi_ahash_get_larval_digest_sram_addr(
-   ctx->drvdata, ctx->hash_mode);
+   ssi_sram_addr_t larval_digest_addr =
+   cc_larval_digest_addr(ctx->drvdata, ctx->hash_mode);
struct ssi_crypto_req ssi_req = {};
struct cc_hw_desc desc;
int rc = -ENOMEM;
@@ -438,8 +438,8 @@ static int ssi_hash_digest(struct ahash_req_ctx *state,
bool is_hmac = ctx->is_hmac;
struct ssi_crypto_req ssi_req = {};
struct cc_hw_desc desc[SSI_MAX_AHASH_SEQ_LEN];
-   ssi_sram_addr_t larval_digest_addr = 
ssi_ahash_get_larval_digest_sram_addr(
-   ctx->drvdata, ctx->hash_mode);
+   ssi_sram_addr_t larval_digest_addr =
+   cc_larval_digest_addr(ctx->drvdata, ctx->hash_mode);
int idx = 0;
int rc = 0;
 
@@ -1008,8 +1008,7 @@ static int ssi_hash_setkey(void *hash,
blocksize = crypto_tfm_alg_blocksize(&((struct crypto_ahash 
*)hash)->base);
digestsize = crypto_ahash_digestsize(((struct crypto_ahash *)hash));
 
-   larval_addr = ssi_ahash_get_larval_digest_sram_addr(
-   ctx->drvdata, ctx->hash_mode);
+   larval_addr = cc_larval_digest_addr(ctx->drvdata, ctx->hash_mode);
 
/* The keylen value distinguishes HASH in case keylen is ZERO bytes,
 * any NON-ZERO value utilizes HMAC flow
@@ -2538,7 +2537,7 @@ static void ssi_hash_create_data_desc(struct 
ahash_req_ctx *areq_ctx,
  *
  * \return u32 The address of the initial digest in SRAM
  */
-ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, u32 mode)
+ssi_sram_addr_t cc_larval_digest_addr(void *drvdata, u32 mode)
 {
struct ssi_drvdata *_drvdata = (struct ssi_drvdata *)drvdata;
struct ssi_hash_handle *hash_handle = _drvdata->hash_handle;
diff --git a/drivers/staging/ccree/ssi_hash.h b/drivers/staging/ccree/ssi_hash.h
index 8e6eee5..32eb473 100644
--- a/drivers/staging/ccree/ssi_hash.h
+++ b/drivers/staging/ccree/ssi_hash.h
@@ -101,7 +101,7 @@ ssi_ahash_get_initial_digest_len_sram_addr(void *drvdata, 
u32 mode);
  *
  * \return u32 The address of the initial digest in SRAM
  */
-ssi_sram_addr_t ssi_ahash_get_larval_digest_sram_addr(void *drvdata, u32 mode);
+ssi_sram_addr_t cc_larval_digest_addr(void *drvdata, u32 mode);
 
 #endif /*__SSI_HASH_H__*/
 
-- 
2.7.4

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


[PATCH 20/24] staging: ccree: remove unneeded wrapper function

2017-11-13 Thread Gilad Ben-Yossef
Remove unneeded wrapper function to simplify code.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_hash.c | 21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index afdc44e..a2e8a9d 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -986,10 +986,8 @@ static int ssi_hash_init(struct ahash_req_ctx *state, 
struct ssi_hash_ctx *ctx)
return 0;
 }
 
-static int ssi_hash_setkey(void *hash,
-  const u8 *key,
-  unsigned int keylen,
-  bool synchronize)
+static int ssi_ahash_setkey(struct crypto_ahash *ahash, const u8 *key,
+   unsigned int keylen)
 {
unsigned int hmac_pad_const[2] = { HMAC_IPAD_CONST, HMAC_OPAD_CONST };
struct ssi_crypto_req ssi_req = {};
@@ -1001,12 +999,12 @@ static int ssi_hash_setkey(void *hash,
ssi_sram_addr_t larval_addr;
struct device *dev;
 
-   ctx = crypto_ahash_ctx(((struct crypto_ahash *)hash));
+   ctx = crypto_ahash_ctx(ahash);
dev = drvdata_to_dev(ctx->drvdata);
dev_dbg(dev, "start keylen: %d", keylen);
 
-   blocksize = crypto_tfm_alg_blocksize(&((struct crypto_ahash 
*)hash)->base);
-   digestsize = crypto_ahash_digestsize(((struct crypto_ahash *)hash));
+   blocksize = crypto_tfm_alg_blocksize(&ahash->base);
+   digestsize = crypto_ahash_digestsize(ahash);
 
larval_addr = cc_larval_digest_addr(ctx->drvdata, ctx->hash_mode);
 
@@ -1167,8 +1165,7 @@ static int ssi_hash_setkey(void *hash,
 
 out:
if (rc)
-   crypto_ahash_set_flags((struct crypto_ahash *)hash,
-  CRYPTO_TFM_RES_BAD_KEY_LEN);
+   crypto_ahash_set_flags(ahash, CRYPTO_TFM_RES_BAD_KEY_LEN);
 
if (ctx->key_params.key_dma_addr) {
dma_unmap_single(dev, ctx->key_params.key_dma_addr,
@@ -1879,12 +1876,6 @@ static int ssi_ahash_import(struct ahash_request *req, 
const void *in)
return rc;
 }
 
-static int ssi_ahash_setkey(struct crypto_ahash *ahash,
-   const u8 *key, unsigned int keylen)
-{
-   return ssi_hash_setkey((void *)ahash, key, keylen, false);
-}
-
 struct ssi_hash_template {
char name[CRYPTO_MAX_ALG_NAME];
char driver_name[CRYPTO_MAX_ALG_NAME];
-- 
2.7.4

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


[PATCH 21/24] staging: ccree: remove unused field

2017-11-13 Thread Gilad Ben-Yossef
Field monitor_null_cycles of struct drvdata was not being used.
Remove it.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_driver.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/ccree/ssi_driver.h 
b/drivers/staging/ccree/ssi_driver.h
index 7c266ff..ff9f5aa 100644
--- a/drivers/staging/ccree/ssi_driver.h
+++ b/drivers/staging/ccree/ssi_driver.h
@@ -125,10 +125,6 @@ struct ssi_drvdata {
int irq;
u32 irq_mask;
u32 fw_ver;
-   /* Calibration time of start/stop
-* monitor descriptors
-*/
-   u32 monitor_null_cycles;
struct platform_device *plat_dev;
ssi_sram_addr_t mlli_sram_addr;
void *buff_mgr_handle;
-- 
2.7.4

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


[PATCH 22/24] staging: ccree: replace msleep with a completion

2017-11-13 Thread Gilad Ben-Yossef
When the driver would try to queue commands to the HW FIFO but ran out of
slots it would use msleep as a delay until the FIFO would clear. This is
messy and not accurate.

Replace the msleep with a proper completion on the event of command
completion which should indicate at least one slot is free.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_driver.c  | 2 ++
 drivers/staging/ccree/ssi_driver.h  | 1 +
 drivers/staging/ccree/ssi_request_mgr.c | 7 +--
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ccree/ssi_driver.c 
b/drivers/staging/ccree/ssi_driver.c
index b17b811..3cb2296 100644
--- a/drivers/staging/ccree/ssi_driver.c
+++ b/drivers/staging/ccree/ssi_driver.c
@@ -251,6 +251,8 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
}
dev_dbg(dev, "Registered to IRQ: %d\n", new_drvdata->irq);
 
+   init_completion(&new_drvdata->hw_queue_avail);
+
if (!plat_dev->dev.dma_mask)
plat_dev->dev.dma_mask = &plat_dev->dev.coherent_dma_mask;
 
diff --git a/drivers/staging/ccree/ssi_driver.h 
b/drivers/staging/ccree/ssi_driver.h
index ff9f5aa..f92867b 100644
--- a/drivers/staging/ccree/ssi_driver.h
+++ b/drivers/staging/ccree/ssi_driver.h
@@ -125,6 +125,7 @@ struct ssi_drvdata {
int irq;
u32 irq_mask;
u32 fw_ver;
+   struct completion hw_queue_avail; /* wait for HW queue availability */
struct platform_device *plat_dev;
ssi_sram_addr_t mlli_sram_addr;
void *buff_mgr_handle;
diff --git a/drivers/staging/ccree/ssi_request_mgr.c 
b/drivers/staging/ccree/ssi_request_mgr.c
index a2a82ef..0882efd 100644
--- a/drivers/staging/ccree/ssi_request_mgr.c
+++ b/drivers/staging/ccree/ssi_request_mgr.c
@@ -312,8 +312,9 @@ int send_request(
return rc;
}
 
-   /* HW queue is full - short sleep */
-   msleep(1);
+   /* HW queue is full - wait for it to clear up */
+   wait_for_completion_interruptible(&drvdata->hw_queue_avail);
+   reinit_completion(&drvdata->hw_queue_avail);
} while (1);
 
/* Additional completion descriptor is needed incase caller did not
@@ -452,6 +453,8 @@ void complete_request(struct ssi_drvdata *drvdata)
 {
struct ssi_request_mgr_handle *request_mgr_handle =
drvdata->request_mgr_handle;
+
+   complete(&drvdata->hw_queue_avail);
 #ifdef COMP_IN_WQ
queue_delayed_work(request_mgr_handle->workq,
   &request_mgr_handle->compwork, 0);
-- 
2.7.4

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


[PATCH 23/24] staging: ccree: use local vars for readability

2017-11-13 Thread Gilad Ben-Yossef
Refactor cc_map_aead_request() to use local vars for addresses
for better readability of code.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_buffer_mgr.c | 64 +++---
 1 file changed, 29 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index 966033d..c542225 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -1259,7 +1259,7 @@ int cc_map_aead_request(
int rc = 0;
struct crypto_aead *tfm = crypto_aead_reqtfm(req);
bool is_gcm4543 = areq_ctx->is_gcm4543;
-
+   dma_addr_t dma_addr;
u32 mapped_nents = 0;
u32 dummy = 0; /*used for the assoc data fragments */
u32 size_to_map = 0;
@@ -1281,32 +1281,31 @@ int cc_map_aead_request(
req->cryptlen :
(req->cryptlen - authsize);
 
-   areq_ctx->mac_buf_dma_addr = dma_map_single(dev, areq_ctx->mac_buf,
-   MAX_MAC_SIZE,
-   DMA_BIDIRECTIONAL);
-   if (unlikely(dma_mapping_error(dev, areq_ctx->mac_buf_dma_addr))) {
+   dma_addr = dma_map_single(dev, areq_ctx->mac_buf, MAX_MAC_SIZE,
+ DMA_BIDIRECTIONAL);
+   if (unlikely(dma_mapping_error(dev, dma_addr))) {
dev_err(dev, "Mapping mac_buf %u B at va=%pK for DMA failed\n",
MAX_MAC_SIZE, areq_ctx->mac_buf);
rc = -ENOMEM;
goto aead_map_failure;
}
+   areq_ctx->mac_buf_dma_addr = dma_addr;
 
if (areq_ctx->ccm_hdr_size != ccm_header_size_null) {
-   areq_ctx->ccm_iv0_dma_addr =
-   dma_map_single(dev, (areq_ctx->ccm_config +
-CCM_CTR_COUNT_0_OFFSET),
-  AES_BLOCK_SIZE, DMA_TO_DEVICE);
+   void *addr = areq_ctx->ccm_config + CCM_CTR_COUNT_0_OFFSET;
 
-   if (unlikely(dma_mapping_error(dev,
-  areq_ctx->ccm_iv0_dma_addr))) {
+   dma_addr = dma_map_single(dev, addr, AES_BLOCK_SIZE,
+ DMA_TO_DEVICE);
+
+   if (unlikely(dma_mapping_error(dev, dma_addr))) {
dev_err(dev, "Mapping mac_buf %u B at va=%pK for DMA 
failed\n",
-   AES_BLOCK_SIZE,
-   (areq_ctx->ccm_config +
-CCM_CTR_COUNT_0_OFFSET));
+   AES_BLOCK_SIZE, addr);
areq_ctx->ccm_iv0_dma_addr = 0;
rc = -ENOMEM;
goto aead_map_failure;
}
+   areq_ctx->ccm_iv0_dma_addr = dma_addr;
+
if (ssi_aead_handle_config_buf(dev, areq_ctx,
   areq_ctx->ccm_config, &sg_data,
   req->assoclen)) {
@@ -1317,54 +1316,49 @@ int cc_map_aead_request(
 
 #if SSI_CC_HAS_AES_GCM
if (areq_ctx->cipher_mode == DRV_CIPHER_GCTR) {
-   areq_ctx->hkey_dma_addr = dma_map_single(dev,
-areq_ctx->hkey,
-AES_BLOCK_SIZE,
-DMA_BIDIRECTIONAL);
-   if (unlikely(dma_mapping_error(dev,
-  areq_ctx->hkey_dma_addr))) {
+   dma_addr = dma_map_single(dev, areq_ctx->hkey, AES_BLOCK_SIZE,
+ DMA_BIDIRECTIONAL);
+   if (unlikely(dma_mapping_error(dev, dma_addr))) {
dev_err(dev, "Mapping hkey %u B at va=%pK for DMA 
failed\n",
AES_BLOCK_SIZE, areq_ctx->hkey);
rc = -ENOMEM;
goto aead_map_failure;
}
+   areq_ctx->hkey_dma_addr = dma_addr;
 
-   areq_ctx->gcm_block_len_dma_addr =
-   dma_map_single(dev, &areq_ctx->gcm_len_block,
-  AES_BLOCK_SIZE, DMA_TO_DEVICE);
-   if (unlikely(dma_mapping_error(dev,
-  
areq_ctx->gcm_block_len_dma_addr))) {
+   dma_addr = dma_map_single(dev, &areq_ctx->gcm_len_block,
+ AES_BLOCK_SIZE, DMA_TO_DEVICE);
+   if (unlikely(dma_mapping_error(dev, dma_addr))) {
dev_err(dev, "Mapping gcm_len_block %u B at va=%pK for 
DMA failed\n",
AES_BLOCK_SIZE, &areq_ctx->gcm_len_block);
rc = -ENOMEM;
goto aead_ma

[PATCH 24/24] staging: ccree: drop unused macro

2017-11-13 Thread Gilad Ben-Yossef
The CC_REG_NAME macro is unused. Drop it.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/cc_hw_queue_defs.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/ccree/cc_hw_queue_defs.h 
b/drivers/staging/ccree/cc_hw_queue_defs.h
index 2ae0f65..c5aaa79 100644
--- a/drivers/staging/ccree/cc_hw_queue_defs.h
+++ b/drivers/staging/ccree/cc_hw_queue_defs.h
@@ -30,8 +30,6 @@
 /* Define max. available slots in HW queue */
 #define HW_QUEUE_SLOTS_MAX  15
 
-#define CC_REG_NAME(word, name) DX_DSCRPTR_QUEUE_WORD ## word ## _ ## name
-
 #define CC_REG_LOW(word, name)  \
(DX_DSCRPTR_QUEUE_WORD ## word ## _ ## name ## _BIT_SHIFT)
 
-- 
2.7.4

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


Re: [PATCH] vmbus: unregister device_obj->channels_kset

2017-11-13 Thread Stephen Hemminger
On Mon, 13 Nov 2017 01:53:33 +
Dexuan Cui  wrote:

> Fixes: c2e5df616e1a ("vmbus: add per-channel sysfs info")
> 
> Without the patch, a device can't be thoroughly destroyed, because
> vmbus_device_register() -> kset_create_and_add() still holds a reference
> to the hv_device's device.kobj.
> 
> Signed-off-by: Dexuan Cui 
> Cc: Stephen Hemminger 
> Cc: K. Y. Srinivasan 
> ---

Good catch

Signed-off-by: Stephen Hemminger 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[GIT PULL] Staging/IIO driver patches for 4.15-rc1

2017-11-13 Thread Greg KH
The following changes since commit bb176f67090ca54869fc1262c913aa69d2ede070:

  Linux 4.14-rc6 (2017-10-23 06:49:47 -0400)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ 
tags/staging-4.15-rc1

for you to fetch changes up to c14dd9d5f8beda9d8c621683b4e7d6cb5cd3cda7:

  staging: lustre: add SPDX identifiers to all lustre files (2017-11-11 
14:46:21 +0100)


Staging/IIO patches for 4.15-rc1

Here is the "big" staging and IIO driver update for 4.15-rc1.

Lots and lots of little changes, almost all minor code cleanups as the
Outreachy application process happened during this development cycle.
Also happened was a lot of IIO driver activity, and the typec USB code
moving out of staging to drivers/usb (same commits are in the USB tree
on a persistent branch to not cause merge issues.)

Overall, it's a wash, I think we added a few hundred more lines than
removed, but really only a few thousand were modified at all.

All of these have been in linux-next for a while.  There might be a
merge issue with Al's vfs tree in the pi433 driver (take his changes,
they are always better), and the media tree with some of the odd atomisp
cleanups (take the media tree's version).

Signed-off-by: Greg Kroah-Hartman 


Aastha Gupta (39):
  staging: dgnc: remove unused variable
  staging: dgnc: remove variable rc
  staging: speakup: remove NULL comparison
  staging: xgifb: fix multiple line dereference
  staging: rtl8192u: fix spaces around algebric and binary operators
  staging: rtl8192u: add space after '}'
  staging: rtl8192u: remove space after '('
  staging: rtl8192u: remove space before ')'
  staging: rtl8192u: add spaces after struct/enum definitions
  staging: rtl8192u:add space before '(' and '{'
  staging: rtl8192u: fix '{' following enum go on the same line
  staging: rtl8192u: remove space function pointer arguments
  staging: rtl8192u: add space after ','
  staging: rtl8192u: remove space before semicolon
  staging: rtl819u: move '{' to next line
  staging: iio: adc: ad7192: use driver private lock to protect hardware 
state changes
  staging: lustre: fix incorrect multi-line comment style
  staging: lustre: fix comparisons should place the constant on the right 
side
  staging: rtl8188eu: fix block comment styling in rtl8188eu files
  staging: rtl8188eu: fix space between function name and '('
  staging: rtl8188eu: fix spaces before tabs
  staging: rtl8188eu: add spaces around algebric and boolean operators
  staging: fbtft: remove unnecessary parantheses around assignment
  staging: rtl8723bs: remove ternary operators in assignmet statments
  staging: rtl8723bs: remove unused variables
  staging: rtl8723bs: Change type to bool
  staging: rtl8723bs: convert type to bool
  staging: rtl8723bs: rename camelcase bAcceptAddbaReq
  staging: rtl8723bs: remove useless variable rtw_AcceptAddbaReq
  staging: rtl8188eu: prefer using BIT macro
  staging: rtl8188eu: add spaces around '|'
  staging: rtl8188eu: use pr_cont()
  staging: lustre: drop macro that has no uses
  staging: lustre: fid: fix line over 80 characters
  staging: lustre: fld: fix line over 80 characters
  staging: lustre: ldlm: fix lines over 80 characters in ldlm files
  staging: lustre: llite: fix lines over 80 characters in llite files
  staging: lustre: llite: fix coding style for error messages
  staging: lustre: lllite: fix multi line comments style

Aditya Shankar (1):
  staging: wilc1000: Fix bssid buffer offset in Txq

Aishwarya Pant (6):
  staging: rtl8188eu: remove parenthesis from right hand side of assignment
  staging: rtl8188eu: remove unneeded conversions to bool
  staging: rtl8188eu: remove implicit bool->int conversions
  staging: rtl8188eu: wrap lines in 80 characters
  atomisp2: remove cast from memory allocation
  staging: rtl8723bs: remove implicit int->bool conversions

Akinobu Mita (1):
  iio: light: tcs3472: support out-of-threshold events

Alfonso Lima Astor (1):
  staging: fbtft: differentiate between buffer and data types to fix sparse 
warning

Andrii Vladyka (2):
  staging: gdm724x: check for skb->len in gdm_lte_emulate_arp
  staging: gdm724x: fix return codes in gdm_lte

Anton Dozenko (1):
  staging: comedi: adv_pci_dio: update for PCI-1761

Arnd Bergmann (4):
  staging: rts5208: fix gcc-8 logic error warning
  staging: greybus: remove unused kfifo_ts
  staging: rtl8723bs: remove unused variables
  staging: greybus/loopback: use ktime_get() for time intervals

Arvind Yadav (8):
  staging: iio: tsl2x7x: constify i2c_device_id
  staging: greybus: light: Release memory obtained by kasprintf
  staging: greybus: light: re

Re: [lustre-devel] [PATCH] staging: lustre: Replaces 'uint32_t' with '__u32' and 'uint64_t' with '__u64'.

2017-11-13 Thread Dilger, Andreas

> On Nov 9, 2017, at 03:57, Roman Storozhenko  wrote:
> 
> On Thu, Nov 9, 2017 at 1:06 PM, Dilger, Andreas
>  wrote:
>> On Nov 3, 2017, at 06:36, Roman Storozhenko  wrote:
>>> 
>>> On Fri, Nov 03, 2017 at 12:46:18PM +0100, Greg Kroah-Hartman wrote:
 On Sun, Oct 29, 2017 at 08:58:39PM +0300, Roman Storozhenko wrote:
> There are two reasons for that:
> 1) As Linus Torvalds said we should use kernel types:
> http://lkml.iu.edu/hypermail//linux/kernel/1506.0/00160.html
> 
> 2) There are only few places in the lustre codebase that use such types.
> In the most cases it uses '__u32' and '__u64'.
 
> drivers/staging/lustre/lustre/include/lustre_sec.h |  4 ++--
> drivers/staging/lustre/lustre/llite/vvp_dev.c  |  2 +-
> drivers/staging/lustre/lustre/lov/lov_internal.h   | 12 ++--
> drivers/staging/lustre/lustre/osc/osc_internal.h   |  6 +++---
> 4 files changed, 12 insertions(+), 12 deletions(-)
 
 The __ types are only needed for when you cross the user/kernel boundry.
 Otherwise just use the "normal" types of u32 and u64.
 
 Do the changes you made here all cross that boundry?  If not, please fix
 this up.
>>> 
>>> Thanks, Greg.
>>> 
>>> I have checked lustre repository and it seems that changed ".h" files 
>>> aren't used in client code. But I realise that I could be mistaken. That 
>>> why I want to ask lustre guys: am I right?
>> 
>> Sorry for not getting back to you sooner, I was traveling.
>> 
>> I'm not sure what you mean by the .h files aren't used in client code?
>> I checked all of the headers, and all of the structures that were changed,
>> and they all looked to be in use.
> 
> Thanks, Andreas. But let me clarify: did you mean that those
> structures are being used in userspace code and this patch could be
> accepted?
> Or those structures are being used only in the kernel code and I
> should change it according to Greg's remark?

These headers are for kernel code only, so should use the "u32" and similar
types, rather than the "__u32" that are used for user-kernel structures.

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







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


[PATCH net-next v2] net: move decnet to staging

2017-11-13 Thread Stephen Hemminger
Support for Decnet has been orphaned for some time.
In the interest of reducing the potential bug surface and pre-holiday
cleaning, move the decnet protocol into staging for eventual removal.

Signed-off-by: Stephen Hemminger 
---
Note original submission was hour or so before net-next closed.
Not sure if you want to wait on this until after 4.15-rc1

v2 - update TODO and move include/net/dn.h to staging as well

 MAINTAINERS|  2 +-
 drivers/staging/Kconfig|  5 +++
 drivers/staging/Makefile   |  1 +
 {net => drivers/staging}/decnet/Kconfig|  0
 {net => drivers/staging}/decnet/Makefile   |  3 +-
 {net => drivers/staging}/decnet/README |  0
 drivers/staging/decnet/TODO|  4 +++
 {net => drivers/staging}/decnet/af_decnet.c|  0
 {net => drivers/staging}/decnet/dn_dev.c   |  0
 {net => drivers/staging}/decnet/dn_fib.c   |  0
 {net => drivers/staging}/decnet/dn_neigh.c |  0
 {net => drivers/staging}/decnet/dn_nsp_in.c|  0
 {net => drivers/staging}/decnet/dn_nsp_out.c   |  0
 {net => drivers/staging}/decnet/dn_route.c |  0
 {net => drivers/staging}/decnet/dn_rules.c |  0
 {net => drivers/staging}/decnet/dn_table.c |  0
 {net => drivers/staging}/decnet/dn_timer.c |  0
 .../staging/decnet/include}/net/dn.h   |  0
 {net => drivers/staging}/decnet/netfilter/Kconfig  |  0
 {net => drivers/staging}/decnet/netfilter/Makefile |  3 +-
 .../staging}/decnet/netfilter/dn_rtmsg.c   |  0
 .../staging}/decnet/sysctl_net_decnet.c|  0
 net/Kconfig|  2 --
 net/Makefile   |  1 -
 net/decnet/TODO| 41 --
 25 files changed, 15 insertions(+), 47 deletions(-)
 rename {net => drivers/staging}/decnet/Kconfig (100%)
 rename {net => drivers/staging}/decnet/Makefile (84%)
 rename {net => drivers/staging}/decnet/README (100%)
 create mode 100644 drivers/staging/decnet/TODO
 rename {net => drivers/staging}/decnet/af_decnet.c (100%)
 rename {net => drivers/staging}/decnet/dn_dev.c (100%)
 rename {net => drivers/staging}/decnet/dn_fib.c (100%)
 rename {net => drivers/staging}/decnet/dn_neigh.c (100%)
 rename {net => drivers/staging}/decnet/dn_nsp_in.c (100%)
 rename {net => drivers/staging}/decnet/dn_nsp_out.c (100%)
 rename {net => drivers/staging}/decnet/dn_route.c (100%)
 rename {net => drivers/staging}/decnet/dn_rules.c (100%)
 rename {net => drivers/staging}/decnet/dn_table.c (100%)
 rename {net => drivers/staging}/decnet/dn_timer.c (100%)
 rename {include => drivers/staging/decnet/include}/net/dn.h (100%)
 rename {net => drivers/staging}/decnet/netfilter/Kconfig (100%)
 rename {net => drivers/staging}/decnet/netfilter/Makefile (62%)
 rename {net => drivers/staging}/decnet/netfilter/dn_rtmsg.c (100%)
 rename {net => drivers/staging}/decnet/sysctl_net_decnet.c (100%)
 delete mode 100644 net/decnet/TODO

diff --git a/MAINTAINERS b/MAINTAINERS
index 29aa89a1837b..66e2d302d9eb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3968,7 +3968,7 @@ W:http://linux-decnet.sourceforge.net
 L: linux-decnet-u...@lists.sourceforge.net
 S: Orphan
 F: Documentation/networking/decnet.txt
-F: net/decnet/
+F: drivers/staging/decnet/
 
 DECSTATION PLATFORM SUPPORT
 M: "Maciej W. Rozycki" 
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 554683912cff..e30af73c3797 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -30,6 +30,11 @@ source "drivers/staging/wlan-ng/Kconfig"
 
 source "drivers/staging/comedi/Kconfig"
 
+if NETFILTER
+source "drivers/staging/decnet/netfilter/Kconfig"
+endif
+source "drivers/staging/decnet/Kconfig"
+
 source "drivers/staging/olpc_dcon/Kconfig"
 
 source "drivers/staging/rtl8192u/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 6e536020029a..89655cc80a91 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_IRDA)  += irda/net/
 obj-$(CONFIG_IRDA) += irda/drivers/
 obj-$(CONFIG_PRISM2_USB)   += wlan-ng/
 obj-$(CONFIG_COMEDI)   += comedi/
+obj-$(CONFIG_DECNET)   += decnet/
 obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon/
 obj-$(CONFIG_RTL8192U) += rtl8192u/
 obj-$(CONFIG_RTL8192E) += rtl8192e/
diff --git a/net/decnet/Kconfig b/drivers/staging/decnet/Kconfig
similarity index 100%
rename from net/decnet/Kconfig
rename to drivers/staging/decnet/Kconfig
diff --git a/net/decnet/Makefile b/drivers/staging/decnet/Makefile
similarity index 84%
rename from net/decnet/Makefile
rename to drivers/staging/decnet/Makefile
index 9e38122d942b..bda16fefbef2 100644
--- a/net/decnet/Makefile
+++ b/drivers/staging/decnet/Makefile
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 

Re: [RFC] hv_netvsc: safer orderly shutdown

2017-11-13 Thread Stephen Hemminger
On Mon, 13 Nov 2017 11:57:47 +0100
Vitaly Kuznetsov  wrote:

> Stephen Hemminger  writes:
> 
> >
> > The NAPI disable is already handled by rndis close.  
> 
> Sorry, but I'm probably missing something: I can only see
> netif_napi_del() call in netvsc_device_remove() but this happens much
> later. And I don see us doing napi_disable() anywhere on the path.
> But I'm probably missing something.
> 

You need to keep NAPI running to handle transmit completions.
Disabling the Tx and Rx filter should keep spurious activity
away until the halt is done.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 07/24] staging: ccree: remove unneeded cast

2017-11-13 Thread Joe Perches
On Mon, 2017-11-13 at 14:45 +, Gilad Ben-Yossef wrote:
> Remove uneeded cast from writel_relaxed parameter.
[]
> diff --git a/drivers/staging/ccree/ssi_request_mgr.c 
> b/drivers/staging/ccree/ssi_request_mgr.c
[]
> @@ -167,13 +167,13 @@ static inline void enqueue_seq(
>   int i;
>  
>   for (i = 0; i < seq_len; i++) {
> - writel_relaxed(seq[i].word[0], (volatile void __iomem 
> *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
> - writel_relaxed(seq[i].word[1], (volatile void __iomem 
> *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
> - writel_relaxed(seq[i].word[2], (volatile void __iomem 
> *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
> - writel_relaxed(seq[i].word[3], (volatile void __iomem 
> *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
> - writel_relaxed(seq[i].word[4], (volatile void __iomem 
> *)(cc_base + CC_REG(DSCRPTR_QUEUE_WORD0)));
> + writel_relaxed(seq[i].word[0], (cc_base + 
> CC_REG(DSCRPTR_QUEUE_WORD0)));

Maybe remove the now unnecessary parentheses around
(cc_case + CC_REG(foo))

Maybe review the use of inline in .c files too

$ git grep -w inline drivers/staging/ccree/*.c | wc -l
41

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


Re: [PATCH 00/24] staging: ccree: more cleanup patches

2017-11-13 Thread Dan Carpenter
These cleanups look nice.  Thanks.

I hope you do a mass remove of likely/unlikely in a patch soon.
Whenever, I see one of those in a + line I always have to remind myself
that you're planning to do it in a later patch.

regards,
dan carpenter


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


Re: [PATCH net-next v2] net: move decnet to staging

2017-11-13 Thread Joe Perches
On Mon, 2017-11-13 at 09:11 -0800, Stephen Hemminger wrote:
> Support for Decnet has been orphaned for some time.
> In the interest of reducing the potential bug surface and pre-holiday
> cleaning, move the decnet protocol into staging for eventual removal.
[]
> diff --git a/drivers/staging/decnet/TODO b/drivers/staging/decnet/TODO
[]
> @@ -0,0 +1,4 @@
> +The DecNet code will be removed soon from the kernel tree as it is old,
> +obsolete, and buggy.

Old and obsolete, well OK, but
what's buggy about decnet?

https://bugzilla.kernel.org/buglist.cgi?quicksearch=decnet

Zarro Boogs found.

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


Re: [PATCH net-next v2] net: move decnet to staging

2017-11-13 Thread Eric Dumazet
On Mon, 2017-11-13 at 11:32 -0800, Joe Perches wrote:
> On Mon, 2017-11-13 at 09:11 -0800, Stephen Hemminger wrote:
> > Support for Decnet has been orphaned for some time.
> > In the interest of reducing the potential bug surface and pre-holiday
> > cleaning, move the decnet protocol into staging for eventual removal.
> []
> > diff --git a/drivers/staging/decnet/TODO b/drivers/staging/decnet/TODO
> []
> > @@ -0,0 +1,4 @@
> > +The DecNet code will be removed soon from the kernel tree as it is old,
> > +obsolete, and buggy.
> 
> Old and obsolete, well OK, but
> what's buggy about decnet?
> 
> https://bugzilla.kernel.org/buglist.cgi?quicksearch=decnet
> 
> Zarro Boogs found.
> 

Then that means nobody uses it.

And that syzkaller guys never bothered to add code to actually trigger
the bugs that are probably there. Probably they have bigger fishes to
fry at this moment.

If we leave the code there, chances are high that some hacker is
interested into exploiting the bugs.


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