From patchwork Thu Jun 9 18:09:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 12875890 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25D23C433EF for ; Thu, 9 Jun 2022 18:15:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 51C2712B62E; Thu, 9 Jun 2022 18:15:12 +0000 (UTC) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by gabe.freedesktop.org (Postfix) with ESMTPS id AAFF712B62B for ; Thu, 9 Jun 2022 18:15:10 +0000 (UTC) Received: by mail-pj1-x1033.google.com with SMTP id v11-20020a17090a4ecb00b001e2c5b837ccso61149pjl.3 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=tLIXFZIOXYTac7wGtotqv02ocBD/9wY2DqcK2ZTwJDpsaDqxOEuTOf63/vpmbaPCiD qgFXGdBLdVYLhylbvZmRmxJLq68+n79NB0zgbfx881ulAuQvdtinGHxUBi4e4aDv0cPa 5PSVoldcngNRY3fJKqCfaD2fSe5b5QHDsinqUj4sq50UKhUagPeWr6sakIPA0kGtyg0C FWeTaBgY4SjSWsSY9wg6wzQquU/g/P8HhsvA4f94zpZILT8YtnEF/H5Bv9z7+8ymbTkq /YentT7xWMvpycFPV3Pj4HTp4AKXQeUh8fZM6S0yquXU/7JGCDPieknYVbv49/6FCzYD aqLQ== X-Gm-Message-State: AOAM5313f0mtkzojocYIp11s9lI8OixPNpsCdxqY/ZZ0lrUoA1hX7+bk aGFAWtMVkKAnHhrTaKIb9SnLEQ== X-Google-Smtp-Source: ABdhPJyyxKehQjOB+Zv3pFD43mnT309OZvZX/yFQjg61a5xqnEbUihmeZDKxY5G0TJCdWiVeDy0Spw== 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 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heikki.krogerus@linux.intel.com, Andrzej Hajda , Neil Armstrong , David Airlie , "open list:DRM DRIVERS" , Laurent Pinchart , Krzysztof Kozlowski , Sam Ravnborg , kernel test robot , Jernej Skrabec , Tzung-Bi Shih , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Thomas Zimmermann , =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Jonas Karlman , swboyd@chromium.org, Pin-Yen Lin , Rob Herring , Maxime Ripard , Hsin-Yi Wang , Xin Ji , AngeloGioacchino Del Regno , Greg Kroah-Hartman , Robert Foss , Prashant Malani , =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 */