From patchwork Mon Jun 3 15:50:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 165623 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644917ili; Mon, 3 Jun 2019 08:52:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxAxGkBtKHrjc1UibvtNmjpQniMFEX1Wv2UC67FI8vI9dnbfg9GBfo019lE2eEnmLyq+225 X-Received: by 2002:a65:51c7:: with SMTP id i7mr29436006pgq.211.1559577129533; Mon, 03 Jun 2019 08:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577129; cv=none; d=google.com; s=arc-20160816; b=TvA1+whNOf6RLzyPcOd/Ptmc4mUZmnatXR2U6shfIewCnbVAdKQlCuMhtd9YdIBqt3 252/kz/zPkx1vYlpw5GkbhBdh1k54XRr1KbntRr1BBZ2EyMEth9Lt6rND/t1ofXzhF9V JsaaQYL2IRFFRnCbyiMVfUb+lsuVHI+vEehk8ENu5LAetvnLX5b1Qt3X/IVs6Gjrr4uT c19N5UrA4v74A4O+Mv9yGugbxHVVYC99+t8uNsgHSzZKvMP/sDVLv73SVfEf5gHQEHot B/Ks1qwcOCPiunGpnQYKkRwdWF/qIcZIZH1NDA7TaOzFosQOqn2K4MnLbSSiXjSFz0Pu UiTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=dCqgXCv4Yo3shQX+w44c8oB2KufwqjDnWPO7l97Rz9Y=; b=pZqHMkutnG/9kuPQOK1bS/1BGXsrkirJ7ShwhX6XvXgvNBZUtW58NRlmCvOO409V48 SPELiYotGrbxzPXU9rbT5Zds0Y4PKXn/wVwIViJne80LL7QCckuZBerzHRNLaWcGIwFq 3Q1HQd+CAH9S7y75OJOd7/KFcq7Kcz1CEQ02YmByML976JkjuRu43C/Pcjk9XFSId9yh N4C1BlYJlHZupcNYoD89QADvVoEV7yYRs8FRzQbGveTdRbYa37jZZ2NQDzF0b62yjg8y OV995hI+n9Ogpe5Vx3IPI9/s+gF+Y+PHYCUci86Y/Ha/t0JOxdrRr2zAWtxa57xEjC+3 jUaw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f32si2535635pje.70.2019.06.03.08.52.09; Mon, 03 Jun 2019 08:52:09 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729525AbfFCPwH (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:07 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53998 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729486AbfFCPwG (ORCPT ); Mon, 3 Jun 2019 11:52:06 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F030D15AB; Mon, 3 Jun 2019 08:52:05 -0700 (PDT) Received: from en101.cambridge.arm.com (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BD4693F246; Mon, 3 Jun 2019 08:52:04 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Heikki Krogerus , linux-usb@vger.kernel.org Subject: [RFC PATCH 44/57] drivers: usb : Use class_find_device_by_fwnode() helper Date: Mon, 3 Jun 2019 16:50:10 +0100 Message-Id: <1559577023-558-45-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559577023-558-1-git-send-email-suzuki.poulose@arm.com> References: <1559577023-558-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reuse the generic helper to find a device by fwnode handle. Cc: Greg Kroah-Hartman Cc: Heikki Krogerus Cc: linux-usb@vger.kernel.org Signed-off-by: Suzuki K Poulose --- drivers/usb/roles/class.c | 8 +------- drivers/usb/typec/class.c | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c index 3dc78cb..be9b70c 100644 --- a/drivers/usb/roles/class.c +++ b/drivers/usb/roles/class.c @@ -85,11 +85,6 @@ enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw) } EXPORT_SYMBOL_GPL(usb_role_switch_get_role); -static int switch_fwnode_match(struct device *dev, const void *fwnode) -{ - return dev_fwnode(dev) == fwnode; -} - static void *usb_role_switch_match(struct device_connection *con, int ep, void *data) { @@ -99,8 +94,7 @@ static void *usb_role_switch_match(struct device_connection *con, int ep, if (!fwnode_property_present(con->fwnode, con->id)) return NULL; - dev = class_find_device(role_class, NULL, con->fwnode, - switch_fwnode_match); + dev = class_find_device_by_fwnode(role_class, NULL, con->fwnode); } else { dev = class_find_device_by_name(role_class, NULL, con->endpoint[ep]); } diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index c11cc5f..12f9759 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -205,11 +205,6 @@ static void typec_altmode_put_partner(struct altmode *altmode) put_device(&adev->dev); } -static int typec_port_fwnode_match(struct device *dev, const void *fwnode) -{ - return dev_fwnode(dev) == fwnode; -} - static void *typec_port_match(struct device_connection *con, int ep, void *data) { struct device *dev; @@ -219,8 +214,7 @@ static void *typec_port_match(struct device_connection *con, int ep, void *data) * we need to return ERR_PTR(-PROBE_DEFER) when there is no device. */ if (con->fwnode) - return class_find_device(typec_class, NULL, con->fwnode, - typec_port_fwnode_match); + return class_find_device_by_fwnode(typec_class, NULL, con->fwnode); dev = class_find_device_by_name(typec_class, NULL, con->endpoint[ep]);