From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 369B31A42D1; Tue, 3 Sep 2024 11:40:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725363644; cv=none; b=e9HBcJtc8XLcUAg1V5kNQ8i/bBFHJfdvquql79nogOiTD+v0J6TnhMNJHCkLGWpocfyhEsxY0L6irGJJpS1au8xw4SJP6jlvTD93yjuRstPZwOJnJUGEl+ITRIL3bC+q9M/9K2fcBleTdSmyve58C1Dgu+XFWPLeWr3TlV80iBo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725363644; c=relaxed/simple; bh=TiMloUZtEOzhiMiKfurPxe7QoHWBPp0gKnxyea5FPRA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DocEikGirmRrCH7ttziOoiC33wX4N9tqyQG9j/GvxdDt2w57NnTMwF8RAgUNuyegE58uDZtnbMcnT7cg/75oFvS8Tdjfvar9V87S1KCXPzVEDU9nAwu87DgKmn52P0hLJ42xNImev4Wc2v1grNr2dGgVCBw4KdS+BQm/R2nWFRI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AjcZcwAY; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AjcZcwAY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725363643; x=1756899643; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=TiMloUZtEOzhiMiKfurPxe7QoHWBPp0gKnxyea5FPRA=; b=AjcZcwAYeG7Kx27VpkPX9wgB1U6P7Jsv+J+0lFe+h2qMr9MdS+46PaqK 2Hb9BwOlIi923rvLCyUCZtkFoEZYNbvOUK2GGm1P8/xof6uQc41jutj0S PbHbZa/LrN+TABhiHwn5ZAYvt4XNMZw9HgNsodLBWm24tAq/jrM0H4pAZ EMa+0VeCVWqEJbc1s1h9BhCtZvrcM2VU15aMu0dif/K6NK3aFPbPYffF3 4o+kLvu9JaU12vkwanD47Lp1gcMXNORFbrQ5UttmgyqAfF5xTtT/9A/Kd xkPg4+U4VK+pcUpDHofwCY3QlLPrDaw95IV2r1Ty6DQ6TFvY7PcqLmDpd g==; X-CSE-ConnectionGUID: fSYLLthNQV+imubDQSaI1w== X-CSE-MsgGUID: p3RZwcYHTeaQ3ZKljvxozQ== X-IronPort-AV: E=McAfee;i="6700,10204,11183"; a="27711957" X-IronPort-AV: E=Sophos;i="6.10,198,1719903600"; d="scan'208";a="27711957" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2024 04:40:43 -0700 X-CSE-ConnectionGUID: HQD9FPlFRrCFVhb6qQT2Lg== X-CSE-MsgGUID: 02SRmlM4S3SyHIy3i8zzKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,198,1719903600"; d="scan'208";a="65389034" Received: from kuha.fi.intel.com ([10.237.72.185]) by orviesa007.jf.intel.com with SMTP; 03 Sep 2024 04:40:33 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 03 Sep 2024 14:40:32 +0300 Date: Tue, 3 Sep 2024 14:40:32 +0300 From: Heikki Krogerus To: Stephen Boyd Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, patches@lists.linux.dev, devicetree@vger.kernel.org, Douglas Anderson , Pin-yen Lin , Andrzej Hajda , Benson Leung , Conor Dooley , Daniel Vetter , David Airlie , Dmitry Baryshkov , dri-devel@lists.freedesktop.org, Guenter Roeck , Jernej Skrabec , Jonas Karlman , Krzysztof Kozlowski , Laurent Pinchart , Lee Jones , Maarten Lankhorst , Maxime Ripard , Neil Armstrong , Prashant Malani , Robert Foss , Rob Herring , Thomas Zimmermann , Tzung-Bi Shih , Alexandre Belloni , Andy Shevchenko , Daniel Scally , Greg Kroah-Hartman , Ivan Orlov , linux-acpi@vger.kernel.org, linux-usb@vger.kernel.org, Mika Westerberg , "Rafael J . Wysocki" , Sakari Ailus , Vinod Koul Subject: Re: [PATCH v4 03/18] usb: typec: Stub out typec_switch APIs when CONFIG_TYPEC=n Message-ID: References: <20240901040658.157425-1-swboyd@chromium.org> <20240901040658.157425-4-swboyd@chromium.org> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240901040658.157425-4-swboyd@chromium.org> On Sat, Aug 31, 2024 at 09:06:41PM -0700, Stephen Boyd wrote: > Ease driver development by adding stubs for the typec_switch APIs when > CONFIG_TYPEC=n. Copy the same method used for the typec_mux APIs to be > consistent. > > Cc: Heikki Krogerus > Cc: Greg Kroah-Hartman > Cc: > Cc: Pin-yen Lin > Signed-off-by: Stephen Boyd Reviewed-by: Heikki Krogerus > --- > include/linux/usb/typec_mux.h | 43 +++++++++++++++++++++++++++++++---- > 1 file changed, 38 insertions(+), 5 deletions(-) > > diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h > index 2489a7857d8e..efb5ed32b813 100644 > --- a/include/linux/usb/typec_mux.h > +++ b/include/linux/usb/typec_mux.h > @@ -3,6 +3,7 @@ > #ifndef __USB_TYPEC_MUX > #define __USB_TYPEC_MUX > > +#include > #include > #include > > @@ -24,16 +25,13 @@ struct typec_switch_desc { > void *drvdata; > }; > > +#if IS_ENABLED(CONFIG_TYPEC) > + > struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode); > void typec_switch_put(struct typec_switch *sw); > int typec_switch_set(struct typec_switch *sw, > enum typec_orientation orientation); > > -static inline struct typec_switch *typec_switch_get(struct device *dev) > -{ > - return fwnode_typec_switch_get(dev_fwnode(dev)); > -} > - > struct typec_switch_dev * > typec_switch_register(struct device *parent, > const struct typec_switch_desc *desc); > @@ -42,6 +40,41 @@ void typec_switch_unregister(struct typec_switch_dev *sw); > void typec_switch_set_drvdata(struct typec_switch_dev *sw, void *data); > void *typec_switch_get_drvdata(struct typec_switch_dev *sw); > > +#else > + > +static inline struct typec_switch * > +fwnode_typec_switch_get(struct fwnode_handle *fwnode) > +{ > + return NULL; > +} > +static inline void typec_switch_put(struct typec_switch *sw) {} > +static inline int typec_switch_set(struct typec_switch *sw, > + enum typec_orientation orientation) > +{ > + return 0; > +} > + > +static inline struct typec_switch_dev * > +typec_switch_register(struct device *parent, > + const struct typec_switch_desc *desc) > +{ > + return ERR_PTR(-EOPNOTSUPP); > +} > +static inline void typec_switch_unregister(struct typec_switch_dev *sw) {} > + > +static inline void typec_switch_set_drvdata(struct typec_switch_dev *sw, void *data) {} > +static inline void *typec_switch_get_drvdata(struct typec_switch_dev *sw) > +{ > + return ERR_PTR(-EOPNOTSUPP); > +} > + > +#endif /* CONFIG_TYPEC */ > + > +static inline struct typec_switch *typec_switch_get(struct device *dev) > +{ > + return fwnode_typec_switch_get(dev_fwnode(dev)); > +} > + > struct typec_mux_state { > struct typec_altmode *alt; > unsigned long mode; -- heikki