Skip to content

Commit 8ab4f88

Browse files
mjruhlij-intel
authored andcommitted
platform/x86/intel/pmt: decouple sysfs and namespace
The PMT namespace includes the crashlog sysfs attribute information. Other crashlog version/types may need different sysfs attributes. Coupling the attributes with the namespace blocks this usage. Decouple sysfs attributes from the name space and add them to the specific entry. Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Michael J. Ruhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 5c7bfa1 commit 8ab4f88

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

drivers/platform/x86/intel/pmt/class.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,
316316

317317
entry->kobj = &dev->kobj;
318318

319-
if (ns->attr_grp) {
320-
ret = sysfs_create_group(entry->kobj, ns->attr_grp);
319+
if (entry->attr_grp) {
320+
ret = sysfs_create_group(entry->kobj, entry->attr_grp);
321321
if (ret)
322322
goto fail_sysfs_create_group;
323323
}
@@ -358,8 +358,8 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,
358358
fail_add_endpoint:
359359
sysfs_remove_bin_file(entry->kobj, &entry->pmt_bin_attr);
360360
fail_ioremap:
361-
if (ns->attr_grp)
362-
sysfs_remove_group(entry->kobj, ns->attr_grp);
361+
if (entry->attr_grp)
362+
sysfs_remove_group(entry->kobj, entry->attr_grp);
363363
fail_sysfs_create_group:
364364
device_unregister(dev);
365365
fail_dev_create:
@@ -401,8 +401,8 @@ void intel_pmt_dev_destroy(struct intel_pmt_entry *entry,
401401
if (entry->size)
402402
sysfs_remove_bin_file(entry->kobj, &entry->pmt_bin_attr);
403403

404-
if (ns->attr_grp)
405-
sysfs_remove_group(entry->kobj, ns->attr_grp);
404+
if (entry->attr_grp)
405+
sysfs_remove_group(entry->kobj, entry->attr_grp);
406406

407407
device_unregister(dev);
408408
xa_erase(ns->xa, entry->devid);

drivers/platform/x86/intel/pmt/class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct intel_pmt_entry {
4343
struct pci_dev *pcidev;
4444
struct intel_pmt_header header;
4545
struct bin_attribute pmt_bin_attr;
46+
const struct attribute_group *attr_grp;
4647
struct kobject *kobj;
4748
void __iomem *disc_table;
4849
void __iomem *base;
@@ -58,7 +59,6 @@ struct intel_pmt_entry {
5859
struct intel_pmt_namespace {
5960
const char *name;
6061
struct xarray *xa;
61-
const struct attribute_group *attr_grp;
6262
int (*pmt_header_decode)(struct intel_pmt_entry *entry,
6363
struct device *dev);
6464
int (*pmt_add_endpoint)(struct intel_vsec_device *ivdev,

drivers/platform/x86/intel/pmt/crashlog.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,15 @@ static int pmt_crashlog_header_decode(struct intel_pmt_entry *entry,
243243
/* Size is measured in DWORDS, but accessor returns bytes */
244244
header->size = GET_SIZE(readl(disc_table + SIZE_OFFSET));
245245

246+
entry->attr_grp = &pmt_crashlog_group;
247+
246248
return 0;
247249
}
248250

249251
static DEFINE_XARRAY_ALLOC(crashlog_array);
250252
static struct intel_pmt_namespace pmt_crashlog_ns = {
251253
.name = "crashlog",
252254
.xa = &crashlog_array,
253-
.attr_grp = &pmt_crashlog_group,
254255
.pmt_header_decode = pmt_crashlog_header_decode,
255256
};
256257

0 commit comments

Comments
 (0)