On Mon, Jul 2, 2018 at 4:39 PM, Dave Jiang <[email protected]> wrote: > The generated dimm id is needed for the sysfs attribute as well as being > used as the identifier/description for the security key. Since it's > constant and should never change, store it as a member of struct nvdimm. > > Signed-off-by: Dave Jiang <[email protected]> > --- > drivers/acpi/nfit/core.c | 33 ++++++++++++++++++++++----------- > drivers/nvdimm/dimm_devs.c | 4 +++- > drivers/nvdimm/nd-core.h | 1 + > include/linux/libnvdimm.h | 2 +- > 4 files changed, 27 insertions(+), 13 deletions(-) > > diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c > index 70351b610b3d..a6fb336da79d 100644 > --- a/drivers/acpi/nfit/core.c > +++ b/drivers/acpi/nfit/core.c [..] > +static int acpi_nfit_get_dimm_id(struct acpi_nfit_control_region *dcr, > + char *buf) > +{ > + if (dcr->valid_fields & ACPI_NFIT_CONTROL_MFG_INFO_VALID) > + return sprintf(buf, "%04x-%02x-%04x-%08x", > + be16_to_cpu(dcr->vendor_id), > + dcr->manufacturing_location, > + be16_to_cpu(dcr->manufacturing_date), > + be32_to_cpu(dcr->serial_number)); > + else > + return sprintf(buf, "%04x-%08x", > + be16_to_cpu(dcr->vendor_id), > + be32_to_cpu(dcr->serial_number)); > +}
Let's just add a 24-byte string to 'struct nfit_mem' to house the id. It's static data, so no need to do another sprintf() once it is initialized. _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
