Commit d24b3475 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Move variables to loop context

Lot of the loops over VBT child devices have variables
declared outside the loop but only used inside the loop.
Move the variables to a tighter scope.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230208015508.24824-3-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent dfefe7bc
...@@ -1202,9 +1202,7 @@ child_device_ptr(const struct bdb_general_definitions *defs, int i) ...@@ -1202,9 +1202,7 @@ child_device_ptr(const struct bdb_general_definitions *defs, int i)
static void static void
parse_sdvo_device_mapping(struct drm_i915_private *i915) parse_sdvo_device_mapping(struct drm_i915_private *i915)
{ {
struct sdvo_device_mapping *mapping;
const struct intel_bios_encoder_data *devdata; const struct intel_bios_encoder_data *devdata;
const struct child_device_config *child;
int count = 0; int count = 0;
/* /*
...@@ -1217,7 +1215,8 @@ parse_sdvo_device_mapping(struct drm_i915_private *i915) ...@@ -1217,7 +1215,8 @@ parse_sdvo_device_mapping(struct drm_i915_private *i915)
} }
list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) { list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) {
child = &devdata->child; const struct child_device_config *child = &devdata->child;
struct sdvo_device_mapping *mapping;
if (child->slave_addr != SLAVE_ADDR1 && if (child->slave_addr != SLAVE_ADDR1 &&
child->slave_addr != SLAVE_ADDR2) { child->slave_addr != SLAVE_ADDR2) {
...@@ -2075,7 +2074,6 @@ parse_compression_parameters(struct drm_i915_private *i915) ...@@ -2075,7 +2074,6 @@ parse_compression_parameters(struct drm_i915_private *i915)
{ {
const struct bdb_compression_parameters *params; const struct bdb_compression_parameters *params;
struct intel_bios_encoder_data *devdata; struct intel_bios_encoder_data *devdata;
const struct child_device_config *child;
u16 block_size; u16 block_size;
int index; int index;
...@@ -2100,7 +2098,7 @@ parse_compression_parameters(struct drm_i915_private *i915) ...@@ -2100,7 +2098,7 @@ parse_compression_parameters(struct drm_i915_private *i915)
} }
list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) { list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) {
child = &devdata->child; const struct child_device_config *child = &devdata->child;
if (!child->compression_enable) if (!child->compression_enable)
continue; continue;
...@@ -2226,14 +2224,14 @@ static u8 map_ddc_pin(struct drm_i915_private *i915, u8 vbt_pin) ...@@ -2226,14 +2224,14 @@ static u8 map_ddc_pin(struct drm_i915_private *i915, u8 vbt_pin)
static enum port get_port_by_ddc_pin(struct drm_i915_private *i915, u8 ddc_pin) static enum port get_port_by_ddc_pin(struct drm_i915_private *i915, u8 ddc_pin)
{ {
const struct intel_bios_encoder_data *devdata;
enum port port; enum port port;
if (!ddc_pin) if (!ddc_pin)
return PORT_NONE; return PORT_NONE;
for_each_port(port) { for_each_port(port) {
devdata = i915->display.vbt.ports[port]; const struct intel_bios_encoder_data *devdata =
i915->display.vbt.ports[port];
if (devdata && ddc_pin == devdata->child.ddc_pin) if (devdata && ddc_pin == devdata->child.ddc_pin)
return port; return port;
...@@ -2292,14 +2290,14 @@ static void sanitize_ddc_pin(struct intel_bios_encoder_data *devdata, ...@@ -2292,14 +2290,14 @@ static void sanitize_ddc_pin(struct intel_bios_encoder_data *devdata,
static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch) static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
{ {
const struct intel_bios_encoder_data *devdata;
enum port port; enum port port;
if (!aux_ch) if (!aux_ch)
return PORT_NONE; return PORT_NONE;
for_each_port(port) { for_each_port(port) {
devdata = i915->display.vbt.ports[port]; const struct intel_bios_encoder_data *devdata =
i915->display.vbt.ports[port];
if (devdata && aux_ch == devdata->child.aux_channel) if (devdata && aux_ch == devdata->child.aux_channel)
return port; return port;
...@@ -3306,7 +3304,6 @@ void intel_bios_fini_panel(struct intel_panel *panel) ...@@ -3306,7 +3304,6 @@ void intel_bios_fini_panel(struct intel_panel *panel)
bool intel_bios_is_tv_present(struct drm_i915_private *i915) bool intel_bios_is_tv_present(struct drm_i915_private *i915)
{ {
const struct intel_bios_encoder_data *devdata; const struct intel_bios_encoder_data *devdata;
const struct child_device_config *child;
if (!i915->display.vbt.int_tv_support) if (!i915->display.vbt.int_tv_support)
return false; return false;
...@@ -3315,7 +3312,7 @@ bool intel_bios_is_tv_present(struct drm_i915_private *i915) ...@@ -3315,7 +3312,7 @@ bool intel_bios_is_tv_present(struct drm_i915_private *i915)
return true; return true;
list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) { list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) {
child = &devdata->child; const struct child_device_config *child = &devdata->child;
/* /*
* If the device type is not TV, continue. * If the device type is not TV, continue.
...@@ -3349,13 +3346,12 @@ bool intel_bios_is_tv_present(struct drm_i915_private *i915) ...@@ -3349,13 +3346,12 @@ bool intel_bios_is_tv_present(struct drm_i915_private *i915)
bool intel_bios_is_lvds_present(struct drm_i915_private *i915, u8 *i2c_pin) bool intel_bios_is_lvds_present(struct drm_i915_private *i915, u8 *i2c_pin)
{ {
const struct intel_bios_encoder_data *devdata; const struct intel_bios_encoder_data *devdata;
const struct child_device_config *child;
if (list_empty(&i915->display.vbt.display_devices)) if (list_empty(&i915->display.vbt.display_devices))
return true; return true;
list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) { list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) {
child = &devdata->child; const struct child_device_config *child = &devdata->child;
/* If the device type is not LFP, continue. /* If the device type is not LFP, continue.
* We have to check both the new identifiers as well as the * We have to check both the new identifiers as well as the
...@@ -3457,17 +3453,14 @@ bool intel_bios_is_dsi_present(struct drm_i915_private *i915, ...@@ -3457,17 +3453,14 @@ bool intel_bios_is_dsi_present(struct drm_i915_private *i915,
enum port *port) enum port *port)
{ {
const struct intel_bios_encoder_data *devdata; const struct intel_bios_encoder_data *devdata;
const struct child_device_config *child;
u8 dvo_port;
list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) { list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) {
child = &devdata->child; const struct child_device_config *child = &devdata->child;
u8 dvo_port = child->dvo_port;
if (!(child->device_type & DEVICE_TYPE_MIPI_OUTPUT)) if (!(child->device_type & DEVICE_TYPE_MIPI_OUTPUT))
continue; continue;
dvo_port = child->dvo_port;
if (dsi_dvo_port_to_port(i915, dvo_port) == PORT_NONE) { if (dsi_dvo_port_to_port(i915, dvo_port) == PORT_NONE) {
drm_dbg_kms(&i915->drm, drm_dbg_kms(&i915->drm,
"VBT has unsupported DSI port %c\n", "VBT has unsupported DSI port %c\n",
...@@ -3554,10 +3547,9 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder, ...@@ -3554,10 +3547,9 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
{ {
struct drm_i915_private *i915 = to_i915(encoder->base.dev); struct drm_i915_private *i915 = to_i915(encoder->base.dev);
const struct intel_bios_encoder_data *devdata; const struct intel_bios_encoder_data *devdata;
const struct child_device_config *child;
list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) { list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) {
child = &devdata->child; const struct child_device_config *child = &devdata->child;
if (!(child->device_type & DEVICE_TYPE_MIPI_OUTPUT)) if (!(child->device_type & DEVICE_TYPE_MIPI_OUTPUT))
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment