Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3496632imu; Sun, 11 Nov 2018 16:26:05 -0800 (PST) X-Google-Smtp-Source: AJdET5fAQF77BbYv1EBsNyXjqLdOrzwiUMlmYaNoRRnidkyRToRN0qoC5CaiIW8MsFQgNHcInomY X-Received: by 2002:a65:5a8e:: with SMTP id c14mr15510273pgt.137.1541982365732; Sun, 11 Nov 2018 16:26:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541982365; cv=none; d=google.com; s=arc-20160816; b=kT/q9vUEp0IqV5/fy0QSHojs+k+n2l4QYRyUoWThjpFtcqWoGJsVKxgrr2W6SJzNeU 7/bhERxF8L+8FBG1fMEw9ZXgrpEwuJSm1oH62xkrifv9TgcsgRrRBjpnNx7nK1uOROIE mIscOFxhnq+vDXkgcQ+EkewHNVuC369dwEmOmHpEWMwa68mwFohnhbIKOm+ESHbLYoQx 2KEbTgRPQ1/Lfaf0oSbaKYly+Uy6R2L37Lz8eN6FvtLeToxKLfaWMtTurlinwcOitTXf AXk/eKMDiencvkyKi/kOISdKS/0D8Hf8LeJqBpNy8p0kTtaZlsMiviFhtCaO6yJ7KISB +jxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :in-reply-to:subject:to:user-agent:organization:from:date:message-id :content-transfer-encoding:mime-version:dkim-signature:dkim-filter; bh=AYCvgoA9d0i5Aij4Ehtl3yejkwMGn2Di94odI+wUa+4=; b=OKJDaFmUNW/2aiAvY7QMU2RfsJDf6o+kTmUfpTjgMAO1eYLFXelUK472D7tjzxBWD0 DQ77HP3mSZZcG4tE7gAL+BEW9z/pTZTzpEj8Kh+TXUDVZC1ghAlJj/dUxvh9RiM4alVu jcS7mvdCAlF45JVm+x1wVsvJE6lyQ+cuU4tqrKjOIzSHOzNC1y7bpa3GNxn5CU9W45y5 jey1o4BRDhAKAVNFAu84bMt7f/NAh+Jcy34QEXlH7bHPA1QXiNk0E/jk+YWHjR3EwkAJ xaLOr/rS5WSVGQdxbdRsUkf/9oGgN0vg4vRMziVnFRF6OQ1pFZMenHJTqlRbG4e0X17y 6wMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="fk78/3Wm"; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h65-v6si17200031pfc.62.2018.11.11.16.25.49; Sun, 11 Nov 2018 16:26:05 -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=@samsung.com header.s=mail20170921 header.b="fk78/3Wm"; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729737AbeKLKOj (ORCPT + 99 others); Mon, 12 Nov 2018 05:14:39 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:52822 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727287AbeKLKOj (ORCPT ); Mon, 12 Nov 2018 05:14:39 -0500 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20181112002404epoutp03d2ce731afbd8d65bf5980a4234ff89a4~mOK6Y61kQ2889028890epoutp03i; Mon, 12 Nov 2018 00:24:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20181112002404epoutp03d2ce731afbd8d65bf5980a4234ff89a4~mOK6Y61kQ2889028890epoutp03i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1541982245; bh=AYCvgoA9d0i5Aij4Ehtl3yejkwMGn2Di94odI+wUa+4=; h=Date:From:To:Subject:In-reply-to:References:From; b=fk78/3WmPJYkRBN0wviQr8o1cXeTZror9O2wjDmourv83M5x8ptgS/9zw2bnSosaU XG+1yJ/jrrvEEfGq9UDWbbEiUKhroxG3dDxwHCZDZgfQLgqggOCAPjSIRbNSk2hhfB Rvlrd0NuoWfE1vFfZ4OAapsOIAHNgfSO6HFst5Pk= Received: from epsmges2p3.samsung.com (unknown [182.195.40.152]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20181112002402epcas1p3695f03b89f9fc3f5ee4d298d96cd44f0~mOK4JK7Bf0373903739epcas1p3K; Mon, 12 Nov 2018 00:24:02 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 13.66.04218.228C8EB5; Mon, 12 Nov 2018 09:24:02 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20181112002402epcas2p2e68d2a9b6c5996677d1654dfed0a7ddf~mOK3p31dR1994119941epcas2p2l; Mon, 12 Nov 2018 00:24:02 +0000 (GMT) X-AuditID: b6c32a47-be1ff7000000107a-bc-5be8c822c206 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 5E.5B.03702.128C8EB5; Mon, 12 Nov 2018 09:24:01 +0900 (KST) MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; charset="UTF-8" Received: from [10.113.63.77] by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PI200HHZ141DH50@mmp1.samsung.com>; Mon, 12 Nov 2018 09:24:01 +0900 (KST) Message-id: <5BE8C821.5080002@samsung.com> Date: Mon, 12 Nov 2018 09:24:01 +0900 From: Chanwoo Choi Organization: Samsung Electronics User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 To: Andy Shevchenko , MyungJoo Ham , linux-usb@vger.kernel.org, Felipe Balbi , Guenter Roeck , Heikki Krogerus , Roger Quadros , linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Sebastian Reichel , linux-omap@vger.kernel.org, Darren Hart , platform-driver-x86@vger.kernel.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Chen-Yu Tsai , Hans de Goede Subject: Re: [PATCH v1 2/5] extcon: Return -EPROBE_DEFER when extcon device is not found In-reply-to: <20181110181101.24557-2-andriy.shevchenko@linux.intel.com> X-Brightmail-Tracker: H4sIAAAAAAAAA01Sa0hTYRjm29m5KK2OM/XDbutgYCtrc80+I8vK6lRCRj+K/GEnPai5Gzub ZAVNJatRVoQGmplpsmakeUvzVsu0u9gFhcowxVYE3aSSsDrbKfLf8z7v8368z/O9FKasI8Kp TJONt5o4A0MEyptvL4yJYu56kzWV1eHoRN5ZGeopGCWRs0KD8itrCfShV6ScNa1y9PTGOQKV Vp2Uo68nugG6WH0YQ6MVD2XoRa6LQDXtXgyVjRdh6PgbNXrQZkMTnj5ZfBBb96YGZxtcarbe fYxgz9/bxnaVXSHZj53PCbb1u4NkCxvdgO0dvC5jv9bPTQrclbUyg+fSeKuKN6Wa0zJN6XHM lu0p61L0MRptlDYWLWdUJs7IxzEJiUlRGzINohlGlc0Z7CKVxAkCs3TVSqvZbuNVGWbBFsfw ljSDJdayROCMgt2UviTVbFyh1Wii9aJwd1ZGXn4TaXEz++50eYADnJ3tBAEUpJfBkqEm0gkC KSXdAuD48DdMKr4DWOmYIP6p+p7041KjDcALv1pwX0NBB8EfZ4bkTkBRGD0Pdj/J8tEYvRA2 tdWSPqykXwH47DKQ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7lvAyLyKUTK1oDg3PbfYqMAoL7Vcrzgxt7g0L10vOT93EyMwwrYd1urfwfh4SfwhRgEO RiUe3obyF9FCrIllxZW5hxglOJiVRHj/HgAK8aYkVlalFuXHF5XmpBYfYpTmYFES5+XPPxYp JJCeWJKanZpakFoEk2Xi4JRqYMzv9XG42NpypPiQJeubKJYd/JGPAj6mZ1rUdlUGzzl/hWve VvPJmzdfis3mfdEwUXmezjWTr4Z5lr++SaWzerxcMG0Vk8Mf1X7ZA2l/M+uP9krHP+eeGx3y 1nevCIedqpH4I96fL5a1vJ+44JqsbWPoxibnFdEen7Tb9xRteBLYVL98E4eRjxJLcUaioRZz UXEiACmlBq2sAgAA X-CMS-MailID: 20181112002402epcas2p2e68d2a9b6c5996677d1654dfed0a7ddf X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20181110181155epcas2p1ac9bffb2dc7dd6337db5c37f8a87bd5e References: <20181110181101.24557-1-andriy.shevchenko@linux.intel.com> <20181110181101.24557-2-andriy.shevchenko@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On 2018년 11월 11일 03:10, Andy Shevchenko wrote: > All current users of extcon_get_extcon_dev() API considers > an extcon device a mandatory to appear. Thus, they all convert > NULL pointer to -EPROBE_DEFER error code. > > There is one more caller anticipated with the same requirements. > > To decrease a code duplication and a burden to the callers, > return -EPROBE_DEFER directly from extcon_get_extcon_dev(). > > Signed-off-by: Andy Shevchenko > --- > drivers/extcon/extcon-axp288.c | 4 ++-- > drivers/extcon/extcon.c | 2 +- > drivers/power/supply/axp288_charger.c | 8 ++++---- > drivers/usb/phy/phy-omap-otg.c | 6 +++--- > drivers/usb/typec/tcpm/fusb302.c | 4 ++-- > 5 files changed, 12 insertions(+), 12 deletions(-) Acked-by: Chanwoo Choi Best Regards, Chanwoo Choi > > diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c > index a983708b77a6..3472d3b756ed 100644 > --- a/drivers/extcon/extcon-axp288.c > +++ b/drivers/extcon/extcon-axp288.c > @@ -360,8 +360,8 @@ static int axp288_extcon_probe(struct platform_device *pdev) > name = acpi_dev_get_first_match_name("INT3496", NULL, -1); > if (name) { > info->id_extcon = extcon_get_extcon_dev(name); > - if (!info->id_extcon) > - return -EPROBE_DEFER; > + if (IS_ERR(info->id_extcon)) > + return PTR_ERR(info->id_extcon); > > dev_info(dev, "controlling USB role\n"); > } else { > diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c > index 5ab0498be652..2bd0f2f33f05 100644 > --- a/drivers/extcon/extcon.c > +++ b/drivers/extcon/extcon.c > @@ -884,7 +884,7 @@ struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name) > if (!strcmp(sd->name, extcon_name)) > goto out; > } > - sd = NULL; > + sd = ERR_PTR(-EPROBE_DEFER); > out: > mutex_unlock(&extcon_dev_list_lock); > return sd; > diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c > index 735658ee1c60..8558577fccf5 100644 > --- a/drivers/power/supply/axp288_charger.c > +++ b/drivers/power/supply/axp288_charger.c > @@ -768,17 +768,17 @@ static int axp288_charger_probe(struct platform_device *pdev) > info->regmap_irqc = axp20x->regmap_irqc; > > info->cable.edev = extcon_get_extcon_dev(AXP288_EXTCON_DEV_NAME); > - if (info->cable.edev == NULL) { > + if (IS_ERR(info->cable.edev)) { > dev_dbg(&pdev->dev, "%s is not ready, probe deferred\n", > AXP288_EXTCON_DEV_NAME); > - return -EPROBE_DEFER; > + return PTR_ERR(info->cable.edev); > } > > if (acpi_dev_present(USB_HOST_EXTCON_HID, NULL, -1)) { > info->otg.cable = extcon_get_extcon_dev(USB_HOST_EXTCON_NAME); > - if (info->otg.cable == NULL) { > + if (IS_ERR(info->otg.cable)) { > dev_dbg(dev, "EXTCON_USB_HOST is not ready, probe deferred\n"); > - return -EPROBE_DEFER; > + return PTR_ERR(info->otg.cable); > } > dev_info(&pdev->dev, > "Using " USB_HOST_EXTCON_HID " extcon for usb-id\n"); > diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c > index ee0863c6553e..605314ddcd3d 100644 > --- a/drivers/usb/phy/phy-omap-otg.c > +++ b/drivers/usb/phy/phy-omap-otg.c > @@ -91,12 +91,12 @@ static int omap_otg_probe(struct platform_device *pdev) > int ret; > u32 rev; > > - if (!config || !config->extcon) > + if (!config) > return -ENODEV; > > extcon = extcon_get_extcon_dev(config->extcon); > - if (!extcon) > - return -EPROBE_DEFER; > + if (IS_ERR(extcon)) > + return PTR_ERR(extcon); > > otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL); > if (!otg_dev) > diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c > index 43b64d9309d0..6d332066202b 100644 > --- a/drivers/usb/typec/tcpm/fusb302.c > +++ b/drivers/usb/typec/tcpm/fusb302.c > @@ -1767,8 +1767,8 @@ static int fusb302_probe(struct i2c_client *client, > */ > if (device_property_read_string(dev, "fcs,extcon-name", &name) == 0) { > chip->extcon = extcon_get_extcon_dev(name); > - if (!chip->extcon) > - return -EPROBE_DEFER; > + if (IS_ERR(chip->extcon)) > + return PTR_ERR(chip->extcon); > } > > chip->vbus = devm_regulator_get(chip->dev, "vbus"); >