public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] crypto: qat - Use list_for_each_entry() helper
@ 2023-08-30  7:54 Jinjie Ruan
  2023-08-31 13:42 ` Andy Shevchenko
  2023-09-15 10:40 ` Herbert Xu
  0 siblings, 2 replies; 4+ messages in thread
From: Jinjie Ruan @ 2023-08-30  7:54 UTC (permalink / raw)
  To: qat-linux, linux-crypto, damian.muszynski, andriy.shevchenko,
	shashank.gupta, tom.zanussi, Giovanni Cabiddu, Herbert Xu,
	David S. Miller
  Cc: ruanjinjie

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>
---
 .../crypto/intel/qat/qat_common/adf_init.c    | 24 +++++--------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/crypto/intel/qat/qat_common/adf_init.c b/drivers/crypto/intel/qat/qat_common/adf_init.c
index 89001fe92e76..79a81e25de97 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_init.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_init.c
@@ -61,7 +61,6 @@ int adf_service_unregister(struct service_hndl *service)
 static int adf_dev_init(struct adf_accel_dev *accel_dev)
 {
 	struct service_hndl *service;
-	struct list_head *list_itr;
 	struct adf_hw_device_data *hw_data = accel_dev->hw_device;
 	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
 	 * prior to starting any of the accelerators.
 	 */
-	list_for_each(list_itr, &service_table) {
-		service = list_entry(list_itr, struct service_hndl, list);
+	list_for_each_entry(service, &service_table, list) {
 		if (service->event_hld(accel_dev, ADF_EVENT_INIT)) {
 			dev_err(&GET_DEV(accel_dev),
 				"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 service_hndl *service;
-	struct list_head *list_itr;
 	int ret;
 
 	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);
 
-	list_for_each(list_itr, &service_table) {
-		service = list_entry(list_itr, struct service_hndl, list);
+	list_for_each_entry(service, &service_table, list) {
 		if (service->event_hld(accel_dev, ADF_EVENT_START)) {
 			dev_err(&GET_DEV(accel_dev),
 				"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 service_hndl *service;
-	struct list_head *list_itr;
 	bool wait = false;
 	int ret;
 
@@ -280,8 +275,7 @@ static void adf_dev_stop(struct adf_accel_dev *accel_dev)
 	if (!list_empty(&accel_dev->compression_list))
 		qat_comp_algs_unregister();
 
-	list_for_each(list_itr, &service_table) {
-		service = list_entry(list_itr, struct service_hndl, list);
+	list_for_each_entry(service, &service_table, list) {
 		if (!test_bit(accel_dev->accel_id, service->start_status))
 			continue;
 		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 service_hndl *service;
-	struct list_head *list_itr;
 
 	if (!hw_data) {
 		dev_err(&GET_DEV(accel_dev),
@@ -340,8 +333,7 @@ static void adf_dev_shutdown(struct adf_accel_dev *accel_dev)
 				  &accel_dev->status);
 	}
 
-	list_for_each(list_itr, &service_table) {
-		service = list_entry(list_itr, struct service_hndl, list);
+	list_for_each_entry(service, &service_table, list) {
 		if (!test_bit(accel_dev->accel_id, service->init_status))
 			continue;
 		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)
 {
 	struct service_hndl *service;
-	struct list_head *list_itr;
 
-	list_for_each(list_itr, &service_table) {
-		service = list_entry(list_itr, struct service_hndl, list);
+	list_for_each_entry(service, &service_table, list) {
 		if (service->event_hld(accel_dev, ADF_EVENT_RESTARTING))
 			dev_err(&GET_DEV(accel_dev),
 				"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)
 {
 	struct service_hndl *service;
-	struct list_head *list_itr;
 
-	list_for_each(list_itr, &service_table) {
-		service = list_entry(list_itr, struct service_hndl, list);
+	list_for_each_entry(service, &service_table, list) {
 		if (service->event_hld(accel_dev, ADF_EVENT_RESTARTED))
 			dev_err(&GET_DEV(accel_dev),
 				"Failed to restart service %s.\n",
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] crypto: qat - Use list_for_each_entry() helper
  2023-08-30  7:54 [PATCH -next] crypto: qat - Use list_for_each_entry() helper Jinjie Ruan
@ 2023-08-31 13:42 ` Andy Shevchenko
  2023-08-31 16:47   ` Giovanni Cabiddu
  2023-09-15 10:40 ` Herbert Xu
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2023-08-31 13:42 UTC (permalink / raw)
  To: Jinjie Ruan
  Cc: qat-linux, linux-crypto, damian.muszynski, shashank.gupta,
	tom.zanussi, Giovanni Cabiddu, Herbert Xu, David S. Miller

On Wed, Aug 30, 2023 at 03:54:51PM +0800, Jinjie Ruan wrote:
> 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.

Seems correct to me, assumed that this has been tested,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] crypto: qat - Use list_for_each_entry() helper
  2023-08-31 13:42 ` Andy Shevchenko
@ 2023-08-31 16:47   ` Giovanni Cabiddu
  0 siblings, 0 replies; 4+ messages in thread
From: Giovanni Cabiddu @ 2023-08-31 16:47 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jinjie Ruan, qat-linux, linux-crypto, damian.muszynski,
	shashank.gupta, tom.zanussi, Herbert Xu, David S. Miller

On Thu, Aug 31, 2023 at 04:42:44PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 30, 2023 at 03:54:51PM +0800, Jinjie Ruan wrote:
> > 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.
> 
> Seems correct to me, assumed that this has been tested,
Seems correct also to me. I also tried it and it works.

Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>

Regards,

-- 
Giovanni

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] crypto: qat - Use list_for_each_entry() helper
  2023-08-30  7:54 [PATCH -next] crypto: qat - Use list_for_each_entry() helper Jinjie Ruan
  2023-08-31 13:42 ` Andy Shevchenko
@ 2023-09-15 10:40 ` Herbert Xu
  1 sibling, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2023-09-15 10:40 UTC (permalink / raw)
  To: Jinjie Ruan
  Cc: qat-linux, linux-crypto, damian.muszynski, andriy.shevchenko,
	shashank.gupta, tom.zanussi, Giovanni Cabiddu, David S. Miller

On Wed, Aug 30, 2023 at 03:54:51PM +0800, Jinjie Ruan wrote:
> 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>
> ---
>  .../crypto/intel/qat/qat_common/adf_init.c    | 24 +++++--------------
>  1 file changed, 6 insertions(+), 18 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-15 10:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-30  7:54 [PATCH -next] crypto: qat - Use list_for_each_entry() helper Jinjie Ruan
2023-08-31 13:42 ` Andy Shevchenko
2023-08-31 16:47   ` Giovanni Cabiddu
2023-09-15 10:40 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox