Path: blob/main/sys/contrib/dev/iwlwifi/mvm/debugfs.h
48287 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2023 Intel Corporation3* Copyright (C) 2012-2014 Intel Corporation4* Copyright (C) 2013-2014 Intel Mobile Communications GmbH5*/6#define MVM_DEBUGFS_READ_FILE_OPS(name) \7static const struct file_operations iwl_dbgfs_##name##_ops = { \8.read = iwl_dbgfs_##name##_read, \9.open = simple_open, \10.llseek = generic_file_llseek, \11}1213#define MVM_DEBUGFS_WRITE_WRAPPER(name, buflen, argtype) \14static ssize_t _iwl_dbgfs_##name##_write(struct file *file, \15const char __user *user_buf, \16size_t count, loff_t *ppos) \17{ \18argtype *arg = file->private_data; \19char buf[buflen] = {}; \20size_t buf_size = min(count, sizeof(buf) - 1); \21\22if (copy_from_user(buf, user_buf, buf_size)) \23return -EFAULT; \24\25return iwl_dbgfs_##name##_write(arg, buf, buf_size, ppos); \26} \2728#define _MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, buflen, argtype) \29MVM_DEBUGFS_WRITE_WRAPPER(name, buflen, argtype) \30static const struct file_operations iwl_dbgfs_##name##_ops = { \31.write = _iwl_dbgfs_##name##_write, \32.read = iwl_dbgfs_##name##_read, \33.open = simple_open, \34.llseek = generic_file_llseek, \35};3637#define _MVM_DEBUGFS_WRITE_FILE_OPS(name, buflen, argtype) \38MVM_DEBUGFS_WRITE_WRAPPER(name, buflen, argtype) \39static const struct file_operations iwl_dbgfs_##name##_ops = { \40.write = _iwl_dbgfs_##name##_write, \41.open = simple_open, \42.llseek = generic_file_llseek, \43};444546