Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp675900iol; Thu, 9 Jun 2022 11:28:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzqLORp8eZg20pKwLaDIzZ2NUlvF4S4yZqwwKV7LWAchX0Pa19W70CJstLy3olF5C0f9Wj X-Received: by 2002:a17:906:6947:b0:711:a86b:6780 with SMTP id c7-20020a170906694700b00711a86b6780mr24548844ejs.686.1654799325001; Thu, 09 Jun 2022 11:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654799324; cv=none; d=google.com; s=arc-20160816; b=tCIJin4IrA2pcjXmDBwvcsAqKU8Y+N/aom25BnBsgn6F8oaoKTO89X5Uslj8yYl7D6 J53k7e2GxgQMnAY8UpAoCoNMdJZJMWqPIYwy/kNftTEbi9s02gX4g08FQuYICuaY9/Tl FPcl4bsSdt/VqSEjllwkvztQOI9mXqT6R90+rhLJ6pqeFCBaPybctZ8nlMAX/ZEm8ury 0Q1nXsFmZrb0KLdH3ty+kTwu27uu+9OpV8m97Xmu9uHlH3WZsmbbSBWM5jwjApgth/8l /e7mXZgGYPvpbi0AxZ1wZhYq2YeXMlbeNxBlJwJ0o2DgjsRCfYLRPafOecQZ7uEu9Q9L x5GA== 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=IdvgLXoLjev9GttM62EnYpKkz6LMe+X1VjPPPf04Vxw=; b=Q8aV0DcCN11kynpvBU/kXq/F7rcZMhPL324qxWHlyckY44rMJE9qPkCy/eLqE9olvH QUzd/feALLK0KptH8MZ+wqhbf51OJbKURTQxGqpsp4bAQYcdlmbH7eWODVM4QqeueKyW 2C38zQeJuhUOG0wRtMJgEVeTNo09ecbjVCf2I7mkrFlaOBm+55z2XPrnbvtx7TLKO1s+ zeoCtJH8dCbsC7X0LX+Vmo/xxcmlOE/bJv3jFQ+h9+kowkb3ieFikspHVk9BDQyUQCw1 vHSabnSMApYkHAolChSNnWEmrdklgTH6FBxddHth2eADzKtEAzoqDRwiUPouhAqIFOXT N0Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aFTtmBkm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs6-20020a1709073e8600b006fe8e64d480si7209636ejc.701.2022.06.09.11.28.17; Thu, 09 Jun 2022 11:28:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aFTtmBkm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbiFISPO (ORCPT + 99 others); Thu, 9 Jun 2022 14:15:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242704AbiFISPM (ORCPT ); Thu, 9 Jun 2022 14:15:12 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F234EA5A8F for ; Thu, 9 Jun 2022 11:15:10 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id r1so3628248plo.10 for ; Thu, 09 Jun 2022 11:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IdvgLXoLjev9GttM62EnYpKkz6LMe+X1VjPPPf04Vxw=; b=aFTtmBkmw+81PJHigGOzSJ9dxv6Y0l82wBq2QqDYzMnyv2bWhO+CrXtdyt4rP7cKXL AqCwxOfduRVJ7NcQgfN130U3Op7vInZ8ZeU23poXFYbm6ttLE+Lu5KfQ3rpF4P2DdiKs 5aLOZbTt35XDan6HUVt+O0GTCFrGVsv92oq2M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IdvgLXoLjev9GttM62EnYpKkz6LMe+X1VjPPPf04Vxw=; b=uyoemPk1lxLSrQTTMcpBpjHBM0uQXmRhDOCl5n+DKw7GfUn+3SXqp0liz3OqiiOPy0 eEvy36iFZ0FGRvI/JuUT09/AUB6Ipe2VG8Ixh4QO9QmLaoM83B/PA89eWN1LF2Qx6Jc4 FU98/vE+qIvQEREpqizYOJruCo3FhCKdvT7ziREhtVrCGAJO1HRoe+nq0qiSeSyzoGBI zfL5bUKf9kE5oXKD6DeuSUUd2UdMpZuxrKk6zSIgCFTrwZ2B/+Vjx5bJi/zjZrqefKNS NOiuffsa5FbC+BTeYMwdPnLUNMU9Z/dptSqRRB26qgHGoRo9Y4ox73JP7b+x4uVDcwx5 LFrg== X-Gm-Message-State: AOAM5322dHa8K8R5zN9/KbD6mplHk/aoALElNGS409Kk+WHHh5B68+mW AFasvZkYVdg8CIBUNx9QWqeanAnisBxWrQ== X-Received: by 2002:a17:902:b692:b0:14c:935b:2b03 with SMTP id c18-20020a170902b69200b0014c935b2b03mr40668224pls.81.1654798510324; Thu, 09 Jun 2022 11:15:10 -0700 (PDT) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id r14-20020a63ec4e000000b003fb0354c43asm17728049pgj.32.2022.06.09.11.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 11:15:10 -0700 (PDT) From: Prashant Malani To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Cc: bleung@chromium.org, swboyd@chromium.org, heikki.krogerus@linux.intel.com, Prashant Malani , kernel test robot , Andrzej Hajda , AngeloGioacchino Del Regno , Daniel Vetter , David Airlie , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), Greg Kroah-Hartman , Hsin-Yi Wang , Jernej Skrabec , Jonas Karlman , =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Krzysztof Kozlowski , Laurent Pinchart , Maxime Ripard , Neil Armstrong , =?UTF-8?q?N=C3=ADcolas=20F=2E=20R=2E=20A=2E=20Prado?= , Pin-Yen Lin , Robert Foss , Rob Herring , Sam Ravnborg , Thomas Zimmermann , Tzung-Bi Shih , Xin Ji Subject: [PATCH v2 2/7] usb: typec: mux: Add CONFIG guards for functions Date: Thu, 9 Jun 2022 18:09:41 +0000 Message-Id: <20220609181106.3695103-3-pmalani@chromium.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220609181106.3695103-1-pmalani@chromium.org> References: <20220609181106.3695103-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are some drivers that can use the Type C mux API, but don't have to. Introduce CONFIG guards for the mux functions so that drivers can include the header file and not run into compilation errors on systems which don't have CONFIG_TYPEC enabled. When CONFIG_TYPEC is not enabled, the Type C mux functions will be stub versions of the original calls. Reported-by: kernel test robot Signed-off-by: Prashant Malani --- Changes since v1: - Added static inline to stub functions. - Updated function signature of stub functions from "struct typec_mux" to "struct typec_mux_dev" in accordance with updates from commit 713fd49b430c ("usb: typec: mux: Introduce indirection") include/linux/usb/typec_mux.h | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h index ee57781dcf28..9eda6146fd26 100644 --- a/include/linux/usb/typec_mux.h +++ b/include/linux/usb/typec_mux.h @@ -58,6 +58,8 @@ struct typec_mux_desc { void *drvdata; }; +#if IS_ENABLED(CONFIG_TYPEC) || IS_MODULE(CONFIG_TYPEC) + struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode, const struct typec_altmode_desc *desc); void typec_mux_put(struct typec_mux *mux); @@ -76,4 +78,40 @@ void typec_mux_unregister(struct typec_mux_dev *mux); void typec_mux_set_drvdata(struct typec_mux_dev *mux, void *data); void *typec_mux_get_drvdata(struct typec_mux_dev *mux); +#else + +static inline struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode, + const struct typec_altmode_desc *desc) +{ + return ERR_PTR(-EOPNOTSUPP); +} + +static inline void typec_mux_put(struct typec_mux *mux) {} + +static inline int typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state) +{ + return -EOPNOTSUPP; +} + +static inline struct typec_mux * +typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc) +{ + return ERR_PTR(-EOPNOTSUPP); +} + +static inline struct typec_mux_dev * +typec_mux_register(struct device *parent, const struct typec_mux_desc *desc) +{ + return ERR_PTR(-EOPNOTSUPP); +} +static inline void typec_mux_unregister(struct typec_mux_dev *mux) {} + +static inline void typec_mux_set_drvdata(struct typec_mux_dev *mux, void *data) {} +static inline void *typec_mux_get_drvdata(struct typec_mux_dev *mux) +{ + return ERR_PTR(-EOPNOTSUPP); +} + +#endif /* CONFIG_TYPEC */ + #endif /* __USB_TYPEC_MUX */ -- 2.36.1.476.g0c4daa206d-goog