From patchwork Mon Jun 3 15:49:56 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: 165618 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644551ili; Mon, 3 Jun 2019 08:51:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+5GgrsBCA4FvavfcK0JQCVcltGby4HaT+llQUVySTVr28xiZOVegVuG8JDzo6mJmmnvxa X-Received: by 2002:aa7:8e45:: with SMTP id d5mr23052984pfr.172.1559577107269; Mon, 03 Jun 2019 08:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577107; cv=none; d=google.com; s=arc-20160816; b=AlDOHWwMmQnwCqbMQYLgnFdnZqoyiaE/SD9U1/ZEOdV2SRSX2nXrqED3YX2csOT+Yi q1rgETkAdXdZVdw+uP87RnsHtNKHS7mJbihbRGIsbmgr+cSVwo+3EyoSMM9uLCsC6Spk WstWjjUfhMnd9jXerAsKGUY4NBRy/FBvK86pigRllpDV5/Uc4v/fdFDAWx94I9DSO4QB EYRSK+P4xVJ/1MeEi9hSxUJYXsXst08uBwxkCwln5Lyp6wAQmUXz8ip196gH1nyU/x6v /CzGIhZ3A0e+2QXO1v9PrY3k5WZhEYw3E9YIsBHRDSrf7vpKN+8EXw3BR+P8MHyiyMSX Rq3g== 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=AykGEF04/jidpneJLQY9+Ll4NQecAhwlz7vZcwM1EbY=; b=mtmN0hJP3aLXEMXAjZCa7Lt3kp2RYvVv+UPLWj/dWZyyo6g5u69yuXr3b0uzSORuBb fzzgbO87VKFd4/nUzkN+qmBFpt/R/iM2FPZloKJu4FOoB4brx/77ZpUJU0t5NFuTBzKI dAnIyDTJUGtO5YeA2queQ8GfqlM034bEa1B9dYxImlvdV8UwRQMvqdGq0Z7zPr++Jla8 DppGHFKJawD9St4rL/giCy4rHPsHdnjK0w+OnIo1u61OPBXuXnZCK0290qnMpfZkLpAx U93LuRta9SVtXp4SuuEVtSKXLRFhPoOfOnhDeTdx6a2rZjPt8hq7CUgiYUxfeczCUUBr zphA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 d27si19408244pgl.202.2019.06.03.08.51.47; Mon, 03 Jun 2019 08:51:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-leds-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-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729282AbfFCPvp (ORCPT + 1 other); Mon, 3 Jun 2019 11:51:45 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53836 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729369AbfFCPvp (ORCPT ); Mon, 3 Jun 2019 11:51:45 -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 352DC1A25; Mon, 3 Jun 2019 08:51:45 -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 A6C423F246; Mon, 3 Jun 2019 08:51:43 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Jacek Anaszewski , Pavel Machek , Dan Murphy , linux-leds@vger.kernel.org Subject: [RFC PATCH 30/57] drivers: leds: Use class_find_device_by_name() helper Date: Mon, 3 Jun 2019 16:49:56 +0100 Message-Id: <1559577023-558-31-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-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Use the new class_find_device_by_name() helper. Cc: Jacek Anaszewski Cc: Pavel Machek Cc: Dan Murphy Cc: linux-leds@vger.kernel.org Signed-off-by: Suzuki K Poulose --- drivers/leds/led-class.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.7.4 Acked-by: Pavel Machek diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 85848c5..ee052aa 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -216,13 +216,6 @@ static int led_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(leds_class_dev_pm_ops, led_suspend, led_resume); -static int match_name(struct device *dev, const void *data) -{ - if (!dev_name(dev)) - return 0; - return !strcmp(dev_name(dev), (char *)data); -} - static int led_classdev_next_name(const char *init_name, char *name, size_t len) { @@ -233,7 +226,7 @@ static int led_classdev_next_name(const char *init_name, char *name, strlcpy(name, init_name, len); while ((ret < len) && - (dev = class_find_device(leds_class, NULL, name, match_name))) { + (dev = class_find_device_by_name(leds_class, NULL, name))) { put_device(dev); ret = snprintf(name, len, "%s_%u", init_name, ++i); }