Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp618494pxb; Tue, 1 Feb 2022 07:06:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBp5MxnmXeVve/eSMR7Y4fXWCY2TKwlkcP4xzqQUCWiueWdRgCQPEBX7YveXsAkQ8+3W9v X-Received: by 2002:a05:6402:278f:: with SMTP id b15mr26250729ede.103.1643728017893; Tue, 01 Feb 2022 07:06:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643728017; cv=none; d=google.com; s=arc-20160816; b=1C5IkyFmztQFp+1ml6efqQQp0oQsJAgxKMaKsTzCbthrGyvTO5EQOqDAoVL1AMTn5/ J9rGjsglZ3WHyXCMtyo9Pji+CpipgPBIGH1s+kIkxjA0oTi5fn0nNBV6JWVZZmPsRDi+ fyouTNlek9TgxACM3O1iPpZajQvP2O5RpGuhny95S1svZNMoti1mh3j+iMcns1W9RvRO Se5IrMUoc0HUcNJ27dkfu997UrseZbTYO/ZrtzzZByJG8u6dUZtRsWTcMPYP92W8lAkw xqhxNbqPGO7/8iUBcrhsls3I4w+tnC5pyU1V8wExfKlpCqvYYpW8GIJYGFjm9hpe1eDW GCJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NP5ZZjbP+5a6CBKM4ARGc3cpSsivbTp+jHAFBgsPOcE=; b=pZ5Pk/DPY0R500vX6LjK7YHE2/uremz84sn+0ckrpyJX+qutrIKgE+uuWYVmqMk2fs H/qBtZTpE7ACnprHMrQ5Fr7TBEuDmScaOB98YKl+ganIOVxCw9JFietQ9O9UbjfztH2q c1u/zN+03LN2DQvFNoR4ilRegKWdOMSXhqLEQ/Q/CiPptr+3O4kc60kE58phqTMh9YK8 bVZag7mnbe+IXuNF+JogVgG33fgYcx12r4RJTMiPXlXBtUAJkG4Zzx17hGXahaWAP2Y2 z4rY4eWZIJoSHuUxNzilP+wh2QjFpZzk0qInITWEDPmW/abNLBqIgq+lRKbHl0I5QuQW 13kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AYfR2Tkw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q3si9395033edj.73.2022.02.01.07.06.33; Tue, 01 Feb 2022 07:06:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AYfR2Tkw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356363AbiA3UsS (ORCPT + 99 others); Sun, 30 Jan 2022 15:48:18 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29473 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356357AbiA3Urs (ORCPT ); Sun, 30 Jan 2022 15:47:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643575667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NP5ZZjbP+5a6CBKM4ARGc3cpSsivbTp+jHAFBgsPOcE=; b=AYfR2TkwIXiItf871AR1C6AmGO/Ft1uUfXrUMtERpzpL15O+6XNwXr3H3ilBtO9iKb4hms 0v5ByAkKRTLwv23zs+OTD63pshQICChSgNtnBC0LIO/9QpzDJdG9Gbs+MQbAZdhuWGdpd7 vsbgfnYH0hhHP/tHuGm4c5dl2KcTicU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-296-m-MSK84kPD6lBQTUrkJh_A-1; Sun, 30 Jan 2022 15:47:44 -0500 X-MC-Unique: m-MSK84kPD6lBQTUrkJh_A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D6B1F18397A7; Sun, 30 Jan 2022 20:47:41 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A22C61093; Sun, 30 Jan 2022 20:47:38 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Mika Westerberg , Mark Gross , Andy Shevchenko , Wolfram Sang , Lee Jones , Sebastian Reichel , MyungJoo Ham , Chanwoo Choi , Ard Biesheuvel Cc: Hans de Goede , Len Brown , linux-acpi@vger.kernel.org, Yauhen Kharuzhy , Tsuchiya Yuto , Fabio Aiuto , platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: [PATCH v4 18/20] extcon: intel-cht-wc: Refactor cht_wc_extcon_get_charger() Date: Sun, 30 Jan 2022 21:45:55 +0100 Message-Id: <20220130204557.15662-19-hdegoede@redhat.com> In-Reply-To: <20220130204557.15662-1-hdegoede@redhat.com> References: <20220130204557.15662-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a preparation patch for adding support for registering a power_supply class device. Setting usbsrc to "CHT_WC_USBSRC_TYPE_SDP << CHT_WC_USBSRC_TYPE_SHIFT" will make the following switch-case return EXTCON_CHG_USB_SDP just as before, so there is no functional change. Acked-by: Chanwoo Choi Signed-off-by: Hans de Goede --- Changes in v3: - Reword the commit message --- drivers/extcon/extcon-intel-cht-wc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c index edc386937dee..150637bea417 100644 --- a/drivers/extcon/extcon-intel-cht-wc.c +++ b/drivers/extcon/extcon-intel-cht-wc.c @@ -153,14 +153,15 @@ static int cht_wc_extcon_get_charger(struct cht_wc_extcon_data *ext, } while (time_before(jiffies, timeout)); if (status != CHT_WC_USBSRC_STS_SUCCESS) { - if (ignore_errors) - return EXTCON_CHG_USB_SDP; /* Save fallback */ + if (!ignore_errors) { + if (status == CHT_WC_USBSRC_STS_FAIL) + dev_warn(ext->dev, "Could not detect charger type\n"); + else + dev_warn(ext->dev, "Timeout detecting charger type\n"); + } - if (status == CHT_WC_USBSRC_STS_FAIL) - dev_warn(ext->dev, "Could not detect charger type\n"); - else - dev_warn(ext->dev, "Timeout detecting charger type\n"); - return EXTCON_CHG_USB_SDP; /* Save fallback */ + /* Save fallback */ + usbsrc = CHT_WC_USBSRC_TYPE_SDP << CHT_WC_USBSRC_TYPE_SHIFT; } usbsrc = (usbsrc & CHT_WC_USBSRC_TYPE_MASK) >> CHT_WC_USBSRC_TYPE_SHIFT; -- 2.33.1