Skip to content

Commit

Permalink
firewire: core: add memo about the caller of show functions for devic…
Browse files Browse the repository at this point in the history
…e attributes

In the case of firewire core function, the caller of show functions for
device attributes is not only sysfs user, but also device initialization.

This commit adds memo about it against the typical assumption that the
functions are just dedicated to sysfs user.

Link: https://lore.kernel.org/lkml/20240318091759.678326-1-o-takashi@sakamocchi.jp/
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
  • Loading branch information
takaswie committed Mar 21, 2024
1 parent 946593d commit bfb1ad3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/firewire/core-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ static ssize_t show_immediate(struct device *dev,
if (value < 0)
return -ENOENT;

// Note that this function is also called by init_fw_attribute_group() with NULL pointer.
return buf ? sysfs_emit(buf, "0x%06x\n", value) : 0;
}

Expand Down Expand Up @@ -357,6 +358,7 @@ static ssize_t show_text_leaf(struct device *dev,
}
}

// Note that this function is also called by init_fw_attribute_group() with NULL pointer.
if (buf) {
bufsize = PAGE_SIZE - 1;
} else {
Expand Down

0 comments on commit bfb1ad3

Please sign in to comment.