Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3011005rwd; Mon, 29 May 2023 04:37:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Gc5MxBMSBI3Qwtqm+n/cYDyS6IhlFsUkPT2GwRE+trqamhhVBvnFTdibFWlqLvA+2XkMd X-Received: by 2002:a17:902:ecc5:b0:19f:87b5:1873 with SMTP id a5-20020a170902ecc500b0019f87b51873mr13291309plh.62.1685360224844; Mon, 29 May 2023 04:37:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685360224; cv=none; d=google.com; s=arc-20160816; b=ZtbwoKfUecoBxoLJ+OZD0MdVHHbYtdW8Jl7iVgHpMQ+EtHM1JrtHjcAkTWJk/ogler T217yLOUog3aN4bmO4e3wwlF6E5vcREkvirz9Ir6DFGN4otneqcshUQlpbEE+zfGUUqs bMrSpELIM7pUGwEfhXpE80jEoacVQcFY/x9IupbgyFraJ1jLKBg2IkAjVkGtCYxR0kR6 gcmYW78i1Zgdd5uKmv6OsLq2e87/q3+xwGQ+pzkCO//t7N9XAjh+/ILaY1hGMl0Aw57u cgLTEMucA65S7PqViyUU9171hnqyvlIH0icmisgvZTVh67bDITZtXGhAWlHNV+n2ZTA3 xQHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from:feedback-id :dkim-signature:dkim-signature; bh=hCn80S16t5KWMrqhGJtFmBVIPiQ9NKvnaZBu9C4Y5xc=; b=O1lWYsFzjnu4aYXnpwgfGgYp+GZOTVLFsjfc9tqUxuJjS3j0/M0yBMGDTsBvvJHCzd YcY7jNIp/0/Nok/Jc/GI6l0ZjxuaUFPwQ9GFKfNm7cTvHNYbzWeJwdPsLnh1z4wQyO4a 98ejKn2f49EtJW2LrInhpxfIAozOHYs3CHr8QEbfXNlMHZTk2BII8aCf1BbOFvVPf7lj cJ8RvystSzhZh39xwMz9zONGmbvKS6H9o5bG6TNjR7Soi11PpATZqjTjjNKXJ9ueDTr7 na+SVv+dv060losy2YS2+Nk3LikR35mo9i+iiTpWiE+h2f0Md8hgG0v7LP91DK+jRepy njTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm1 header.b="q3/PXv12"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=BTn8MYuw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k15-20020a170902c40f00b001ac4f733007si10622258plk.549.2023.05.29.04.36.35; Mon, 29 May 2023 04:37:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm1 header.b="q3/PXv12"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=BTn8MYuw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbjE2Leu (ORCPT + 99 others); Mon, 29 May 2023 07:34:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbjE2Leq (ORCPT ); Mon, 29 May 2023 07:34:46 -0400 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AE94FE for ; Mon, 29 May 2023 04:34:28 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 3DC163200929; Mon, 29 May 2023 07:34:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 29 May 2023 07:34:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1685360066; x= 1685446466; bh=hCn80S16t5KWMrqhGJtFmBVIPiQ9NKvnaZBu9C4Y5xc=; b=q 3/PXv12ub3R543er7mtSqTG+UOl9z9RizPLl3+jLjcqk5V7W/0HqO8BjbPb5hmll ImZTRuZ+HREPQDUxoS0yCVs4zh2hBcGw8IDobLfre9D4Wbij9YFsJNd19CRuFYqp GjtzNwEgKBMun/4HXcr3Mp1BJsvhR0cQmTtCQnWQ03CKMa5NJnagzJXdBNwSm+Gd vttC3Gg+IJ+pQsd5N/2Pj5nyqP17wU+DU+3pObOUDoQlzvZVHeWQf8c+C311TJfT /KsezunhzL5BpsOh5Ql7ctUnRxPj0a0E7M/vMMzNwTBdcWHssoBO9TKvIHcgW871 rpTEUf4F1i4e8W0mt+8eQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1685360066; x=1685446466; bh=h Cn80S16t5KWMrqhGJtFmBVIPiQ9NKvnaZBu9C4Y5xc=; b=BTn8MYuwszk8Iw27z MXblbdH/e4Ca9imlzuRm1qKQo6+2rKHcyIIXu1eK7vHR9dMvR537eRidlzctB8sD XzGHo48+GTorW3YpQpJQQuYR8Khuodiu1rpcJCDZvld6pPwQFVyMfnz3diiIBayy nhBOQB8mW1m7mGVCqDGxV8wtylJqL+IKSimuU0AnWuAT3uhFvn20NxtXF8+7AfK5 jxOjpXXQMsZ8YUm1C1XTO5p6/KPBxdd9W3muxqos38PI5oIciOC/9HyGHzZLXR8B F+b93LZEUVkAvRsRrHdFJms9h+TMcGcyoLp8Q/crL1YqGAxFusUdGUnhFMfp53He /hXiA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeekhedggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepohdqthgrkhgrshhhihessh grkhgrmhhotggthhhirdhjph X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 May 2023 07:34:25 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH v3 07/12] firewire: cdev: code refactoring to operate event of response Date: Mon, 29 May 2023 20:34:01 +0900 Message-Id: <20230529113406.986289-8-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529113406.986289-1-o-takashi@sakamocchi.jp> References: <20230529113406.986289-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit is a preparation to handle time stamp of asynchronous transaction for user space application. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-cdev.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 5a9446d30447..315ebc8c545d 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c @@ -170,7 +170,9 @@ struct outbound_transaction_event { struct event event; struct client *client; struct outbound_transaction_resource r; - struct fw_cdev_event_response response; + union { + struct fw_cdev_event_response without_tstamp; + } rsp; }; struct inbound_transaction_event { @@ -540,7 +542,7 @@ static void complete_transaction(struct fw_card *card, int rcode, void *payload, size_t length, void *data) { struct outbound_transaction_event *e = data; - struct fw_cdev_event_response *rsp = &e->response; + struct fw_cdev_event_response *rsp = &e->rsp.without_tstamp; struct client *client = e->client; unsigned long flags; @@ -581,6 +583,8 @@ static int init_request(struct client *client, int destination_id, int speed) { struct outbound_transaction_event *e; + struct fw_cdev_event_response *rsp; + void *payload; int ret; if (request->tcode != TCODE_STREAM_DATA && @@ -594,14 +598,14 @@ static int init_request(struct client *client, e = kmalloc(sizeof(*e) + request->length, GFP_KERNEL); if (e == NULL) return -ENOMEM; - e->client = client; - e->response.length = request->length; - e->response.closure = request->closure; - if (request->data && - copy_from_user(e->response.data, - u64_to_uptr(request->data), request->length)) { + rsp = &e->rsp.without_tstamp; + rsp->length = request->length; + rsp->closure = request->closure; + payload = rsp->data; + + if (request->data && copy_from_user(payload, u64_to_uptr(request->data), request->length)) { ret = -EFAULT; goto failed; } @@ -611,10 +615,9 @@ static int init_request(struct client *client, if (ret < 0) goto failed; - fw_send_request(client->device->card, &e->r.transaction, - request->tcode, destination_id, request->generation, - speed, request->offset, e->response.data, - request->length, complete_transaction, e); + fw_send_request(client->device->card, &e->r.transaction, request->tcode, destination_id, + request->generation, speed, request->offset, payload, request->length, + complete_transaction, e); return 0; failed: -- 2.39.2