From 9183a5f8861fecace8db3b50a11797f1cc5b157d Mon Sep 17 00:00:00 2001 From: Alexandre Bard Date: Wed, 24 Aug 2022 09:59:10 +0200 Subject: [PATCH] lmsensors: Remove uneeded patch After discussion with the maintainers, the problem actually lies in the kernel drivers where a dash is forbidden. But the da9063-hwmon driver was using a deprecated function which was not checking the name. BugzID: 81093 --- ...support-for-driver-names-with-dashes.patch | 138 ------------------ .../lm_sensors/lmsensors_3.6.0.bbappend | 6 - 2 files changed, 144 deletions(-) delete mode 100644 recipes-bsp/lm_sensors/lmsensors/0001-libsensors-Fix-support-for-driver-names-with-dashes.patch delete mode 100644 recipes-bsp/lm_sensors/lmsensors_3.6.0.bbappend diff --git a/recipes-bsp/lm_sensors/lmsensors/0001-libsensors-Fix-support-for-driver-names-with-dashes.patch b/recipes-bsp/lm_sensors/lmsensors/0001-libsensors-Fix-support-for-driver-names-with-dashes.patch deleted file mode 100644 index e67b543..0000000 --- a/recipes-bsp/lm_sensors/lmsensors/0001-libsensors-Fix-support-for-driver-names-with-dashes.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 0992bce0612852dd10006a8e182b4e69361c99dc Mon Sep 17 00:00:00 2001 -From: Alexandre Bard -Date: Fri, 12 Aug 2022 14:32:09 +0200 -Subject: [PATCH] libsensors: Fix support for driver names with dashes - -The dash is used as delimiter in the conversion rules. This works fine -with kernel drivers with simple names like lm75, but some drivers have a -compound name like da9063-hwmon which were not handled properly by these -rules. - -Signed-off-by: Alexandre Bard ---- - lib/data.c | 102 +++++++++++++++++++++++++++++++++-------------------- - 1 file changed, 64 insertions(+), 38 deletions(-) - -diff --git a/lib/data.c b/lib/data.c -index c5aea429..318a35f8 100644 ---- a/lib/data.c -+++ b/lib/data.c -@@ -83,54 +83,80 @@ void sensors_free_chip_name(sensors_chip_name *chip) - int sensors_parse_chip_name(const char *name, sensors_chip_name *res) - { - char *dash; -+ const char * prefix = name; -+ const char * bus_type; - - /* First, the prefix. It's either "*" or a real chip name. */ -- if (!strncmp(name, "*-", 2)) { -- res->prefix = SENSORS_CHIP_NAME_PREFIX_ANY; -- name += 2; -+ if (!strncmp(prefix, "*-", 2)) { -+ bus_type = prefix + 2; - } else { -- if (!(dash = strchr(name, '-'))) -+ if (!(dash = strchr(prefix, '-'))) - return -SENSORS_ERR_CHIP_NAME; -- res->prefix = strndup(name, dash - name); -- if (!res->prefix) -- sensors_fatal_error(__func__, -- "Allocating name prefix"); -- name = dash + 1; -+ bus_type = dash + 1; - } - -- /* Then we have either a sole "*" (all chips with this name) or a bus -- type and an address. */ -- if (!strcmp(name, "*")) { -- res->bus.type = SENSORS_BUS_TYPE_ANY; -- res->bus.nr = SENSORS_BUS_NR_ANY; -- res->addr = SENSORS_CHIP_NAME_ADDR_ANY; -- return 0; -+ /* We go through the name until we find a valid bus type or "*" -+ (all chips with this name). Dashes on the way are considered -+ part of the prefix. */ -+ while (1) { -+ if (!strcmp(bus_type, "*")) { -+ res->bus.type = SENSORS_BUS_TYPE_ANY; -+ break; -+ } -+ -+ if (!(dash = strchr(bus_type, '-'))) -+ return -SENSORS_ERR_CHIP_NAME; -+ -+ if (!strncmp(bus_type, "i2c", dash - bus_type)) { -+ res->bus.type = SENSORS_BUS_TYPE_I2C; -+ break; -+ } -+ else if (!strncmp(bus_type, "isa", dash - bus_type)) { -+ res->bus.type = SENSORS_BUS_TYPE_ISA; -+ break; -+ } -+ else if (!strncmp(bus_type, "pci", dash - bus_type)) { -+ res->bus.type = SENSORS_BUS_TYPE_PCI; -+ break; -+ } -+ else if (!strncmp(bus_type, "spi", dash - bus_type)) { -+ res->bus.type = SENSORS_BUS_TYPE_SPI; -+ break; -+ } -+ else if (!strncmp(bus_type, "virtual", dash - bus_type)) { -+ res->bus.type = SENSORS_BUS_TYPE_VIRTUAL; -+ break; -+ } -+ else if (!strncmp(bus_type, "acpi", dash - bus_type)) { -+ res->bus.type = SENSORS_BUS_TYPE_ACPI; -+ break; -+ } -+ else if (!strncmp(bus_type, "hid", dash - bus_type)) { -+ res->bus.type = SENSORS_BUS_TYPE_HID; -+ break; -+ } -+ else if (!strncmp(bus_type, "mdio", dash - bus_type)) { -+ res->bus.type = SENSORS_BUS_TYPE_MDIO; -+ break; -+ } -+ else if (!strncmp(bus_type, "scsi", dash - bus_type)) { -+ res->bus.type = SENSORS_BUS_TYPE_SCSI; -+ break; -+ } -+ else { -+ /* Assume the prefix contains a dash */ -+ bus_type = dash + 1; -+ } - } - -- if (!(dash = strchr(name, '-'))) -- goto ERROR; -- if (!strncmp(name, "i2c", dash - name)) -- res->bus.type = SENSORS_BUS_TYPE_I2C; -- else if (!strncmp(name, "isa", dash - name)) -- res->bus.type = SENSORS_BUS_TYPE_ISA; -- else if (!strncmp(name, "pci", dash - name)) -- res->bus.type = SENSORS_BUS_TYPE_PCI; -- else if (!strncmp(name, "spi", dash - name)) -- res->bus.type = SENSORS_BUS_TYPE_SPI; -- else if (!strncmp(name, "virtual", dash - name)) -- res->bus.type = SENSORS_BUS_TYPE_VIRTUAL; -- else if (!strncmp(name, "acpi", dash - name)) -- res->bus.type = SENSORS_BUS_TYPE_ACPI; -- else if (!strncmp(name, "hid", dash - name)) -- res->bus.type = SENSORS_BUS_TYPE_HID; -- else if (!strncmp(name, "mdio", dash - name)) -- res->bus.type = SENSORS_BUS_TYPE_MDIO; -- else if (!strncmp(name, "scsi", dash - name)) -- res->bus.type = SENSORS_BUS_TYPE_SCSI; -- else -- goto ERROR; - name = dash + 1; - -+ /* We can now properly set the prefix */ -+ res->prefix = strndup(prefix, bus_type - prefix - 1); -+ if (!res->prefix) -+ sensors_fatal_error(__func__, -+ "Allocating name prefix"); -+ - /* Some bus types (i2c, spi) have an additional bus number. - For these, the next part is either a "*" (any bus of that type) - or a decimal number. */ diff --git a/recipes-bsp/lm_sensors/lmsensors_3.6.0.bbappend b/recipes-bsp/lm_sensors/lmsensors_3.6.0.bbappend deleted file mode 100644 index 08ddb17..0000000 --- a/recipes-bsp/lm_sensors/lmsensors_3.6.0.bbappend +++ /dev/null @@ -1,6 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" - -SRC_URI += "file://0001-libsensors-Fix-support-for-driver-names-with-dashes.patch" - -PACKAGECONFIG = "" -