Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Pengyu Luo <mitltlatltl@gmail.com>
Cc: "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jean Delvare" <jdelvare@suse.com>,
	"Guenter Roeck" <linux@roeck-us.net>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-hwmon@vger.kernel.org,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>
Subject: Re: [PATCH v2 2/5] platform: arm64: add Huawei Matebook E Go EC driver
Date: Tue, 7 Jan 2025 14:25:05 +0200	[thread overview]
Message-ID: <Z30dIRA4MdtCp63q@kuha.fi.intel.com> (raw)
In-Reply-To: <20250105174159.227831-3-mitltlatltl@gmail.com>

Hi,

> +/* -------------------------------------------------------------------------- */
> +/* API For UCSI */
> +
> +int gaokun_ec_ucsi_read(struct gaokun_ec *ec,
> +			u8 resp[GAOKUN_UCSI_READ_SIZE])
> +{
> +	u8 req[] = MKREQ(0x03, 0xD5, 0);
> +	u8 _resp[] = MKRESP(GAOKUN_UCSI_READ_SIZE);
> +	int ret;
> +
> +	ret = gaokun_ec_read(ec, req, sizeof(_resp), _resp);
> +	if (ret)
> +		return ret;
> +
> +	extr_resp(resp, _resp, GAOKUN_UCSI_READ_SIZE);
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(gaokun_ec_ucsi_read);
> +
> +int gaokun_ec_ucsi_write(struct gaokun_ec *ec,
> +			 const u8 req[GAOKUN_UCSI_WRITE_SIZE])
> +{
> +	u8 _req[] = MKREQ(0x03, 0xD4, GAOKUN_UCSI_WRITE_SIZE);
> +
> +
> +	refill_req(_req, req, GAOKUN_UCSI_WRITE_SIZE);
> +
> +	return gaokun_ec_write(ec, _req);
> +}
> +EXPORT_SYMBOL_GPL(gaokun_ec_ucsi_write);
> +
> +int gaokun_ec_ucsi_get_reg(struct gaokun_ec *ec, u8 *ureg)
> +{
> +	u8 req[] = MKREQ(0x03, 0xD3, 0);
> +	u8 _resp[] = MKRESP(UCSI_REG_SIZE);
> +	int ret;
> +
> +	ret = gaokun_ec_read(ec, req, sizeof(_resp), _resp);
> +	if (ret)
> +		return ret;
> +
> +	extr_resp(ureg, _resp, UCSI_REG_SIZE);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(gaokun_ec_ucsi_get_reg);

Why not just take struct gaokun_ucsi_reg as parameter? I did not see
this (or any of these) being used anywhere else except in your UCSI
glue driver. So the prototype would be:

        int gaokun_ec_ucsi_get_reg(struct gaokun_ec *ec,
                                   struct gaokun_ucsi_reg *reg);

> +int gaokun_ec_ucsi_pan_ack(struct gaokun_ec *ec, int port_id)
> +{
> +	u8 req[] = MKREQ(0x03, 0xD2, 1);
> +	u8 data = 1 << port_id;
> +
> +	if (port_id == GAOKUN_UCSI_NO_PORT_UPDATE)
> +		data = 0;
> +
> +	refill_req(req, &data, 1);
> +
> +	return gaokun_ec_write(ec, req);
> +}
> +EXPORT_SYMBOL_GPL(gaokun_ec_ucsi_pan_ack);

I think you should add proper kernel doc comments to these exported
functions.

thanks,

-- 
heikki

  reply	other threads:[~2025-01-07 12:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-05 17:41 [PATCH v2 0/5] platform: arm64: Huawei Matebook E Go embedded controller Pengyu Luo
2025-01-05 17:41 ` [PATCH v2 1/5] dt-bindings: platform: Add Huawei Matebook E Go EC Pengyu Luo
2025-01-06  7:11   ` Krzysztof Kozlowski
2025-01-06  8:06     ` Pengyu Luo
2025-01-06 12:29       ` Krzysztof Kozlowski
2025-01-05 17:41 ` [PATCH v2 2/5] platform: arm64: add Huawei Matebook E Go EC driver Pengyu Luo
2025-01-07 12:25   ` Heikki Krogerus [this message]
2025-01-07 16:53     ` Pengyu Luo
2025-01-05 17:41 ` [PATCH v2 3/5] usb: typec: ucsi: add Huawei Matebook E Go ucsi driver Pengyu Luo
2025-01-07 12:30   ` Heikki Krogerus
2025-01-07 16:54     ` Pengyu Luo
2025-01-05 17:41 ` [PATCH v2 4/5] power: supply: add Huawei Matebook E Go psy driver Pengyu Luo
2025-01-05 17:41 ` [PATCH v2 5/5] arm64: dts: qcom: gaokun3: Add Embedded Controller node Pengyu Luo
2025-01-09 14:37   ` Konrad Dybcio
2025-01-06 19:27 ` [PATCH v2 0/5] platform: arm64: Huawei Matebook E Go embedded controller Rob Herring (Arm)

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=Z30dIRA4MdtCp63q@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jdelvare@suse.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mitltlatltl@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sre@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox