Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp336708ybl; Wed, 29 Jan 2020 01:14:36 -0800 (PST) X-Google-Smtp-Source: APXvYqxfAMs3JEvqIDpz03sUoe9bLbVovmPvIUIvPuxml6Qgy4zb8XAld6sdTL0BjAOQ5KmcNEeB X-Received: by 2002:aca:534f:: with SMTP id h76mr5816592oib.23.1580289276292; Wed, 29 Jan 2020 01:14:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580289276; cv=none; d=google.com; s=arc-20160816; b=AdfkawNa7+5zmA805zji48NZ2CnYxW7KylSNFhxZiNwulaiwaMWUC0vq8Y755CbpWo Pm45UtS4U7SzOl4fVpfajuBJC8WLsENBaLInoEhUnOylMXrAEq+/LdTIhVvnPJFEkjxq XqF42bXbde2E0DoG1fwP7B1SpRSIgBFPVZyN0HT6ZpkTJmYghAjsWl0hwa9Snjxafacz JEbL/siwCTRPT24pw5JBT9/nyzH75CeayNtAz9Ef5i+GIaSrtuBW6kZcGZemkzqbuKP8 2EcEbPRSxLOOWaQwBAhjpj6drzdBMoI/efaD2biIOGm+wOeRFeKxaUEiHYgQddZw4F0e qf7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=AfKsN9drip9fGF1J0qLuc6MudsZ5rcBopOsTLJQmYOU=; b=Nv8rRrYUxXSfsq2uzm9zepq7Rb6YP4OXybQ6iKZ7N6IpWBSCOaToFKYg9rClglBd2v 13G3stdLs65tKCwj+ZORcpslkBSGelg3SKE7QWlbldVWBcArkWWMT6tKOhrEUZ1ZPL5l b1tGGHGEBvhMsoz5ymcBYXIWut1oQrwXeg7NEW4wmGGFv2QLbUqIuuPghnOOV998Qiad +ijmmh19ao1++e3T036zVKtGQva9cL/UZT7QVxmA100SKovW4orE4g0vcCApTV8v7nC+ zNud0wwfwkIYEkKlRtTiLlZP1M2vo3Edamr+ougWnYucL48FWMFBfZeJOGL+b2J0jPYW BcSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=MBAooP6z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d199si823332oib.135.2020.01.29.01.14.24; Wed, 29 Jan 2020 01:14:36 -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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=MBAooP6z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726184AbgA2JNc (ORCPT + 99 others); Wed, 29 Jan 2020 04:13:32 -0500 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:17471 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725951AbgA2JNc (ORCPT ); Wed, 29 Jan 2020 04:13:32 -0500 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Wed, 29 Jan 2020 01:12:40 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Wed, 29 Jan 2020 01:13:30 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Wed, 29 Jan 2020 01:13:30 -0800 Received: from [10.19.66.205] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 29 Jan 2020 09:13:27 +0000 Subject: Re: [Patch V3 03/18] phy: tegra: xusb: Add usb-role-switch support To: Thierry Reding CC: , , , , , , , , , References: <1577704195-2535-1-git-send-email-nkristam@nvidia.com> <1577704195-2535-4-git-send-email-nkristam@nvidia.com> <20200128173244.GA2293590@ulmo> X-Nvconfidentiality: public From: Nagarjuna Kristam Message-ID: Date: Wed, 29 Jan 2020 14:45:38 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200128173244.GA2293590@ulmo> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1580289160; bh=AfKsN9drip9fGF1J0qLuc6MudsZ5rcBopOsTLJQmYOU=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=MBAooP6zorBL94Rw5yws9+pE/JuBQTCObfMRTLoCqHa7DkGpdPFUVTuyxJNMrl2Yn uNS7Ry4YpvrYeuh4Vtez6/SPp7MiOVe8GMHYaqMmNnhUptibVxL8XLaDTPUVSUepM+ AmhQ0jo5hhnn+7fnT+I4soRC6ZpbeO9ZV0MUdGO04iVKOqpITv+LRl0JqvHk6JVXzm D66WU5Mtr+iC9LEgwd+GPB9RKWzvt275lKagF6mHDNM/8HCwOmK7EOXKatldBrWuoA iWfnXwllUpw96TA64d9dVETfJIVNZQp0nIEOtTNpmDWGUk6pz9SU2gUoMXyeAxXwTM tPZGwOIA1GCeQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28-01-2020 23:02, Thierry Reding wrote: > On Mon, Dec 30, 2019 at 04:39:40PM +0530, Nagarjuna Kristam wrote: >> If usb-role-switch property is present in USB 2 port, register >> usb-role-switch to receive usb role changes. >> >> Signed-off-by: Nagarjuna Kristam >> --- >> V3: >> - Driver aborts if usb-role-switch is not added in dt forotg/peripheral >> roles. >> - Added role name strings instead of enum values in debug prints. >> - Updated arguments and variable allignments as per Thierry inputs. >> --- >> V2: >> - Removed dev_set_drvdata for port->dev. >> - Added of_platform_depopulate during error handling and driver removal. >> --- >> drivers/phy/tegra/Kconfig | 1 + >> drivers/phy/tegra/xusb.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++ >> drivers/phy/tegra/xusb.h | 3 +++ >> 3 files changed, 61 insertions(+) >> >> diff --git a/drivers/phy/tegra/Kconfig b/drivers/phy/tegra/Kconfig >> index f9817c3..df07c4d 100644 >> --- a/drivers/phy/tegra/Kconfig >> +++ b/drivers/phy/tegra/Kconfig >> @@ -2,6 +2,7 @@ >> config PHY_TEGRA_XUSB >> tristate "NVIDIA Tegra XUSB pad controller driver" >> depends on ARCH_TEGRA >> + select USB_CONN_GPIO >> help >> Choose this option if you have an NVIDIA Tegra SoC. >> >> diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c >> index f98ec39..11ea9b5 100644 >> --- a/drivers/phy/tegra/xusb.c >> +++ b/drivers/phy/tegra/xusb.c >> @@ -523,6 +523,7 @@ static int tegra_xusb_port_init(struct tegra_xusb_port *port, >> port->dev.type = &tegra_xusb_port_type; >> port->dev.of_node = of_node_get(np); >> port->dev.parent = padctl->dev; >> + port->dev.driver = padctl->dev->driver; > This looks wrong. I don't think driver's are supposed to set this > because it basically means that the device is being attached to the > driver, but in this case it doesn't get probed by the driver and in > fact the ports don't match the pad controller, so they can't really > be driven by the same driver. > > Is there any particular reason why you need this? > > Thierry Yes, port->dev.driver->owner is accessed in USB role switch driver in API usb_role_switch_get. If driver param is not updated, it causes NULL pointer exception. Based on your inputs, since this assignment is not supposed to used, I believe option available is to create a new device_driver structure and assign the same here. Please share your thoughts. - Nagarjuna