Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1760193iog; Tue, 14 Jun 2022 12:41:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjpr0ctgxVn0erBsYy1R1GFJ3owQMT1+98TQKpq9DFyDXLU+9nBLkDq43LB8n8veEzuPoI X-Received: by 2002:aa7:c508:0:b0:42d:cc6b:df80 with SMTP id o8-20020aa7c508000000b0042dcc6bdf80mr8110134edq.393.1655235702699; Tue, 14 Jun 2022 12:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655235702; cv=none; d=google.com; s=arc-20160816; b=oZyTF1Vh2N7x57fhZuhMSYxvlf8DRy4ckRfBi+aFIg2iEGKYUFubXFXYVWgBR/Uoy9 MjBl9eumO13h+qSm8RUNaRMMZTlPWbxhJHllVRfn1HEPMXV2gjQlGQr6JHAJH2g0buxq mTNwojIWnjNrgmQmfneNq80QjarEph1o9lh28JzkOWrwR4tTwKogoJPznSflrFj8w6e7 dMKQhlI0o44RkPIj9HDxl0CjyH3KN2XvShtiLdY8CoF3kfCeSqikSEO4VKHhvo08a1Zj tU9sWAbFPBqOxRFMnqGnA/w2tR/wPh19n9u7qiMRAmibbDygu/wFdRg4rNtxJ6XU3i/R GCcQ== 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=X4y09CKhEKSaAIT/j96bs/qEeHv9usgEjzmQybc1t0A=; b=Ea4Kn+qjR/jOkmMsW7aI7dYL9giJgnKC0lq5XeuiSeS62Zf3QnM9nedr0hVNVa25wW a5z6Q9PXHIT5ZKNECSRpmc3g1AiLjRbY9vqs6+CG2EOOLj80QQGyDjo1EELQbyBWWt0+ ewBxKMbTUW4ml3ElLMieEZI1quPHI0X27NUU9OTooZNnB4CSOG+CVdOyB+3mpTMXSaea vZN109/h1wWRyDD7Y4LlFnz61aeanfVGT08ExVcXF3l5BL7Mza70IOBewA8RLO0PY91k G8+T5XnTr6JxQ/jA8ufgKKruTCnHu2x//2sOtUtqfDM1/viamAUZbaSQN2wFfecxBbs+ 3kKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=CtlXGh7a; 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 jg7-20020a170907970700b006fe98e19840si14997107ejc.733.2022.06.14.12.41.13; Tue, 14 Jun 2022 12:41:42 -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=CtlXGh7a; 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 S239402AbiFNTkD (ORCPT + 99 others); Tue, 14 Jun 2022 15:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235668AbiFNTkC (ORCPT ); Tue, 14 Jun 2022 15:40:02 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41514275E8 for ; Tue, 14 Jun 2022 12:40:01 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id e11so9456346pfj.5 for ; Tue, 14 Jun 2022 12:40:01 -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=X4y09CKhEKSaAIT/j96bs/qEeHv9usgEjzmQybc1t0A=; b=CtlXGh7aAuuavGs8UilVy+VnypIwaHyMERCE9mfQ1Fz7il/9JQIR0SPkAP4hwFL5Hs J1PBuztOxKvrn96WWxvUtSLLgzGBgW0O/eBxDI8hApvB3OFqKs6tu6NkWNyEBm01bEJ6 vTvpfF/WlT+TQTbOinp9WKfXfAN2cjuRM4Gvc= 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=X4y09CKhEKSaAIT/j96bs/qEeHv9usgEjzmQybc1t0A=; b=xEPdAnolVjMqtaiuNjffVT9tB5FT5HEWja7lRDYv9aETQ66UT3rcQ+z3dWaFtQC7Mz dAEOVDavYdy40vo7D1O+GsbOud5ndQ+8m04eiKvvFkr2lRz8Hr/yILsUCkw2b3tlm4mL ayMlEDFdvlPuJ9f+r0PUJLX9U0EWwdQlGidvPGte+ZzB6lw2ZRaZGmlTCou7VDY+Zk3m Ebk3pSjfXk0nS4dDSnUMzs+O6QYssO5rMfqXp/p0QxL1ckYntuO09n0cPtrRG3LF2qFq vKKWaflkM7hV38W5coljKFkBAYPy6N9DY4CGZyEKiFeLSw2t83LxfGg1WQRumbex7Gov TKrw== X-Gm-Message-State: AOAM5303TPjMdAtu28sAAl8ww5brAsVhN702bUPYAdG5FSICFHGyIrI0 SZ3N1fqk9T53K/BS7vW1uTtyvHNhHL9JuA== X-Received: by 2002:a63:8b4b:0:b0:3fc:ea73:db40 with SMTP id j72-20020a638b4b000000b003fcea73db40mr5698179pge.399.1655235600547; Tue, 14 Jun 2022 12:40:00 -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 l21-20020a17090a409500b001df3a251cc2sm10014426pjg.4.2022.06.14.12.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 12:39:59 -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 , =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , Andrzej Hajda , 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 , Pin-Yen Lin , Robert Foss , Rob Herring , Sam Ravnborg , Thomas Zimmermann , Xin Ji Subject: [PATCH v3 2/7] usb: typec: mux: Add CONFIG guards for functions Date: Tue, 14 Jun 2022 19:34:36 +0000 Message-Id: <20220614193558.1163205-3-pmalani@chromium.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220614193558.1163205-1-pmalani@chromium.org> References: <20220614193558.1163205-1-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 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 Reviewed-by: NĂ­colas F. R. A. Prado Tested-by: NĂ­colas F. R. A. Prado Signed-off-by: Prashant Malani --- Changes since v2: - Fix up return types for some of the stubs. Remove 1 unnecessary stub in the else condition. - Remove unnecessary IS_MODULE config guard. - Added Reviewed-by and Tested-by tags. 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 | 44 ++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h index ee57781dcf28..9292f0e07846 100644 --- a/include/linux/usb/typec_mux.h +++ b/include/linux/usb/typec_mux.h @@ -58,17 +58,13 @@ struct typec_mux_desc { void *drvdata; }; +#if IS_ENABLED(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); int typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state); -static inline struct typec_mux * -typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc) -{ - return fwnode_typec_mux_get(dev_fwnode(dev), desc); -} - struct typec_mux_dev * typec_mux_register(struct device *parent, const struct typec_mux_desc *desc); void typec_mux_unregister(struct typec_mux_dev *mux); @@ -76,4 +72,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 NULL; +} + +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 0; +} + +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 */ + +static inline struct typec_mux * +typec_mux_get(struct device *dev, const struct typec_altmode_desc *desc) +{ + return fwnode_typec_mux_get(dev_fwnode(dev), desc); +} + #endif /* __USB_TYPEC_MUX */ -- 2.36.1.476.g0c4daa206d-goog