[Intel-gfx] [PATCH 04/14] drm/i915: Data driven register to forcewake domains lookup

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Mon Oct 3 07:58:22 UTC 2016


On pe, 2016-09-30 at 18:48 +0100, Tvrtko Ursulin wrote:
> 
> +find_fw_domain(u32 offset, const struct intel_forcewake_range *ranges,
> +	       unsigned int num_ranges)

Gotta remind that generally "fw" is associated with firmware.
"forcewake" might be appropriate word in function names too.

> +{
> +	unsigned int i;
> +	struct intel_forcewake_range *entry =
> +		(struct intel_forcewake_range *)ranges;
> +
> +	for (i = 0; i < num_ranges; i++, entry++) {
> +		if (offset >= entry->start && offset <= entry->end)
> +			return entry->domains;
> +	}
> +
> +	return -1;
> +}
> 

This could be a binary search, too, with some sorting.

Already as is;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list