linux/drivers/gpu/drm/i915/i915_drm_client.h
Arnd Bergmann d57ba095e4 drm/i915: make i915_drm_client_fdinfo() reference conditional again
The function is only defined if CONFIG_PROC_FS is enabled:

ld.lld: error: undefined symbol: i915_drm_client_fdinfo
>>> referenced by i915_driver.c
>>>               drivers/gpu/drm/i915/i915_driver.o:(i915_drm_driver) in archive vmlinux.a

Use the PTR_IF() helper to make the reference NULL otherwise.

Fixes: e894b724c316d ("drm/i915: Use the fdinfo helper")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230616093158.3568480-1-arnd@kernel.org
(cherry picked from commit 8084c63743a88472af0a34ba209eebf9caea1dae)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2023-06-20 08:54:43 +01:00

53 lines
1.1 KiB
C

/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2020 Intel Corporation
*/
#ifndef __I915_DRM_CLIENT_H__
#define __I915_DRM_CLIENT_H__
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <uapi/drm/i915_drm.h>
#define I915_LAST_UABI_ENGINE_CLASS I915_ENGINE_CLASS_COMPUTE
struct drm_file;
struct drm_printer;
struct i915_drm_client {
struct kref kref;
unsigned int id;
spinlock_t ctx_lock; /* For add/remove from ctx_list. */
struct list_head ctx_list; /* List of contexts belonging to client. */
/**
* @past_runtime: Accumulation of pphwsp runtimes from closed contexts.
*/
atomic64_t past_runtime[I915_LAST_UABI_ENGINE_CLASS + 1];
};
static inline struct i915_drm_client *
i915_drm_client_get(struct i915_drm_client *client)
{
kref_get(&client->kref);
return client;
}
void __i915_drm_client_free(struct kref *kref);
static inline void i915_drm_client_put(struct i915_drm_client *client)
{
kref_put(&client->kref, __i915_drm_client_free);
}
struct i915_drm_client *i915_drm_client_alloc(void);
void i915_drm_client_fdinfo(struct drm_printer *p, struct drm_file *file);
#endif /* !__I915_DRM_CLIENT_H__ */