summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ccree/ssi_buffer_mgr.c
Commit message (Collapse)AuthorAgeFilesLines
* staging: ccree: use a consistent file naming conventionGilad Ben-Yossef2018-01-091-1657/+0
| | | | | | | | | | | | The ccree driver source files were using an inconsistent naming convention stemming from what the company was called when they were added. Move to a single consistent naming convention for better code readability. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: use array for double bufferGilad Ben-Yossef2018-01-081-14/+7
| | | | | | | | | | | | The ccree hash code is using a double buffer to hold data for processing but manages the buffers and their associated data count in two separate fields and uses a predicate to chose which to use. Move to using a proper 2 members array for a much cleaner code. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: handle end of sg list gracefullyGilad Ben-Yossef2018-01-081-1/+1
| | | | | | | | | If we are asked for number of entries of an offset bigger than the sg list we should not crash. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: check DMA pool buf !NULL before freeGilad Ben-Yossef2018-01-081-1/+2
| | | | | | | | | | If we ran out of DMA pool buffers, we get into the unmap code path with a NULL before. Deal with this by checking the virtual mapping is not NULL. Cc: stable@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: pick alloc mem flags based on req flagsGilad Ben-Yossef2018-01-081-9/+10
| | | | | | | | | The ccree driver was allocating memory using GFP_KERNEL flag always, ignoring the flags set in the crypto request. Fix it by choosing gfp flags based on crypto request flags. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: SPDXify driverGilad Ben-Yossef2018-01-081-15/+2
| | | | | | | Replace verbatim GPL v2 copy with SPDX tag. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fix buf mgr naming conventionGilad Ben-Yossef2017-12-131-16/+12
| | | | | | | | | | | The buffer manager files were using a func naming convention which was inconsistent (ssi vs. cc) and often too long. Make the code more readable by switching to a simpler, consistent naming convention. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: rename vars/structs/enums from ssi_ to cc_Gilad Ben-Yossef2017-12-131-15/+15
| | | | | | | | Unify naming convention by renaming all ssi_ vars/structs/enums and variables to cc_* Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: rename all SSI to CCGilad Ben-Yossef2017-12-131-39/+39
| | | | | | | Unify naming convention by renaming all SSI macros to CC. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove SSI_CC_HAS_ macrosGilad Ben-Yossef2017-12-131-4/+0
| | | | | | | | Remove macro controlling build of various features. This needs to happen dynamically in registration time. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fix func call param indentationGilad Ben-Yossef2017-12-131-17/+11
| | | | | | | | Fix function call parameter indentation according to coding style guide lines. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: simplify expression with local varGilad Ben-Yossef2017-12-131-12/+10
| | | | | | | | Simplify expression by using a local variable for better code readability. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fix func def and decl coding styleGilad Ben-Yossef2017-12-131-86/+58
| | | | | | | | Fix functions definition and declaration indentation according to coding style guide lines for better code readability Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* drivers: staging: remove duplicate includesPravin Shedge2017-12-061-1/+0
| | | | | | | | These duplicate includes have been found with scripts/checkincludes.pl but they have been removed manually to avoid removing false positives. Signed-off-by: Pravin Shedge <pravin.shedge4linux@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove more unnecessary parenthesesGilad Ben-Yossef2017-12-061-2/+2
| | | | | | | | The removal of likely/unlikely unearthed some more unnecessary parentheses. Remove them for better readability. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove unproven likely/unlikelyGilad Ben-Yossef2017-12-061-82/+72
| | | | | | | | | The ccree code made a lot of use of likely/unlikely qualifiers without proven measurements showing any benefits. Remove them all until we see what is justified and what is not. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove inline qualifiersGilad Ben-Yossef2017-12-061-18/+17
| | | | | | | | | The ccree drivers was marking a lot of big functions in C file as static inline for no good reason. Remove the inline qualifier from any but the few truly single line functions. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: use local vars for readabilityGilad Ben-Yossef2017-11-271-35/+29
| | | | | | | | Refactor cc_map_aead_request() to use local vars for addresses for better readability of code. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: trim long lines for readabilityGilad Ben-Yossef2017-11-271-39/+61
| | | | | | | | | 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 <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: replace macro with inline funcGilad Ben-Yossef2017-11-271-9/+18
| | | | | | | | Replace GET_DMA_BUFFER_TYPE with an inline function variant with type checking. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove unneeded empty linesGilad Ben-Yossef2017-11-271-1/+0
| | | | | | | Remove uneeded empty lines that crept in to code. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: move logical cont. to 1st lineGilad Ben-Yossef2017-11-271-4/+4
| | | | | | | Move logical continuations to first line for readability. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove unnecessary parenthesesGilad Ben-Yossef2017-11-271-14/+14
| | | | | | | Remove unnecessary parentheses in if statements across the driver. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove braces for single statementGilad Ben-Yossef2017-11-271-4/+2
| | | | | | | | | Remove necessary braces for single statement blocks to improve code readabilty. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove compare to none zeroGilad Ben-Yossef2017-11-271-37/+37
| | | | | | | | | The driver was full of code checking "if (x != 0)". Replace by "if (x)" for better readability. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fold common code into functionGilad Ben-Yossef2017-11-271-52/+37
| | | | | | | | | | Fold common code copying MAC to/from a temp. buffer into an inline function instead of keeping multiple open coded versions of same. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: simplify buf mgr using local varsGilad Ben-Yossef2017-11-271-8/+10
| | | | | | | | | | Make the code more readable by using a local variables for commonly use expressions in the buffer manager part of the driver. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: make long func call sites readableGilad Ben-Yossef2017-11-271-242/+188
| | | | | | | | | | | | | | | | | | The driver was using a function naming scheme including common prefixes for driver global functions based on the code module they came from. The combination of long names with long common prefixes made the whole thing too long for a human to parse. Switch to simple and shorter function naming scheme. Where required, realign parameters and add paranthesis for better code readability. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: Fix indentation in ssi_buffer_mgr.cStephen Brennan2017-11-021-8/+8
| | | | | | | | | In particular, fixes some over-indented if statement bodies as well as a couple lines indented with spaces. checkpatch.pl now reports no warnings on this file other than 80 character warnings. Signed-off-by: Stephen Brennan <stephen@brennan.io> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: move to generic device log infraGilad Ben-Yossef2017-10-031-205/+189
| | | | | | | | Move over from using macro wrappers around to printk to dev_err, dev_dbg and friends and clean up resulting fallout. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: simplify access to struct deviceGilad Ben-Yossef2017-10-031-7/+7
| | | | | | | | | | Introduce a function to retrieve struct device from private data structure in preparation to replacing custom logging macros with proper dev_dbg and friends which require struct device. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove BUG macro usageGilad Ben-Yossef2017-09-171-12/+6
| | | | | | | | Replace BUG() macro usage that crash the kernel with alternatives that signal error and/or try to recover. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: Fix alignment issues in ssi_buffer_mgr.cSimon Sandström2017-07-271-16/+24
| | | | | | | Fixes checkpatch.pl alignment warnings. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: CamelCase to snake_case in aead structGilad Ben-Yossef2017-07-161-39/+39
| | | | | | | Rename aead_req_struct fields from CamelCase to snake_case. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: CamelCase to snake_case in func varsGilad Ben-Yossef2017-07-161-7/+8
| | | | | | | | Turn local vars and function parameters names in CamelCase to snake_case. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: use proper printk format for dma_addr_tGilad Ben-Yossef2017-07-161-24/+24
| | | | | | | | Fix needless casting to unsigned long long in printk for DMA addresses by using proper %pad format. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree remove unnecessary parenthesesGilad Ben-Yossef2017-07-161-4/+4
| | | | | | | Remove unnecessary parentheses from ccree driver code. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: Fix alignment issues in ssi_buffer_mgr.cSimon Sandström2017-07-161-131/+164
| | | | | | | Fixes checkpatch.pl alignment warnings. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fix placement of curly bracesTyler Olivieri2017-07-161-8/+4
| | | | | | | | | | Patch to fix checkpatch errors: ERROR: that open brace { should be on the previous line ERROR: open brace '{' following function declarations go on the next line Signed-off-by: Tyler Olivieri <sleepingzucchini@gmail.com> Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove redudant semicolonsTyler Olivieri2017-07-161-1/+1
| | | | | | | | | Patch to remove checkpatch warning: WARNING: Statements terminations use 1 semicolon Signed-off-by: Tyler Olivieri <sleepingzucchini@gmail.com> Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: use sizeof(*var) in kmallocGustavo A. R. Silva2017-07-161-1/+1
| | | | | | | | | | | Fix the following checkpatch warning: CHECK: Prefer kmalloc(sizeof(*buff_mgr_handle)...) over kmalloc(sizeof(struct buff_mgr_handle)...) Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove unnecessary cast on kmallocGustavo A. R. Silva2017-07-161-2/+1
| | | | | | | | | | | | | | | | | | | | | The assignment operator implicitly converts a void pointer to the type of the pointer it is assigned to. This issue was detected using Coccinelle and the following semantic patch: @@ expression * e; expression arg1, arg2; type T; @@ - e=(T*) + e= kmalloc(arg1, arg2); Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove/add (un)needed blank linesGilad Ben-Yossef2017-06-291-3/+4
| | | | | | | Remove or add blank lines as needed to match coding style. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fix pointer locationGilad Ben-Yossef2017-06-291-6/+6
| | | | | | | Fix location of pointer in variables definitions and dereference. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove comparisons to NULLGilad Ben-Yossef2017-06-291-22/+22
| | | | | | | Remove explicit comparisons to NULL in ccree driver. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fix unmatched if/else bracesGilad Ben-Yossef2017-06-291-1/+2
| | | | | | | Fix mismatched braces between if and else. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: no need for braces for single statementsGilad Ben-Yossef2017-06-291-40/+30
| | | | | | | Fix several cases of needless braces around single statement blocks. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: remove redundant blank linesGilad Ben-Yossef2017-06-291-8/+0
| | | | | | | Remove redundant blank lines in brace blocks Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: fix else placementGilad Ben-Yossef2017-06-291-2/+1
| | | | | | | | Fix cases where the else clause was not located correctly after the if brace. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: ccree: drop comparsion to true/falseGilad Ben-Yossef2017-06-291-10/+10
| | | | | | | | Fix cases in ccree where explicit comparsion to true/false was made. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
OpenPOWER on IntegriCloud