// SPDX-License-Identifier: GPL-2.01/*2* Common Code for DAMON Modules3*4* Author: SeongJae Park <[email protected]>5*/67#include <linux/damon.h>89#include "modules-common.h"1011/*12* Allocate, set, and return a DAMON context for the physical address space.13* @ctxp: Pointer to save the point to the newly created context14* @targetp: Pointer to save the point to the newly created target15*/16int damon_modules_new_paddr_ctx_target(struct damon_ctx **ctxp,17struct damon_target **targetp)18{19struct damon_ctx *ctx;20struct damon_target *target;2122ctx = damon_new_ctx();23if (!ctx)24return -ENOMEM;2526if (damon_select_ops(ctx, DAMON_OPS_PADDR)) {27damon_destroy_ctx(ctx);28return -EINVAL;29}3031target = damon_new_target();32if (!target) {33damon_destroy_ctx(ctx);34return -ENOMEM;35}36damon_add_target(ctx, target);3738*ctxp = ctx;39*targetp = target;40return 0;41}424344