Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp426679imj; Thu, 7 Feb 2019 06:30:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IYNuQEuwWBivhm88WO9RNdCL2Mfs1XeDX8YbNhQoKzzVb934nVMSUgwwI7MFHIaSAAClbCA X-Received: by 2002:a62:546:: with SMTP id 67mr16089750pff.99.1549549806096; Thu, 07 Feb 2019 06:30:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549549806; cv=none; d=google.com; s=arc-20160816; b=H6kFCEu8Ey4n7WzvwP1PnbU5j8HkpaLL/pwU4zisDCitDz7iuYP5U2t1Yhp1IUQuqf 9i0+372v2OPc8liajh/1bboboQekkuO3j7HccdEkHl1EOcSlhrJItmvIDzfH0RuOP6mW xmmOmUDVnvw8d1AqV9Qn/Q1LbiuvZBtNC2zsM2UD4rIDQnlM1tw85GUqOwm/XaDZBoHS Immi4IWm0G0E4L5fxLYRCeKOOilBve7+rqBSz5B//VooDO22+FoLQnDcOfdgnugyzBuA emKDj5sfADFEy62PMEFncdMZn638T3QjqDRHgIy9SKVYBVIraHsuOBCNjfwc48J48A5X DpMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zQJdMMykYHDfljm6uWNARVG+PjmFBkqIpgrJT00+vPs=; b=zfSWXJIg5SRskEiJvHARz1Qcln0VvunhfiANyAp+KR06OnpKA4NKQqwX+j/umLfYdG BfFIvvJZd/W769cD2/Km4wkxRRCB36lBuEV1FHTkeGxLRDuJE+mYMd2hddsPyAYVol35 sci8tlXfWTTC2fUMqZ8jIo2OUjcUQgvHnlOfdMyA+CEvbUagetc5QDAPj9mNupImQG2p zmf3x6rh4IVLUrv3EQY3dSTP/7cg0ub+v3qKkhZJJ/3rw7cLpUQPqbqF254dp/6QwT3Q TsZ9ulvePKKjKWFcECAy72+p4dbKHl/pt9svgmog8hjtsKFu4vHV2nGc6airk9wmAmby 2sDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g124si812927pgc.568.2019.02.07.06.29.49; Thu, 07 Feb 2019 06:30:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727263AbfBGO2z (ORCPT + 99 others); Thu, 7 Feb 2019 09:28:55 -0500 Received: from mga06.intel.com ([134.134.136.31]:45978 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726750AbfBGO2y (ORCPT ); Thu, 7 Feb 2019 09:28:54 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Feb 2019 06:28:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,344,1544515200"; d="scan'208";a="120682728" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga007.fm.intel.com with ESMTP; 07 Feb 2019 06:28:47 -0800 Received: from andy by smile with local (Exim 4.92-RC5) (envelope-from ) id 1grkfW-0006SC-8J; Thu, 07 Feb 2019 16:28:46 +0200 Date: Thu, 7 Feb 2019 16:28:46 +0200 From: Andy Shevchenko To: Mika Westerberg Cc: linux-kernel@vger.kernel.org, Michael Jamet , Yehezkel Bernat , Andreas Noever , Lukas Wunner , "David S . Miller" , netdev@vger.kernel.org Subject: Re: [PATCH v2 21/28] thunderbolt: Add support for Display Port tunnels Message-ID: <20190207142846.GH9224@smile.fi.intel.com> References: <20190206131738.43696-1-mika.westerberg@linux.intel.com> <20190206131738.43696-22-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190206131738.43696-22-mika.westerberg@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 06, 2019 at 04:17:31PM +0300, Mika Westerberg wrote: > Display Port tunnels are somewhat more complex than PCIe tunnels as it > requires 3 tunnels (AUX Rx/Tx and Video). In addition we are not > supposed to create the tunnels immediately when a DP OUT is enumerated. > Instead we need to wait until we get hotplug event to that adapter port > or check if the port has HPD set before tunnels can be established. This > adds Display Port tunneling support to the software connection manager. > +static int tb_tunnel_dp(struct tb *tb, struct tb_port *out) > +{ > + struct tb_cm *tcm = tb_priv(tb); > + struct tb_switch *sw = out->sw; > + struct tb_tunnel *tunnel; > + struct tb_port *in; > + > + if (tb_port_is_enabled(out)) > + return 0; > + > + do { > + sw = tb_to_switch(sw->dev.parent); > + if (!sw) > + return 0; > + in = tb_find_unused_port(sw, TB_TYPE_DP_HDMI_IN); > + } while (!in); > + > + tunnel = tb_tunnel_alloc_dp(tb, in, out); > + if (!tunnel) { > + tb_port_dbg(out, "DP tunnel allocation failed\n"); > + return -EIO; In the same way how you done for XDomains it makes sense to return here -ENOMEM. > + } > + > + if (tb_tunnel_activate(tunnel)) { > + tb_port_info(out, "DP tunnel activation failed, aborting\n"); > + tb_tunnel_free(tunnel); > + return -EIO; > + } > + > + list_add_tail(&tunnel->list, &tcm->tunnel_list); > + return 0; > +} -- With Best Regards, Andy Shevchenko