Skip to content

Commit f657a68

Browse files
committed
firewire: core: use from_work() macro to expand parent structure of work_struct
A commit 60b2ebf ("workqueue: Introduce from_work() helper for cleaner callback declarations") introduces a new macro to retrieve a poiner for the parent structure of the work item. It is convenient to reduce input text. This commit uses the macro in core functionalities. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent 8ffef79 commit f657a68

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

drivers/firewire/core-card.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ EXPORT_SYMBOL(fw_schedule_bus_reset);
237237

238238
static void br_work(struct work_struct *work)
239239
{
240-
struct fw_card *card = container_of(work, struct fw_card, br_work.work);
240+
struct fw_card *card = from_work(card, work, br_work.work);
241241

242242
/* Delay for 2s after last reset per IEEE 1394 clause 8.2.1. */
243243
if (card->reset_jiffies != 0 &&
@@ -286,7 +286,7 @@ void fw_schedule_bm_work(struct fw_card *card, unsigned long delay)
286286

287287
static void bm_work(struct work_struct *work)
288288
{
289-
struct fw_card *card = container_of(work, struct fw_card, bm_work.work);
289+
struct fw_card *card = from_work(card, work, bm_work.work);
290290
struct fw_device *root_device, *irm_device;
291291
struct fw_node *root_node;
292292
int root_id, new_root_id, irm_id, bm_id, local_id;

drivers/firewire/core-cdev.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,8 +1313,7 @@ static int ioctl_get_cycle_timer(struct client *client, union ioctl_arg *arg)
13131313
static void iso_resource_work(struct work_struct *work)
13141314
{
13151315
struct iso_resource_event *e;
1316-
struct iso_resource *r =
1317-
container_of(work, struct iso_resource, work.work);
1316+
struct iso_resource *r = from_work(r, work, work.work);
13181317
struct client *client = r->client;
13191318
unsigned long index = r->resource.handle;
13201319
int generation, channel, bandwidth, todo;

drivers/firewire/core-device.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,7 @@ static void fw_schedule_device_work(struct fw_device *device,
853853

854854
static void fw_device_shutdown(struct work_struct *work)
855855
{
856-
struct fw_device *device =
857-
container_of(work, struct fw_device, work.work);
856+
struct fw_device *device = from_work(device, work, work.work);
858857

859858
if (time_before64(get_jiffies_64(),
860859
device->card->reset_jiffies + SHUTDOWN_DELAY)
@@ -921,8 +920,7 @@ static int update_unit(struct device *dev, void *data)
921920

922921
static void fw_device_update(struct work_struct *work)
923922
{
924-
struct fw_device *device =
925-
container_of(work, struct fw_device, work.work);
923+
struct fw_device *device = from_work(device, work, work.work);
926924

927925
fw_device_cdev_update(device);
928926
device_for_each_child(&device->device, NULL, update_unit);
@@ -1002,8 +1000,7 @@ static int compare_configuration_rom(struct device *dev, const void *data)
10021000

10031001
static void fw_device_init(struct work_struct *work)
10041002
{
1005-
struct fw_device *device =
1006-
container_of(work, struct fw_device, work.work);
1003+
struct fw_device *device = from_work(device, work, work.work);
10071004
struct fw_card *card = device->card;
10081005
struct device *found;
10091006
u32 minor;
@@ -1184,8 +1181,7 @@ static int reread_config_rom(struct fw_device *device, int generation,
11841181

11851182
static void fw_device_refresh(struct work_struct *work)
11861183
{
1187-
struct fw_device *device =
1188-
container_of(work, struct fw_device, work.work);
1184+
struct fw_device *device = from_work(device, work, work.work);
11891185
struct fw_card *card = device->card;
11901186
int ret, node_id = device->node_id;
11911187
bool changed;
@@ -1251,8 +1247,7 @@ static void fw_device_refresh(struct work_struct *work)
12511247

12521248
static void fw_device_workfn(struct work_struct *work)
12531249
{
1254-
struct fw_device *device = container_of(to_delayed_work(work),
1255-
struct fw_device, work);
1250+
struct fw_device *device = from_work(device, to_delayed_work(work), work);
12561251
device->workfn(work);
12571252
}
12581253

0 commit comments

Comments
 (0)