On Tue, Jan 24, 2023 at 09:26:31PM +0200, Andy Shevchenko wrote: > On Mon, Jan 23, 2023 at 03:46:13PM +0200, Sakari Ailus wrote: ... > u8 val8[BITS_TO_BYTES(MAX_LANES(port))]; Here forgot to rename u8 val[BITS_TO_BYTES(MAX_LANES(port))]; And it seems also good to have #define MAX_LANES_BYTES(port) BITS_TO_BYTES(MAX_LANES(port)) u8 val[MAX_LANES_BYTES(port)]; ... > ret = fwnode_property_count_u8(mipi_port_fwnode, "mipi-img-dlane-polarities"); > if (ret < 0) { > acpi_handle_debug(acpi_device_handle(device), > "no lane polarity provided\n"); > } else if (ret < 1 + num_lanes) { > acpi_handle_warn(acpi_device_handle(device), > "too few lane polarity bytes (%u)\n", bytes); > } else { > // assuming we dropped the union and renamed to val... > ret = fwnode_property_read_u8_array(mipi_port_fwnode, > "mipi-img-lane-polarities", > val, sizeof(val)); > if (ret) { > ...can't read... (debug message?) > } else { > unsigned int i; > > for (i = 0; i < 1 + num_lanes; i++) Here something like for (i = 0; i < MAX_LANES_BYTES(port); i++) But I'm tired for today, please double check. I hope you got the idea. > bitmap_set_value8(polarity, val[i], i * BITS_PER_BYTE); > > // assuming that lane_polarities is zeroed by default... > for_each_set_bit(i, polarity, 1 + num_lanes) > port->lane_polarities[i] = 1; > } > } -- With Best Regards, Andy Shevchenko