From nobody Wed Nov 27 14:31:38 2024 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B998A1BFE1A for ; Thu, 10 Oct 2024 10:23:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728555812; cv=none; b=sb4iVmbL04KP5kSBd1EQfABN0qdHRmD2B/xYU+TByi5b5oGJAq9V2/ciUpl/Jaz5mC6xTq8u1qCkJu8RdCJ9HWxnNOnNmaTh3o2jlJv3cCmGPukMzcTpsLE4DDz9VSeppKo/27tmig+Kj7BkV0Tcb9R0AgQAiarK6Tbffn17qTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728555812; c=relaxed/simple; bh=/EcI/XV+/Sh4a+TZw9I3cKKIBdcOZg82XQwjyZRX5mA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lAf/u2/KBPOvelr72iUF2QpMr8mGRAgj5g2Ev1OnwqVk0XoNco/bTTOfCLOQoj1asENyDwMumefPkqCjkjMxIsgShtabd07ABy6PEkzT9NuR1ObhXcz8DBpAGw68eoaaaIQSveLnjbqUidTnNC6PaW9VtxQhRrAJi2BbvaZ8I9Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=k8KZvuPc; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="k8KZvuPc" Received: from umang.jain (unknown [IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 00B66A8F; Thu, 10 Oct 2024 12:21:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728555704; bh=/EcI/XV+/Sh4a+TZw9I3cKKIBdcOZg82XQwjyZRX5mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k8KZvuPcEqXxicFmFSSrNdXn3qw67Ie2tet7dugHqXFWsAUim6shmuqhkNgWhWX4P 5IVK0MXrRQGADytBm0fkzlRCLzfKjmkRfMLuHdl4kRmwyno7WS0xOBsxam5hiec8Ty hCU37mHlbWuUWk7OBjFGR8CALxGuiG1zJHnDWrNA= From: Umang Jain To: Greg Kroah-Hartman , Broadcom internal kernel review list Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Kieran Bingham , Dan Carpenter , Stefan Wahren , Laurent Pinchart , Umang Jain Subject: [PATCH 3/5] staging: vchiq_core: Reflow long lines to 80 columns Date: Thu, 10 Oct 2024 15:52:47 +0530 Message-ID: <20241010102250.236545-4-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241010102250.236545-1-umang.jain@ideasonboard.com> References: <20241010102250.236545-1-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In order to respect the coding style, wrap long lines in vchiq_core.c to fit in 80 columns. No functional changes intended in this patch. Signed-off-by: Umang Jain --- .../interface/vchiq_arm/vchiq_core.c | 267 +++++++++++------- 1 file changed, 168 insertions(+), 99 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c= b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 1e4b2978c186..8be2dcf3658c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -227,7 +227,8 @@ set_service_state(struct vchiq_service *service, int ne= wstate) service->srvstate =3D newstate; } =20 -struct vchiq_service *handle_to_service(struct vchiq_instance *instance, u= nsigned int handle) +struct vchiq_service *handle_to_service(struct vchiq_instance *instance, + unsigned int handle) { int idx =3D handle & (VCHIQ_MAX_SERVICES - 1); =20 @@ -249,7 +250,8 @@ find_service_by_handle(struct vchiq_instance *instance,= unsigned int handle) return service; } rcu_read_unlock(); - dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", hand= le); + dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", + handle); return NULL; } =20 @@ -289,12 +291,15 @@ find_service_for_instance(struct vchiq_instance *inst= ance, unsigned int handle) return service; } rcu_read_unlock(); - dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", hand= le); + dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", + handle); + return NULL; } =20 struct vchiq_service * -find_closed_service_for_instance(struct vchiq_instance *instance, unsigned= int handle) +find_closed_service_for_instance(struct vchiq_instance *instance, + unsigned int handle) { struct vchiq_service *service; =20 @@ -311,7 +316,9 @@ find_closed_service_for_instance(struct vchiq_instance = *instance, unsigned int h return service; } rcu_read_unlock(); - dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", hand= le); + dev_dbg(instance->state->dev, "core: Invalid service handle 0x%x\n", + handle); + return service; } =20 @@ -462,8 +469,8 @@ make_service_callback(struct vchiq_service *service, en= um vchiq_reason reason, dev_dbg(service->state->dev, "core: %d: callback:%d (%s, %pK, %pK)\n", service->state->id, service->localport, reason_names[reason], header, bulk_userdata); - status =3D service->base.callback(service->instance, reason, header, serv= ice->handle, - bulk_userdata); + status =3D service->base.callback(service->instance, reason, header, + service->handle, bulk_userdata); if (status && (status !=3D -EAGAIN)) { dev_warn(service->state->dev, "core: %d: ignoring ERROR from callback to service %x\n", @@ -483,7 +490,9 @@ vchiq_set_conn_state(struct vchiq_state *state, enum vc= hiq_connstate newstate) enum vchiq_connstate oldstate =3D state->conn_state; =20 dev_dbg(state->dev, "core: %d: %s->%s\n", - state->id, conn_state_names[oldstate], conn_state_names[newstate]); + state->id, conn_state_names[oldstate], + conn_state_names[newstate]); + state->conn_state =3D newstate; vchiq_platform_conn_state_changed(state, oldstate, newstate); } @@ -524,7 +533,10 @@ remote_event_wait(wait_queue_head_t *wq, struct remote= _event *event) return ret; } event->armed =3D 0; - /* Ensure that the peer sees that we are not waiting (armed =3D=3D 0). */ + /* + * Ensure that the peer sees that we are not waiting + * (armed =3D=3D 0). + */ wmb(); } =20 @@ -578,8 +590,10 @@ remote_event_poll(wait_queue_head_t *wq, struct remote= _event *event) void remote_event_pollall(struct vchiq_state *state) { - remote_event_poll(&state->sync_trigger_event, &state->local->sync_trigger= ); - remote_event_poll(&state->sync_release_event, &state->local->sync_release= ); + remote_event_poll(&state->sync_trigger_event, + &state->local->sync_trigger); + remote_event_poll(&state->sync_release_event, + &state->local->sync_release); remote_event_poll(&state->trigger_event, &state->local->trigger); remote_event_poll(&state->recycle_event, &state->local->recycle); } @@ -614,8 +628,7 @@ get_listening_service(struct vchiq_state *state, int fo= urcc) struct vchiq_service *service; =20 service =3D rcu_dereference(state->services[i]); - if (service && - service->public_fourcc =3D=3D fourcc && + if (service && service->public_fourcc =3D=3D fourcc && (service->srvstate =3D=3D VCHIQ_SRVSTATE_LISTENING || (service->srvstate =3D=3D VCHIQ_SRVSTATE_OPEN && service->remoteport =3D=3D VCHIQ_PORT_FREE)) && @@ -679,7 +692,8 @@ request_poll(struct vchiq_state *state, struct vchiq_se= rvice *service, wmb(); =20 /* ... and ensure the slot handler runs. */ - remote_event_signal_local(&state->trigger_event, &state->local->trigger); + remote_event_signal_local(&state->trigger_event, + &state->local->trigger); } =20 /* @@ -789,11 +803,13 @@ process_free_data_message(struct vchiq_state *state, = u32 *service_found, */ complete("a->quota_event); dev_dbg(state->dev, "core: %d: pfq:%d %x@%pK - slot_use->%d\n", - state->id, port, header->size, header, count - 1); + state->id, port, header->size, + header, count - 1); } else { dev_err(state->dev, "core: service %d slot_use_count=3D%d (header %pK, msgid %x, header->m= sgid %x, header->size %x)\n", - port, count, header, msgid, header->msgid, header->size); + port, count, header, msgid, + header->msgid, header->size); WARN(1, "bad slot use count\n"); } } @@ -858,7 +874,8 @@ process_free_queue(struct vchiq_state *state, u32 *serv= ice_found, if (pos > VCHIQ_SLOT_SIZE) { dev_err(state->dev, "core: pfq - pos %x: header %pK, msgid %x, header->msgid %x, header->= size %x\n", - pos, header, msgid, header->msgid, header->size); + pos, header, msgid, + header->msgid, header->size); WARN(1, "invalid slot position\n"); } } @@ -894,8 +911,8 @@ memcpy_copy_callback(void *context, void *dest, size_t = offset, size_t maxsize) } =20 static ssize_t -copy_message_data(ssize_t (*copy_callback)(void *context, void *dest, size= _t offset, - size_t maxsize), +copy_message_data(ssize_t (*copy_callback)(void *context, void *dest, + size_t offset, size_t maxsize), void *context, void *dest, size_t size) @@ -1049,8 +1066,8 @@ queue_message(struct vchiq_state *state, struct vchiq= _service *service, int slot_use_count; =20 dev_dbg(state->dev, "core: %d: qm %s@%pK,%zx (%d->%d)\n", - state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, size, - VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); + state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, + size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); =20 WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK | QMFLAGS_NO_MUTEX_UNLOCK)); @@ -1099,15 +1116,16 @@ queue_message(struct vchiq_state *state, struct vch= iq_service *service, =20 if (slot_use_count) dev_dbg(state->dev, "core: %d: qm:%d %s,%zx - slot_use->%d (hdr %p)\n", - state->id, service->localport, msg_type_str(VCHIQ_MSG_TYPE(msgid)), - size, slot_use_count, header); + state->id, service->localport, + msg_type_str(VCHIQ_MSG_TYPE(msgid)), size, + slot_use_count, header); =20 VCHIQ_SERVICE_STATS_INC(service, ctrl_tx_count); VCHIQ_SERVICE_STATS_ADD(service, ctrl_tx_bytes, size); } else { dev_dbg(state->dev, "core: %d: qm %s@%pK,%zx (%d->%d)\n", - state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, size, - VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); + state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, + size, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid)); if (size !=3D 0) { /* * It is assumed for now that this code path @@ -1136,8 +1154,10 @@ queue_message(struct vchiq_state *state, struct vchi= q_service *service, : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); =20 dev_dbg(state->dev, "core_msg: Sent Msg %s(%u) to %p4cc s:%u d:%d len:%z= u\n", - msg_type_str(VCHIQ_MSG_TYPE(msgid)), VCHIQ_MSG_TYPE(msgid), - &svc_fourcc, VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid), size); + msg_type_str(VCHIQ_MSG_TYPE(msgid)), + VCHIQ_MSG_TYPE(msgid), &svc_fourcc, + VCHIQ_MSG_SRCPORT(msgid), VCHIQ_MSG_DSTPORT(msgid), + size); } =20 /* Make sure the new header is visible to the peer. */ @@ -1256,7 +1276,8 @@ release_slot(struct vchiq_state *state, struct vchiq_= slot_info *slot_info, if (header) { int msgid =3D header->msgid; =20 - if (((msgid & VCHIQ_MSGID_CLAIMED) =3D=3D 0) || (service && service->clo= sing)) { + if (((msgid & VCHIQ_MSGID_CLAIMED) =3D=3D 0) || + (service && service->closing)) { mutex_unlock(&state->recycle_mutex); return; } @@ -1377,8 +1398,9 @@ notify_bulks(struct vchiq_service *service, struct vc= hiq_bulk_queue *queue, status =3D 0; =20 if (status =3D=3D -EAGAIN) - request_poll(service->state, service, (queue =3D=3D &service->bulk_tx) ? - VCHIQ_POLL_TXNOTIFY : VCHIQ_POLL_RXNOTIFY); + request_poll(service->state, service, + (queue =3D=3D &service->bulk_tx) ? VCHIQ_POLL_TXNOTIFY + : VCHIQ_POLL_RXNOTIFY); =20 return status; } @@ -1405,7 +1427,8 @@ poll_services_of_group(struct vchiq_state *state, int= group) service_flags =3D atomic_xchg(&service->poll_flags, 0); if (service_flags & BIT(VCHIQ_POLL_REMOVE)) { dev_dbg(state->dev, "core: %d: ps - remove %d<->%d\n", - state->id, service->localport, service->remoteport); + state->id, service->localport, + service->remoteport); =20 /* * Make it look like a client, because @@ -1441,7 +1464,8 @@ poll_services(struct vchiq_state *state) } =20 static void -cleanup_pagelistinfo(struct vchiq_instance *instance, struct vchiq_pagelis= t_info *pagelistinfo) +cleanup_pagelistinfo(struct vchiq_instance *instance, + struct vchiq_pagelist_info *pagelistinfo) { if (pagelistinfo->scatterlist_mapped) { dma_unmap_sg(instance->state->dev, pagelistinfo->scatterlist, @@ -1451,7 +1475,8 @@ cleanup_pagelistinfo(struct vchiq_instance *instance,= struct vchiq_pagelist_info if (pagelistinfo->pages_need_release) unpin_user_pages(pagelistinfo->pages, pagelistinfo->num_pages); =20 - dma_free_coherent(instance->state->dev, pagelistinfo->pagelist_buffer_siz= e, + dma_free_coherent(instance->state->dev, + pagelistinfo->pagelist_buffer_size, pagelistinfo->pagelist, pagelistinfo->dma_addr); } =20 @@ -1518,8 +1543,8 @@ create_pagelist(struct vchiq_instance *instance, char= *buf, char __user *ubuf, /* Allocate enough storage to hold the page pointers and the page * list */ - pagelist =3D dma_alloc_coherent(instance->state->dev, pagelist_size, &dma= _addr, - GFP_KERNEL); + pagelist =3D dma_alloc_coherent(instance->state->dev, pagelist_size, + &dma_addr, GFP_KERNEL); =20 dev_dbg(instance->state->dev, "arm: %pK\n", pagelist); =20 @@ -1572,8 +1597,10 @@ create_pagelist(struct vchiq_instance *instance, cha= r *buf, char __user *ubuf, } /* do not try and release vmalloc pages */ } else { - actual_pages =3D pin_user_pages_fast((unsigned long)ubuf & PAGE_MASK, nu= m_pages, - type =3D=3D PAGELIST_READ, pages); + actual_pages =3D + pin_user_pages_fast((unsigned long)ubuf & PAGE_MASK, + num_pages, type =3D=3D PAGELIST_READ, + pages); =20 if (actual_pages !=3D num_pages) { dev_dbg(instance->state->dev, "arm: Only %d/%d pages locked\n", @@ -1664,15 +1691,16 @@ create_pagelist(struct vchiq_instance *instance, ch= ar *buf, char __user *ubuf, } =20 static void -free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info = *pagelistinfo, - int actual) +free_pagelist(struct vchiq_instance *instance, + struct vchiq_pagelist_info *pagelistinfo, int actual) { struct vchiq_drv_mgmt *drv_mgmt; struct pagelist *pagelist =3D pagelistinfo->pagelist; struct page **pages =3D pagelistinfo->pages; unsigned int num_pages =3D pagelistinfo->num_pages; =20 - dev_dbg(instance->state->dev, "arm: %pK, %d\n", pagelistinfo->pagelist, a= ctual); + dev_dbg(instance->state->dev, "arm: %pK, %d\n", + pagelistinfo->pagelist, actual); =20 drv_mgmt =3D dev_get_drvdata(instance->state->dev); =20 @@ -1685,16 +1713,17 @@ free_pagelist(struct vchiq_instance *instance, stru= ct vchiq_pagelist_info *pagel pagelistinfo->scatterlist_mapped =3D 0; =20 /* Deal with any partial cache lines (fragments) */ - if (pagelist->type >=3D PAGELIST_READ_WITH_FRAGMENTS && drv_mgmt->fragmen= ts_base) { + if (pagelist->type >=3D PAGELIST_READ_WITH_FRAGMENTS && + drv_mgmt->fragments_base) { char *fragments =3D drv_mgmt->fragments_base + (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * drv_mgmt->fragments_size; int head_bytes, tail_bytes; =20 head_bytes =3D (drv_mgmt->info->cache_line_size - pagelist->offset) & - (drv_mgmt->info->cache_line_size - 1); + (drv_mgmt->info->cache_line_size - 1); tail_bytes =3D (pagelist->offset + actual) & - (drv_mgmt->info->cache_line_size - 1); + (drv_mgmt->info->cache_line_size - 1); =20 if ((actual >=3D 0) && (head_bytes !=3D 0)) { if (head_bytes > actual) @@ -1731,8 +1760,8 @@ free_pagelist(struct vchiq_instance *instance, struct= vchiq_pagelist_info *pagel } =20 static int -vchiq_prepare_bulk_data(struct vchiq_instance *instance, struct vchiq_bulk= *bulk, void *offset, - void __user *uoffset, int size, int dir) +vchiq_prepare_bulk_data(struct vchiq_instance *instance, struct vchiq_bulk= *bulk, + void *offset, void __user *uoffset, int size, int dir) { struct vchiq_pagelist_info *pagelistinfo; =20 @@ -1759,7 +1788,8 @@ static void vchiq_complete_bulk(struct vchiq_instance *instance, struct vchiq_bulk *bu= lk) { if (bulk && bulk->remote_data && bulk->actual) - free_pagelist(instance, (struct vchiq_pagelist_info *)bulk->remote_data, + free_pagelist(instance, + (struct vchiq_pagelist_info *)bulk->remote_data, bulk->actual); } =20 @@ -1796,8 +1826,8 @@ abort_outstanding_bulks(struct vchiq_service *service, dev_dbg(service->state->dev, "core_msg: %s %p4cc d:%d ABORTED - tx len:%d, rx len:%d\n", is_tx ? "Send Bulk to" : "Recv Bulk from", - &service->base.fourcc, - service->remoteport, bulk->size, bulk->remote_size); + &service->base.fourcc, service->remoteport, + bulk->size, bulk->remote_size); } else { /* fabricate a matching dummy bulk */ bulk->data =3D 0; @@ -1845,7 +1875,8 @@ parse_open(struct vchiq_state *state, struct vchiq_he= ader *header) /* Version mismatch */ dev_err(state->dev, "%d: service %d (%p4cc) version mismatch - local (%d= , min %d) vs. remote (%d, min %d)", state->id, service->localport, &fourcc, - service->version, service->version_min, version, version_min); + service->version, service->version_min, + version, version_min); vchiq_service_put(service); service =3D NULL; goto fail_open; @@ -1864,15 +1895,18 @@ parse_open(struct vchiq_state *state, struct vchiq_= header *header) =20 /* Acknowledge the OPEN */ if (service->sync) { - if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback, - &ack_payload, sizeof(ack_payload)) =3D=3D -EAGAIN) + if (queue_message_sync(state, NULL, openack_id, + memcpy_copy_callback, + &ack_payload, + sizeof(ack_payload)) =3D=3D -EAGAIN) goto bail_not_ready; =20 /* The service is now open */ set_service_state(service, VCHIQ_SRVSTATE_OPENSYNC); } else { - if (queue_message(state, NULL, openack_id, memcpy_copy_callback, - &ack_payload, sizeof(ack_payload), 0) =3D=3D -EINTR) + if (queue_message(state, NULL, openack_id, + memcpy_copy_callback, &ack_payload, + sizeof(ack_payload), 0) =3D=3D -EINTR) goto bail_not_ready; =20 /* The service is now open */ @@ -1957,14 +1991,15 @@ parse_message(struct vchiq_state *state, struct vch= iq_header *header) dev_warn(state->dev, "core: %d: prs %s@%pK (%d->%d) - found connected service %d\n", state->id, msg_type_str(type), header, - remoteport, localport, service->localport); + remoteport, localport, + service->localport); } =20 if (!service) { dev_err(state->dev, "core: %d: prs %s@%pK (%d->%d) - invalid/closed service %d\n", - state->id, msg_type_str(type), header, remoteport, - localport, localport); + state->id, msg_type_str(type), header, + remoteport, localport, localport); goto skip_message; } break; @@ -1976,9 +2011,11 @@ parse_message(struct vchiq_state *state, struct vchi= q_header *header) : VCHIQ_MAKE_FOURCC('?', '?', '?', '?'); =20 dev_dbg(state->dev, "core_msg: Rcvd Msg %s(%u) from %p4cc s:%d d:%d len:%= d\n", - msg_type_str(type), type, &svc_fourcc, remoteport, localport, size); + msg_type_str(type), type, &svc_fourcc, + remoteport, localport, size); if (size > 0) - vchiq_log_dump_mem(state->dev, "Rcvd", 0, header->data, min(16, size)); + vchiq_log_dump_mem(state->dev, "Rcvd", 0, header->data, + min(16, size)); =20 if (((unsigned long)header & VCHIQ_SLOT_MASK) + calc_stride(size) > VCHIQ_SLOT_SIZE) { @@ -2025,7 +2062,8 @@ parse_message(struct vchiq_state *state, struct vchiq= _header *header) goto bail_not_ready; =20 dev_dbg(state->dev, "core: Close Service %p4cc s:%u d:%d\n", - &service->base.fourcc, service->localport, service->remoteport); + &service->base.fourcc, service->localport, + service->remoteport); break; case VCHIQ_MSG_DATA: dev_dbg(state->dev, "core: %d: prs DATA@%pK,%x (%d->%d)\n", @@ -2036,8 +2074,9 @@ parse_message(struct vchiq_state *state, struct vchiq= _header *header) header->msgid =3D msgid | VCHIQ_MSGID_CLAIMED; claim_slot(state->rx_info); DEBUG_TRACE(PARSE_LINE); - if (make_service_callback(service, VCHIQ_MESSAGE_AVAILABLE, header, - NULL) =3D=3D -EAGAIN) { + if (make_service_callback(service, + VCHIQ_MESSAGE_AVAILABLE, + header, NULL) =3D=3D -EAGAIN) { DEBUG_TRACE(PARSE_LINE); goto bail_not_ready; } @@ -2082,8 +2121,10 @@ parse_message(struct vchiq_state *state, struct vchi= q_header *header) queue->local_insert) >=3D 0) { dev_err(state->dev, "core: %d: prs %s@%pK (%d->%d) unexpected (ri=3D%d,li=3D%d)\n", - state->id, msg_type_str(type), header, remoteport, - localport, queue->remote_insert, queue->local_insert); + state->id, msg_type_str(type), header, + remoteport, localport, + queue->remote_insert, + queue->local_insert); mutex_unlock(&service->bulk_mutex); break; } @@ -2100,13 +2141,15 @@ parse_message(struct vchiq_state *state, struct vch= iq_header *header) queue->remote_insert++; =20 dev_dbg(state->dev, "core: %d: prs %s@%pK (%d->%d) %x@%pad\n", - state->id, msg_type_str(type), header, remoteport, - localport, bulk->actual, &bulk->data); + state->id, msg_type_str(type), header, + remoteport, localport, + bulk->actual, &bulk->data); =20 dev_dbg(state->dev, "core: %d: prs:%d %cx li=3D%x ri=3D%x p=3D%x\n", state->id, localport, (type =3D=3D VCHIQ_MSG_BULK_RX_DONE) ? 'r' : 't', - queue->local_insert, queue->remote_insert, queue->process); + queue->local_insert, queue->remote_insert, + queue->process); =20 DEBUG_TRACE(PARSE_LINE); WARN_ON(queue->process =3D=3D queue->local_insert); @@ -2133,8 +2176,8 @@ parse_message(struct vchiq_state *state, struct vchiq= _header *header) } if (state->conn_state !=3D VCHIQ_CONNSTATE_PAUSE_SENT) { /* Send a PAUSE in response */ - if (queue_message(state, NULL, MAKE_PAUSE, NULL, NULL, 0, - QMFLAGS_NO_MUTEX_UNLOCK) =3D=3D -EINTR) + if (queue_message(state, NULL, MAKE_PAUSE, NULL, NULL, + 0, QMFLAGS_NO_MUTEX_UNLOCK) =3D=3D -EINTR) goto bail_not_ready; } /* At this point slot_mutex is held */ @@ -2362,7 +2405,8 @@ sync_func(void *v) int type; unsigned int localport, remoteport; =20 - ret =3D remote_event_wait(&state->sync_trigger_event, &local->sync_trigg= er); + ret =3D remote_event_wait(&state->sync_trigger_event, + &local->sync_trigger); if (ret) return ret; =20 @@ -2380,8 +2424,8 @@ sync_func(void *v) if (!service) { dev_err(state->dev, "sync: %d: sf %s@%pK (%d->%d) - invalid/closed service %d\n", - state->id, msg_type_str(type), header, remoteport, - localport, localport); + state->id, msg_type_str(type), header, + remoteport, localport, localport); release_message_sync(state, header); continue; } @@ -2389,9 +2433,11 @@ sync_func(void *v) svc_fourcc =3D service->base.fourcc; =20 dev_dbg(state->dev, "sync: Rcvd Msg %s from %p4cc s:%d d:%d len:%d\n", - msg_type_str(type), &svc_fourcc, remoteport, localport, size); + msg_type_str(type), &svc_fourcc, remoteport, localport, + size); if (size > 0) - vchiq_log_dump_mem(state->dev, "Rcvd", 0, header->data, min(16, size)); + vchiq_log_dump_mem(state->dev, "Rcvd", 0, header->data, + min(16, size)); =20 switch (type) { case VCHIQ_MSG_OPENACK: @@ -2406,7 +2452,8 @@ sync_func(void *v) service->peer_version); if (service->srvstate =3D=3D VCHIQ_SRVSTATE_OPENING) { service->remoteport =3D remoteport; - set_service_state(service, VCHIQ_SRVSTATE_OPENSYNC); + set_service_state(service, + VCHIQ_SRVSTATE_OPENSYNC); service->sync =3D 1; complete(&service->remove_event); } @@ -2419,7 +2466,9 @@ sync_func(void *v) =20 if ((service->remoteport =3D=3D remoteport) && (service->srvstate =3D=3D VCHIQ_SRVSTATE_OPENSYNC)) { - if (make_service_callback(service, VCHIQ_MESSAGE_AVAILABLE, header, + if (make_service_callback(service, + VCHIQ_MESSAGE_AVAILABLE, + header, NULL) =3D=3D -EAGAIN) dev_err(state->dev, "sync: error: synchronous callback to service %d returns -EAGAIN\n", @@ -2488,7 +2537,8 @@ vchiq_init_slots(struct device *dev, void *mem_base, = int mem_size) } =20 int -vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_z= ero, struct device *dev) +vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_z= ero, + struct device *dev) { struct vchiq_shared_state *local; struct vchiq_shared_state *remote; @@ -2569,7 +2619,8 @@ vchiq_init_state(struct vchiq_state *state, struct vc= hiq_slot_zero *slot_zero, s ((struct vchiq_header *) SLOT_DATA_FROM_INDEX(state, local->slot_sync))->msgid =3D VCHIQ_MSGID_PADDING; - remote_event_signal_local(&state->sync_release_event, &local->sync_releas= e); + remote_event_signal_local(&state->sync_release_event, + &local->sync_release); =20 local->debug[DEBUG_ENTRIES] =3D DEBUG_MAX; =20 @@ -2581,7 +2632,8 @@ vchiq_init_state(struct vchiq_state *state, struct vc= hiq_slot_zero *slot_zero, s * bring up slot handler thread */ snprintf(threadname, sizeof(threadname), "vchiq-slot/%d", state->id); - state->slot_handler_thread =3D kthread_create(&slot_handler_func, (void *= )state, threadname); + state->slot_handler_thread =3D kthread_create(&slot_handler_func, + (void *)state, threadname); =20 if (IS_ERR(state->slot_handler_thread)) { dev_err(state->dev, "couldn't create thread %s\n", threadname); @@ -2590,7 +2642,8 @@ vchiq_init_state(struct vchiq_state *state, struct vc= hiq_slot_zero *slot_zero, s set_user_nice(state->slot_handler_thread, -19); =20 snprintf(threadname, sizeof(threadname), "vchiq-recy/%d", state->id); - state->recycle_thread =3D kthread_create(&recycle_func, (void *)state, th= readname); + state->recycle_thread =3D kthread_create(&recycle_func, (void *)state, + threadname); if (IS_ERR(state->recycle_thread)) { dev_err(state->dev, "couldn't create thread %s\n", threadname); ret =3D PTR_ERR(state->recycle_thread); @@ -2599,7 +2652,8 @@ vchiq_init_state(struct vchiq_state *state, struct vc= hiq_slot_zero *slot_zero, s set_user_nice(state->recycle_thread, -19); =20 snprintf(threadname, sizeof(threadname), "vchiq-sync/%d", state->id); - state->sync_thread =3D kthread_create(&sync_func, (void *)state, threadna= me); + state->sync_thread =3D kthread_create(&sync_func, (void *)state, + threadname); if (IS_ERR(state->sync_thread)) { dev_err(state->dev, "couldn't create thread %s\n", threadname); ret =3D PTR_ERR(state->sync_thread); @@ -2647,7 +2701,8 @@ void vchiq_msg_queue_push(struct vchiq_instance *inst= ance, unsigned int handle, } EXPORT_SYMBOL(vchiq_msg_queue_push); =20 -struct vchiq_header *vchiq_msg_hold(struct vchiq_instance *instance, unsig= ned int handle) +struct vchiq_header *vchiq_msg_hold(struct vchiq_instance *instance, + unsigned int handle) { struct vchiq_service *service =3D find_service_by_handle(instance, handle= ); struct vchiq_header *header; @@ -2849,7 +2904,8 @@ vchiq_open_service_internal(struct vchiq_service *ser= vice, int client_id) if (service->srvstate !=3D VCHIQ_SRVSTATE_CLOSEWAIT) dev_err(service->state->dev, "core: %d: osi - srvstate =3D %s (ref %u)\n", - service->state->id, srvstate_names[service->srvstate], + service->state->id, + srvstate_names[service->srvstate], kref_read(&service->ref_count)); status =3D -EINVAL; VCHIQ_SERVICE_STATS_INC(service, error_count); @@ -2904,15 +2960,18 @@ release_service_messages(struct vchiq_service *serv= ice) int msgid =3D header->msgid; int port =3D VCHIQ_MSG_DSTPORT(msgid); =20 - if ((port =3D=3D service->localport) && (msgid & VCHIQ_MSGID_CLAIMED)) { - dev_dbg(state->dev, "core: fsi - hdr %pK\n", header); + if ((port =3D=3D service->localport) && + (msgid & VCHIQ_MSGID_CLAIMED)) { + dev_dbg(state->dev, "core: fsi - hdr %pK\n", + header); release_slot(state, slot_info, header, NULL); } pos +=3D calc_stride(header->size); if (pos > VCHIQ_SLOT_SIZE) { dev_err(state->dev, "core: fsi - pos %x: header %pK, msgid %x, header->msgid %x, header->= size %x\n", - pos, header, msgid, header->msgid, header->size); + pos, header, msgid, + header->msgid, header->size); WARN(1, "invalid slot position\n"); } } @@ -2972,7 +3031,8 @@ close_service_complete(struct vchiq_service *service,= int failstate) return -EINVAL; } =20 - status =3D make_service_callback(service, VCHIQ_SERVICE_CLOSED, NULL, NUL= L); + status =3D make_service_callback(service, VCHIQ_SERVICE_CLOSED, + NULL, NULL); =20 if (status !=3D -EAGAIN) { int uc =3D service->service_use_count; @@ -3059,7 +3119,8 @@ vchiq_bulk_xfer_queue_msg_killable(struct vchiq_servi= ce *service, bulk->size =3D size; bulk->actual =3D VCHIQ_BULK_ACTUAL_ABORTED; =20 - if (vchiq_prepare_bulk_data(service->instance, bulk, offset, uoffset, siz= e, dir)) + if (vchiq_prepare_bulk_data(service->instance, bulk, + offset, uoffset, size, dir)) goto unlock_error_exit; =20 /* @@ -3266,7 +3327,8 @@ vchiq_free_service_internal(struct vchiq_service *ser= vice) { struct vchiq_state *state =3D service->state; =20 - dev_dbg(state->dev, "core: %d: fsi - (%d)\n", state->id, service->localpo= rt); + dev_dbg(state->dev, "core: %d: fsi - (%d)\n", + state->id, service->localport); =20 switch (service->srvstate) { case VCHIQ_SRVSTATE_OPENING: @@ -3277,7 +3339,8 @@ vchiq_free_service_internal(struct vchiq_service *ser= vice) break; default: dev_err(state->dev, "core: %d: fsi - (%d) in state %s\n", - state->id, service->localport, srvstate_names[service->srvstate]); + state->id, service->localport, + srvstate_names[service->srvstate]); return; } =20 @@ -3290,7 +3353,8 @@ vchiq_free_service_internal(struct vchiq_service *ser= vice) } =20 int -vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *i= nstance) +vchiq_connect_internal(struct vchiq_state *state, + struct vchiq_instance *instance) { struct vchiq_service *service; int status =3D 0; @@ -3342,7 +3406,8 @@ int vchiq_close_service(struct vchiq_instance *instance, unsigned int handle) { /* Unregister the service */ - struct vchiq_service *service =3D find_service_by_handle(instance, handle= ); + struct vchiq_service *service =3D find_service_by_handle(instance, + handle); int status =3D 0; =20 if (!service) @@ -3476,8 +3541,8 @@ vchiq_bulk_xfer_blocking(struct vchiq_instance *insta= nce, unsigned int handle, goto error_exit; =20 =20 - status =3D vchiq_bulk_xfer_queue_msg_killable(service, offset, uoffset, s= ize, - userdata, mode, dir); + status =3D vchiq_bulk_xfer_queue_msg_killable(service, offset, uoffset, + size, userdata, mode, dir); =20 error_exit: vchiq_service_put(service); @@ -3614,7 +3679,8 @@ vchiq_queue_message(struct vchiq_instance *instance, = unsigned int handle, return status; } =20 -int vchiq_queue_kernel_message(struct vchiq_instance *instance, unsigned i= nt handle, void *data, +int vchiq_queue_kernel_message(struct vchiq_instance *instance, + unsigned int handle, void *data, unsigned int size) { =20 @@ -3666,7 +3732,8 @@ release_message_sync(struct vchiq_state *state, struc= t vchiq_header *header) } =20 int -vchiq_get_peer_version(struct vchiq_instance *instance, unsigned int handl= e, short *peer_version) +vchiq_get_peer_version(struct vchiq_instance *instance, unsigned int handl= e, + short *peer_version) { int status =3D -EINVAL; struct vchiq_service *service =3D find_service_by_handle(instance, handle= ); @@ -3803,8 +3870,8 @@ vchiq_dump_shared_state(struct seq_file *f, struct vc= hiq_state *state, struct vchiq_slot_info slot_info =3D *SLOT_INFO_FROM_INDEX(state, i); if (slot_info.use_count !=3D slot_info.release_count) { - seq_printf(f, " %d: %d/%d\n", i, slot_info.use_count, - slot_info.release_count); + seq_printf(f, " %d: %d/%d\n", i, + slot_info.use_count, slot_info.release_count); } } =20 @@ -3836,7 +3903,8 @@ vchiq_dump_service_state(struct seq_file *f, struct v= chiq_service *service) "%u", service->remoteport); =20 if (service->public_fourcc !=3D VCHIQ_FOURCC_INVALID) - scnprintf(remoteport + len2, sizeof(remoteport) - len2, + scnprintf(remoteport + len2, + sizeof(remoteport) - len2, " (client 0x%x)", service->client_id); } else { strscpy(remoteport, "n/a", sizeof(remoteport)); @@ -3909,7 +3977,8 @@ void vchiq_dump_state(struct seq_file *f, struct vchi= q_state *state) =20 if (VCHIQ_ENABLE_STATS) { seq_printf(f, " Stats: ctrl_tx_count=3D%d, ctrl_rx_count=3D%d, error_co= unt=3D%d\n", - state->stats.ctrl_tx_count, state->stats.ctrl_rx_count, + state->stats.ctrl_tx_count, + state->stats.ctrl_rx_count, state->stats.error_count); } =20 --=20 2.45.2