summaryrefslogtreecommitdiff
path: root/drivers/staging/ccree
AgeCommit message (Collapse)Author
2017-11-06staging: ccree: simplify ioread/iowriteGilad Ben-Yossef
Registers ioread/iowrite operations were done via macros, sometime using a "magical" implicit parameter. Replace all register access with simple inline macros. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-06staging: ccree: simplify registers accessGilad Ben-Yossef
The register offset calculation macro was taking a HW block base parameter that was not actually used. Simplify the whole thing by dropping it and rename the macro for better readability. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-06staging: ccree: simplify error handling logicGilad Ben-Yossef
Turn the code sites that don't require any special handling on error return to a simple return. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-06staging: ccree: remove dead codeGilad Ben-Yossef
The inflight_counter field is updated in a single location and never used. Remove it. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-06staging: ccree: handle limiting of DMA masksGilad Ben-Yossef
Properly handle limiting of DMA masks based on device and bus capabilities. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-06staging: ccree: copy IV to DMAable memoryGilad Ben-Yossef
We are being passed an IV buffer from unknown origin, which may be stack allocated and thus not safe for DMA. Allocate a DMA safe buffer for the IV and use that instead. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02staging: ccree: Fix indentation in ssi_buffer_mgr.cStephen Brennan
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>
2017-11-02staging: ccree: fix 64 bit scatter/gather DMA opsGilad Ben-Yossef
Fix a wrong offset used in splitting a 64 DMA address to MSB/LSB parts needed for scatter/gather HW descriptors causing operations relying on them to fail on 64 bit platforms. Fixes: c6f7f2f4591f ("staging: ccree: refactor LLI access macros") Reported-by: Stuart Yoder <stuart.yoder@arm.com> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: ccree: fix boolreturn.cocci warningSuniel Mahesh
This fixes the following coccinelle warning: WARNING: return of 0/1 in function 'ssi_is_hw_key' with return type bool. return "false" instead of 0. Signed-off-by: Suniel Mahesh <sunil.m@techveda.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: ccree: Fix bool comparisonSuniel Mahesh
Comparision operator "equal to" not required on a variable "foo" of type "bool". Bool has only two values, can be used directly or with logical not. This fixes the following coccinelle warning: WARNING: Comparison of bool to 0/1 Signed-off-by: Suniel Mahesh <sunil.m@techveda.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging/ccree: Declare compiled out functions static inlineRishabh Hardas
Sparse was giving out a warning for symbols 'cc_set_ree_fips_status' and 'fips_handler' that they were not declared and need to be made static. This patch makes both the symbols static inline, to remove the warnings. Signed-off-by: Rishabh Hardas <rishabhhardas@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-04staging: ccree: Convert to platform_{get,set}_drvdata()Suniel Mahesh
Platform devices are expected to use wrapper functions, platform_{get,set}_drvdata() with platform_device as argument, for getting and setting the driver data. dev_{get,set}_drvdata() are using &plat_dev->dev. For wrapper functions we can directly pass a struct platform_device. dev_set_drvdata() is redundant and therefore removed. The driver core clears the driver data to NULL after device_release or on probe failure. Signed-off-by: Suniel Mahesh <sunil.m@techveda.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-03staging: ccree: else is not generally useful after a break or returnSuniel Mahesh
Fixes checkpatch warnings: WARNING: else is not generally useful after a break or return Signed-off-by: Suniel Mahesh <sunil.m@techveda.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-03staging: ccree: simplify OOM handlingGilad Ben-Yossef
Simplify handling of memory allocation failures and remove redundant log messages Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-03staging: ccree: move to generic device log infraGilad Ben-Yossef
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>
2017-10-03staging: ccree: simplify access to struct deviceGilad Ben-Yossef
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>
2017-10-03staging: ccree: remove sysfs if of deleted codeGilad Ben-Yossef
The ccree cycle count mechanism was removed in commit 7f821f0c6ffa ("staging: ccree: remove cycle count debug support") but the sysfs interface lingered on. Remove it now. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: ccree: remove unused and redundant variable idxColin Ian King
Variable idx is being set but never read and thus it can be removed because it is redundant. Cleans up clang build warnings: warning: Value stored to 'idx' during its initialization is never read warning: Value stored to 'idx' is never read warning: Value stored to 'idx' is never read Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18Staging: ccree: Use kcalloc instead of kzallocSrishti Sharma
Use kcalloc instead of kzalloc to check for overflow before multiplication. Done using the following semantic patch by coccinelle. http://coccinelle.lip6.fr/rules/kzalloc.cocci Signed-off-by: Srishti Sharma <srishtishar@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17Staging: ccree: Remove unused variable monitor_lockSrishti Sharma
Remove the variable monitor_lock as it is not used anywhere. Signed-off-by: Srishti Sharma <srishtishar@gmail.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17Staging: ccree: Merge assignment with returnSrishti Sharma
Merge the assignment and the return statements to return the value directly. Done using coccinelle. @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Srishti Sharma <srishtishar@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging: ccree: remove BUG macro usageGilad Ben-Yossef
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>
2017-09-17staging: ccree: replace noop macro with inlineGilad Ben-Yossef
Replace noop macro with a noop inline function Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging: ccree: move over to BIT macro for bit definesGilad Ben-Yossef
Use BIT macro for bit definitions where needed. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging: ccree: remove unused completionGilad Ben-Yossef
icache_setup_completion is no longer used. Remove it. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging: ccree: simplify resource release on errorGilad Ben-Yossef
The resource release on probe/init error was being handled in an awkward manner and possibly leaking memory on certain (unlikely) error path. Fix it by simplifying the error resource release and making it easier to track. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging: ccree: Use platform_get_irq and devm_request_irqSuniel Mahesh
It is recommended to use managed function devm_request_irq(), which simplifies driver cleanup paths and driver code. This patch does the following: (a) replace platform_get_resource(), request_irq() and corresponding error handling with platform_get_irq() and devm_request_irq(). (b) remove struct resource pointer(res_irq) in struct ssi_drvdata as it seems redundant. (c) change type of member irq in struct ssi_drvdata from unsigned int to int, as return type of platform_get_irq is int and can be used in error handling. (d) remove irq_registered variable from driver probe as it seems redundant. (e) free_irq is not required any more, devm_request_irq() free's it on driver detach. (f) adjust log messages accordingly and remove any blank lines. Signed-off-by: Suniel Mahesh <sunil.m@techveda.org> Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging: ccree: Convert to devm_ioremap_resource for map, unmapSuniel Mahesh
It is recommended to use managed function devm_ioremap_resource(), which simplifies driver cleanup paths and driver code. This patch does the following: (a) replace request_mem_region(), ioremap() and corresponding error handling with devm_ioremap_resource(). (b) remove struct resource pointer(res_mem) in struct ssi_drvdata as it seems redundant, use struct resource pointer which is defined locally and adjust return value of platform_get_resource() accordingly. (c) release_mem_region() and iounmap() are dropped, since devm_ioremap_ resource() releases and unmaps mem region on driver detach. (d) adjust log messages accordingly and remove any blank lines. Signed-off-by: Suniel Mahesh <sunil.m@techveda.org> [gby: rebase on top of latest coding style fixes changes] Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging: ccree: Replace kzalloc with devm_kzallocSuniel Mahesh
It is recommended to use managed function devm_kzalloc, which simplifies driver cleanup paths and driver code. This patch does the following: (a) replace kzalloc with devm_kzalloc. (b) drop kfree(), because memory allocated with devm_kzalloc() is automatically freed on driver detach, otherwise it leads to a double free. (c) remove unnecessary blank lines. Signed-off-by: Suniel Mahesh <sunil.m@techveda.org> [gby: rebase on top of latest coding style fixes changes] Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17Staging: ccree: Remove unused variable.Srishti Sharma
Remove the local variable inflight_counter as it is never used. Signed-off-by: Srishti Sharma <srishtishar@gmail.com> Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-23staging: ccree: save ciphertext for CTS IVGilad Ben-Yossef
The crypto API requires saving the last blocks of ciphertext in req->info for use as IV for CTS mode. The ccree driver was not doing this. This patch fixes that. The bug was manifested with cts(cbc(aes)) mode in tcrypt tests. Fixes: 302ef8ebb4b2 ("Add CryptoCell skcipher support") Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-16staging: ccree: constify dev_pm_ops structures.Arvind Yadav
dev_pm_ops are not supposed to change at runtime. All functions working with dev_pm_ops provided by <linux/device.h> work with const dev_pm_ops. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-16staging: ccree: Use sizeof(variable) in memory allocsSimon Sandström
Fixes 9 checkpatch.pl warnings of type "Prefer kmalloc(sizeof(variable)...) over kmalloc(sizeof(type)...)" in staging/ccree. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-27staging: ccree: Fix unnecessary NULL check before kfree'ing itSuniel Mahesh
kfree(NULL) is safe and their is no need for a NULL check. Pointed out by checkpatch. Signed-off-by: Suniel Mahesh <sunil.m@techveda.org> Acked-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-27staging: ccree: remove func name from log messagesGilad Ben-Yossef
The SSI_LOG macros already add __func__ to log messages, so remove log message that add them a second time in the log message itself. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-27staging: ccree: Fix alignment issues in ssi_request_mgr.cSimon Sandström
Fixes checkpatch.pl alignment warnings. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-27staging: ccree: Fix alignment issues in ssi_ivgen.cSimon Sandström
Fixes checkpatch.pl alignment warnings. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-27staging: ccree: Fix alignment issues in ssi_cipher.cSimon Sandström
Fixes checkpatch.pl alignment warnings. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-27staging: ccree: Fix alignment issues in ssi_buffer_mgr.cSimon Sandström
Fixes checkpatch.pl alignment warnings. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-27staging: ccree: Fix alignment issues in ssi_hash.cSimon Sandström
Fixes checkpatch.pl alignment warnings. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-27staging: ccree: Fix alignment issues in ssi_aead.cSimon Sandström
Fixes checkpatch.pl alignment warnings. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-18drivers: staging: ccree: use __func__ to get function name in error messages.Dhananjay Balan
fixes checkpatch warning. Signed-off-by: Dhananjay Balan <mail@dbalan.in> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: ccree: move comment to fit coding styleBincy K Philip
Trivial fix for Line over 80 characters Moved the comment to top of the definition Signed-off-by: Bincy K Philip <bincy_k_philip@yahoo.co.in> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: ccree: remove whitespace before a quoted newlineGilad Ben-Yossef
Remove unnecessary whitespace before a quoted newline in strings. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: ccree: avoid unnecessary line continuationGilad Ben-Yossef
Avoid unnecessary line continuation in log function call. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: ccree: avoid constant comparisonGilad Ben-Yossef
Re-write predicate to avoid constant comparison. Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: ccree: CamelCase to snake_case in aead structGilad Ben-Yossef
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>
2017-07-16staging: ccree: CamelCase to snake_case in func varsGilad Ben-Yossef
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>
2017-07-16staging: ccree: use proper printk format for dma_addr_tGilad Ben-Yossef
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>
2017-07-16staging: ccree: clean up struct ssi_aead_ctxGilad Ben-Yossef
struct ssi_aead_ctx has some nested structure defined, resulting in code accessing them to be very unreadable. Move out the nested structure definitions out of the struct and use the change to make the code accessing it more readable and better coding style compliant by shortening lines and properly matching alignment, Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>