Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3581572imj; Tue, 12 Feb 2019 00:52:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IahycZQwQm/2gGRRoetRo0/n2CWFNWG5ws90A/S6ZpdnFXV3ohqV49W6S8pUQdlfRJf48fT X-Received: by 2002:a63:b447:: with SMTP id n7mr2612673pgu.401.1549961541279; Tue, 12 Feb 2019 00:52:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549961541; cv=none; d=google.com; s=arc-20160816; b=Stpp/HYUUv/FCqa/fbtkTs8/VpJX7oicnB6DrcqLJ8LoOEi9pZAH+SwtmQJ8+n802y HHrorxd/bKO+Bk8cnkoQcO652DCXD07xZu7epINmD8Kc5sU95GRQsb6UHL86wloP+IIW qkJym3fT73ALqG3ABDtuzGH3oaBniv2CjFZpOSp1ZXHAvyoDt4un29YeGGpJPj6GgLyz 8C5M0tEIl9nFL9k9lx8tAsExNkmfNNZf3iXoHe12hpy8EDoDii9hrMkaoF5cItuJym0J jvOyPgn2CMDnpEMjzevJPS+2gHQWdVRjK+LUyZIcrVX39SxVZ8r5BnVVyqdaRmSO1QhW oO7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=UR2DHhS6igQibOTccKF1qYzRKB02x/IdFAZ2GpqTric=; b=jMvUjJYt7HP1EY2WJEHpT4soolp52hAQwh3Vj5etGe6cCOTDWT4PBEGGdMv7Ndw5mW Y30wNvTCcgWXOBtZMp44WW2yD2PCicJ5IIjb6eMquC6wbaHDkvYBcbKNIMCBUx0r3osX 4BIY2ym/oSqPJ4uLVsR2vHH7uPHv+/37xAyDYaXwmfil0iOOIhxIlqHugdgTONbHTfkE 9/oUrOpghk3Jxt4RQd71pVIV6DNgi8kbOWLj0dW+m5OL24MpP8MZogW9Av/Vv5UQkRrF bqCzFo40aPThoBoypZ75OdbgDIRmtUYL33whQjSYb7qmXf9V9BqqfyOkmvyOLjStHRV6 z85g== 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 d35si4774259pla.48.2019.02.12.00.52.05; Tue, 12 Feb 2019 00:52:21 -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 S1728610AbfBLIuh (ORCPT + 99 others); Tue, 12 Feb 2019 03:50:37 -0500 Received: from mga14.intel.com ([192.55.52.115]:2256 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727234AbfBLIuh (ORCPT ); Tue, 12 Feb 2019 03:50:37 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Feb 2019 00:50:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,361,1544515200"; d="scan'208";a="146128803" Received: from kuha.fi.intel.com ([10.237.72.189]) by fmsmga001.fm.intel.com with SMTP; 12 Feb 2019 00:50:33 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 12 Feb 2019 10:50:33 +0200 Date: Tue, 12 Feb 2019 10:50:33 +0200 From: Heikki Krogerus To: Jun Li Cc: Greg Kroah-Hartman , Andy Shevchenko , Chen Yu , Hans de Goede , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 6/9] usb: roles: Find the muxes by also matching against the device node Message-ID: <20190212085033.GB32070@kuha.fi.intel.com> References: <20190130160259.46919-1-heikki.krogerus@linux.intel.com> <20190130160259.46919-7-heikki.krogerus@linux.intel.com> <20190211104629.GE16987@kuha.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Hi, On Tue, Feb 12, 2019 at 06:03:42AM +0000, Jun Li wrote: > > > return dev_fwnode(dev->parent) == fwnode; > > > > That's actually not the case. struct usb_role_switch_desc has a member for fwnode, > > and that's what we use with the actual mux device. Check > > usb_role_switch_register(): > > > > ... > > sw->dev.fwnode = desc->fwnode; > > ... > > > > Sorry for not realizing it before. > > So desc->fwnode should be initialized before do usb_role_switch_register()? > But seems usb_role_switch_desc is a read-only object so can't be set at runtime. It can. Even though usb_role_switch_register() takes read-only parameter, nothing's preventing you from passing data even from the stack (the content of the descriptor is copied in any case). Expecting the descriptor to be read-only just means it can be read-only, but it does not have to be. > usb_controller_node { > ... > usb-role-switch; > > port { > sw_provider_node: endpoint { > remote-endpoint = <&sw_consumer_node>; > }; > }; > }; > > typec_node { > ... > port { > sw_consumer_node: endpoint { > remote-endpoint = <&sw_provider_node>; > }; > }; > }; That looks roughly correct to me. thanks, -- heikki