linux-stable/include/misc/cxl-base.h
Thomas Gleixner 2874c5fd28 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation either version 2 of the license or at
  your option any later version

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30 11:26:32 -07:00

48 lines
1,017 B
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright 2014 IBM Corp.
*/
#ifndef _MISC_CXL_BASE_H
#define _MISC_CXL_BASE_H
#ifdef CONFIG_CXL_BASE
#define CXL_IRQ_RANGES 4
struct cxl_irq_ranges {
irq_hw_number_t offset[CXL_IRQ_RANGES];
irq_hw_number_t range[CXL_IRQ_RANGES];
};
extern atomic_t cxl_use_count;
static inline bool cxl_ctx_in_use(void)
{
return (atomic_read(&cxl_use_count) != 0);
}
static inline void cxl_ctx_get(void)
{
atomic_inc(&cxl_use_count);
}
static inline void cxl_ctx_put(void)
{
atomic_dec(&cxl_use_count);
}
struct cxl_afu *cxl_afu_get(struct cxl_afu *afu);
void cxl_afu_put(struct cxl_afu *afu);
void cxl_slbia(struct mm_struct *mm);
#else /* CONFIG_CXL_BASE */
static inline bool cxl_ctx_in_use(void) { return false; }
static inline struct cxl_afu *cxl_afu_get(struct cxl_afu *afu) { return NULL; }
static inline void cxl_afu_put(struct cxl_afu *afu) {}
static inline void cxl_slbia(struct mm_struct *mm) {}
#endif /* CONFIG_CXL_BASE */
#endif