From: Brian Masney <bmasney@redhat.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sebastian Reichel <sre@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
Steev Klimaszewski <steev@kali.org>
Subject: Re: [PATCH v2 2/3] power: supply: Add Lenovo Yoga C630 EC driver
Date: Mon, 6 Feb 2023 13:28:23 -0500 [thread overview]
Message-ID: <Y+FGxylqBLRA+Um4@x1> (raw)
In-Reply-To: <20230205152809.2233436-3-dmitry.baryshkov@linaro.org>
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
next prev parent reply other threads:[~2023-02-06 18:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-05 15:28 [PATCH v2 0/3] power: supply: Lenovo Yoga C630 EC Dmitry Baryshkov
2023-02-05 15:28 ` [PATCH v2 1/3] dt-bindings: power: supply: Add " Dmitry Baryshkov
2023-02-06 15:16 ` Krzysztof Kozlowski
2023-02-06 16:03 ` Rob Herring
2023-02-06 18:19 ` Brian Masney
2023-02-07 0:09 ` Dmitry Baryshkov
2023-02-05 15:28 ` [PATCH v2 2/3] power: supply: Add Lenovo Yoga C630 EC driver Dmitry Baryshkov
2023-02-06 18:28 ` Brian Masney [this message]
2023-02-13 21:11 ` Sebastian Reichel
2023-02-05 15:28 ` [PATCH v2 3/3] arm64: dts: qcom: c630: Add Embedded Controller node Dmitry Baryshkov
2023-02-06 10:57 ` Konrad Dybcio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y+FGxylqBLRA+Um4@x1 \
--to=bmasney@redhat.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=steev@kali.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.