Commit f23e2cc4 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

mei: constify struct file pointer

The struct file file pointer is used as an opaque handle to for a
connected client, for this part the pointer should be immutable and
should be set to count.
Reviewed-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d0df8dfb
...@@ -93,7 +93,7 @@ int mei_amthif_host_init(struct mei_device *dev, struct mei_me_client *me_cl) ...@@ -93,7 +93,7 @@ int mei_amthif_host_init(struct mei_device *dev, struct mei_me_client *me_cl)
* Return: returned a list entry on success, NULL on failure. * Return: returned a list entry on success, NULL on failure.
*/ */
struct mei_cl_cb *mei_amthif_find_read_list_entry(struct mei_device *dev, struct mei_cl_cb *mei_amthif_find_read_list_entry(struct mei_device *dev,
struct file *file) const struct file *file)
{ {
struct mei_cl_cb *cb; struct mei_cl_cb *cb;
...@@ -205,7 +205,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, ...@@ -205,7 +205,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
* *
* Return: 0 on success, <0 on failure. * Return: 0 on success, <0 on failure.
*/ */
static int mei_amthif_read_start(struct mei_cl *cl, struct file *file) static int mei_amthif_read_start(struct mei_cl *cl, const struct file *file)
{ {
struct mei_device *dev = cl->dev; struct mei_device *dev = cl->dev;
struct mei_cl_cb *cb; struct mei_cl_cb *cb;
...@@ -495,7 +495,7 @@ static bool mei_clear_list(struct mei_device *dev, ...@@ -495,7 +495,7 @@ static bool mei_clear_list(struct mei_device *dev,
* *
* Return: true if callback removed from the list, false otherwise * Return: true if callback removed from the list, false otherwise
*/ */
static bool mei_clear_lists(struct mei_device *dev, struct file *file) static bool mei_clear_lists(struct mei_device *dev, const struct file *file)
{ {
bool removed = false; bool removed = false;
......
...@@ -359,7 +359,7 @@ void mei_io_cb_free(struct mei_cl_cb *cb) ...@@ -359,7 +359,7 @@ void mei_io_cb_free(struct mei_cl_cb *cb)
* Return: mei_cl_cb pointer or NULL; * Return: mei_cl_cb pointer or NULL;
*/ */
struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type, struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type,
struct file *fp) const struct file *fp)
{ {
struct mei_cl_cb *cb; struct mei_cl_cb *cb;
...@@ -455,7 +455,8 @@ int mei_io_cb_alloc_buf(struct mei_cl_cb *cb, size_t length) ...@@ -455,7 +455,8 @@ int mei_io_cb_alloc_buf(struct mei_cl_cb *cb, size_t length)
* Return: cb on success and NULL on failure * Return: cb on success and NULL on failure
*/ */
struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length, struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length,
enum mei_cb_file_ops type, struct file *fp) enum mei_cb_file_ops type,
const struct file *fp)
{ {
struct mei_cl_cb *cb; struct mei_cl_cb *cb;
...@@ -1028,7 +1029,7 @@ int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -1028,7 +1029,7 @@ int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb,
* Return: 0 on success, <0 on failure. * Return: 0 on success, <0 on failure.
*/ */
int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl, int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl,
struct file *file) const struct file *file)
{ {
struct mei_device *dev; struct mei_device *dev;
struct mei_cl_cb *cb; struct mei_cl_cb *cb;
...@@ -1277,7 +1278,8 @@ int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -1277,7 +1278,8 @@ int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb,
* *
* Return: 0 on such and error otherwise. * Return: 0 on such and error otherwise.
*/ */
int mei_cl_notify_request(struct mei_cl *cl, struct file *file, u8 request) int mei_cl_notify_request(struct mei_cl *cl,
const struct file *file, u8 request)
{ {
struct mei_device *dev; struct mei_device *dev;
struct mei_cl_cb *cb; struct mei_cl_cb *cb;
...@@ -1443,7 +1445,7 @@ static bool mei_cl_is_read_fc_cb(struct mei_cl *cl) ...@@ -1443,7 +1445,7 @@ static bool mei_cl_is_read_fc_cb(struct mei_cl *cl)
* *
* Return: 0 on success, <0 on failure. * Return: 0 on success, <0 on failure.
*/ */
int mei_cl_read_start(struct mei_cl *cl, size_t length, struct file *fp) int mei_cl_read_start(struct mei_cl *cl, size_t length, const struct file *fp)
{ {
struct mei_device *dev; struct mei_device *dev;
struct mei_cl_cb *cb; struct mei_cl_cb *cb;
......
...@@ -83,7 +83,7 @@ static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl) ...@@ -83,7 +83,7 @@ static inline u8 mei_me_cl_ver(const struct mei_me_client *me_cl)
* MEI IO Functions * MEI IO Functions
*/ */
struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type, struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, enum mei_cb_file_ops type,
struct file *fp); const struct file *fp);
void mei_io_cb_free(struct mei_cl_cb *priv_cb); void mei_io_cb_free(struct mei_cl_cb *priv_cb);
int mei_io_cb_alloc_buf(struct mei_cl_cb *cb, size_t length); int mei_io_cb_alloc_buf(struct mei_cl_cb *cb, size_t length);
...@@ -116,7 +116,8 @@ struct mei_cl_cb *mei_cl_read_cb(const struct mei_cl *cl, ...@@ -116,7 +116,8 @@ struct mei_cl_cb *mei_cl_read_cb(const struct mei_cl *cl,
const struct file *fp); const struct file *fp);
void mei_cl_read_cb_flush(const struct mei_cl *cl, const struct file *fp); void mei_cl_read_cb_flush(const struct mei_cl *cl, const struct file *fp);
struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length, struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length,
enum mei_cb_file_ops type, struct file *fp); enum mei_cb_file_ops type,
const struct file *fp);
int mei_cl_flush_queues(struct mei_cl *cl, const struct file *fp); int mei_cl_flush_queues(struct mei_cl *cl, const struct file *fp);
/* /*
...@@ -213,10 +214,10 @@ void mei_cl_set_disconnected(struct mei_cl *cl); ...@@ -213,10 +214,10 @@ void mei_cl_set_disconnected(struct mei_cl *cl);
int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_disconnect(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list); struct mei_cl_cb *cmpl_list);
int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl, int mei_cl_connect(struct mei_cl *cl, struct mei_me_client *me_cl,
struct file *file); const struct file *file);
int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list); struct mei_cl_cb *cmpl_list);
int mei_cl_read_start(struct mei_cl *cl, size_t length, struct file *fp); int mei_cl_read_start(struct mei_cl *cl, size_t length, const struct file *fp);
int mei_cl_irq_read_msg(struct mei_cl *cl, struct mei_msg_hdr *hdr, int mei_cl_irq_read_msg(struct mei_cl *cl, struct mei_msg_hdr *hdr,
struct mei_cl_cb *cmpl_list); struct mei_cl_cb *cmpl_list);
int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking); int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking);
...@@ -229,7 +230,8 @@ void mei_host_client_init(struct work_struct *work); ...@@ -229,7 +230,8 @@ void mei_host_client_init(struct work_struct *work);
u8 mei_cl_notify_fop2req(enum mei_cb_file_ops fop); u8 mei_cl_notify_fop2req(enum mei_cb_file_ops fop);
enum mei_cb_file_ops mei_cl_notify_req2fop(u8 request); enum mei_cb_file_ops mei_cl_notify_req2fop(u8 request);
int mei_cl_notify_request(struct mei_cl *cl, struct file *file, u8 request); int mei_cl_notify_request(struct mei_cl *cl,
const struct file *file, u8 request);
int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb, int mei_cl_irq_notify(struct mei_cl *cl, struct mei_cl_cb *cb,
struct mei_cl_cb *cmpl_list); struct mei_cl_cb *cmpl_list);
int mei_cl_notify_get(struct mei_cl *cl, bool block, bool *notify_ev); int mei_cl_notify_get(struct mei_cl *cl, bool block, bool *notify_ev);
......
...@@ -435,7 +435,7 @@ static int mei_ioctl_connect_client(struct file *file, ...@@ -435,7 +435,7 @@ static int mei_ioctl_connect_client(struct file *file,
* *
* Return: 0 on success , <0 on error * Return: 0 on success , <0 on error
*/ */
static int mei_ioctl_client_notify_request(struct file *file, u32 request) static int mei_ioctl_client_notify_request(const struct file *file, u32 request)
{ {
struct mei_cl *cl = file->private_data; struct mei_cl *cl = file->private_data;
...@@ -450,7 +450,7 @@ static int mei_ioctl_client_notify_request(struct file *file, u32 request) ...@@ -450,7 +450,7 @@ static int mei_ioctl_client_notify_request(struct file *file, u32 request)
* *
* Return: 0 on success , <0 on error * Return: 0 on success , <0 on error
*/ */
static int mei_ioctl_client_notify_get(struct file *file, u32 *notify_get) static int mei_ioctl_client_notify_get(const struct file *file, u32 *notify_get)
{ {
struct mei_cl *cl = file->private_data; struct mei_cl *cl = file->private_data;
bool notify_ev; bool notify_ev;
......
...@@ -190,7 +190,7 @@ struct mei_cl_cb { ...@@ -190,7 +190,7 @@ struct mei_cl_cb {
enum mei_cb_file_ops fop_type; enum mei_cb_file_ops fop_type;
struct mei_msg_data buf; struct mei_msg_data buf;
size_t buf_idx; size_t buf_idx;
struct file *file_object; const struct file *file_object;
int status; int status;
u32 internal:1; u32 internal:1;
u32 completed:1; u32 completed:1;
...@@ -497,7 +497,7 @@ struct mei_device { ...@@ -497,7 +497,7 @@ struct mei_device {
struct mei_cl_cb amthif_cmd_list; struct mei_cl_cb amthif_cmd_list;
/* driver managed amthif list for reading completed amthif cmd data */ /* driver managed amthif list for reading completed amthif cmd data */
struct mei_cl_cb amthif_rd_complete_list; struct mei_cl_cb amthif_rd_complete_list;
struct file *iamthif_file_object; const struct file *iamthif_file_object;
struct mei_cl iamthif_cl; struct mei_cl iamthif_cl;
struct mei_cl_cb *iamthif_current_cb; struct mei_cl_cb *iamthif_current_cb;
long iamthif_open_count; long iamthif_open_count;
...@@ -590,7 +590,7 @@ unsigned int mei_amthif_poll(struct mei_device *dev, ...@@ -590,7 +590,7 @@ unsigned int mei_amthif_poll(struct mei_device *dev,
int mei_amthif_release(struct mei_device *dev, struct file *file); int mei_amthif_release(struct mei_device *dev, struct file *file);
struct mei_cl_cb *mei_amthif_find_read_list_entry(struct mei_device *dev, struct mei_cl_cb *mei_amthif_find_read_list_entry(struct mei_device *dev,
struct file *file); const struct file *file);
int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb); int mei_amthif_write(struct mei_cl *cl, struct mei_cl_cb *cb);
int mei_amthif_run_next_cmd(struct mei_device *dev); int mei_amthif_run_next_cmd(struct mei_device *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment