* [PATCH 1/3] firewire: core: minor code refactoring for case-dependent parameters of iso resources management
2026-05-20 13:08 [PATCH 0/3] firewire: core: more code refactoring for cdev layer Takashi Sakamoto
@ 2026-05-20 13:08 ` Takashi Sakamoto
2026-05-20 13:08 ` [PATCH 2/3] firewire: core: rename member name for channel mask of isoc resource Takashi Sakamoto
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Takashi Sakamoto @ 2026-05-20 13:08 UTC (permalink / raw)
To: linux1394-devel; +Cc: linux-kernel
The generation parameter is specific to the auto case of iso resources
management, while it is in the common parameter structure.
Move the generation member to the structure specific to auto case.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
drivers/firewire/core-cdev.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
index c166e7617d2a..c669c9e42d34 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
@@ -129,7 +129,6 @@ struct descriptor_resource {
};
struct iso_resource_params {
- int generation;
u64 channels;
s32 bandwidth;
};
@@ -144,6 +143,7 @@ struct iso_resource_auto {
ISO_RES_AUTO_REALLOC,
ISO_RES_AUTO_DEALLOC,
} todo;
+ int generation;
struct iso_resource_params params;
struct iso_resource_event *e_alloc, *e_dealloc;
};
@@ -1316,7 +1316,6 @@ static int fill_iso_resource_params(struct iso_resource_params *params,
request->bandwidth > BANDWIDTH_AVAILABLE_INITIAL)
return -EINVAL;
- params->generation = -1;
params->channels = request->channels;
params->bandwidth = request->bandwidth;
@@ -1336,8 +1335,8 @@ static void iso_resource_auto_work(struct work_struct *work)
scoped_guard(spinlock_irq, &client->lock) {
reset_jiffies = client->device->card->reset_jiffies;
current_generation = client->device->generation;
- resource_generation = r->params.generation;
- r->params.generation = current_generation;
+ resource_generation = r->generation;
+ r->generation = current_generation;
todo = r->todo;
}
@@ -1495,7 +1494,6 @@ static void iso_resource_once_work(struct work_struct *work)
scoped_guard(spinlock_irq, &client->lock)
generation = client->device->generation;
- r->params.generation = generation;
bandwidth = r->params.bandwidth;
fw_iso_resource_manage(client->device->card, generation, r->params.channels, &channel,
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/3] firewire: core: rename member name for channel mask of isoc resource
2026-05-20 13:08 [PATCH 0/3] firewire: core: more code refactoring for cdev layer Takashi Sakamoto
2026-05-20 13:08 ` [PATCH 1/3] firewire: core: minor code refactoring for case-dependent parameters of iso resources management Takashi Sakamoto
@ 2026-05-20 13:08 ` Takashi Sakamoto
2026-05-20 13:08 ` [PATCH 3/3] firewire: core: cancel using delayed work for iso_resource_once management Takashi Sakamoto
2026-05-21 9:45 ` [PATCH 0/3] firewire: core: more code refactoring for cdev layer Takashi Sakamoto
3 siblings, 0 replies; 5+ messages in thread
From: Takashi Sakamoto @ 2026-05-20 13:08 UTC (permalink / raw)
To: linux1394-devel; +Cc: linux-kernel
The iso_resource_params structure has a member for channel mask, while
the name of field is easy to misinterpret.
Append _mask to the member name.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
drivers/firewire/core-cdev.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
index c669c9e42d34..56c21cabc20c 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
@@ -129,7 +129,7 @@ struct descriptor_resource {
};
struct iso_resource_params {
- u64 channels;
+ u64 channels_mask;
s32 bandwidth;
};
@@ -1316,7 +1316,7 @@ static int fill_iso_resource_params(struct iso_resource_params *params,
request->bandwidth > BANDWIDTH_AVAILABLE_INITIAL)
return -EINVAL;
- params->channels = request->channels;
+ params->channels_mask = request->channels;
params->bandwidth = request->bandwidth;
return 0;
@@ -1360,7 +1360,7 @@ static void iso_resource_auto_work(struct work_struct *work)
bandwidth = r->params.bandwidth;
- fw_iso_resource_manage(client->device->card, current_generation, r->params.channels,
+ fw_iso_resource_manage(client->device->card, current_generation, r->params.channels_mask,
&channel, &bandwidth, todo != ISO_RES_AUTO_DEALLOC);
if (todo == ISO_RES_AUTO_DEALLOC) {
@@ -1402,7 +1402,7 @@ static void iso_resource_auto_work(struct work_struct *work)
r->todo = ISO_RES_AUTO_REALLOC;
if (channel >= 0)
- r->params.channels = 1ULL << channel;
+ r->params.channels_mask = BIT_ULL(channel);
e = r->e_alloc;
r->e_alloc = NULL;
@@ -1496,7 +1496,7 @@ static void iso_resource_once_work(struct work_struct *work)
bandwidth = r->params.bandwidth;
- fw_iso_resource_manage(client->device->card, generation, r->params.channels, &channel,
+ fw_iso_resource_manage(client->device->card, generation, r->params.channels_mask, &channel,
&bandwidth, r->todo == ISO_RES_ONCE_ALLOC);
e->iso_resource.handle = UNAVAILABLE_HANDLE;
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 3/3] firewire: core: cancel using delayed work for iso_resource_once management
2026-05-20 13:08 [PATCH 0/3] firewire: core: more code refactoring for cdev layer Takashi Sakamoto
2026-05-20 13:08 ` [PATCH 1/3] firewire: core: minor code refactoring for case-dependent parameters of iso resources management Takashi Sakamoto
2026-05-20 13:08 ` [PATCH 2/3] firewire: core: rename member name for channel mask of isoc resource Takashi Sakamoto
@ 2026-05-20 13:08 ` Takashi Sakamoto
2026-05-21 9:45 ` [PATCH 0/3] firewire: core: more code refactoring for cdev layer Takashi Sakamoto
3 siblings, 0 replies; 5+ messages in thread
From: Takashi Sakamoto @ 2026-05-20 13:08 UTC (permalink / raw)
To: linux1394-devel; +Cc: linux-kernel
There is no need to use deferrable type of work for iso_resource_once
management because the work is queued to run immediately.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
drivers/firewire/core-cdev.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
index 56c21cabc20c..e49d8a58be09 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
@@ -150,8 +150,7 @@ struct iso_resource_auto {
struct iso_resource_once {
struct client *client;
- // Schedule work and access todo only with client->lock held.
- struct delayed_work work;
+ struct work_struct work;
enum {
ISO_RES_ONCE_ALLOC,
ISO_RES_ONCE_DEALLOC,
@@ -1486,7 +1485,7 @@ static int ioctl_deallocate_iso_resource(struct client *client,
static void iso_resource_once_work(struct work_struct *work)
{
- struct iso_resource_once *r = from_work(r, work, work.work);
+ struct iso_resource_once *r = from_work(r, work, work);
struct client *client = r->client;
struct iso_resource_event *e = r->event;
int generation, channel, bandwidth;
@@ -1505,7 +1504,7 @@ static void iso_resource_once_work(struct work_struct *work)
queue_event(client, &e->event, &e->iso_resource, sizeof(e->iso_resource), NULL, 0);
- cancel_delayed_work(&r->work);
+ cancel_work(&r->work);
kfree(r);
client_put(client);
@@ -1525,7 +1524,7 @@ static int init_iso_resource_once(struct client *client,
if (err < 0)
return err;
- INIT_DELAYED_WORK(&r->work, iso_resource_once_work);
+ INIT_WORK(&r->work, iso_resource_once_work);
r->client = client;
r->todo = todo;
@@ -1539,7 +1538,7 @@ static int init_iso_resource_once(struct client *client,
// Keep the client until work item finishing.
client_get(r->client);
- queue_delayed_work(fw_workqueue, &no_free_ptr(r)->work, 0);
+ queue_work(fw_workqueue, &no_free_ptr(r)->work);
request->handle = UNAVAILABLE_HANDLE;
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 0/3] firewire: core: more code refactoring for cdev layer
2026-05-20 13:08 [PATCH 0/3] firewire: core: more code refactoring for cdev layer Takashi Sakamoto
` (2 preceding siblings ...)
2026-05-20 13:08 ` [PATCH 3/3] firewire: core: cancel using delayed work for iso_resource_once management Takashi Sakamoto
@ 2026-05-21 9:45 ` Takashi Sakamoto
3 siblings, 0 replies; 5+ messages in thread
From: Takashi Sakamoto @ 2026-05-21 9:45 UTC (permalink / raw)
To: linux1394-devel; +Cc: linux-kernel
On Wed, May 20, 2026 at 10:08:37PM +0900, Takashi Sakamoto wrote:
> Hi,
>
> Some paths could still be refactored to remove redundant paths after
> the previous cdev layer refactoring patchset[1].
>
>
> [1] https://lore.kernel.org/lkml/20260501135823.241940-1-o-takashi@sakamocchi.jp/
>
>
> Takashi Sakamoto (3):
> firewire: core: minor code refactoring for case-dependent parameters
> of iso resources management
> firewire: core: rename member name for channel mask of isoc resource
> firewire: core: cancel using delayed work for iso_resource_once
> management
>
> drivers/firewire/core-cdev.c | 29 +++++++++++++----------------
> 1 file changed, 13 insertions(+), 16 deletions(-)
Applied for for-next branch.
Regards
Takashi Sakamoto
^ permalink raw reply [flat|nested] 5+ messages in thread