Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3412958rwa; Tue, 23 Aug 2022 04:29:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR59r2+0+SP/DYEpXlpDFTgUH9bXnA2LBFllO0vrHrkGxcu2I8MgBIcCqIAc1RIeaNcZF9xk X-Received: by 2002:a63:d55:0:b0:41c:86b0:59b5 with SMTP id 21-20020a630d55000000b0041c86b059b5mr20189396pgn.351.1661254151773; Tue, 23 Aug 2022 04:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254151; cv=none; d=google.com; s=arc-20160816; b=xdUSL9hA8XGUMsC8gMpPGjFt/ckv0KXxWChExc/mPOFZbpExROQbo8gyz5sRPzHgih Q/AfOlNVwqqLGhAdy8IRr7UH3BXgPeDa/kYr37S1rIJLjtl9WBTd5O6s3K0qEKmOqema ncaLLK38GDJiewR4glo84Dl54beZy4nXqJxPN+ljcjie9/UQBnSLEQx26elssy5pho8o HmX4hjMTm20pSRnbsH1Ffb1RGvJuJlJpsnb6gSwGHs/QghVSw5FltprqBYUL0i7ViS8I DKgrxkEnA8THvLmzrAUyXdsENBxw0jQkV/vQP2IXSiGpe3GtPWGu1esiPGp0lXPan33l pIRw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7lxl0vW6ihhq31086O/riRFYrjdcp5gZzvuKagBfOo0=; b=BBFU7IpjXC98wquHYg9uzyJr8Cufb2HWKoemn/UWHe9BZsn5Jq9fcuy18MAm3muyL6 jVDKwiRDUammxPs4AClU7cUUyDTcoLAO9DQQW+9cEG6IW7Zex+DLSRKxkZ/lTMBY7SA8 wwl8VDVK0qYlX+E/tvX6qFh565itwNCnSvwvvAGgZfVBnEs7b8OOi3ToqTJIYvap9dTo RF/S7cc6GOIUgsECjrurbZA4J4OBZSK5OohKDAfdfwtnpyAgY0mgWG5SsMyuL9gAlSMJ IGIkb1adfvhwWU03JD9wlUqC8Jnz3pp7DI4+b7z1P4GtJ6O9fAq6VBIyaveZh0JBBGyF 7pOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QtFRCMhx; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn3-20020a056a00340300b00536fd1adab2si1477189pfb.378.2022.08.23.04.29.00; Tue, 23 Aug 2022 04:29:11 -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=@linuxfoundation.org header.s=korg header.b=QtFRCMhx; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348991AbiHWJNv (ORCPT + 99 others); Tue, 23 Aug 2022 05:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348822AbiHWJKy (ORCPT ); Tue, 23 Aug 2022 05:10:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB0F574E18; Tue, 23 Aug 2022 01:31:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 30FB4B81C20; Tue, 23 Aug 2022 08:30:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82C7CC433C1; Tue, 23 Aug 2022 08:30:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243425; bh=9yq06iy7wO79sD8w+W4l8pQHAI+xo3r+nkuC6o1BkqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QtFRCMhxHx/B8OCV10ZeAN4vQ7Kz1JBg+816tXQGTs/nF0Dhaqv9Uif44AY6damim w3cQfAwXUFlq4qG0a1OXKry2pgU+kUP6A1bh+pATnYGyp8suFzsbte9uYtNepUiUSm evLGsLgDJjNO5J6Y8u33pyMq9pJmPQqSS4e6PRIA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Heikki Krogerus , AngeloGioacchino Del Regno , Prashant Malani , Sasha Levin Subject: [PATCH 5.19 274/365] usb: typec: mux: Add CONFIG guards for functions Date: Tue, 23 Aug 2022 10:02:55 +0200 Message-Id: <20220823080129.624882306@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Prashant Malani [ Upstream commit a37599ebfb656c2af4ca119de556eba29b6926d6 ] 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 Reviewed-by: Heikki Krogerus Reviewed-by: AngeloGioacchino Del Regno Tested-by: NĂ­colas F. R. A. Prado Signed-off-by: Prashant Malani Link: https://lore.kernel.org/r/20220615172129.1314056-3-pmalani@chromium.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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.35.1