diff mbox series

[v3,2/4] staging: vc04_services: Drop vchiq_log_warning() in favour of dev_warn

Message ID 20231205084157.73819-3-umang.jain@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series staging: vc04_services: Drop custom logging | expand

Commit Message

Umang Jain Dec. 5, 2023, 8:41 a.m. UTC
Drop vchiq_log_warning() macro which wraps dev_dbg(). Introduce the usage
of dev_warn() directly.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 .../interface/vchiq_arm/vchiq_arm.c           | 30 +++++++++----------
 .../interface/vchiq_arm/vchiq_core.c          | 30 +++++++++----------
 .../interface/vchiq_arm/vchiq_core.h          |  4 ---
 3 files changed, 29 insertions(+), 35 deletions(-)

Comments

Stefan Wahren Dec. 5, 2023, 7:37 p.m. UTC | #1
Hi Umang,

Am 05.12.23 um 09:41 schrieb Umang Jain:
> Drop vchiq_log_warning() macro which wraps dev_dbg(). Introduce the usage
> of dev_warn() directly.
>
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   .../interface/vchiq_arm/vchiq_arm.c           | 30 +++++++++----------
>   .../interface/vchiq_arm/vchiq_core.c          | 30 +++++++++----------
>   .../interface/vchiq_arm/vchiq_core.h          |  4 ---
>   3 files changed, 29 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index b403400edd8e..56326b59a718 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -687,8 +687,8 @@ int vchiq_initialise(struct vchiq_instance **instance_out)
>   		ret = -ENOTCONN;
>   		goto failed;
>   	} else if (i > 0) {
> -		vchiq_log_warning(state->dev, VCHIQ_CORE,
> -				  "%s: videocore initialized after %d retries\n", __func__, i);
> +		dev_warn(state->dev, "core: %s: videocore initialized after %d retries\n",
> +			 __func__, i);
>   	}
>
>   	instance = kzalloc(sizeof(*instance), GFP_KERNEL);
> @@ -1644,20 +1644,19 @@ vchiq_dump_service_use_state(struct vchiq_state *state)
>   	read_unlock_bh(&arm_state->susp_res_lock);
>
>   	if (only_nonzero)
> -		vchiq_log_warning(state->dev, VCHIQ_SUSPEND,
> -				  "Too many active services (%d). Only dumping up to first %d services with non-zero use-count",
> -				  active_services, found);
> +		dev_warn(state->dev,
> +			 "suspend: Too many active services (%d). Only dumping up to first %d services with non-zero use-count\n",
> +			 active_services, found);
>
>   	for (i = 0; i < found; i++) {
> -		vchiq_log_warning(state->dev, VCHIQ_SUSPEND,
> -				  "%p4cc:%d service count %d %s",
> -				  &service_data[i].fourcc,
> -				  service_data[i].clientid, service_data[i].use_count,
> -				  service_data[i].use_count ? nz : "");
> +		dev_warn(state->dev,
> +			 "suspend: %p4cc:%d service count %d %s\n",
> +			 &service_data[i].fourcc,
> +			 service_data[i].clientid, service_data[i].use_count,
> +			 service_data[i].use_count ? nz : "");
>   	}
> -	vchiq_log_warning(state->dev, VCHIQ_SUSPEND, "VCHIQ use count %d", peer_count);
> -	vchiq_log_warning(state->dev, VCHIQ_SUSPEND, "Overall vchiq instance use count %d",
> -			  vc_use_count);
> +	dev_warn(state->dev, "suspend: VCHIQ use count %d\n", peer_count);
> +	dev_warn(state->dev, "suspend: Overall vchiq instance use count %d\n", vc_use_count);
>
>   	kfree(service_data);
>   }
> @@ -1771,8 +1770,7 @@ static int vchiq_probe(struct platform_device *pdev)
>   	 */
>   	err = vchiq_register_chrdev(&pdev->dev);
>   	if (err) {
> -		vchiq_log_warning(&pdev->dev, VCHIQ_ARM,
> -				  "Failed to initialize vchiq cdev");
> +		dev_warn(&pdev->dev, "arm: Failed to initialize vchiq cdev\n");
I think a dev_err() would fit better here.
>   		goto error_exit;
>   	}
>
> @@ -1782,7 +1780,7 @@ static int vchiq_probe(struct platform_device *pdev)
>   	return 0;
>
>   failed_platform_init:
> -	vchiq_log_warning(&pdev->dev, VCHIQ_ARM, "could not initialize vchiq platform");
> +	dev_warn(&pdev->dev, "arm: Could not initialize vchiq platform\n");
ditto
>   error_exit:
>   	return err;
>   }
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> index 63f412815a32..2fd793954001 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> @@ -465,9 +465,9 @@ make_service_callback(struct vchiq_service *service, enum vchiq_reason reason,
>   	status = service->base.callback(service->instance, reason, header, service->handle,
>   					bulk_userdata);
>   	if (status && (status != -EAGAIN)) {
> -		vchiq_log_warning(service->state->dev, VCHIQ_CORE,
> -				  "%d: ignoring ERROR from callback to service %x",
> -				  service->state->id, service->handle);
> +		dev_warn(service->state->dev,
> +			 "core: %d: ignoring ERROR from callback to service %x\n",
> +			 service->state->id, service->handle);
>   		status = 0;
>   	}
>
> @@ -1609,10 +1609,10 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
>   				vchiq_service_put(service);
>   			service = get_connected_service(state, remoteport);
>   			if (service)
> -				vchiq_log_warning(state->dev, VCHIQ_CORE,
> -						  "%d: prs %s@%pK (%d->%d) - found connected service %d",
> -						  state->id, msg_type_str(type), header,
> -						  remoteport, localport, service->localport);
> +				dev_warn(state->dev,
> +					 "core: %d: prs %s@%pK (%d->%d) - found connected service %d\n",
> +					 state->id, msg_type_str(type), header,
> +					 remoteport, localport, service->localport);
>   		}
>
>   		if (!service) {
> @@ -2903,10 +2903,10 @@ vchiq_close_service(struct vchiq_instance *instance, unsigned int handle)
>   		    (service->srvstate == VCHIQ_SRVSTATE_OPEN))
>   			break;
>
> -		vchiq_log_warning(service->state->dev, VCHIQ_CORE,
> -				  "%d: close_service:%d - waiting in state %s",
> -				  service->state->id, service->localport,
> -				  srvstate_names[service->srvstate]);
> +		dev_warn(service->state->dev,
> +			 "core: %d: close_service:%d - waiting in state %s\n",
> +			 service->state->id, service->localport,
> +			 srvstate_names[service->srvstate]);
>   	}
>
>   	if (!status &&
> @@ -2964,10 +2964,10 @@ vchiq_remove_service(struct vchiq_instance *instance, unsigned int handle)
>   		    (service->srvstate == VCHIQ_SRVSTATE_OPEN))
>   			break;
>
> -		vchiq_log_warning(service->state->dev, VCHIQ_CORE,
> -				  "%d: remove_service:%d - waiting in state %s",
> -				  service->state->id, service->localport,
> -				  srvstate_names[service->srvstate]);
> +		dev_warn(service->state->dev,
> +			 "core: %d: remove_service:%d - waiting in state %s\n",
> +			 service->state->id, service->localport,
> +			 srvstate_names[service->srvstate]);
>   	}
>
>   	if (!status && (service->srvstate != VCHIQ_SRVSTATE_FREE))
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> index d7dcd17e4bff..bc980a001711 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> @@ -53,10 +53,6 @@ static inline const char *log_category_str(enum vchiq_log_category c)
>   	return strings[c];
>   };
>
> -#ifndef vchiq_log_warning
> -#define vchiq_log_warning(dev, cat, fmt, ...) \
> -	do { dev_dbg(dev, "%s warning: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
> -#endif
>   #ifndef vchiq_log_debug
>   #define vchiq_log_debug(dev, cat, fmt, ...) \
>   	do { dev_dbg(dev, "%s debug: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
diff mbox series

Patch

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index b403400edd8e..56326b59a718 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -687,8 +687,8 @@  int vchiq_initialise(struct vchiq_instance **instance_out)
 		ret = -ENOTCONN;
 		goto failed;
 	} else if (i > 0) {
-		vchiq_log_warning(state->dev, VCHIQ_CORE,
-				  "%s: videocore initialized after %d retries\n", __func__, i);
+		dev_warn(state->dev, "core: %s: videocore initialized after %d retries\n",
+			 __func__, i);
 	}
 
 	instance = kzalloc(sizeof(*instance), GFP_KERNEL);
@@ -1644,20 +1644,19 @@  vchiq_dump_service_use_state(struct vchiq_state *state)
 	read_unlock_bh(&arm_state->susp_res_lock);
 
 	if (only_nonzero)
-		vchiq_log_warning(state->dev, VCHIQ_SUSPEND,
-				  "Too many active services (%d). Only dumping up to first %d services with non-zero use-count",
-				  active_services, found);
+		dev_warn(state->dev,
+			 "suspend: Too many active services (%d). Only dumping up to first %d services with non-zero use-count\n",
+			 active_services, found);
 
 	for (i = 0; i < found; i++) {
-		vchiq_log_warning(state->dev, VCHIQ_SUSPEND,
-				  "%p4cc:%d service count %d %s",
-				  &service_data[i].fourcc,
-				  service_data[i].clientid, service_data[i].use_count,
-				  service_data[i].use_count ? nz : "");
+		dev_warn(state->dev,
+			 "suspend: %p4cc:%d service count %d %s\n",
+			 &service_data[i].fourcc,
+			 service_data[i].clientid, service_data[i].use_count,
+			 service_data[i].use_count ? nz : "");
 	}
-	vchiq_log_warning(state->dev, VCHIQ_SUSPEND, "VCHIQ use count %d", peer_count);
-	vchiq_log_warning(state->dev, VCHIQ_SUSPEND, "Overall vchiq instance use count %d",
-			  vc_use_count);
+	dev_warn(state->dev, "suspend: VCHIQ use count %d\n", peer_count);
+	dev_warn(state->dev, "suspend: Overall vchiq instance use count %d\n", vc_use_count);
 
 	kfree(service_data);
 }
@@ -1771,8 +1770,7 @@  static int vchiq_probe(struct platform_device *pdev)
 	 */
 	err = vchiq_register_chrdev(&pdev->dev);
 	if (err) {
-		vchiq_log_warning(&pdev->dev, VCHIQ_ARM,
-				  "Failed to initialize vchiq cdev");
+		dev_warn(&pdev->dev, "arm: Failed to initialize vchiq cdev\n");
 		goto error_exit;
 	}
 
@@ -1782,7 +1780,7 @@  static int vchiq_probe(struct platform_device *pdev)
 	return 0;
 
 failed_platform_init:
-	vchiq_log_warning(&pdev->dev, VCHIQ_ARM, "could not initialize vchiq platform");
+	dev_warn(&pdev->dev, "arm: Could not initialize vchiq platform\n");
 error_exit:
 	return err;
 }
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 63f412815a32..2fd793954001 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -465,9 +465,9 @@  make_service_callback(struct vchiq_service *service, enum vchiq_reason reason,
 	status = service->base.callback(service->instance, reason, header, service->handle,
 					bulk_userdata);
 	if (status && (status != -EAGAIN)) {
-		vchiq_log_warning(service->state->dev, VCHIQ_CORE,
-				  "%d: ignoring ERROR from callback to service %x",
-				  service->state->id, service->handle);
+		dev_warn(service->state->dev,
+			 "core: %d: ignoring ERROR from callback to service %x\n",
+			 service->state->id, service->handle);
 		status = 0;
 	}
 
@@ -1609,10 +1609,10 @@  parse_message(struct vchiq_state *state, struct vchiq_header *header)
 				vchiq_service_put(service);
 			service = get_connected_service(state, remoteport);
 			if (service)
-				vchiq_log_warning(state->dev, VCHIQ_CORE,
-						  "%d: prs %s@%pK (%d->%d) - found connected service %d",
-						  state->id, msg_type_str(type), header,
-						  remoteport, localport, service->localport);
+				dev_warn(state->dev,
+					 "core: %d: prs %s@%pK (%d->%d) - found connected service %d\n",
+					 state->id, msg_type_str(type), header,
+					 remoteport, localport, service->localport);
 		}
 
 		if (!service) {
@@ -2903,10 +2903,10 @@  vchiq_close_service(struct vchiq_instance *instance, unsigned int handle)
 		    (service->srvstate == VCHIQ_SRVSTATE_OPEN))
 			break;
 
-		vchiq_log_warning(service->state->dev, VCHIQ_CORE,
-				  "%d: close_service:%d - waiting in state %s",
-				  service->state->id, service->localport,
-				  srvstate_names[service->srvstate]);
+		dev_warn(service->state->dev,
+			 "core: %d: close_service:%d - waiting in state %s\n",
+			 service->state->id, service->localport,
+			 srvstate_names[service->srvstate]);
 	}
 
 	if (!status &&
@@ -2964,10 +2964,10 @@  vchiq_remove_service(struct vchiq_instance *instance, unsigned int handle)
 		    (service->srvstate == VCHIQ_SRVSTATE_OPEN))
 			break;
 
-		vchiq_log_warning(service->state->dev, VCHIQ_CORE,
-				  "%d: remove_service:%d - waiting in state %s",
-				  service->state->id, service->localport,
-				  srvstate_names[service->srvstate]);
+		dev_warn(service->state->dev,
+			 "core: %d: remove_service:%d - waiting in state %s\n",
+			 service->state->id, service->localport,
+			 srvstate_names[service->srvstate]);
 	}
 
 	if (!status && (service->srvstate != VCHIQ_SRVSTATE_FREE))
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index d7dcd17e4bff..bc980a001711 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -53,10 +53,6 @@  static inline const char *log_category_str(enum vchiq_log_category c)
 	return strings[c];
 };
 
-#ifndef vchiq_log_warning
-#define vchiq_log_warning(dev, cat, fmt, ...) \
-	do { dev_dbg(dev, "%s warning: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
-#endif
 #ifndef vchiq_log_debug
 #define vchiq_log_debug(dev, cat, fmt, ...) \
 	do { dev_dbg(dev, "%s debug: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)