forked from Minki/linux
staging: most: usb: use function sysfs_streq
This patch replaces function strcmp() with sysfs_streq() to compare strings provided via sysfs. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/1590570387-27069-11-git-send-email-christian.gromm@microchip.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f1f48239cd
commit
549d2db702
@ -808,7 +808,7 @@ static int get_stat_reg_addr(const struct regs *regs, int size,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
if (!strcmp(name, regs[i].name)) {
|
||||
if (sysfs_streq(name, regs[i].name)) {
|
||||
*reg_addr = regs[i].reg;
|
||||
return 0;
|
||||
}
|
||||
@ -828,10 +828,10 @@ static ssize_t value_show(struct device *dev, struct device_attribute *attr,
|
||||
u16 reg_addr;
|
||||
int err;
|
||||
|
||||
if (!strcmp(name, "arb_address"))
|
||||
if (sysfs_streq(name, "arb_address"))
|
||||
return snprintf(buf, PAGE_SIZE, "%04x\n", dci_obj->reg_addr);
|
||||
|
||||
if (!strcmp(name, "arb_value"))
|
||||
if (sysfs_streq(name, "arb_value"))
|
||||
reg_addr = dci_obj->reg_addr;
|
||||
else if (get_static_reg_addr(ro_regs, name, ®_addr) &&
|
||||
get_static_reg_addr(rw_regs, name, ®_addr))
|
||||
@ -858,14 +858,14 @@ static ssize_t value_store(struct device *dev, struct device_attribute *attr,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (!strcmp(name, "arb_address")) {
|
||||
if (sysfs_streq(name, "arb_address")) {
|
||||
dci_obj->reg_addr = val;
|
||||
return count;
|
||||
}
|
||||
|
||||
if (!strcmp(name, "arb_value"))
|
||||
if (sysfs_streq(name, "arb_value"))
|
||||
err = drci_wr_reg(usb_dev, dci_obj->reg_addr, val);
|
||||
else if (!strcmp(name, "sync_ep"))
|
||||
else if (sysfs_streq(name, "sync_ep"))
|
||||
err = start_sync_ep(usb_dev, val);
|
||||
else if (!get_static_reg_addr(rw_regs, name, ®_addr))
|
||||
err = drci_wr_reg(usb_dev, reg_addr, val);
|
||||
|
Loading…
Reference in New Issue
Block a user