Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

staging: axis-fifo: Use sysfs_emit()

sysfs_read() is anly called from _show() functions declared by
DEVICE_ATTR_RW().

Using sysfs_emit() is the preferred style and here, it saves a useless
copy and a temporary buffer in the stack.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/588327734f374b5f5cb5c4d5725d884fdc83663e.1707654406.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Christophe JAILLET and committed by
Greg Kroah-Hartman
cfd87832 72c068a1

+1 -6
+1 -6
drivers/staging/axis-fifo/axis-fifo.c
··· 165 165 { 166 166 struct axis_fifo *fifo = dev_get_drvdata(dev); 167 167 unsigned int read_val; 168 - unsigned int len; 169 - char tmp[32]; 170 168 171 169 read_val = ioread32(fifo->base_addr + addr_offset); 172 - len = snprintf(tmp, sizeof(tmp), "0x%x\n", read_val); 173 - memcpy(buf, tmp, len); 174 - 175 - return len; 170 + return sysfs_emit(buf, "0x%x\n", read_val); 176 171 } 177 172 178 173 static ssize_t isr_store(struct device *dev, struct device_attribute *attr,