mirror of
https://github.com/torvalds/linux.git
synced 2024-11-12 23:23:03 +00:00
firewire updates for 6.9
This update includes small changes about page-aligned buffer for string processing in device attribute. -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQE66IEYNDXNBPeGKSsLtaWM8LwEwUCZfVO4wAKCRCsLtaWM8Lw E/bgAQCzVf+CjXB4WafDOIgAPIYQHZ1XkTXG4cfrbR8qcx9MnwEA64SzBXrrbX2k EpazxwYZR3F3LvYAAb4rVgnbRXKBNQE= =dVEb -----END PGP SIGNATURE----- Merge tag 'firewire-updates-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394 Pull firewire updates from Takashi Sakamoto: "Small changes to string processing in device attribute" * tag 'firewire-updates-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: firewire: core: fix build failure due to the caller of fw_csr_string() firewire: Convert snprintf/sprintf to sysfs_emit firewire: Kill unnecessary buf check in device_attribute.show
This commit is contained in:
commit
4438a810f3
@ -322,7 +322,7 @@ static ssize_t show_immediate(struct device *dev,
|
||||
if (value < 0)
|
||||
return -ENOENT;
|
||||
|
||||
return snprintf(buf, buf ? PAGE_SIZE : 0, "0x%06x\n", value);
|
||||
return sysfs_emit(buf, "0x%06x\n", value);
|
||||
}
|
||||
|
||||
#define IMMEDIATE_ATTR(name, key) \
|
||||
@ -334,8 +334,6 @@ static ssize_t show_text_leaf(struct device *dev,
|
||||
struct config_rom_attribute *attr =
|
||||
container_of(dattr, struct config_rom_attribute, attr);
|
||||
const u32 *directories[] = {NULL, NULL};
|
||||
size_t bufsize;
|
||||
char dummy_buf[2];
|
||||
int i, ret = -ENOENT;
|
||||
|
||||
down_read(&fw_device_rwsem);
|
||||
@ -357,15 +355,9 @@ static ssize_t show_text_leaf(struct device *dev,
|
||||
}
|
||||
}
|
||||
|
||||
if (buf) {
|
||||
bufsize = PAGE_SIZE - 1;
|
||||
} else {
|
||||
buf = dummy_buf;
|
||||
bufsize = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(directories) && !!directories[i]; ++i) {
|
||||
int result = fw_csr_string(directories[i], attr->key, buf, bufsize);
|
||||
int result = fw_csr_string(directories[i], attr->key, buf,
|
||||
PAGE_SIZE - 1);
|
||||
// Detected.
|
||||
if (result >= 0) {
|
||||
ret = result;
|
||||
@ -374,7 +366,7 @@ static ssize_t show_text_leaf(struct device *dev,
|
||||
// in the root directory follows to the directory entry for vendor ID
|
||||
// instead of the immediate value for vendor ID.
|
||||
result = fw_csr_string(directories[i], CSR_DIRECTORY | attr->key, buf,
|
||||
bufsize);
|
||||
PAGE_SIZE - 1);
|
||||
if (result >= 0)
|
||||
ret = result;
|
||||
}
|
||||
@ -490,7 +482,7 @@ static ssize_t is_local_show(struct device *dev,
|
||||
{
|
||||
struct fw_device *device = fw_device(dev);
|
||||
|
||||
return sprintf(buf, "%u\n", device->is_local);
|
||||
return sysfs_emit(buf, "%u\n", device->is_local);
|
||||
}
|
||||
|
||||
static int units_sprintf(char *buf, const u32 *directory)
|
||||
|
Loading…
Reference in New Issue
Block a user