* Re: [PATCH 11/11] firewire: cdev: implement new event relevant to phy packet with time stamp
@ 2023-02-04 17:08 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2023-02-04 17:08 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "low confidence static check warning: drivers/firewire/core-cdev.c:1706:38: warning: Value stored to 'pp' during its initialization is never read [clang-analyzer-deadcode.DeadStores]"
::::::
BCC: lkp@intel.com
CC: llvm@lists.linux.dev
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20230125120301.51585-12-o-takashi@sakamocchi.jp>
References: <20230125120301.51585-12-o-takashi@sakamocchi.jp>
TO: Takashi Sakamoto <o-takashi@sakamocchi.jp>
TO: stefanr@s5r6.in-berlin.de
CC: linux1394-devel@lists.sourceforge.net
CC: linux-kernel@vger.kernel.org
CC: tiwai@suse.de
Hi Takashi,
I love your patch! Perhaps something to improve:
[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on next-20230203]
[cannot apply to tiwai-sound/for-linus linus/master v6.2-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Takashi-Sakamoto/firewire-cdev-add-new-version-of-ABI-to-notify-time-stamp-at-request-response-subaction-of-transaction/20230125-200634
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link: https://lore.kernel.org/r/20230125120301.51585-12-o-takashi%40sakamocchi.jp
patch subject: [PATCH 11/11] firewire: cdev: implement new event relevant to phy packet with time stamp
:::::: branch date: 10 days ago
:::::: commit date: 10 days ago
config: s390-randconfig-c005-20230123 (https://download.01.org/0day-ci/archive/20230205/202302050013.pp3qpCRq-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 4196ca3278f78c6e19246e54ab0ecb364e37d66a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/27355dff42dad4fe3a33e259ad8ace3102367a32
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Takashi-Sakamoto/firewire-cdev-add-new-version-of-ABI-to-notify-time-stamp-at-request-response-subaction-of-transaction/20230125-200634
git checkout 27355dff42dad4fe3a33e259ad8ace3102367a32
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 clang-analyzer olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 clang-analyzer
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
clang_analyzer warnings: (new ones prefixed by >>)
^~~~
drivers/firewire/core-cdev.c:1344:28: note: Left side of '||' is true
todo == ISO_RES_REALLOC ||
^
drivers/firewire/core-cdev.c:1351:6: note: Assuming the condition is false
if (channel == -EAGAIN &&
^~~~~~~~~~~~~~~~~~
drivers/firewire/core-cdev.c:1351:25: note: Left side of '&&' is false
if (channel == -EAGAIN &&
^
drivers/firewire/core-cdev.c:1355:12: note: Assuming 'channel' is < 0
success = channel >= 0 || bandwidth > 0;
^~~~~~~~~~~~
drivers/firewire/core-cdev.c:1355:12: note: Left side of '||' is false
drivers/firewire/core-cdev.c:1355:28: note: Assuming 'bandwidth' is <= 0
success = channel >= 0 || bandwidth > 0;
^~~~~~~~~~~~~
drivers/firewire/core-cdev.c:1362:9: note: Field 'todo' is not equal to ISO_RES_ALLOC
if (r->todo == ISO_RES_ALLOC)
^
drivers/firewire/core-cdev.c:1362:2: note: Taking false branch
if (r->todo == ISO_RES_ALLOC)
^
drivers/firewire/core-cdev.c:1368:9: note: Field 'todo' is equal to ISO_RES_REALLOC
if (r->todo == ISO_RES_REALLOC && !success &&
^
drivers/firewire/core-cdev.c:1368:6: note: Left side of '&&' is true
if (r->todo == ISO_RES_REALLOC && !success &&
^
drivers/firewire/core-cdev.c:1368:37: note: 'success' is false
if (r->todo == ISO_RES_REALLOC && !success &&
^~~~~~~
drivers/firewire/core-cdev.c:1368:6: note: Left side of '&&' is true
if (r->todo == ISO_RES_REALLOC && !success &&
^
drivers/firewire/core-cdev.c:1369:6: note: Assuming field 'in_shutdown' is false
!client->in_shutdown &&
^~~~~~~~~~~~~~~~~~~~
drivers/firewire/core-cdev.c:1368:6: note: Left side of '&&' is true
if (r->todo == ISO_RES_REALLOC && !success &&
^
drivers/firewire/core-cdev.c:1370:6: note: Assuming the condition is true
idr_remove(&client->resource_idr, r->resource.handle)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/firewire/core-cdev.c:1368:2: note: Taking true branch
if (r->todo == ISO_RES_REALLOC && !success &&
^
drivers/firewire/core-cdev.c:1371:3: note: Calling 'client_put'
client_put(client);
^~~~~~~~~~~~~~~~~~
drivers/firewire/core-cdev.c:88:2: note: Calling 'kref_put'
kref_put(&client->kref, client_release);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kref.h:64:2: note: Taking true branch
if (refcount_dec_and_test(&kref->refcount)) {
^
include/linux/kref.h:65:3: note: Calling 'client_release'
release(kref);
^~~~~~~~~~~~~
drivers/firewire/core-cdev.c:83:2: note: Memory is released
kfree(client);
^~~~~~~~~~~~~
include/linux/kref.h:65:3: note: Returning; memory was released
release(kref);
^~~~~~~~~~~~~
drivers/firewire/core-cdev.c:88:2: note: Returning; memory was released
kref_put(&client->kref, client_release);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/firewire/core-cdev.c:1371:3: note: Returning; memory was released via 1st parameter
client_put(client);
^~~~~~~~~~~~~~~~~~
drivers/firewire/core-cdev.c:1376:6: note: 'todo' is not equal to ISO_RES_ALLOC
if (todo == ISO_RES_ALLOC && channel >= 0)
^~~~
drivers/firewire/core-cdev.c:1376:28: note: Left side of '&&' is false
if (todo == ISO_RES_ALLOC && channel >= 0)
^
drivers/firewire/core-cdev.c:1379:6: note: 'todo' is equal to ISO_RES_REALLOC
if (todo == ISO_RES_REALLOC && success)
^~~~
drivers/firewire/core-cdev.c:1379:6: note: Left side of '&&' is true
drivers/firewire/core-cdev.c:1379:33: note: 'success' is false
if (todo == ISO_RES_REALLOC && success)
^~~~~~~
drivers/firewire/core-cdev.c:1379:2: note: Taking false branch
if (todo == ISO_RES_REALLOC && success)
^
drivers/firewire/core-cdev.c:1382:6: note: 'todo' is not equal to ISO_RES_ALLOC
if (todo == ISO_RES_ALLOC || todo == ISO_RES_ALLOC_ONCE) {
^~~~
drivers/firewire/core-cdev.c:1382:6: note: Left side of '||' is false
drivers/firewire/core-cdev.c:1382:31: note: 'todo' is not equal to ISO_RES_ALLOC_ONCE
if (todo == ISO_RES_ALLOC || todo == ISO_RES_ALLOC_ONCE) {
^~~~
drivers/firewire/core-cdev.c:1382:2: note: Taking false branch
if (todo == ISO_RES_ALLOC || todo == ISO_RES_ALLOC_ONCE) {
^
drivers/firewire/core-cdev.c:1393:2: note: Use of memory after it is freed
queue_event(client, &e->event,
^ ~~~~~~
>> drivers/firewire/core-cdev.c:1706:38: warning: Value stored to 'pp' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct fw_cdev_event_phy_packet2 *pp = &e->phy_packet.with_tstamp;
^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/firewire/core-cdev.c:1706:38: note: Value stored to 'pp' during its initialization is never read
struct fw_cdev_event_phy_packet2 *pp = &e->phy_packet.with_tstamp;
^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/idr.h:174:2: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
local_unlock(&radix_tree_preloads.lock);
^
include/linux/local_lock.h:37:29: note: expanded from macro 'local_unlock'
#define local_unlock(lock) __local_unlock(lock)
^
include/linux/local_lock_internal.h:85:22: note: expanded from macro '__local_unlock'
local_lock_release(this_cpu_ptr(lock)); \
^
include/linux/percpu-defs.h:252:27: note: expanded from macro 'this_cpu_ptr'
#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/asm-generic/percpu.h:44:31: note: expanded from macro 'arch_raw_cpu_ptr'
#define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
^
include/linux/percpu-defs.h:231:2: note: expanded from macro 'SHIFT_PERCPU_PTR'
RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
^
include/linux/compiler.h:170:28: note: expanded from macro 'RELOC_HIDE'
(typeof(ptr)) (__ptr + (off)); })
^
drivers/firewire/core-cdev.c:821:6: note: Assuming 'r' is not equal to NULL
if (r == NULL)
^~~~~~~~~
drivers/firewire/core-cdev.c:821:2: note: Taking false branch
if (r == NULL)
^
drivers/firewire/core-cdev.c:825:6: note: Assuming field 'version' is >= FW_CDEV_VERSION_ALLOCATE_REGION_END
if (client->version < FW_CDEV_VERSION_ALLOCATE_REGION_END)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/firewire/core-cdev.c:825:2: note: Taking false branch
if (client->version < FW_CDEV_VERSION_ALLOCATE_REGION_END)
^
drivers/firewire/core-cdev.c:837:6: note: Assuming 'ret' is >= 0
if (ret < 0) {
^~~~~~~
drivers/firewire/core-cdev.c:837:2: note: Taking false branch
if (ret < 0) {
^
drivers/firewire/core-cdev.c:844:8: note: Calling 'add_client_resource'
ret = add_client_resource(client, &r->resource, GFP_KERNEL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/firewire/core-cdev.c:493:6: note: 'preload' is true
if (preload)
^~~~~~~
drivers/firewire/core-cdev.c:493:2: note: Taking true branch
if (preload)
^
drivers/firewire/core-cdev.c:495:2: note: Loop condition is false. Exiting loop
spin_lock_irqsave(&client->lock, flags);
^
include/linux/spinlock.h:380:2: note: expanded from macro 'spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^
include/linux/spinlock.h:241:2: note: expanded from macro 'raw_spin_lock_irqsave'
do { \
^
drivers/firewire/core-cdev.c:495:2: note: Loop condition is false. Exiting loop
spin_lock_irqsave(&client->lock, flags);
^
include/linux/spinlock.h:378:43: note: expanded from macro 'spin_lock_irqsave'
#define spin_lock_irqsave(lock, flags) \
^
drivers/firewire/core-cdev.c:497:6: note: Assuming field 'in_shutdown' is true
if (client->in_shutdown)
^~~~~~~~~~~~~~~~~~~
drivers/firewire/core-cdev.c:497:2: note: Taking true branch
if (client->in_shutdown)
^
drivers/firewire/core-cdev.c:502:6: note: 'ret' is < 0
if (ret >= 0) {
^~~
drivers/firewire/core-cdev.c:502:2: note: Taking false branch
if (ret >= 0) {
^
drivers/firewire/core-cdev.c:509:6: note: 'preload' is true
if (preload)
^~~~~~~
drivers/firewire/core-cdev.c:509:2: note: Taking true branch
if (preload)
^
drivers/firewire/core-cdev.c:510:3: note: Calling 'idr_preload_end'
idr_preload_end();
^~~~~~~~~~~~~~~~~
include/linux/idr.h:174:2: note: Loop condition is false. Exiting loop
local_unlock(&radix_tree_preloads.lock);
^
include/linux/local_lock.h:37:29: note: expanded from macro 'local_unlock'
#define local_unlock(lock) __local_unlock(lock)
^
include/linux/local_lock_internal.h:85:22: note: expanded from macro '__local_unlock'
local_lock_release(this_cpu_ptr(lock)); \
^
include/linux/percpu-defs.h:252:27: note: expanded from macro 'this_cpu_ptr'
vim +/pp +1706 drivers/firewire/core-cdev.c
bf54e1462b9192 Stefan Richter 2010-07-16 1681
bf54e1462b9192 Stefan Richter 2010-07-16 1682 void fw_cdev_handle_phy_packet(struct fw_card *card, struct fw_packet *p)
bf54e1462b9192 Stefan Richter 2010-07-16 1683 {
bf54e1462b9192 Stefan Richter 2010-07-16 1684 struct client *client;
bf54e1462b9192 Stefan Richter 2010-07-16 1685 struct inbound_phy_packet_event *e;
bf54e1462b9192 Stefan Richter 2010-07-16 1686 unsigned long flags;
bf54e1462b9192 Stefan Richter 2010-07-16 1687
bf54e1462b9192 Stefan Richter 2010-07-16 1688 spin_lock_irqsave(&card->lock, flags);
bf54e1462b9192 Stefan Richter 2010-07-16 1689
bf54e1462b9192 Stefan Richter 2010-07-16 1690 list_for_each_entry(client, &card->phy_receiver_list, phy_receiver_link) {
bf54e1462b9192 Stefan Richter 2010-07-16 1691 e = kmalloc(sizeof(*e) + 8, GFP_ATOMIC);
cfb0c9d1ffbf93 Stefan Richter 2013-03-24 1692 if (e == NULL)
bf54e1462b9192 Stefan Richter 2010-07-16 1693 break;
cfb0c9d1ffbf93 Stefan Richter 2013-03-24 1694
27355dff42dad4 Takashi Sakamoto 2023-01-25 1695 if (client->version < FW_CDEV_VERSION_EVENT_ASYNC_TSTAMP) {
27355dff42dad4 Takashi Sakamoto 2023-01-25 1696 struct fw_cdev_event_phy_packet *pp = &e->phy_packet.without_tstamp;
27355dff42dad4 Takashi Sakamoto 2023-01-25 1697
a56b6c7e7d92bd Takashi Sakamoto 2023-01-25 1698 pp->closure = client->phy_receiver_closure;
a56b6c7e7d92bd Takashi Sakamoto 2023-01-25 1699 pp->type = FW_CDEV_EVENT_PHY_PACKET_RECEIVED;
a56b6c7e7d92bd Takashi Sakamoto 2023-01-25 1700 pp->rcode = RCODE_COMPLETE;
a56b6c7e7d92bd Takashi Sakamoto 2023-01-25 1701 pp->length = 8;
a56b6c7e7d92bd Takashi Sakamoto 2023-01-25 1702 pp->data[0] = p->header[1];
a56b6c7e7d92bd Takashi Sakamoto 2023-01-25 1703 pp->data[1] = p->header[2];
a56b6c7e7d92bd Takashi Sakamoto 2023-01-25 1704 queue_event(client, &e->event, &e->phy_packet, sizeof(*pp) + 8, NULL, 0);
27355dff42dad4 Takashi Sakamoto 2023-01-25 1705 } else {
27355dff42dad4 Takashi Sakamoto 2023-01-25 @1706 struct fw_cdev_event_phy_packet2 *pp = &e->phy_packet.with_tstamp;
27355dff42dad4 Takashi Sakamoto 2023-01-25 1707
27355dff42dad4 Takashi Sakamoto 2023-01-25 1708 pp = &e->phy_packet.with_tstamp;
27355dff42dad4 Takashi Sakamoto 2023-01-25 1709 pp->closure = client->phy_receiver_closure;
27355dff42dad4 Takashi Sakamoto 2023-01-25 1710 pp->type = FW_CDEV_EVENT_PHY_PACKET_RECEIVED2;
27355dff42dad4 Takashi Sakamoto 2023-01-25 1711 pp->rcode = RCODE_COMPLETE;
27355dff42dad4 Takashi Sakamoto 2023-01-25 1712 pp->length = 8;
27355dff42dad4 Takashi Sakamoto 2023-01-25 1713 pp->tstamp = p->timestamp;
27355dff42dad4 Takashi Sakamoto 2023-01-25 1714 pp->data[0] = p->header[1];
27355dff42dad4 Takashi Sakamoto 2023-01-25 1715 pp->data[1] = p->header[2];
27355dff42dad4 Takashi Sakamoto 2023-01-25 1716 queue_event(client, &e->event, &e->phy_packet, sizeof(*pp) + 8, NULL, 0);
27355dff42dad4 Takashi Sakamoto 2023-01-25 1717 }
bf54e1462b9192 Stefan Richter 2010-07-16 1718 }
bf54e1462b9192 Stefan Richter 2010-07-16 1719
bf54e1462b9192 Stefan Richter 2010-07-16 1720 spin_unlock_irqrestore(&card->lock, flags);
bf54e1462b9192 Stefan Richter 2010-07-16 1721 }
bf54e1462b9192 Stefan Richter 2010-07-16 1722
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 11/11] firewire: cdev: implement new event relevant to phy packet with time stamp
2023-01-25 12:02 [PATCH 00/11] firewire: deliver hardware time stamp for asynchronous transaction Takashi Sakamoto
@ 2023-01-25 12:03 ` Takashi Sakamoto
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Sakamoto @ 2023-01-25 12:03 UTC (permalink / raw)
To: stefanr; +Cc: linux1394-devel, linux-kernel, tiwai
In 1394 OHCI, the OUTPUT_LAST descriptor of Asynchronous Transmit (AT)
context has timeStamp field, in which 1394 OHCI controller record the
isochronous cycle when the packet was sent for the request subaction.
Additionally, the trailing quadlet of Asynchronous Receive (AR) context
has timeStamp field as well in which 1394 OHCI controller record the
isochronous cycle when the packet arrived. The time stamps are also
available for the cases to send and receive phy packet.
This commit implements new events with time stamp field for user space.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
drivers/firewire/core-cdev.c | 90 +++++++++++++++++++++++++++---------
1 file changed, 68 insertions(+), 22 deletions(-)
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
index 2220de3c945e..6274b86eb943 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
@@ -206,6 +206,7 @@ struct outbound_phy_packet_event {
struct fw_packet p;
union {
struct fw_cdev_event_phy_packet without_tstamp;
+ struct fw_cdev_event_phy_packet2 with_tstamp;
} phy_packet;
};
@@ -213,6 +214,7 @@ struct inbound_phy_packet_event {
struct event event;
union {
struct fw_cdev_event_phy_packet without_tstamp;
+ struct fw_cdev_event_phy_packet2 with_tstamp;
} phy_packet;
};
@@ -1555,7 +1557,6 @@ static void outbound_phy_packet_callback(struct fw_packet *packet,
container_of(packet, struct outbound_phy_packet_event, p);
struct client *e_client = e->client;
u32 rcode;
- struct fw_cdev_event_phy_packet *pp;
switch (status) {
// expected:
@@ -1583,10 +1584,31 @@ static void outbound_phy_packet_callback(struct fw_packet *packet,
break;
}
- pp = &e->phy_packet.without_tstamp;
- pp->rcode = rcode;
- pp->data[0] = packet->timestamp;
- queue_event(e->client, &e->event, &e->phy_packet, sizeof(*pp) + pp->length, NULL, 0);
+ switch (e->phy_packet.without_tstamp.type) {
+ case FW_CDEV_EVENT_PHY_PACKET_SENT:
+ {
+ struct fw_cdev_event_phy_packet *pp = &e->phy_packet.without_tstamp;
+
+ pp->rcode = rcode;
+ pp->data[0] = packet->timestamp;
+ queue_event(e->client, &e->event, &e->phy_packet, sizeof(*pp) + pp->length,
+ NULL, 0);
+ break;
+ }
+ case FW_CDEV_EVENT_PHY_PACKET_SENT2:
+ {
+ struct fw_cdev_event_phy_packet2 *pp = &e->phy_packet.with_tstamp;
+
+ pp->rcode = rcode;
+ pp->tstamp = packet->timestamp;
+ queue_event(e->client, &e->event, &e->phy_packet, sizeof(*pp) + pp->length,
+ NULL, 0);
+ break;
+ }
+ default:
+ WARN_ON(1);
+ break;
+ }
client_put(e_client);
}
@@ -1596,13 +1618,12 @@ static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg)
struct fw_cdev_send_phy_packet *a = &arg->send_phy_packet;
struct fw_card *card = client->device->card;
struct outbound_phy_packet_event *e;
- struct fw_cdev_event_phy_packet *pp;
/* Access policy: Allow this ioctl only on local nodes' device files. */
if (!client->device->is_local)
return -ENOSYS;
- e = kzalloc(sizeof(*e) + 4, GFP_KERNEL);
+ e = kzalloc(sizeof(*e) + sizeof(a->data), GFP_KERNEL);
if (e == NULL)
return -ENOMEM;
@@ -1616,11 +1637,23 @@ static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg)
e->p.header_length = 12;
e->p.callback = outbound_phy_packet_callback;
- pp = &e->phy_packet.without_tstamp;
- pp->closure = a->closure;
- pp->type = FW_CDEV_EVENT_PHY_PACKET_SENT;
- if (is_ping_packet(a->data))
- pp->length = 4;
+ if (client->version < FW_CDEV_VERSION_EVENT_ASYNC_TSTAMP) {
+ struct fw_cdev_event_phy_packet *pp = &e->phy_packet.without_tstamp;
+
+ pp->closure = a->closure;
+ pp->type = FW_CDEV_EVENT_PHY_PACKET_SENT;
+ if (is_ping_packet(a->data))
+ pp->length = 4;
+ } else {
+ struct fw_cdev_event_phy_packet2 *pp = &e->phy_packet.with_tstamp;
+
+ pp->closure = a->closure;
+ pp->type = FW_CDEV_EVENT_PHY_PACKET_SENT2;
+ // Keep the data field so that application can match the response event to the
+ // request.
+ pp->length = sizeof(a->data);
+ memcpy(pp->data, a->data, sizeof(a->data));
+ }
card->driver->send_request(card, &e->p);
@@ -1655,20 +1688,33 @@ void fw_cdev_handle_phy_packet(struct fw_card *card, struct fw_packet *p)
spin_lock_irqsave(&card->lock, flags);
list_for_each_entry(client, &card->phy_receiver_list, phy_receiver_link) {
- struct fw_cdev_event_phy_packet *pp;
-
e = kmalloc(sizeof(*e) + 8, GFP_ATOMIC);
if (e == NULL)
break;
- pp = &e->phy_packet.without_tstamp;
- pp->closure = client->phy_receiver_closure;
- pp->type = FW_CDEV_EVENT_PHY_PACKET_RECEIVED;
- pp->rcode = RCODE_COMPLETE;
- pp->length = 8;
- pp->data[0] = p->header[1];
- pp->data[1] = p->header[2];
- queue_event(client, &e->event, &e->phy_packet, sizeof(*pp) + 8, NULL, 0);
+ if (client->version < FW_CDEV_VERSION_EVENT_ASYNC_TSTAMP) {
+ struct fw_cdev_event_phy_packet *pp = &e->phy_packet.without_tstamp;
+
+ pp->closure = client->phy_receiver_closure;
+ pp->type = FW_CDEV_EVENT_PHY_PACKET_RECEIVED;
+ pp->rcode = RCODE_COMPLETE;
+ pp->length = 8;
+ pp->data[0] = p->header[1];
+ pp->data[1] = p->header[2];
+ queue_event(client, &e->event, &e->phy_packet, sizeof(*pp) + 8, NULL, 0);
+ } else {
+ struct fw_cdev_event_phy_packet2 *pp = &e->phy_packet.with_tstamp;
+
+ pp = &e->phy_packet.with_tstamp;
+ pp->closure = client->phy_receiver_closure;
+ pp->type = FW_CDEV_EVENT_PHY_PACKET_RECEIVED2;
+ pp->rcode = RCODE_COMPLETE;
+ pp->length = 8;
+ pp->tstamp = p->timestamp;
+ pp->data[0] = p->header[1];
+ pp->data[1] = p->header[2];
+ queue_event(client, &e->event, &e->phy_packet, sizeof(*pp) + 8, NULL, 0);
+ }
}
spin_unlock_irqrestore(&card->lock, flags);
--
2.37.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-04 17:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04 17:08 [PATCH 11/11] firewire: cdev: implement new event relevant to phy packet with time stamp kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2023-01-25 12:02 [PATCH 00/11] firewire: deliver hardware time stamp for asynchronous transaction Takashi Sakamoto
2023-01-25 12:03 ` [PATCH 11/11] firewire: cdev: implement new event relevant to phy packet with time stamp Takashi Sakamoto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.