mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
cxl/test: Add test for module parameters
Add a test for module paraters during module init to make sure that only one is activated. [dj: Dropped counting fail_autoassemble modparm. (Alison) ] Suggested-by: Alison Schofield <alison.schofield@intel.com> Tested-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Link: https://patch.msgid.link/20260629221104.3891733-2-dave.jiang@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
This commit is contained in:
parent
96ddf1af34
commit
afae0fa7c6
|
|
@ -1827,11 +1827,29 @@ static struct attribute *cxl_acpi_attrs[] = {
|
|||
};
|
||||
ATTRIBUTE_GROUPS(cxl_acpi);
|
||||
|
||||
static bool __init have_multiple_modparms(void)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if (interleave_arithmetic)
|
||||
count++;
|
||||
if (extended_linear_cache)
|
||||
count++;
|
||||
if (hmem_test)
|
||||
count++;
|
||||
|
||||
return count > 1;
|
||||
}
|
||||
|
||||
static __init int cxl_test_init(void)
|
||||
{
|
||||
int rc, i;
|
||||
struct range mappable;
|
||||
|
||||
/* Enforce a single module param active at a time */
|
||||
if (have_multiple_modparms())
|
||||
return -EINVAL;
|
||||
|
||||
if (!IS_ALIGNED(mock_auto_region_size, PMD_SIZE)) {
|
||||
pr_err_once("mock_auto_region_size %d must be PMD-aligned\n",
|
||||
mock_auto_region_size);
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@
|
|||
#include <linux/moduleparam.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include "../../../drivers/dax/bus.h"
|
||||
#include "mock.h"
|
||||
|
||||
static bool hmem_test;
|
||||
bool hmem_test;
|
||||
|
||||
static void hmem_test_work(struct work_struct *work)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include <linux/dax.h>
|
||||
#include <cxl.h>
|
||||
|
||||
extern bool hmem_test;
|
||||
|
||||
struct cxl_mock_ops {
|
||||
struct list_head list;
|
||||
bool (*is_mock_adev)(struct acpi_device *dev);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user