From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E92E6C04AAF for ; Tue, 21 May 2019 07:45:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C017721019 for ; Tue, 21 May 2019 07:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727010AbfEUHpR (ORCPT ); Tue, 21 May 2019 03:45:17 -0400 Received: from mailgw02.mediatek.com ([1.203.163.81]:19606 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726719AbfEUHpR (ORCPT ); Tue, 21 May 2019 03:45:17 -0400 X-UUID: abed8824c125450b9678ab85644ecc39-20190521 X-UUID: abed8824c125450b9678ab85644ecc39-20190521 Received: from mtkcas36.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1337020285; Tue, 21 May 2019 15:44:55 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 21 May 2019 15:44:54 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 21 May 2019 15:44:53 +0800 Message-ID: <1558424693.10179.374.camel@mhfsdcap03> Subject: Re: [PATCH v5 5/6] usb: roles: add USB Type-B GPIO connector driver From: Chunfeng Yun To: Heikki Krogerus CC: Rob Herring , Greg Kroah-Hartman , Mark Rutland , "Matthias Brugger" , Adam Thomson , Li Jun , "Badhri Jagan Sridharan" , Hans de Goede , Andy Shevchenko , Min Guo , , , , , , Biju Das , Linus Walleij Date: Tue, 21 May 2019 15:44:53 +0800 In-Reply-To: <20190520083151.GD1887@kuha.fi.intel.com> References: <1557823643-8616-1-git-send-email-chunfeng.yun@mediatek.com> <1557823643-8616-6-git-send-email-chunfeng.yun@mediatek.com> <20190520083151.GD1887@kuha.fi.intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon, 2019-05-20 at 11:31 +0300, Heikki Krogerus wrote: > On Tue, May 14, 2019 at 04:47:22PM +0800, Chunfeng Yun wrote: > > +static int usb_conn_probe(struct platform_device *pdev) > > +{ > > + struct device *dev = &pdev->dev; > > + struct device_node *node = dev->of_node; > > + struct device_node *remote_node; > > + struct usb_conn_info *info; > > + int ret = 0; > > + > > + info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); > > + if (!info) > > + return -ENOMEM; > > + > > + info->dev = dev; > > + info->id_gpiod = devm_gpiod_get_optional(dev, "id", GPIOD_IN); > > + if (IS_ERR(info->id_gpiod)) > > + return PTR_ERR(info->id_gpiod); > > + > > + info->vbus_gpiod = devm_gpiod_get_optional(dev, "vbus", GPIOD_IN); > > + if (IS_ERR(info->vbus_gpiod)) > > + return PTR_ERR(info->vbus_gpiod); > > + > > + if (!info->id_gpiod && !info->vbus_gpiod) { > > + dev_err(dev, "failed to get gpios\n"); > > + return -ENODEV; > > + } > > + > > + if (info->id_gpiod) > > + ret = gpiod_set_debounce(info->id_gpiod, USB_GPIO_DEB_US); > > + if (!ret && info->vbus_gpiod) > > + ret = gpiod_set_debounce(info->vbus_gpiod, USB_GPIO_DEB_US); > > + if (ret < 0) > > + info->debounce_jiffies = msecs_to_jiffies(USB_GPIO_DEB_MS); > > + > > + INIT_DELAYED_WORK(&info->dw_det, usb_conn_detect_cable); > > + > > + info->vbus = devm_regulator_get(dev, "vbus"); > > + if (IS_ERR(info->vbus)) { > > + dev_err(dev, "failed to get vbus\n"); > > + return PTR_ERR(info->vbus); > > + } > > + > > + remote_node = of_graph_get_remote_node(node, -1, 0); > > This is really not ideal. In practice this code will only work if > there is only one endpoint described for this device, or if the first > endpoint is always the one we are looking for. There is no way to > guarantee that. Yes, it is. I'll modify it as case 2, see reply [v5, 4/6] in this series. > > The code really has to walk through the entire graph, and identify the > remote endpoint it's looking for (and for that we have the boolean > device property). > > > + if (!remote_node) { > > + dev_err(dev, "failed to get remote node\n"); > > + return -ENODEV; > > + } > > + > > + info->role_sw = > > + fwnode_usb_role_switch_get(of_fwnode_handle(remote_node)); > > So fwnode_usb_role_switch_get() needs be the one that walks through > the graph, not the drivers. Otherwise every driver will do the same > exact steps (boilerplate). Here you need to be able to just pass the > node of this device, not the remote endpoint: > > info->role_sw = fwnode_usb_role_switch_get(dev_fwnode(&client->dev)); > > But why do you need that function at all? Why wouldn't > usb_role_switch_get() work? > > info->role_sw = usb_role_switch_get(&client->dev); > see reply [v5, 4/6] in this series Thanks a lot. > > + of_node_put(remote_node); > > + if (IS_ERR(info->role_sw)) { > > + dev_err(dev, "failed to get role switch\n"); > > + return PTR_ERR(info->role_sw); > > + } > > + > > + if (info->id_gpiod) { > > + info->id_irq = gpiod_to_irq(info->id_gpiod); > > + if (info->id_irq < 0) { > > + dev_err(dev, "failed to get ID IRQ\n"); > > + ret = info->id_irq; > > + goto put_role_sw; > > + } > > + > > + ret = devm_request_threaded_irq(dev, info->id_irq, NULL, > > + usb_conn_isr, USB_CONN_IRQF, > > + pdev->name, info); > > + if (ret < 0) { > > + dev_err(dev, "failed to request ID IRQ\n"); > > + goto put_role_sw; > > + } > > + } > > + > > + if (info->vbus_gpiod) { > > + info->vbus_irq = gpiod_to_irq(info->vbus_gpiod); > > + if (info->vbus_irq < 0) { > > + dev_err(dev, "failed to get VBUS IRQ\n"); > > + ret = info->vbus_irq; > > + goto put_role_sw; > > + } > > + > > + ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL, > > + usb_conn_isr, USB_CONN_IRQF, > > + pdev->name, info); > > + if (ret < 0) { > > + dev_err(dev, "failed to request VBUS IRQ\n"); > > + goto put_role_sw; > > + } > > + } > > + > > + platform_set_drvdata(pdev, info); > > + > > + /* Perform initial detection */ > > + usb_conn_queue_dwork(info, 0); > > + > > + return 0; > > + > > +put_role_sw: > > + usb_role_switch_put(info->role_sw); > > + return ret; > > +} > > thanks, > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chunfeng Yun Subject: Re: [PATCH v5 5/6] usb: roles: add USB Type-B GPIO connector driver Date: Tue, 21 May 2019 15:44:53 +0800 Message-ID: <1558424693.10179.374.camel@mhfsdcap03> References: <1557823643-8616-1-git-send-email-chunfeng.yun@mediatek.com> <1557823643-8616-6-git-send-email-chunfeng.yun@mediatek.com> <20190520083151.GD1887@kuha.fi.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190520083151.GD1887@kuha.fi.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Heikki Krogerus Cc: Mark Rutland , devicetree@vger.kernel.org, Hans de Goede , Greg Kroah-Hartman , Linus Walleij , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Biju Das , Badhri Jagan Sridharan , Andy Shevchenko , Rob Herring , linux-mediatek@lists.infradead.org, Min Guo , Matthias Brugger , Adam Thomson , linux-arm-kernel@lists.infradead.org, Li Jun List-Id: devicetree@vger.kernel.org Hi, On Mon, 2019-05-20 at 11:31 +0300, Heikki Krogerus wrote: > On Tue, May 14, 2019 at 04:47:22PM +0800, Chunfeng Yun wrote: > > +static int usb_conn_probe(struct platform_device *pdev) > > +{ > > + struct device *dev = &pdev->dev; > > + struct device_node *node = dev->of_node; > > + struct device_node *remote_node; > > + struct usb_conn_info *info; > > + int ret = 0; > > + > > + info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); > > + if (!info) > > + return -ENOMEM; > > + > > + info->dev = dev; > > + info->id_gpiod = devm_gpiod_get_optional(dev, "id", GPIOD_IN); > > + if (IS_ERR(info->id_gpiod)) > > + return PTR_ERR(info->id_gpiod); > > + > > + info->vbus_gpiod = devm_gpiod_get_optional(dev, "vbus", GPIOD_IN); > > + if (IS_ERR(info->vbus_gpiod)) > > + return PTR_ERR(info->vbus_gpiod); > > + > > + if (!info->id_gpiod && !info->vbus_gpiod) { > > + dev_err(dev, "failed to get gpios\n"); > > + return -ENODEV; > > + } > > + > > + if (info->id_gpiod) > > + ret = gpiod_set_debounce(info->id_gpiod, USB_GPIO_DEB_US); > > + if (!ret && info->vbus_gpiod) > > + ret = gpiod_set_debounce(info->vbus_gpiod, USB_GPIO_DEB_US); > > + if (ret < 0) > > + info->debounce_jiffies = msecs_to_jiffies(USB_GPIO_DEB_MS); > > + > > + INIT_DELAYED_WORK(&info->dw_det, usb_conn_detect_cable); > > + > > + info->vbus = devm_regulator_get(dev, "vbus"); > > + if (IS_ERR(info->vbus)) { > > + dev_err(dev, "failed to get vbus\n"); > > + return PTR_ERR(info->vbus); > > + } > > + > > + remote_node = of_graph_get_remote_node(node, -1, 0); > > This is really not ideal. In practice this code will only work if > there is only one endpoint described for this device, or if the first > endpoint is always the one we are looking for. There is no way to > guarantee that. Yes, it is. I'll modify it as case 2, see reply [v5, 4/6] in this series. > > The code really has to walk through the entire graph, and identify the > remote endpoint it's looking for (and for that we have the boolean > device property). > > > + if (!remote_node) { > > + dev_err(dev, "failed to get remote node\n"); > > + return -ENODEV; > > + } > > + > > + info->role_sw = > > + fwnode_usb_role_switch_get(of_fwnode_handle(remote_node)); > > So fwnode_usb_role_switch_get() needs be the one that walks through > the graph, not the drivers. Otherwise every driver will do the same > exact steps (boilerplate). Here you need to be able to just pass the > node of this device, not the remote endpoint: > > info->role_sw = fwnode_usb_role_switch_get(dev_fwnode(&client->dev)); > > But why do you need that function at all? Why wouldn't > usb_role_switch_get() work? > > info->role_sw = usb_role_switch_get(&client->dev); > see reply [v5, 4/6] in this series Thanks a lot. > > + of_node_put(remote_node); > > + if (IS_ERR(info->role_sw)) { > > + dev_err(dev, "failed to get role switch\n"); > > + return PTR_ERR(info->role_sw); > > + } > > + > > + if (info->id_gpiod) { > > + info->id_irq = gpiod_to_irq(info->id_gpiod); > > + if (info->id_irq < 0) { > > + dev_err(dev, "failed to get ID IRQ\n"); > > + ret = info->id_irq; > > + goto put_role_sw; > > + } > > + > > + ret = devm_request_threaded_irq(dev, info->id_irq, NULL, > > + usb_conn_isr, USB_CONN_IRQF, > > + pdev->name, info); > > + if (ret < 0) { > > + dev_err(dev, "failed to request ID IRQ\n"); > > + goto put_role_sw; > > + } > > + } > > + > > + if (info->vbus_gpiod) { > > + info->vbus_irq = gpiod_to_irq(info->vbus_gpiod); > > + if (info->vbus_irq < 0) { > > + dev_err(dev, "failed to get VBUS IRQ\n"); > > + ret = info->vbus_irq; > > + goto put_role_sw; > > + } > > + > > + ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL, > > + usb_conn_isr, USB_CONN_IRQF, > > + pdev->name, info); > > + if (ret < 0) { > > + dev_err(dev, "failed to request VBUS IRQ\n"); > > + goto put_role_sw; > > + } > > + } > > + > > + platform_set_drvdata(pdev, info); > > + > > + /* Perform initial detection */ > > + usb_conn_queue_dwork(info, 0); > > + > > + return 0; > > + > > +put_role_sw: > > + usb_role_switch_put(info->role_sw); > > + return ret; > > +} > > thanks, > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6722C04AAF for ; Tue, 21 May 2019 07:45:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9C0E521019 for ; Tue, 21 May 2019 07:45:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OAqV7oA0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9C0E521019 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dnRkRUnDp/e058HzkR/i3zxfP/QaK4c23964D8vKlh8=; b=OAqV7oA0h12fIs B2CZL8nn6kLRvn/0jF3nOUKxiNpv5/4YC0AzjObpBtoIxZI8t+WRCbLWyZOu8+nGmn61FnNBn6pMX icuppt5n0E+dILTf1JAUKOlkSVrhgYW6SDLPhkTv5AuSR4maq29CWxn/Ox5l8D5TlIlJdw89yBxYu BgcTHWlRl6i0q1G6AvsM191vaZ8vWmOdlu4aZZVgcAyGePwHkaRqInsg1gPTuBfyCyT/e5Xz6QWH5 KraDpgi3lTLslK2IB5KYCGWOYmuDHX5oK6mXChJvFH65S5HrmvqMRI9mHOmW24mHIpoN+EvUI7Q5k YkSyNp2bRy/FK7aC1MNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSzSO-0004m6-IC; Tue, 21 May 2019 07:45:08 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSzSI-0004Nj-5Z; Tue, 21 May 2019 07:45:04 +0000 X-UUID: 00f87ac4fa424d4c8133d4e49eff014c-20190520 X-UUID: 00f87ac4fa424d4c8133d4e49eff014c-20190520 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1223937690; Mon, 20 May 2019 23:44:58 -0800 Received: from MTKMBS31N1.mediatek.inc (172.27.4.69) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 21 May 2019 00:44:56 -0700 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31N1.mediatek.inc (172.27.4.69) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 21 May 2019 15:44:54 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 21 May 2019 15:44:53 +0800 Message-ID: <1558424693.10179.374.camel@mhfsdcap03> Subject: Re: [PATCH v5 5/6] usb: roles: add USB Type-B GPIO connector driver From: Chunfeng Yun To: Heikki Krogerus Date: Tue, 21 May 2019 15:44:53 +0800 In-Reply-To: <20190520083151.GD1887@kuha.fi.intel.com> References: <1557823643-8616-1-git-send-email-chunfeng.yun@mediatek.com> <1557823643-8616-6-git-send-email-chunfeng.yun@mediatek.com> <20190520083151.GD1887@kuha.fi.intel.com> X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190521_004502_364545_EA9963F7 X-CRM114-Status: GOOD ( 17.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Hans de Goede , Greg Kroah-Hartman , Linus Walleij , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Biju Das , Badhri Jagan Sridharan , Andy Shevchenko , Rob Herring , linux-mediatek@lists.infradead.org, Min Guo , Matthias Brugger , Adam Thomson , linux-arm-kernel@lists.infradead.org, Li Jun Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On Mon, 2019-05-20 at 11:31 +0300, Heikki Krogerus wrote: > On Tue, May 14, 2019 at 04:47:22PM +0800, Chunfeng Yun wrote: > > +static int usb_conn_probe(struct platform_device *pdev) > > +{ > > + struct device *dev = &pdev->dev; > > + struct device_node *node = dev->of_node; > > + struct device_node *remote_node; > > + struct usb_conn_info *info; > > + int ret = 0; > > + > > + info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); > > + if (!info) > > + return -ENOMEM; > > + > > + info->dev = dev; > > + info->id_gpiod = devm_gpiod_get_optional(dev, "id", GPIOD_IN); > > + if (IS_ERR(info->id_gpiod)) > > + return PTR_ERR(info->id_gpiod); > > + > > + info->vbus_gpiod = devm_gpiod_get_optional(dev, "vbus", GPIOD_IN); > > + if (IS_ERR(info->vbus_gpiod)) > > + return PTR_ERR(info->vbus_gpiod); > > + > > + if (!info->id_gpiod && !info->vbus_gpiod) { > > + dev_err(dev, "failed to get gpios\n"); > > + return -ENODEV; > > + } > > + > > + if (info->id_gpiod) > > + ret = gpiod_set_debounce(info->id_gpiod, USB_GPIO_DEB_US); > > + if (!ret && info->vbus_gpiod) > > + ret = gpiod_set_debounce(info->vbus_gpiod, USB_GPIO_DEB_US); > > + if (ret < 0) > > + info->debounce_jiffies = msecs_to_jiffies(USB_GPIO_DEB_MS); > > + > > + INIT_DELAYED_WORK(&info->dw_det, usb_conn_detect_cable); > > + > > + info->vbus = devm_regulator_get(dev, "vbus"); > > + if (IS_ERR(info->vbus)) { > > + dev_err(dev, "failed to get vbus\n"); > > + return PTR_ERR(info->vbus); > > + } > > + > > + remote_node = of_graph_get_remote_node(node, -1, 0); > > This is really not ideal. In practice this code will only work if > there is only one endpoint described for this device, or if the first > endpoint is always the one we are looking for. There is no way to > guarantee that. Yes, it is. I'll modify it as case 2, see reply [v5, 4/6] in this series. > > The code really has to walk through the entire graph, and identify the > remote endpoint it's looking for (and for that we have the boolean > device property). > > > + if (!remote_node) { > > + dev_err(dev, "failed to get remote node\n"); > > + return -ENODEV; > > + } > > + > > + info->role_sw = > > + fwnode_usb_role_switch_get(of_fwnode_handle(remote_node)); > > So fwnode_usb_role_switch_get() needs be the one that walks through > the graph, not the drivers. Otherwise every driver will do the same > exact steps (boilerplate). Here you need to be able to just pass the > node of this device, not the remote endpoint: > > info->role_sw = fwnode_usb_role_switch_get(dev_fwnode(&client->dev)); > > But why do you need that function at all? Why wouldn't > usb_role_switch_get() work? > > info->role_sw = usb_role_switch_get(&client->dev); > see reply [v5, 4/6] in this series Thanks a lot. > > + of_node_put(remote_node); > > + if (IS_ERR(info->role_sw)) { > > + dev_err(dev, "failed to get role switch\n"); > > + return PTR_ERR(info->role_sw); > > + } > > + > > + if (info->id_gpiod) { > > + info->id_irq = gpiod_to_irq(info->id_gpiod); > > + if (info->id_irq < 0) { > > + dev_err(dev, "failed to get ID IRQ\n"); > > + ret = info->id_irq; > > + goto put_role_sw; > > + } > > + > > + ret = devm_request_threaded_irq(dev, info->id_irq, NULL, > > + usb_conn_isr, USB_CONN_IRQF, > > + pdev->name, info); > > + if (ret < 0) { > > + dev_err(dev, "failed to request ID IRQ\n"); > > + goto put_role_sw; > > + } > > + } > > + > > + if (info->vbus_gpiod) { > > + info->vbus_irq = gpiod_to_irq(info->vbus_gpiod); > > + if (info->vbus_irq < 0) { > > + dev_err(dev, "failed to get VBUS IRQ\n"); > > + ret = info->vbus_irq; > > + goto put_role_sw; > > + } > > + > > + ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL, > > + usb_conn_isr, USB_CONN_IRQF, > > + pdev->name, info); > > + if (ret < 0) { > > + dev_err(dev, "failed to request VBUS IRQ\n"); > > + goto put_role_sw; > > + } > > + } > > + > > + platform_set_drvdata(pdev, info); > > + > > + /* Perform initial detection */ > > + usb_conn_queue_dwork(info, 0); > > + > > + return 0; > > + > > +put_role_sw: > > + usb_role_switch_put(info->role_sw); > > + return ret; > > +} > > thanks, > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel