On Wed, Nov 25, 2020 at 10:37 AM Hans de Goede <hdegoede@xxxxxxxxxx> wrote: > > bmc150 accelerometers with an ACPI hardware-id of BOSC0200 have an ACPI > method providing their mount-matrix, add support for retrieving this. ... > + if (strcmp(dev_name(dev), "i2c-BOSC0200:base") == 0) > + alt_name = "ROMK"; > + else > + alt_name = "ROMS"; > + > + if (acpi_has_method(adev->handle, "ROTM")) > + name = "ROTM"; My gosh, it's a third method of this... ... > + elements = obj->package.elements; > + for (i = 0; i < 3; i++) { > + if (elements[i].type != ACPI_TYPE_STRING) > + goto unknown_format; > + > + str = elements[i].string.pointer; > + if (sscanf(str, "%d %d %d", &val[0], &val[1], &val[2]) != 3) > + goto unknown_format; > + > + for (j = 0; j < 3; j++) { > + switch (val[j]) { > + case -1: str = "-1"; break; > + case 0: str = "0"; break; > + case 1: str = "1"; break; > + default: goto unknown_format; > + } > + orientation->rotation[i * 3 + j] = str; > + } > + } I'm wondering if we can come up with some common code out of this and existing apply_acpi_orientation(). -- With Best Regards, Andy Shevchenko