Re: [PATCH 08/26] drm/dp_mst: Refactor drm_dp_send_enum_path_resources

2019-08-14 Thread Daniel Vetter
On Wed, Jul 17, 2019 at 09:42:31PM -0400, Lyude Paul wrote:
> Use more pointers so we don't have to write out
> txmsg->reply.u.path_resources each time. Also, fix line wrapping +
> rearrange local variables.
> 
> Cc: Juston Li 
> Cc: Imre Deak 
> Cc: Ville Syrjälä 
> Cc: Harry Wentland 
> Signed-off-by: Lyude Paul 

Reviewed-by: Daniel Vetter 

> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 24 
>  1 file changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index ec6865e1af75..57c9c605ee17 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -2350,12 +2350,14 @@ static void drm_dp_send_link_address(struct 
> drm_dp_mst_topology_mgr *mgr,
>   kfree(txmsg);
>  }
>  
> -static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr 
> *mgr,
> -struct drm_dp_mst_branch *mstb,
> -struct drm_dp_mst_port *port)
> +static int
> +drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
> + struct drm_dp_mst_branch *mstb,
> + struct drm_dp_mst_port *port)
>  {
> - int len;
> + struct drm_dp_enum_path_resources_ack_reply *path_res;
>   struct drm_dp_sideband_msg_tx *txmsg;
> + int len;
>   int ret;
>  
>   txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
> @@ -2369,14 +2371,20 @@ static int drm_dp_send_enum_path_resources(struct 
> drm_dp_mst_topology_mgr *mgr,
>  
>   ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
>   if (ret > 0) {
> + path_res = >reply.u.path_resources;
> +
>   if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK) {
>   DRM_DEBUG_KMS("enum path resources nak received\n");
>   } else {
> - if (port->port_num != 
> txmsg->reply.u.path_resources.port_number)
> + if (port->port_num != path_res->port_number)
>   DRM_ERROR("got incorrect port in response\n");
> - DRM_DEBUG_KMS("enum path resources %d: %d %d\n", 
> txmsg->reply.u.path_resources.port_number, 
> txmsg->reply.u.path_resources.full_payload_bw_number,
> -
> txmsg->reply.u.path_resources.avail_payload_bw_number);
> - port->available_pbn = 
> txmsg->reply.u.path_resources.avail_payload_bw_number;
> +
> + DRM_DEBUG_KMS("enum path resources %d: %d %d\n",
> +   path_res->port_number,
> +   path_res->full_payload_bw_number,
> +   path_res->avail_payload_bw_number);
> + port->available_pbn =
> + path_res->avail_payload_bw_number;
>   }
>   }
>  
> -- 
> 2.21.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH 08/26] drm/dp_mst: Refactor drm_dp_send_enum_path_resources

2019-07-17 Thread Lyude Paul
Use more pointers so we don't have to write out
txmsg->reply.u.path_resources each time. Also, fix line wrapping +
rearrange local variables.

Cc: Juston Li 
Cc: Imre Deak 
Cc: Ville Syrjälä 
Cc: Harry Wentland 
Signed-off-by: Lyude Paul 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index ec6865e1af75..57c9c605ee17 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2350,12 +2350,14 @@ static void drm_dp_send_link_address(struct 
drm_dp_mst_topology_mgr *mgr,
kfree(txmsg);
 }
 
-static int drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
-  struct drm_dp_mst_branch *mstb,
-  struct drm_dp_mst_port *port)
+static int
+drm_dp_send_enum_path_resources(struct drm_dp_mst_topology_mgr *mgr,
+   struct drm_dp_mst_branch *mstb,
+   struct drm_dp_mst_port *port)
 {
-   int len;
+   struct drm_dp_enum_path_resources_ack_reply *path_res;
struct drm_dp_sideband_msg_tx *txmsg;
+   int len;
int ret;
 
txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
@@ -2369,14 +2371,20 @@ static int drm_dp_send_enum_path_resources(struct 
drm_dp_mst_topology_mgr *mgr,
 
ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
if (ret > 0) {
+   path_res = >reply.u.path_resources;
+
if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK) {
DRM_DEBUG_KMS("enum path resources nak received\n");
} else {
-   if (port->port_num != 
txmsg->reply.u.path_resources.port_number)
+   if (port->port_num != path_res->port_number)
DRM_ERROR("got incorrect port in response\n");
-   DRM_DEBUG_KMS("enum path resources %d: %d %d\n", 
txmsg->reply.u.path_resources.port_number, 
txmsg->reply.u.path_resources.full_payload_bw_number,
-  
txmsg->reply.u.path_resources.avail_payload_bw_number);
-   port->available_pbn = 
txmsg->reply.u.path_resources.avail_payload_bw_number;
+
+   DRM_DEBUG_KMS("enum path resources %d: %d %d\n",
+ path_res->port_number,
+ path_res->full_payload_bw_number,
+ path_res->avail_payload_bw_number);
+   port->available_pbn =
+   path_res->avail_payload_bw_number;
}
}
 
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel