[lkml]   [2017]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH 0/3] staging: ccree: Employ devm_* functions, remove redundant code
From: Suniel Mahesh <>


This patch series replaces the current API's which request
for device resources in driver probe, with devm_*() functions
of the kernel framework as recommended by the kernel community.
Doing so simplifies driver cleanup paths and code organization.

The current set of API's whch request for device resources are
not device managed.

The devm_*() functions of the kernel framework are kernel managed
resources which the kernel tracks and then automatically releases
them when the device goes away.

Patch 1/3, replaces kzalloc with devm_kzalloc, kfree's and blank
lines are removed accordingly.

Patch 2/3, utilizes devm_ioremap_resource for map and unmap of
device resources.

request_mem_region(), ioremap() and corresponding error handling
is replaced with devm_ioremap_resource().

release_mem_region() and iounmap() are dropped. A struct member in
struct ssi_drvdata is dropped as it seemed redundant. Log messages
adjusted accordingly.

Patch 3/3, replaces platform_get_resource(), request_irq() and
corresponding error handling with platform_get_irq() and

free_irq is not required any more, devm_request_irq() free's it on
driver detach.

A struct member in struct ssi_drvdata and a bool variable in driver probe
are dropped as they seemed redundant.

Changed type of a member in struct ssi_drvdata to use it with platform_get_irq().
Log messages adjusted accordingly.

Patch was tested and built(ARCH=arm) on next-20170714.
No build issues reported, however it was not tested on
real hardware.

Please drop any patch if they break the flow. As per my
analysis these changes should not create a problem.

Thanks, Suniel

Suniel Mahesh (3):
staging: ccree: Replace kzalloc with devm_kzalloc
staging: ccree: Convert to devm_ioremap_resource for map, unmap
staging: ccree: Use platform_get_irq and devm_request_irq

drivers/staging/ccree/ssi_driver.c | 92 +++++++++++---------------------------
drivers/staging/ccree/ssi_driver.h | 4 +-
2 files changed, 26 insertions(+), 70 deletions(-)


 \ /
  Last update: 2017-07-15 09:52    [W:0.148 / U:17.496 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site