Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1681457rwb; Sun, 14 Aug 2022 09:24:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR7OIJN00lGV1Ck/TbF2qkqMOCSoKI1KOqFWjvvKG4mqRiqnewtVIjZ08AJa4QsAyJSYeid0 X-Received: by 2002:a17:902:820d:b0:16e:c853:ddd1 with SMTP id x13-20020a170902820d00b0016ec853ddd1mr13153997pln.31.1660494256665; Sun, 14 Aug 2022 09:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660494256; cv=none; d=google.com; s=arc-20160816; b=SyCXDTz1UPpokavoFsP2QtdyWo6QpbLXWuucXKHxvXRK9+A3v6SgF4++yD5f1YeC07 x3u89tM3vq9XnIgQ0CEBoZerQt0Fs4tqHLYAxIlneFZXR4P8r91wKM858LFcMi5tpsi/ PBtYZATIU4qoO97TTquXaWkb78J24RpZRAPmFGUDmoBqRayo2Q6x7UOMAEcZVaGJl15R AfIPmcPaE9+sg+bhaSDnG8a/63Ra+Zxli7SN+0U+OY54ugvK1VqGsRVKCjmkUPO+nYe1 ACCMM4ohj7XrD3VKQW1pxSdCYvY1gPx4niyu4HgEg4eeS6eDo86BClov+b1EgFscl24N LUOg== 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=7lxl0vW6ihhq31086O/riRFYrjdcp5gZzvuKagBfOo0=; b=qMsxUbmZlHOUEKoz9l0tJVbvSmPJPOxM8VjzS71elmcWPgfTLatSIRMwTWbbjPrgBD vM9WvBujqvQt1ZTjrx6acwipt/jbDhWpb0mboY7VW74g7S+vxassVGs7pP402UOU1Hvi GjI6N+CcMUHh24x0pemZH2IDUZdOVYZ30BI9iQmcOYgw/n1N77t1sVfzfQnqOq6pQpGv /VFI9myQ1RQc0ysaOYbin2Fzo0GnT3ZHcHG5NaBGBw4N7P4Scm4jh0wltafBXLFsly4Y Dp9JdqiHhslN/b32iQaUh0vviUjbmZ5rPKwZ3r6CGHqijF17qfRwRV8v/+wYEALmNci+ uZpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Qphc0YdR; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t3-20020a170902a5c300b0016c759a35c7si7605205plq.317.2022.08.14.09.24.06; Sun, 14 Aug 2022 09:24:16 -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=@kernel.org header.s=k20201202 header.b=Qphc0YdR; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240220AbiHNP3U (ORCPT + 99 others); Sun, 14 Aug 2022 11:29:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239999AbiHNP2i (ORCPT ); Sun, 14 Aug 2022 11:28:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74A30B7DF; Sun, 14 Aug 2022 08:28:37 -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 22E73B80B78; Sun, 14 Aug 2022 15:28:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3AE1C433D6; Sun, 14 Aug 2022 15:28:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660490914; bh=9yq06iy7wO79sD8w+W4l8pQHAI+xo3r+nkuC6o1BkqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qphc0YdRT5V2R2dHQCjZIJXei/RSA/7eWEWHZrIcQ/zTFzuG6XSZBqqXHAjLLQl/0 e5nyygBilO384mMY7SxrLTGqkd08YiJsGLah4k0qUOEIcjkQCJ5eidVUctrEK1OMee StvtprunMZfIZPJL0NXhS9v/73NFJlrVx5SRuNKztreAHQkPO+Wl2C02rMmhBhdi84 2ld/g0qfxdjfYIPx0gadOila837CVt/mSyXg1pEKswBtZzPTo18rai7cHDUdg6VNxC XTzXPUeicDXUgFIZX89N9q7fAC+IR4y5/6F8GuVkxrsYGD6YJleRf0Is/sQwxcvGVn /EZxXg03WvfdA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Prashant Malani , kernel test robot , =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , Heikki Krogerus , AngeloGioacchino Del Regno , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 19/64] usb: typec: mux: Add CONFIG guards for functions Date: Sun, 14 Aug 2022 11:23:52 -0400 Message-Id: <20220814152437.2374207-19-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814152437.2374207-1-sashal@kernel.org> References: <20220814152437.2374207-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=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