Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2074702ybf; Mon, 2 Mar 2020 01:18:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyT2nhlhzILzmaJH+Tto46nYL82M4hkp+DG/ygcySihL9O0m2JVXs+udWW76Y/sTH5tg5Y5 X-Received: by 2002:a9d:4c8c:: with SMTP id m12mr12854659otf.312.1583140682928; Mon, 02 Mar 2020 01:18:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583140682; cv=none; d=google.com; s=arc-20160816; b=zLBti88A1kC+yQUUw0DxtXrCCD+4KgKiQXvbhRUazfsoxbj0fb3EfREh9nkuzvJ94e dem3MFVu18wmtqhpDO5HGCCTbI3CJoJX8wxIJulXuCy9e+3miEHgVAKLsTh8yT1kckKE G6BAyM17DHeFYzgJnYoupxL73mFMbFKmXBdaWEx8gkp8zXNLKeFFHTnc8TKvwl9MKVPV GHH5t5mTBvzgJIPqTNsTy7sIBweYHiDg9gWUkQTdWGlEfoWMK6VvamhQxk6mTUjfqttf WDsAy4mY+gEfxsxLonxk9HuLK0fDAblZVaHXBmtBwhACBlKSgOXtZZlXgrBAqrhXQGG0 U89g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=tfVcSnEpBmTntXbcMlNcyVgiwMNnB3bwYu1E27LqEVI=; b=q2z4s9k5iVqtWNBKCASgVBRBElb+/iJxQ6yfrrPX8q5WlTeXL/wpB3E+ZNU2UJ4Dq2 mLhhkDrRWLqBK5TTDraFl5HbFH/d/ZvLlV5Le/R2BLhUlMxOLDhorhC6UmT22CdyCsg5 3HTiGQIHjkoWlqRWMfFGT4ivVO4qggy1uwe1Rvu+D+SgarpSQkBaqU+TlBAJlwcV4fnd 0i1tGkICX+4+41GFzCZwDojCigFhUu72qofAKCyhppVKyulDS6qGmwWk15or6aW1fxIj 7U8e+B7s7oU32KUSY/M9J8OPNRfyvTm0RyDZR7HLNwdIa1U2VVevun73x4qEy1XlOz5H 9ONA== 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 e21si6368729oti.124.2020.03.02.01.17.50; Mon, 02 Mar 2020 01:18:02 -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 S1727032AbgCBJRn (ORCPT + 99 others); Mon, 2 Mar 2020 04:17:43 -0500 Received: from mga14.intel.com ([192.55.52.115]:47928 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726144AbgCBJRn (ORCPT ); Mon, 2 Mar 2020 04:17:43 -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; 02 Mar 2020 01:17:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,506,1574150400"; d="scan'208";a="351500767" Received: from kuha.fi.intel.com ([10.237.72.53]) by fmsmga001.fm.intel.com with SMTP; 02 Mar 2020 01:17:39 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 02 Mar 2020 11:17:38 +0200 Date: Mon, 2 Mar 2020 11:17:38 +0200 From: Heikki Krogerus To: Peter Chen Cc: Greg Kroah-Hartman , Benson Leung , Prashant Malani , Mika Westerberg , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , Felipe Balbi , Chunfeng Yun , Bin Liu Subject: Re: [PATCH v2 5/9] usb: roles: Provide the switch drivers handle to the switch in the API Message-ID: <20200302091738.GB22243@kuha.fi.intel.com> References: <20200224121406.2419-1-heikki.krogerus@linux.intel.com> <20200224121406.2419-6-heikki.krogerus@linux.intel.com> <20200224131442.GA5365@b29397-desktop> <20200302062302.GE3834@b29397-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200302062302.GE3834@b29397-desktop> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 02, 2020 at 06:22:59AM +0000, Peter Chen wrote: > > > @@ -613,9 +613,10 @@ static enum usb_role ci_usb_role_switch_get(struct device *dev) > > > return role; > > > } > > > > > > -static int ci_usb_role_switch_set(struct device *dev, enum usb_role role) > > > +static int ci_usb_role_switch_set(struct usb_role_switch *sw, > > > + enum usb_role role) > > > { > > > - struct ci_hdrc *ci = dev_get_drvdata(dev); > > > + struct ci_hdrc *ci = usb_role_switch_get_drvdata(sw); > > > struct ci_hdrc_cable *cable = NULL; > > > enum usb_role current_role = ci_role_to_usb_role(ci); > > > enum ci_role ci_role = usb_role_to_ci_role(role); > > > @@ -1118,6 +1119,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) > > > } > > > > > > if (ci_role_switch.fwnode) { > > > + ci_role_switch.driver_data = ci; > > And chipidea code, better change it like cdns3's, otherwise, the > switch desc for all controllers have the same driver_data. That I'll skip after all... Note that since the context of the switch descriptor is always copied during registration, the driver_data is not going to be the same for every switch. The structure is actually filled in two separate functions, so the change is not straightforward. We can still change that of course, but it's out side the scope of this series, so it needs to be done separately. thanks, -- heikki