mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
crypto: qat - Use list_for_each_entry() helper
Convert list_for_each() to list_for_each_entry() so that the list_itr list_head pointer and list_entry() call are no longer needed, which can reduce a few lines of code. No functional changed. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
7b3c2348d3
commit
65029eec5c
1 changed files with 6 additions and 18 deletions
|
@ -61,7 +61,6 @@ int adf_service_unregister(struct service_hndl *service)
|
||||||
static int adf_dev_init(struct adf_accel_dev *accel_dev)
|
static int adf_dev_init(struct adf_accel_dev *accel_dev)
|
||||||
{
|
{
|
||||||
struct service_hndl *service;
|
struct service_hndl *service;
|
||||||
struct list_head *list_itr;
|
|
||||||
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
|
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -137,8 +136,7 @@ static int adf_dev_init(struct adf_accel_dev *accel_dev)
|
||||||
* This is to facilitate any ordering dependencies between services
|
* This is to facilitate any ordering dependencies between services
|
||||||
* prior to starting any of the accelerators.
|
* prior to starting any of the accelerators.
|
||||||
*/
|
*/
|
||||||
list_for_each(list_itr, &service_table) {
|
list_for_each_entry(service, &service_table, list) {
|
||||||
service = list_entry(list_itr, struct service_hndl, list);
|
|
||||||
if (service->event_hld(accel_dev, ADF_EVENT_INIT)) {
|
if (service->event_hld(accel_dev, ADF_EVENT_INIT)) {
|
||||||
dev_err(&GET_DEV(accel_dev),
|
dev_err(&GET_DEV(accel_dev),
|
||||||
"Failed to initialise service %s\n",
|
"Failed to initialise service %s\n",
|
||||||
|
@ -165,7 +163,6 @@ static int adf_dev_start(struct adf_accel_dev *accel_dev)
|
||||||
{
|
{
|
||||||
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
|
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
|
||||||
struct service_hndl *service;
|
struct service_hndl *service;
|
||||||
struct list_head *list_itr;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
set_bit(ADF_STATUS_STARTING, &accel_dev->status);
|
set_bit(ADF_STATUS_STARTING, &accel_dev->status);
|
||||||
|
@ -209,8 +206,7 @@ static int adf_dev_start(struct adf_accel_dev *accel_dev)
|
||||||
|
|
||||||
adf_heartbeat_start(accel_dev);
|
adf_heartbeat_start(accel_dev);
|
||||||
|
|
||||||
list_for_each(list_itr, &service_table) {
|
list_for_each_entry(service, &service_table, list) {
|
||||||
service = list_entry(list_itr, struct service_hndl, list);
|
|
||||||
if (service->event_hld(accel_dev, ADF_EVENT_START)) {
|
if (service->event_hld(accel_dev, ADF_EVENT_START)) {
|
||||||
dev_err(&GET_DEV(accel_dev),
|
dev_err(&GET_DEV(accel_dev),
|
||||||
"Failed to start service %s\n",
|
"Failed to start service %s\n",
|
||||||
|
@ -259,7 +255,6 @@ static void adf_dev_stop(struct adf_accel_dev *accel_dev)
|
||||||
{
|
{
|
||||||
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
|
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
|
||||||
struct service_hndl *service;
|
struct service_hndl *service;
|
||||||
struct list_head *list_itr;
|
|
||||||
bool wait = false;
|
bool wait = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -280,8 +275,7 @@ static void adf_dev_stop(struct adf_accel_dev *accel_dev)
|
||||||
if (!list_empty(&accel_dev->compression_list))
|
if (!list_empty(&accel_dev->compression_list))
|
||||||
qat_comp_algs_unregister();
|
qat_comp_algs_unregister();
|
||||||
|
|
||||||
list_for_each(list_itr, &service_table) {
|
list_for_each_entry(service, &service_table, list) {
|
||||||
service = list_entry(list_itr, struct service_hndl, list);
|
|
||||||
if (!test_bit(accel_dev->accel_id, service->start_status))
|
if (!test_bit(accel_dev->accel_id, service->start_status))
|
||||||
continue;
|
continue;
|
||||||
ret = service->event_hld(accel_dev, ADF_EVENT_STOP);
|
ret = service->event_hld(accel_dev, ADF_EVENT_STOP);
|
||||||
|
@ -318,7 +312,6 @@ static void adf_dev_shutdown(struct adf_accel_dev *accel_dev)
|
||||||
{
|
{
|
||||||
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
|
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
|
||||||
struct service_hndl *service;
|
struct service_hndl *service;
|
||||||
struct list_head *list_itr;
|
|
||||||
|
|
||||||
if (!hw_data) {
|
if (!hw_data) {
|
||||||
dev_err(&GET_DEV(accel_dev),
|
dev_err(&GET_DEV(accel_dev),
|
||||||
|
@ -340,8 +333,7 @@ static void adf_dev_shutdown(struct adf_accel_dev *accel_dev)
|
||||||
&accel_dev->status);
|
&accel_dev->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_for_each(list_itr, &service_table) {
|
list_for_each_entry(service, &service_table, list) {
|
||||||
service = list_entry(list_itr, struct service_hndl, list);
|
|
||||||
if (!test_bit(accel_dev->accel_id, service->init_status))
|
if (!test_bit(accel_dev->accel_id, service->init_status))
|
||||||
continue;
|
continue;
|
||||||
if (service->event_hld(accel_dev, ADF_EVENT_SHUTDOWN))
|
if (service->event_hld(accel_dev, ADF_EVENT_SHUTDOWN))
|
||||||
|
@ -378,10 +370,8 @@ static void adf_dev_shutdown(struct adf_accel_dev *accel_dev)
|
||||||
int adf_dev_restarting_notify(struct adf_accel_dev *accel_dev)
|
int adf_dev_restarting_notify(struct adf_accel_dev *accel_dev)
|
||||||
{
|
{
|
||||||
struct service_hndl *service;
|
struct service_hndl *service;
|
||||||
struct list_head *list_itr;
|
|
||||||
|
|
||||||
list_for_each(list_itr, &service_table) {
|
list_for_each_entry(service, &service_table, list) {
|
||||||
service = list_entry(list_itr, struct service_hndl, list);
|
|
||||||
if (service->event_hld(accel_dev, ADF_EVENT_RESTARTING))
|
if (service->event_hld(accel_dev, ADF_EVENT_RESTARTING))
|
||||||
dev_err(&GET_DEV(accel_dev),
|
dev_err(&GET_DEV(accel_dev),
|
||||||
"Failed to restart service %s.\n",
|
"Failed to restart service %s.\n",
|
||||||
|
@ -393,10 +383,8 @@ int adf_dev_restarting_notify(struct adf_accel_dev *accel_dev)
|
||||||
int adf_dev_restarted_notify(struct adf_accel_dev *accel_dev)
|
int adf_dev_restarted_notify(struct adf_accel_dev *accel_dev)
|
||||||
{
|
{
|
||||||
struct service_hndl *service;
|
struct service_hndl *service;
|
||||||
struct list_head *list_itr;
|
|
||||||
|
|
||||||
list_for_each(list_itr, &service_table) {
|
list_for_each_entry(service, &service_table, list) {
|
||||||
service = list_entry(list_itr, struct service_hndl, list);
|
|
||||||
if (service->event_hld(accel_dev, ADF_EVENT_RESTARTED))
|
if (service->event_hld(accel_dev, ADF_EVENT_RESTARTED))
|
||||||
dev_err(&GET_DEV(accel_dev),
|
dev_err(&GET_DEV(accel_dev),
|
||||||
"Failed to restart service %s.\n",
|
"Failed to restart service %s.\n",
|
||||||
|
|
Loading…
Reference in a new issue