[PATCH 07/12] drm/client: Use array notation for function arguments

Thomas Zimmermann tzimmermann at suse.de
Fri Apr 5 08:02:59 UTC 2024


Hi

Am 04.04.24 um 22:33 schrieb Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Use the array notation rather that the pointer notation for
> function arguments. This makes it clear to the reader that
> we are in fact dealing with an array rather than a single
> pointer. Functionally the two are equivalent.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>   drivers/gpu/drm/drm_client_modeset.c | 42 ++++++++++++++--------------
>   1 file changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
> index 384a9f8227a0..08fc896885dd 100644
> --- a/drivers/gpu/drm/drm_client_modeset.c
> +++ b/drivers/gpu/drm/drm_client_modeset.c
> @@ -232,9 +232,9 @@ static bool drm_connector_enabled(struct drm_connector *connector, bool strict)
>   	return enable;
>   }
>   
> -static void drm_client_connectors_enabled(struct drm_connector **connectors,
> +static void drm_client_connectors_enabled(struct drm_connector *connectors[],
>   					  unsigned int connector_count,
> -					  bool *enabled)
> +					  bool enabled[])

I like this style, but have been criticized for using it. I hope this 
has changed.

Best regards
Thomas

>   {
>   	bool any_enabled = false;
>   	struct drm_connector *connector;
> @@ -257,11 +257,11 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
>   }
>   
>   static bool drm_client_target_cloned(struct drm_device *dev,
> -				     struct drm_connector **connectors,
> +				     struct drm_connector *connectors[],
>   				     unsigned int connector_count,
> -				     const struct drm_display_mode **modes,
> -				     struct drm_client_offset *offsets,
> -				     bool *enabled, int width, int height)
> +				     const struct drm_display_mode *modes[],
> +				     struct drm_client_offset offsets[],
> +				     bool enabled[], int width, int height)
>   {
>   	int count, i, j;
>   	bool can_clone = false;
> @@ -342,10 +342,10 @@ static bool drm_client_target_cloned(struct drm_device *dev,
>   	return false;
>   }
>   
> -static int drm_client_get_tile_offsets(struct drm_connector **connectors,
> +static int drm_client_get_tile_offsets(struct drm_connector *connectors[],
>   				       unsigned int connector_count,
> -				       const struct drm_display_mode **modes,
> -				       struct drm_client_offset *offsets,
> +				       const struct drm_display_mode *modes[],
> +				       struct drm_client_offset offsets[],
>   				       int idx,
>   				       int h_idx, int v_idx)
>   {
> @@ -375,11 +375,11 @@ static int drm_client_get_tile_offsets(struct drm_connector **connectors,
>   	return 0;
>   }
>   
> -static bool drm_client_target_preferred(struct drm_connector **connectors,
> +static bool drm_client_target_preferred(struct drm_connector *connectors[],
>   					unsigned int connector_count,
> -					const struct drm_display_mode **modes,
> -					struct drm_client_offset *offsets,
> -					bool *enabled, int width, int height)
> +					const struct drm_display_mode *modes[],
> +					struct drm_client_offset offsets[],
> +					bool enabled[], int width, int height)
>   {
>   	const u64 mask = BIT_ULL(connector_count) - 1;
>   	struct drm_connector *connector;
> @@ -491,10 +491,10 @@ static bool connector_has_possible_crtc(struct drm_connector *connector,
>   }
>   
>   static int drm_client_pick_crtcs(struct drm_client_dev *client,
> -				 struct drm_connector **connectors,
> +				 struct drm_connector *connectors[],
>   				 unsigned int connector_count,
> -				 struct drm_crtc **best_crtcs,
> -				 const struct drm_display_mode **modes,
> +				 struct drm_crtc *best_crtcs[],
> +				 const struct drm_display_mode *modes[],
>   				 int n, int width, int height)
>   {
>   	struct drm_device *dev = client->dev;
> @@ -566,12 +566,12 @@ static int drm_client_pick_crtcs(struct drm_client_dev *client,
>   
>   /* Try to read the BIOS display configuration and use it for the initial config */
>   static bool drm_client_firmware_config(struct drm_client_dev *client,
> -				       struct drm_connector **connectors,
> +				       struct drm_connector *connectors[],
>   				       unsigned int connector_count,
> -				       struct drm_crtc **crtcs,
> -				       const struct drm_display_mode **modes,
> -				       struct drm_client_offset *offsets,
> -				       bool *enabled, int width, int height)
> +				       struct drm_crtc *crtcs[],
> +				       const struct drm_display_mode *modes[],
> +				       struct drm_client_offset offsets[],
> +				       bool enabled[], int width, int height)
>   {
>   	const int count = min_t(unsigned int, connector_count, BITS_PER_LONG);
>   	unsigned long conn_configured, conn_seq, mask;

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



More information about the Intel-gfx mailing list