mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
clangd reports many "unused header" warnings throughout the Xe driver. Start working to clean this up by removing unnecessary includes in our .c files and/or replacing them with explicit includes of other headers that were previously being included indirectly. By far the most common offender here was unnecessary inclusion of xe_gt.h. That likely originates from the early days of xe.ko when xe_mmio did not exist and all register accesses, including those unrelated to GTs, were done with GT functions. There's still a lot of additional #include cleanup that can be done in the headers themselves; that will come as a followup series. v2: - Squash the 79-patch series down to a single patch. (MattB) Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20260115032803.4067824-2-matthew.d.roper@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
56 lines
1013 B
C
56 lines
1013 B
C
// SPDX-License-Identifier: MIT
|
|
/*
|
|
* Copyright © 2022 Intel Corporation
|
|
*/
|
|
|
|
#include "xe_gt_sysfs.h"
|
|
|
|
#include <linux/kobject.h>
|
|
#include <linux/sysfs.h>
|
|
|
|
#include <drm/drm_managed.h>
|
|
|
|
#include "xe_gt_types.h"
|
|
|
|
static void xe_gt_sysfs_kobj_release(struct kobject *kobj)
|
|
{
|
|
kfree(kobj);
|
|
}
|
|
|
|
static const struct kobj_type xe_gt_sysfs_kobj_type = {
|
|
.release = xe_gt_sysfs_kobj_release,
|
|
.sysfs_ops = &kobj_sysfs_ops,
|
|
};
|
|
|
|
static void gt_sysfs_fini(void *arg)
|
|
{
|
|
struct xe_gt *gt = arg;
|
|
|
|
kobject_put(gt->sysfs);
|
|
}
|
|
|
|
int xe_gt_sysfs_init(struct xe_gt *gt)
|
|
{
|
|
struct xe_tile *tile = gt_to_tile(gt);
|
|
struct xe_device *xe = gt_to_xe(gt);
|
|
struct kobj_gt *kg;
|
|
int err;
|
|
|
|
kg = kzalloc(sizeof(*kg), GFP_KERNEL);
|
|
if (!kg)
|
|
return -ENOMEM;
|
|
|
|
kobject_init(&kg->base, &xe_gt_sysfs_kobj_type);
|
|
kg->gt = gt;
|
|
|
|
err = kobject_add(&kg->base, tile->sysfs, "gt%d", gt->info.id);
|
|
if (err) {
|
|
kobject_put(&kg->base);
|
|
return err;
|
|
}
|
|
|
|
gt->sysfs = &kg->base;
|
|
|
|
return devm_add_action_or_reset(xe->drm.dev, gt_sysfs_fini, gt);
|
|
}
|