Skip to content

Commit 4d1b7ef

Browse files
debox1jwrdegoede
authored andcommitted
platform/x86/intel/pmt: Add header to struct intel_pmt_entry
The PMT header is passed to several functions. Instead, store the header in struct intel_pmt_entry which is also passed to these functions and shorten the argument list. This simplifies the calls in preparation for later changes. While here also perform a newline cleanup. Signed-off-by: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20231129222132.2331261-10-david.e.box@linux.intel.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent e97ec7f commit 4d1b7ef

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ static struct class intel_pmt_class = {
159159
};
160160

161161
static int intel_pmt_populate_entry(struct intel_pmt_entry *entry,
162-
struct intel_pmt_header *header,
163162
struct intel_vsec_device *ivdev,
164163
struct resource *disc_res)
165164
{
166165
struct pci_dev *pci_dev = ivdev->pcidev;
167166
struct device *dev = &ivdev->auxdev.dev;
167+
struct intel_pmt_header *header = &entry->header;
168168
u8 bir;
169169

170170
/*
@@ -313,7 +313,6 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespa
313313
struct intel_vsec_device *intel_vsec_dev, int idx)
314314
{
315315
struct device *dev = &intel_vsec_dev->auxdev.dev;
316-
struct intel_pmt_header header;
317316
struct resource *disc_res;
318317
int ret;
319318

@@ -323,16 +322,15 @@ int intel_pmt_dev_create(struct intel_pmt_entry *entry, struct intel_pmt_namespa
323322
if (IS_ERR(entry->disc_table))
324323
return PTR_ERR(entry->disc_table);
325324

326-
ret = ns->pmt_header_decode(entry, &header, dev);
325+
ret = ns->pmt_header_decode(entry, dev);
327326
if (ret)
328327
return ret;
329328

330-
ret = intel_pmt_populate_entry(entry, &header, intel_vsec_dev, disc_res);
329+
ret = intel_pmt_populate_entry(entry, intel_vsec_dev, disc_res);
331330
if (ret)
332331
return ret;
333332

334333
return intel_pmt_dev_register(entry, ns, dev);
335-
336334
}
337335
EXPORT_SYMBOL_NS_GPL(intel_pmt_dev_create, INTEL_PMT);
338336

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@
1818
#define GET_BIR(v) ((v) & GENMASK(2, 0))
1919
#define GET_ADDRESS(v) ((v) & GENMASK(31, 3))
2020

21+
struct intel_pmt_header {
22+
u32 base_offset;
23+
u32 size;
24+
u32 guid;
25+
u8 access_type;
26+
};
27+
2128
struct intel_pmt_entry {
29+
struct intel_pmt_header header;
2230
struct bin_attribute pmt_bin_attr;
2331
struct kobject *kobj;
2432
void __iomem *disc_table;
@@ -29,19 +37,11 @@ struct intel_pmt_entry {
2937
int devid;
3038
};
3139

32-
struct intel_pmt_header {
33-
u32 base_offset;
34-
u32 size;
35-
u32 guid;
36-
u8 access_type;
37-
};
38-
3940
struct intel_pmt_namespace {
4041
const char *name;
4142
struct xarray *xa;
4243
const struct attribute_group *attr_grp;
4344
int (*pmt_header_decode)(struct intel_pmt_entry *entry,
44-
struct intel_pmt_header *header,
4545
struct device *dev);
4646
};
4747

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,10 @@ static const struct attribute_group pmt_crashlog_group = {
223223
};
224224

225225
static int pmt_crashlog_header_decode(struct intel_pmt_entry *entry,
226-
struct intel_pmt_header *header,
227226
struct device *dev)
228227
{
229228
void __iomem *disc_table = entry->disc_table;
229+
struct intel_pmt_header *header = &entry->header;
230230
struct crashlog_entry *crashlog;
231231

232232
if (!pmt_crashlog_supported(entry))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ static bool pmt_telem_region_overlaps(struct intel_pmt_entry *entry,
5858
}
5959

6060
static int pmt_telem_header_decode(struct intel_pmt_entry *entry,
61-
struct intel_pmt_header *header,
6261
struct device *dev)
6362
{
6463
void __iomem *disc_table = entry->disc_table;
64+
struct intel_pmt_header *header = &entry->header;
6565

6666
if (pmt_telem_region_overlaps(entry, dev))
6767
return 1;

0 commit comments

Comments
 (0)