Loading drivers/soc/qcom/hab/hab.c +13 −4 Original line number Original line Diff line number Diff line /* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -612,6 +612,7 @@ int hab_vchan_recv(struct uhab_context *ctx, vchan = hab_get_vchan_fromvcid(vcid, ctx, 1); vchan = hab_get_vchan_fromvcid(vcid, ctx, 1); if (!vchan) { if (!vchan) { pr_err("vcid %X vchan 0x%pK ctx %pK\n", vcid, vchan, ctx); pr_err("vcid %X vchan 0x%pK ctx %pK\n", vcid, vchan, ctx); *message = NULL; return -ENODEV; return -ENODEV; } } Loading Loading @@ -720,12 +721,14 @@ void hab_send_close_msg(struct virtual_channel *vchan) } } } } void hab_vchan_close(struct uhab_context *ctx, int32_t vcid) int hab_vchan_close(struct uhab_context *ctx, int32_t vcid) { { struct virtual_channel *vchan, *tmp; struct virtual_channel *vchan = NULL, *tmp = NULL; int vchan_found = 0; int ret = 0; if (!ctx) if (!ctx) return; return -EINVAL; write_lock(&ctx->ctx_lock); write_lock(&ctx->ctx_lock); list_for_each_entry_safe(vchan, tmp, &ctx->vchannels, node) { list_for_each_entry_safe(vchan, tmp, &ctx->vchannels, node) { Loading @@ -746,10 +749,16 @@ void hab_vchan_close(struct uhab_context *ctx, int32_t vcid) hab_vchan_stop_notify(vchan); hab_vchan_stop_notify(vchan); hab_vchan_put(vchan); /* there is a lock inside */ hab_vchan_put(vchan); /* there is a lock inside */ write_lock(&ctx->ctx_lock); write_lock(&ctx->ctx_lock); vchan_found = 1; break; break; } } } } write_unlock(&ctx->ctx_lock); write_unlock(&ctx->ctx_lock); if (!vchan_found) ret = -ENODEV; return ret; } } /* /* Loading drivers/soc/qcom/hab/hab.h +2 −2 Original line number Original line Diff line number Diff line /* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -384,7 +384,7 @@ struct export_desc_super { int hab_vchan_open(struct uhab_context *ctx, int hab_vchan_open(struct uhab_context *ctx, unsigned int mmid, int32_t *vcid, unsigned int mmid, int32_t *vcid, int32_t timeout, uint32_t flags); int32_t timeout, uint32_t flags); void hab_vchan_close(struct uhab_context *ctx, int hab_vchan_close(struct uhab_context *ctx, int32_t vcid); int32_t vcid); long hab_vchan_send(struct uhab_context *ctx, long hab_vchan_send(struct uhab_context *ctx, int vcid, int vcid, Loading drivers/soc/qcom/hab/hab_linux.c +2 −2 Original line number Original line Diff line number Diff line /* Copyright (c) 2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -117,7 +117,7 @@ static long hab_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) break; break; case IOCTL_HAB_VC_CLOSE: case IOCTL_HAB_VC_CLOSE: close_param = (struct hab_close *)data; close_param = (struct hab_close *)data; hab_vchan_close(ctx, close_param->vcid); ret = hab_vchan_close(ctx, close_param->vcid); break; break; case IOCTL_HAB_SEND: case IOCTL_HAB_SEND: send_param = (struct hab_send *)data; send_param = (struct hab_send *)data; Loading drivers/soc/qcom/hab/khab.c +3 −4 Original line number Original line Diff line number Diff line /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading @@ -23,8 +23,7 @@ EXPORT_SYMBOL(habmm_socket_open); int32_t habmm_socket_close(int32_t handle) int32_t habmm_socket_close(int32_t handle) { { hab_vchan_close(hab_driver.kctx, handle); return hab_vchan_close(hab_driver.kctx, handle); return 0; } } EXPORT_SYMBOL(habmm_socket_close); EXPORT_SYMBOL(habmm_socket_close); Loading @@ -47,7 +46,7 @@ int32_t habmm_socket_recv(int32_t handle, void *dst_buff, uint32_t *size_bytes, uint32_t timeout, uint32_t flags) uint32_t timeout, uint32_t flags) { { int ret = 0; int ret = 0; struct hab_message *msg; struct hab_message *msg = NULL; if (!size_bytes || !dst_buff) if (!size_bytes || !dst_buff) return -EINVAL; return -EINVAL; Loading Loading
drivers/soc/qcom/hab/hab.c +13 −4 Original line number Original line Diff line number Diff line /* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -612,6 +612,7 @@ int hab_vchan_recv(struct uhab_context *ctx, vchan = hab_get_vchan_fromvcid(vcid, ctx, 1); vchan = hab_get_vchan_fromvcid(vcid, ctx, 1); if (!vchan) { if (!vchan) { pr_err("vcid %X vchan 0x%pK ctx %pK\n", vcid, vchan, ctx); pr_err("vcid %X vchan 0x%pK ctx %pK\n", vcid, vchan, ctx); *message = NULL; return -ENODEV; return -ENODEV; } } Loading Loading @@ -720,12 +721,14 @@ void hab_send_close_msg(struct virtual_channel *vchan) } } } } void hab_vchan_close(struct uhab_context *ctx, int32_t vcid) int hab_vchan_close(struct uhab_context *ctx, int32_t vcid) { { struct virtual_channel *vchan, *tmp; struct virtual_channel *vchan = NULL, *tmp = NULL; int vchan_found = 0; int ret = 0; if (!ctx) if (!ctx) return; return -EINVAL; write_lock(&ctx->ctx_lock); write_lock(&ctx->ctx_lock); list_for_each_entry_safe(vchan, tmp, &ctx->vchannels, node) { list_for_each_entry_safe(vchan, tmp, &ctx->vchannels, node) { Loading @@ -746,10 +749,16 @@ void hab_vchan_close(struct uhab_context *ctx, int32_t vcid) hab_vchan_stop_notify(vchan); hab_vchan_stop_notify(vchan); hab_vchan_put(vchan); /* there is a lock inside */ hab_vchan_put(vchan); /* there is a lock inside */ write_lock(&ctx->ctx_lock); write_lock(&ctx->ctx_lock); vchan_found = 1; break; break; } } } } write_unlock(&ctx->ctx_lock); write_unlock(&ctx->ctx_lock); if (!vchan_found) ret = -ENODEV; return ret; } } /* /* Loading
drivers/soc/qcom/hab/hab.h +2 −2 Original line number Original line Diff line number Diff line /* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -384,7 +384,7 @@ struct export_desc_super { int hab_vchan_open(struct uhab_context *ctx, int hab_vchan_open(struct uhab_context *ctx, unsigned int mmid, int32_t *vcid, unsigned int mmid, int32_t *vcid, int32_t timeout, uint32_t flags); int32_t timeout, uint32_t flags); void hab_vchan_close(struct uhab_context *ctx, int hab_vchan_close(struct uhab_context *ctx, int32_t vcid); int32_t vcid); long hab_vchan_send(struct uhab_context *ctx, long hab_vchan_send(struct uhab_context *ctx, int vcid, int vcid, Loading
drivers/soc/qcom/hab/hab_linux.c +2 −2 Original line number Original line Diff line number Diff line /* Copyright (c) 2019, The Linux Foundation. All rights reserved. /* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -117,7 +117,7 @@ static long hab_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) break; break; case IOCTL_HAB_VC_CLOSE: case IOCTL_HAB_VC_CLOSE: close_param = (struct hab_close *)data; close_param = (struct hab_close *)data; hab_vchan_close(ctx, close_param->vcid); ret = hab_vchan_close(ctx, close_param->vcid); break; break; case IOCTL_HAB_SEND: case IOCTL_HAB_SEND: send_param = (struct hab_send *)data; send_param = (struct hab_send *)data; Loading
drivers/soc/qcom/hab/khab.c +3 −4 Original line number Original line Diff line number Diff line /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. * * * This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and Loading @@ -23,8 +23,7 @@ EXPORT_SYMBOL(habmm_socket_open); int32_t habmm_socket_close(int32_t handle) int32_t habmm_socket_close(int32_t handle) { { hab_vchan_close(hab_driver.kctx, handle); return hab_vchan_close(hab_driver.kctx, handle); return 0; } } EXPORT_SYMBOL(habmm_socket_close); EXPORT_SYMBOL(habmm_socket_close); Loading @@ -47,7 +46,7 @@ int32_t habmm_socket_recv(int32_t handle, void *dst_buff, uint32_t *size_bytes, uint32_t timeout, uint32_t flags) uint32_t timeout, uint32_t flags) { { int ret = 0; int ret = 0; struct hab_message *msg; struct hab_message *msg = NULL; if (!size_bytes || !dst_buff) if (!size_bytes || !dst_buff) return -EINVAL; return -EINVAL; Loading