From patchwork Mon Jun 3 15:49:59 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: 165645 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646548ili; Mon, 3 Jun 2019 08:53:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxL9M7VQMVM9ymjbwA3890tLjNyCXvXEY++N3uwHVA5z9b89OapNPiFPV3P5WW/fcZNoFCZ X-Received: by 2002:a17:902:ac85:: with SMTP id h5mr23404006plr.198.1559577223773; Mon, 03 Jun 2019 08:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577223; cv=none; d=google.com; s=arc-20160816; b=RygbUU/yM8Aid5xpY6O+4FH9D1NeK/HHWapAxh+Z81xzgHu+r7n3surDuCaPHgsjws sr4uHbGRhejbrvF3IXwm6PbDxwAYwOoPe5pWC7rjixHq3fe6PWvi+MzXMy+y67TaEQDf BAARm+MtEjiWSiNeTCe4ULE930qRk7ftlNi1NwRTWJfEA7jVfNF0I/41UgVagRD62V/p O43M2910nQ9jlN9gHshfqc5zAEVCDxqJ8LTzPTfJo5Oyb0VFyF91fqTOpeDjZMUirOzQ 5ChMHmqrQ2gG0kzYcEpJDI5bS6hmkd2b8ou2ZDjW3gYjeQLZ/p0luD8gWZ9OAQvxaOhj dv8A== 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=HBQmtr7lr/+WkkDCUkQNvfrHojCA5Fj5Lf1lPSOugyc=; b=SMLUDDf2LsF03hwhhMeMATwNNW+OhsYWp4VOhDGCCgTuAIReUFe9lkfpLYa6t75IZ7 Kb1ic7QlsGJuq08Eai9v/FC8nKBYkxHGqqHpZ+w8psGCmFp7BSx8gJzJuXDIXtJHMGNC q4G5BWi67eVb3xfwmaMXeb8DY07pwZ6tPJ7DSpNXXGXak5LPmgyaFNxu/6P7Aon540hI rkUzl1iYQPTvJRrR3vPxTYIvI6970Esiix0frPMlIDxoW90YfL+yMgPL+MCD83GupBJT 4nrRKkBkj4t2OEDGfcioMANQ7QXv96p5o+RjEqh9Eq6deZl0qn+csw2Tlw/qwy5x/Hue /NSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-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 h187si21804126pfb.129.2019.06.03.08.53.43; Mon, 03 Jun 2019 08:53:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-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-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729701AbfFCPxm (ORCPT + 5 others); Mon, 3 Jun 2019 11:53:42 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53878 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729410AbfFCPvu (ORCPT ); Mon, 3 Jun 2019 11:51:50 -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 E332A1AED; Mon, 3 Jun 2019 08:51:49 -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 B02323F246; Mon, 3 Jun 2019 08:51:48 -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 33/57] drivers: usb: Use class_find_device_by_name() helper Date: Mon, 3 Jun 2019 16:49:59 +0100 Message-Id: <1559577023-558-34-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-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Use the new class_find_device_by_name() helper. 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 f45d8df..3dc78cb 100644 --- a/drivers/usb/roles/class.c +++ b/drivers/usb/roles/class.c @@ -90,11 +90,6 @@ static int switch_fwnode_match(struct device *dev, const void *fwnode) return dev_fwnode(dev) == fwnode; } -static int switch_name_match(struct device *dev, const void *name) -{ - return !strcmp((const char *)name, dev_name(dev)); -} - static void *usb_role_switch_match(struct device_connection *con, int ep, void *data) { @@ -107,8 +102,7 @@ static void *usb_role_switch_match(struct device_connection *con, int ep, dev = class_find_device(role_class, NULL, con->fwnode, switch_fwnode_match); } else { - dev = class_find_device(role_class, NULL, con->endpoint[ep], - switch_name_match); + dev = class_find_device_by_name(role_class, NULL, con->endpoint[ep]); } return dev ? to_role_switch(dev) : ERR_PTR(-EPROBE_DEFER); diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 2eb6238..c11cc5f 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -210,11 +210,6 @@ static int typec_port_fwnode_match(struct device *dev, const void *fwnode) return dev_fwnode(dev) == fwnode; } -static int typec_port_name_match(struct device *dev, const void *name) -{ - return !strcmp((const char *)name, dev_name(dev)); -} - static void *typec_port_match(struct device_connection *con, int ep, void *data) { struct device *dev; @@ -227,8 +222,7 @@ static void *typec_port_match(struct device_connection *con, int ep, void *data) return class_find_device(typec_class, NULL, con->fwnode, typec_port_fwnode_match); - dev = class_find_device(typec_class, NULL, con->endpoint[ep], - typec_port_name_match); + dev = class_find_device_by_name(typec_class, NULL, con->endpoint[ep]); return dev ? dev : ERR_PTR(-EPROBE_DEFER); }