From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F718CCA47A for ; Wed, 8 Jun 2022 20:13:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232466AbiFHUN6 (ORCPT ); Wed, 8 Jun 2022 16:13:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236197AbiFHUN4 (ORCPT ); Wed, 8 Jun 2022 16:13:56 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1563640A3C for ; Wed, 8 Jun 2022 13:13:55 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id l7-20020a17090aaa8700b001dd1a5b9965so19317206pjq.2 for ; Wed, 08 Jun 2022 13:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=p8gfYTqdBB7YfKTUUZfAgLjuct5/Ju4bzHCdUHoJSiA=; b=Tcj47/AlGaRRSrZqSt+U2Kngcun7RU6+h/c8KbSrFTExCr8705QFfSZar69ezhbBAh nB1BexK4oHzvtAn+HHDZfYSXoem10OsMZgxbWGmDnBGKr3BHKbfXmOqKJiqGGr131nTh 1COslDbdB0AtHWDxsmRTjl45ecOUxwVDuAnhM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=p8gfYTqdBB7YfKTUUZfAgLjuct5/Ju4bzHCdUHoJSiA=; b=zkKGlrGetPiPfQyVioCqI+imlRbHV1EEmeGqUWHiIlSxcR/52Jy4ZKu0+3cf1l6XFp IN5NasRxKlbRc1QtHAyzuOIis9iqnZ3qUVcN4SL2Cr3Qe2gWMBWxGSuIoVEhe1FiFyC5 4Tt0qfhE8+qQFcwNUcP8VothIBvCO6vJeGvNX2c7t+PIDurGbe10xlWM0JWNqmS/aqSW 9jeYQgpNMYBvjp50szAM/85aHYY489L/KZE8Hnj/VaJ1vC7vX/BRQanbS9JfiQ7CyKuQ NRWxwgJu9bPUIrsm8ljh7qWRqw/YpQHj8fY+ER06FvoUdSE4PBDcD1WluU7TKdoem3hq GjKA== X-Gm-Message-State: AOAM532xr1+LMupFWBM2W9l24ebzl85GB2/By1qAdUij6BxppZgACKzK As1g6/HwPSXqAOirLD+skVNopmORD4+Avw== X-Google-Smtp-Source: ABdhPJwZaWsj1DFOL1VbG1L9Ph8vwcd+mQeowEgVt3g26sXa0ccQR+75qaZvjcmhPymiJXldQ2SunA== X-Received: by 2002:a17:902:ab05:b0:164:21:6802 with SMTP id ik5-20020a170902ab0500b0016400216802mr35435794plb.56.1654719234171; Wed, 08 Jun 2022 13:13:54 -0700 (PDT) Received: from chromium.org (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id a8-20020aa795a8000000b0051810d460adsm15587780pfk.114.2022.06.08.13.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 13:13:53 -0700 (PDT) Date: Wed, 8 Jun 2022 20:13:52 +0000 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, Andrzej Hajda , AngeloGioacchino Del Regno , Daniel Vetter , David Airlie , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:DRM DRIVERS" , Greg Kroah-Hartman , Hsin-Yi Wang , Jernej Skrabec , Jonas Karlman , =?iso-8859-1?Q?Jos=E9_Exp=F3sito?= , Krzysztof Kozlowski , Laurent Pinchart , Maxime Ripard , Neil Armstrong , =?iso-8859-1?Q?N=EDcolas_F=2E_R=2E_A=2E?= Prado , Pin-Yen Lin , Robert Foss , Rob Herring , Sam Ravnborg , Thomas Zimmermann , Tzung-Bi Shih , Xin Ji Subject: Re: [PATCH 2/7] usb: typec: mux: Add CONFIG guards for functions Message-ID: References: <20220607190131.1647511-1-pmalani@chromium.org> <20220607190131.1647511-3-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220607190131.1647511-3-pmalani@chromium.org> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Jun 07 19:00, Prashant Malani wrote: > 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. > > Signed-off-by: Prashant Malani > --- > 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..758d34ced1f8 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 > + > +struct typec_mux *fwnode_typec_mux_get(struct fwnode_handle *fwnode, > + const struct typec_altmode_desc *desc) > +{ > + return ERR_PTR(-EOPNOTSUPP); > +} > + > +void typec_mux_put(struct typec_mux *mux) {} > + > +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); > +} > + > +struct typec_mux * > +typec_mux_register(struct device *parent, const struct typec_mux_desc *desc) > +{ > + return ERR_PTR(-EOPNOTSUPP); > +} > +void typec_mux_unregister(struct typec_mux *mux) {} > + > +void typec_mux_set_drvdata(struct typec_mux *mux, void *data) {} > +void *typec_mux_get_drvdata(struct typec_mux *mux) > +{ > + return ERR_PTR(-EOPNOTSUPP); > +} LKP discovered some issues with static inlining as well as older (incorrect struct). [1] I will fix this in the next version. [1] https://lore.kernel.org/linux-usb/20220607190131.1647511-1-pmalani@chromium.org/T/#m571c46dce2339186967216bd5af25bcf9e6d1380 > + > +#endif /* CONFIG_TYPEC */ > + > #endif /* __USB_TYPEC_MUX */ > -- > 2.36.1.255.ge46751e96f-goog >