mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
staging: most: hdm-usb: remove repeated access to structure
This patch removes the repeated access to a struct member by assigning its value to a local variable once. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3e2880bee5
commit
98a3c4d7ae
1 changed files with 12 additions and 8 deletions
|
@ -1073,16 +1073,18 @@ static int get_stat_reg_addr(const struct regs *regs, int size,
|
||||||
static ssize_t show_value(struct most_dci_obj *dci_obj,
|
static ssize_t show_value(struct most_dci_obj *dci_obj,
|
||||||
struct most_dci_attribute *attr, char *buf)
|
struct most_dci_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
|
const char *name = attr->attr.name;
|
||||||
u16 val;
|
u16 val;
|
||||||
u16 reg_addr;
|
u16 reg_addr;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!strcmp(attr->attr.name, "arb_address"))
|
if (!strcmp(name, "arb_address"))
|
||||||
return snprintf(buf, PAGE_SIZE, "%04x\n", dci_obj->reg_addr);
|
return snprintf(buf, PAGE_SIZE, "%04x\n", dci_obj->reg_addr);
|
||||||
if (!strcmp(attr->attr.name, "arb_value"))
|
|
||||||
|
if (!strcmp(name, "arb_value"))
|
||||||
reg_addr = dci_obj->reg_addr;
|
reg_addr = dci_obj->reg_addr;
|
||||||
else if (get_static_reg_addr(ro_regs, attr->attr.name, ®_addr) &&
|
else if (get_static_reg_addr(ro_regs, name, ®_addr) &&
|
||||||
get_static_reg_addr(rw_regs, attr->attr.name, ®_addr))
|
get_static_reg_addr(rw_regs, name, ®_addr))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
err = drci_rd_reg(dci_obj->usb_device, reg_addr, &val);
|
err = drci_rd_reg(dci_obj->usb_device, reg_addr, &val);
|
||||||
|
@ -1098,23 +1100,25 @@ static ssize_t store_value(struct most_dci_obj *dci_obj,
|
||||||
{
|
{
|
||||||
u16 val;
|
u16 val;
|
||||||
u16 reg_addr;
|
u16 reg_addr;
|
||||||
|
const char *name = attr->attr.name;
|
||||||
int err = kstrtou16(buf, 16, &val);
|
int err = kstrtou16(buf, 16, &val);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (!strcmp(attr->attr.name, "arb_address")) {
|
if (!strcmp(name, "arb_address")) {
|
||||||
dci_obj->reg_addr = val;
|
dci_obj->reg_addr = val;
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
if (!strcmp(attr->attr.name, "arb_value")) {
|
|
||||||
|
if (!strcmp(name, "arb_value")) {
|
||||||
reg_addr = dci_obj->reg_addr;
|
reg_addr = dci_obj->reg_addr;
|
||||||
} else if (!strcmp(attr->attr.name, "sync_ep")) {
|
} else if (!strcmp(name, "sync_ep")) {
|
||||||
u16 ep = val;
|
u16 ep = val;
|
||||||
|
|
||||||
reg_addr = DRCI_REG_BASE + DRCI_COMMAND + ep * 16;
|
reg_addr = DRCI_REG_BASE + DRCI_COMMAND + ep * 16;
|
||||||
val = 1;
|
val = 1;
|
||||||
} else if (get_static_reg_addr(ro_regs, attr->attr.name, ®_addr)) {
|
} else if (get_static_reg_addr(ro_regs, name, ®_addr)) {
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue