On Sun, Feb 05, 2023 at 05:28:08PM +0200, Dmitry Baryshkov wrote: > +static int yoga_c630_ec_adpt_get_property(struct power_supply *psy, > + enum power_supply_property psp, > + union power_supply_propval *val) > +{ > + struct yoga_c630_ec *ec = power_supply_get_drvdata(psy); > + int rc = 0; > + > + yoga_c630_ec_update_adapter_status(ec); > + > + switch (psp) { > + case POWER_SUPPLY_PROP_ONLINE: > + val->intval = ec->adapter_online; > + break; > + default: > + rc = -EINVAL; > + break; > + } > + > + return rc; You can simplify this function by getting rid of the switch statement and rc variable: if (psp == POWER_SUPPLY_PROP_ONLINE) { val->intval = ec->adapter_online; return 0; } return -EINVAL; Brian