Re: [PATCH v5 03/11] platform: cznic: turris-omnia-mcu: Add support for MCU connected GPIOs

Dan Carpenter
2024-04-02T09:59:51Z

On Sat, Mar 23, 2024 at 05:43:51PM +0100, Marek Behún wrote:
> +static ssize_t front_button_mode_store(struct device *dev,
> + struct device_attribute *a,
> + const char *buf, size_t count)
> +{
> + struct omnia_mcu *mcu = i2c_get_clientdata(to_i2c_client(dev));
> + u8 mask, val;
> + int err, i;
> +
> + mask = CTL_BUTTON_MODE;

No need for the mask variable. Just use CTL_BUTTON_MODE directly.

regards,
dan carpenter

> +
> + i = sysfs_match_string(front_button_modes, buf);
> + if (i < 0)
> + return i;
> +
> + val = i ? mask : 0;
> + err = omnia_ctl_cmd_locked(mcu, CMD_GENERAL_CONTROL, val, mask);
> + if (err)
> + return err;
> +
> + return count;
> +}
> +static DEVICE_ATTR_RW(front_button_mode);