Date: Mon, 9 Sep 2019 20:49:37 +0000 (UTC) From: D Scott Phillips <scottph@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352108 - in stable/12/sys/dev: acpica nvdimm Message-ID: <201909092049.x89Knb5L003633@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: scottph Date: Mon Sep 9 20:49:37 2019 New Revision: 352108 URL: https://svnweb.freebsd.org/changeset/base/352108 Log: MFC 348757,351225: acpi and nvdimm location_str updates 348757: nvdimm: Provide nvdimm location information Provide the acpi handle path as the location string for the nvdimm children of the nvdimm_root device. 351225: Don't set the string "unknown" as a device's location_str Return an empty string when the location is unknown instead of the string "unknown". This ensures that all location entries are of the form key=val. Approved by: scottl (mentor) Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D20644 Modified: stable/12/sys/dev/acpica/acpi.c stable/12/sys/dev/nvdimm/nvdimm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpica/acpi.c ============================================================================== --- stable/12/sys/dev/acpica/acpi.c Mon Sep 9 20:48:12 2019 (r352107) +++ stable/12/sys/dev/acpica/acpi.c Mon Sep 9 20:49:37 2019 (r352108) @@ -869,7 +869,7 @@ acpi_child_location_str_method(device_t cbdev, device_ strlcat(buf, buf2, buflen); } } else { - snprintf(buf, buflen, "unknown"); + snprintf(buf, buflen, ""); } return (0); } Modified: stable/12/sys/dev/nvdimm/nvdimm.c ============================================================================== --- stable/12/sys/dev/nvdimm/nvdimm.c Mon Sep 9 20:48:12 2019 (r352107) +++ stable/12/sys/dev/nvdimm/nvdimm.c Mon Sep 9 20:49:37 2019 (r352108) @@ -560,6 +560,24 @@ nvdimm_root_write_ivar(device_t dev, device_t child, i return (0); } +static int +nvdimm_root_child_location_str(device_t dev, device_t child, char *buf, + size_t buflen) +{ + ACPI_HANDLE handle; + int res; + + handle = nvdimm_root_get_acpi_handle(child); + if (handle != NULL) + res = snprintf(buf, buflen, "handle=%s", acpi_name(handle)); + else + res = snprintf(buf, buflen, ""); + + if (res >= buflen) + return (EOVERFLOW); + return (0); +} + static device_method_t nvdimm_methods[] = { DEVMETHOD(device_probe, nvdimm_probe), DEVMETHOD(device_attach, nvdimm_attach), @@ -582,6 +600,7 @@ static device_method_t nvdimm_root_methods[] = { DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_read_ivar, nvdimm_root_read_ivar), DEVMETHOD(bus_write_ivar, nvdimm_root_write_ivar), + DEVMETHOD(bus_child_location_str, nvdimm_root_child_location_str), DEVMETHOD_END };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909092049.x89Knb5L003633>