platform/chrome: cros_ec_typec: Use existing feature check
Replace the cros_typec_feature_supported() function with the pre-existing cros_ec_check_features() function which does the same thing. Signed-off-by: Prashant Malani <pmalani@chromium.org> Link: https://lore.kernel.org/r/20210803173619.91539-2-pmalani@chromium.org Signed-off-by: Benson Leung <bleung@chromium.org>
This commit is contained in:
Родитель
3abc16af57
Коммит
a8db7a3f8a
|
@ -1054,24 +1054,6 @@ static int cros_typec_get_cmd_version(struct cros_typec_data *typec)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Check the EC feature flags to see if TYPEC_* features are supported. */
|
||||
static int cros_typec_feature_supported(struct cros_typec_data *typec, enum ec_feature_code feature)
|
||||
{
|
||||
struct ec_response_get_features resp = {};
|
||||
int ret;
|
||||
|
||||
ret = cros_typec_ec_command(typec, 0, EC_CMD_GET_FEATURES, NULL, 0,
|
||||
&resp, sizeof(resp));
|
||||
if (ret < 0) {
|
||||
dev_warn(typec->dev,
|
||||
"Failed to get features, assuming typec feature=%d unsupported.\n",
|
||||
feature);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return resp.flags[feature / 32] & EC_FEATURE_MASK_1(feature);
|
||||
}
|
||||
|
||||
static void cros_typec_port_work(struct work_struct *work)
|
||||
{
|
||||
struct cros_typec_data *typec = container_of(work, struct cros_typec_data, port_work);
|
||||
|
@ -1113,6 +1095,7 @@ MODULE_DEVICE_TABLE(of, cros_typec_of_match);
|
|||
|
||||
static int cros_typec_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct cros_ec_dev *ec_dev = NULL;
|
||||
struct device *dev = &pdev->dev;
|
||||
struct cros_typec_data *typec;
|
||||
struct ec_response_usb_pd_ports resp;
|
||||
|
@ -1132,10 +1115,10 @@ static int cros_typec_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
typec->typec_cmd_supported = !!cros_typec_feature_supported(typec,
|
||||
EC_FEATURE_TYPEC_CMD);
|
||||
typec->needs_mux_ack = !!cros_typec_feature_supported(typec,
|
||||
EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK);
|
||||
ec_dev = dev_get_drvdata(&typec->ec->ec->dev);
|
||||
typec->typec_cmd_supported = !!cros_ec_check_features(ec_dev, EC_FEATURE_TYPEC_CMD);
|
||||
typec->needs_mux_ack = !!cros_ec_check_features(ec_dev,
|
||||
EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK);
|
||||
|
||||
ret = cros_typec_ec_command(typec, 0, EC_CMD_USB_PD_PORTS, NULL, 0,
|
||||
&resp, sizeof(resp));
|
||||
|
|
Загрузка…
Ссылка в новой задаче