From patchwork Mon Jun 3 15:49:27 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: 165603 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4643790ili; Mon, 3 Jun 2019 08:51:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyC+PTYCyF+/UTYaKNIhtUQt/r6rXyJGOAYYv/bBxEStfwo9EqF63/cTBbRYBF1uU1peUM X-Received: by 2002:a62:ed09:: with SMTP id u9mr32012075pfh.23.1559577062075; Mon, 03 Jun 2019 08:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577062; cv=none; d=google.com; s=arc-20160816; b=hPyb5Id8j8+z2qpl13+pqA5gZWqrd/VePyf2PTBSBoY2WMZMbQD6Uxi0iOBRFQixOM 3zKAElFvgjIbpcyV5KJ4oZzdWG0tQF5WhNCcBYFOeULDXKp8QvNz4VO0lyAQ45QVaJwh TOpQ4rCYJyFbL5SvFNuVIsSX59HrPmf5c2Uql4nJ2VdPenFW7ih5Y1g6+uJEzPtUOZ5Z jrZzfxdHVeeATvDc4HZ8dHkoC3T1roiT+i2XBpLateHBQusKCicsg/LtesPAHMe+fAH/ z1Wnlc4eecYzu7P99+n8OKYBoZgX/S6v7/bE1i3WzvbPM4X5+X+vl3rBzXWSMobj4uoP z77Q== 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=7OcctiR3Y5yafVm6MQ9anMwvPpnlhFp0GiQMldlkUH4=; b=OXdo3QcgNqi3TTwC+ysYQxKUhIfb80BbkDCcVokS0W6kpASV8LRT72jfizuq4Vp5aI i1Hsy14d+2f3XAkOvvEZAlQlTblw4oGqBAOl3DClHcfUHEsTZBBRZWcHiqBbYpG1d6MR VI5QRcBdtGRo/YejhYeZVqTm7rx9b+cioYZq6QvPt9Aa8cEZe3wCrhp32BWWQ9j0p884 UZox9eDNFQ4t6bPqVOO4wQLtBuu9ZImK+2KduowPwO5vMp4bDBlGj9pDfpKnJRoHTyAf fksR8SwhMue5TsEx+4ZpKl6hqjgNNxMH556tjQQFFUxc45pWQe8/fSWjrTCa7p3R5R/d HbLg== 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 a8si18108271pgm.592.2019.06.03.08.51.01; Mon, 03 Jun 2019 08:51:02 -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 S1728264AbfFCPvA (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:00 -0400 Received: from foss.arm.com ([217.140.101.70]:53500 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbfFCPvA (ORCPT ); Mon, 3 Jun 2019 11:51:00 -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 0599515AB; Mon, 3 Jun 2019 08:51:00 -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 A35A63F246; Mon, 3 Jun 2019 08:50:58 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Sebastian Ott , Peter Oberparleiter , Heiko Carstens Subject: [RFC PATCH 01/57] drivers: s390/cio: Use driver_for_each_device Date: Mon, 3 Jun 2019 16:49:27 +0100 Message-Id: <1559577023-558-2-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 The cio driver use driver_find_device() to find all devices to release them before the driver is unregistered. Instead, it could easily use a lighter driver_for_each_device() helper to iterate over all the devices. Cc: Sebastian Ott Cc: Peter Oberparleiter Cc: Heiko Carstens Signed-off-by: Suzuki K Poulose --- drivers/s390/cio/ccwgroup.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) -- 2.7.4 Reviewed-by: Sebastian Ott diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 4ebf6d4..a006945 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c @@ -581,9 +581,12 @@ int ccwgroup_driver_register(struct ccwgroup_driver *cdriver) } EXPORT_SYMBOL(ccwgroup_driver_register); -static int __ccwgroup_match_all(struct device *dev, void *data) +static int ccwgroup_release_device(struct device *dev, void *unused) { - return 1; + struct ccwgroup_device *gdev = to_ccwgroupdev(dev); + + ccwgroup_ungroup(gdev); + return 0; } /** @@ -594,16 +597,11 @@ static int __ccwgroup_match_all(struct device *dev, void *data) */ void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver) { - struct device *dev; + int ret; /* We don't want ccwgroup devices to live longer than their driver. */ - while ((dev = driver_find_device(&cdriver->driver, NULL, NULL, - __ccwgroup_match_all))) { - struct ccwgroup_device *gdev = to_ccwgroupdev(dev); - - ccwgroup_ungroup(gdev); - put_device(dev); - } + ret = driver_for_each_device(&cdriver->driver, NULL, NULL, + ccwgroup_release_device); driver_unregister(&cdriver->driver); } EXPORT_SYMBOL(ccwgroup_driver_unregister); From patchwork Mon Jun 3 15:49:28 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: 165658 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4648012ili; Mon, 3 Jun 2019 08:55:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwU5eBQPYLLMXbtrtnCqaIkf97utiVxACYO/25c0OVb6ggj40qlkmu1gAXFOwzYHecAaQLU X-Received: by 2002:a17:90a:8b91:: with SMTP id z17mr30972651pjn.61.1559577305957; Mon, 03 Jun 2019 08:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577305; cv=none; d=google.com; s=arc-20160816; b=QU3/KW10N5U5+fzGmoxSxuPr0fza4iMBhiNk9RyvSCYCV4YgTLv1XMSi5mb0EeylV4 QWwnQ0b8RLjDNTT2pkxxO6NxK0HTMzM7uFq/zmdQaAB2HtO0Khd9czIRsX5abUpL6ylo KuMWL95oXtY/PTI3Ebm0OPWA0k5MPDFEYBX4JLVaaU/2hcnKa0uPqYDyPfP9F1Up4DZ3 FP9/ABBu0E0mDsLx289p4R01QxgbCEhqiMi833ldPL+SbHpsPBrpb3GA+I/c5lKWM8SC 04MlQCpoXBMUkq32cIQNFAV8jXqu+J9o7ew4SroUK0hCww/Gc3jYrR4BPBgfc6k29pLp khew== 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=v/N1pCXi8x+EUneafQSzDm4FxJ/OZcnILHoErrkmaFQ=; b=p8YGdyRiIX01CbDQ0uYDSJXFhEqyBxbs3Tc3mV7S1pxYHHrrael2ffMG7riZEqAXXA hgibD/m44215m4BLw46gElusdq17VPvf0Chk40BT+nD+iDFcrWYvPsvIuJGUh8XSH7M8 CVfan7OHvO/meMn0DDK+U2xeSy+0YzCxXvZTGt/lVLssNfa2Wj4BbbCedGIiz5BgnHlO aoA5+46+kOeOgUIrSGL/n1+BqsxGx8Zi/ukDQT6uyFH5eRye7aJaXYWISutY6YpGGf1I AOQddAoX8vR1ArhTKCVvXjdn0StI8We548rfrwoXvwsmnU/tmR1KwF7Ij7TsxkcFk1Ff dlKw== 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 d197si17414434pga.110.2019.06.03.08.55.05; Mon, 03 Jun 2019 08:55:05 -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 S1728311AbfFCPvE (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:04 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53520 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbfFCPvB (ORCPT ); Mon, 3 Jun 2019 11:51:01 -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 7E3671682; Mon, 3 Jun 2019 08:51:01 -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 4250E3F246; Mon, 3 Jun 2019 08:51:00 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Corey Minyard , Arnd Bergmann Subject: [RFC PATCH 02/57] drivers: ipmi: Drop device reference Date: Mon, 3 Jun 2019 16:49:28 +0100 Message-Id: <1559577023-558-3-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 Drop the reference to a device found via bus_find_device() Cc: Corey Minyard Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Signed-off-by: Suzuki K Poulose --- drivers/char/ipmi/ipmi_si_platform.c | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c index f2a91c4..ff82353 100644 --- a/drivers/char/ipmi/ipmi_si_platform.c +++ b/drivers/char/ipmi/ipmi_si_platform.c @@ -442,6 +442,7 @@ void ipmi_remove_platform_device_by_name(char *name) pdev_match_name))) { struct platform_device *pdev = to_platform_device(dev); + put_device(dev); platform_device_unregister(pdev); } } From patchwork Mon Jun 3 15:49:29 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: 165604 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4643876ili; Mon, 3 Jun 2019 08:51:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHUPtKV4ysbihc8O0DQSK+xJhv0DNpSaxSOUK3vTlzhJ/tjrmWvzd753hBNbA4FV4tLGsn X-Received: by 2002:a62:1b85:: with SMTP id b127mr32275242pfb.165.1559577067473; Mon, 03 Jun 2019 08:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577067; cv=none; d=google.com; s=arc-20160816; b=s6FUTCo/yLZ7DHjnI7wATkR7AFneKJBp3h4ytsQlbn5543d8AeN8Dd3ZFFbJcUGpn4 aG/rwCuT3j0YAHZ95/2DFLybdMj6a6Jor/phCU04cKNetX09WN8eFNwIPRWn/vnYsmgQ eIDW0Outn8VbY2Rrgwx3PjO0TFOok58PiooTyct7lhvSWZNtk/B2P698sAEHKVZlQECM 1kZF9pmC2Iti3fGscjPaBHvVhwDbuNrC2wD81PPZH9DkItxkO+Lrz0ypFB62FULTrOqY p0FSq6oUbH+LUEs1V00Mr/SQXGtKJhVQkEd78g7pIpr+owZ4PmKpiTBeP5PlETwQ+4Pl 5JQQ== 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=B1rsYvgq0M6E5jcznA4QwExcc0OZz7+JWXi4H3iLlbA=; b=ahQx24hDoLvpHiGVGm1jCDcr67lWVy0giFmEmvcVAAO9HRnZaWXI2kz2l25v86TTKo OdUcWlq6VTR5RH/RJyrD/1At0mmzMCY2j1t3jMU1cm6c4DMtZ3b+YbCipBbR1Qcs0uvI dyNxAYESQzW5jZEg7oB2CXWDbduZS/DYpS4dIsL+6362kzgT8HVpBENhnINo+xercui7 pLfdEjI8dPB4RYY2XqPwXZ3hx5q4MKAEHKtuC+nphsplMiO171ghguAKlYvZm1XF3FR6 0AG7pz0ttp9cWKksQAz1wqzHb54TdeF3Usc3CTmyq9FAFAWBrfHhw5XfM4uQHnbNMgjR qAQQ== 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 a8si18108271pgm.592.2019.06.03.08.51.07; Mon, 03 Jun 2019 08:51:07 -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 S1727649AbfFCPvG (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:06 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53530 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728274AbfFCPvD (ORCPT ); Mon, 3 Jun 2019 11:51:03 -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 D37C21688; Mon, 3 Jun 2019 08:51:02 -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 BAF2E3F246; Mon, 3 Jun 2019 08:51:01 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Mathieu Poirier Subject: [RFC PATCH 03/57] drivers: coresight: Drop device references found via bus_find_device Date: Mon, 3 Jun 2019 16:49:29 +0100 Message-Id: <1559577023-558-4-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 We must drop references to the device found via bus_find_device(). Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 4b13028..37ccd67 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -540,7 +540,7 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) dev = bus_find_device(&coresight_bustype, NULL, &deactivate, coresight_enabled_sink); - + put_device(dev); return dev ? to_coresight_device(dev) : NULL; } @@ -581,7 +581,7 @@ struct coresight_device *coresight_get_sink_by_id(u32 id) dev = bus_find_device(&coresight_bustype, NULL, &id, coresight_sink_by_id); - + put_device(dev); return dev ? to_coresight_device(dev) : NULL; } From patchwork Mon Jun 3 15:49:30 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: 165659 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4648076ili; Mon, 3 Jun 2019 08:55:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqye8YGpM7SNmZBSdqT/G50UojEOkD4hAclDD95A98Z5e+YbsHizr+29aNfW69NRTMuqAI8P X-Received: by 2002:a17:90a:9291:: with SMTP id n17mr30440419pjo.66.1559577308872; Mon, 03 Jun 2019 08:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577308; cv=none; d=google.com; s=arc-20160816; b=y5SkQfbCJbxka8P+TV7MyYZtKCZH/ZeZsFjCdb3rwCwyjQb4VykcpOfJr3fV6M8qr7 Jm3wPgh9hg0HOCa7jRBt6H1bYPDc6l1PBhQ/MDpr27H+vATqXW4UGpmMiX89wxull777 atg79VuHFdWcUpP915Vgtm2MYObrV9f1J0+qJ9VqaPv4IoCK6wHiZ09SFx2q8R52kD11 ByeUcofBk87y9Mj27ow01Mk1cI9PO2LbchSfxt+hXtGPHCstmtEaGs1L/qI8IVkjQ+sW qGh1OAVyyEFRPeMCxE2Gx0a1U8IfSGfLnXoSKmNIfnyyC0hSDLrWgvu3sZwcXGsM4dEP ngvQ== 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=ejWPrHbvUkKeqGL1OR1Rhnryt3c3itUcJJAQiRGOvs8=; b=XeTdvrYJVLtuQhEE4hLCv6nJpm/a8VHtY/vd9FHo7/oLtrAZTXHBd0G51Fl36YMTOJ bH4I2IoArEYEtT31ODaXUxFakdg8bWA1RsGNWpOIJfZMp2rq7eeq3Ju9VSaEGuGZ3WBK rCiWV29mZRN6JagInMBHs2i9fcoYqw23LjeImqeGGQUapoECQRiJtB853KFuM83eb8a8 OCyZ9X4z4OFe43q7+vo+Rpl/vV5vW4TlPoowI10rYAaZm+9oAj+k5o7bSZvL132ObgEy UW2t9vb7EdfOuwX8ZyFWsrPAwprNnVCqkd+rEFJqjjLkRW832V9eTK1QKn9IO5tDTsEt z/fg== 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 d197si17414434pga.110.2019.06.03.08.55.08; Mon, 03 Jun 2019 08:55:08 -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 S1729532AbfFCPzH (ORCPT + 30 others); Mon, 3 Jun 2019 11:55:07 -0400 Received: from foss.arm.com ([217.140.101.70]:53542 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728296AbfFCPvE (ORCPT ); Mon, 3 Jun 2019 11:51:04 -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 4F58D169E; Mon, 3 Jun 2019 08:51:04 -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 1C7283F246; Mon, 3 Jun 2019 08:51:02 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Ulf Hansson , Joe Perches Subject: [RFC PATCH 04/57] drivers: Add generic match helper to match the device of_node Date: Mon, 3 Jun 2019 16:49:30 +0100 Message-Id: <1559577023-558-5-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 Instead of spilling the match function to check the of_node for a given value, lets add a common helper. Also add a wrapper to find device by of_node pointer for bus. Cc: "Rafael J. Wysocki" Cc: Greg Kroah-Hartman Cc: Ulf Hansson Cc: Joe Perches Signed-off-by: Suzuki K Poulose --- drivers/base/core.c | 6 ++++++ include/linux/device.h | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) -- 2.7.4 diff --git a/drivers/base/core.c b/drivers/base/core.c index fd7511e..d20699c 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3328,3 +3328,9 @@ void device_set_of_node_from_dev(struct device *dev, const struct device *dev2) dev->of_node_reused = true; } EXPORT_SYMBOL_GPL(device_set_of_node_from_dev); + +int device_match_of_node(struct device *dev, void *np) +{ + return dev->of_node == np; +} +EXPORT_SYMBOL_GPL(device_match_of_node); diff --git a/include/linux/device.h b/include/linux/device.h index e85264f..fe16be4 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -163,6 +163,8 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); void subsys_dev_iter_exit(struct subsys_dev_iter *iter); +int device_match_of_node(struct device *dev, void *np); + int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); struct device *bus_find_device(struct bus_type *bus, struct device *start, @@ -171,6 +173,21 @@ struct device *bus_find_device(struct bus_type *bus, struct device *start, struct device *bus_find_device_by_name(struct bus_type *bus, struct device *start, const char *name); + +/** + * bus_find_device_by_of_node : device iterator for locating a particular device + * matching the of_node. + * @bus: bus type + * @start: Device to begin with + * @np: of_node of the device to match. + */ +static inline struct device *bus_find_device_by_of_node(struct bus_type *bus, + struct device *start, + struct device_node *np) +{ + return bus_find_device(bus, start, np, device_match_of_node); +} + struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, struct device *hint); int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, From patchwork Mon Jun 3 15:49:31 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: 165605 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4643943ili; Mon, 3 Jun 2019 08:51:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGswRtpLMDp3qCvCpv6FV3r4x7c9pJlZ1AZpIOXmcBTeFDAg3xyJcxXdVc6a/ppmcIvnRT X-Received: by 2002:a17:902:b102:: with SMTP id q2mr21163317plr.149.1559577070968; Mon, 03 Jun 2019 08:51:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577070; cv=none; d=google.com; s=arc-20160816; b=IhW0jrcRCr8GfYhV1ZTT7kSVvmvmRMjCDZjfhvAJKI6CnDFDUwPR1Vd8hAG7ZPNF4n u1sjm8e/ujL4n/1umIoJZrLXknt5jYSAwybdImvaCFT4mHz1LYrQ9qKoeBrNWVNYcnbX cY6URVdCNNn8LiOCQmsb7OX8VfTq36EO/QPo4wDI/BgKpaDrqcgigAxZ+th1xSDUE5wM gLXyggKaOphe6H2n+lzXQXYLcf5VeGj7ACXaY2Hklc1dq/NQkOLHADb+Bs0o07e2pF4t 38LJaBfAaa5XrI/JgG33ChxdHsmDw0YnIgPZUejI9JziEuR7qvqO2YFqPqX0/3pTLnDR 9uSA== 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=pbBVeQ+LYHQfa1J4T3fyjlm8X7BKPo4hg3pHBxAZGYg=; b=Bg3DI35I1qCpEbW1fDscGydz3pfMzwMt2xbtIMeK24c3QV6yDrMoJDe6AH83gv6dv2 SNbaoTi83tw8yklyry+lyMwoWVctl9BFHbeR6Fn8I/gRDG45H87lT7ZTUtUzDYWAQ7xZ pq11DPSUDcs7bunL/zKThOALnyTIaaBDN2Jgyh9IccdnaD/ruaCaZBkjxV6NiImme0vb hHbTlWVFXP3K5VkWnc0HVicJlY2tO0Fr+0WOQM1MZShHFLoqy5QQSE98wWQ0o0EcIkWg kg3LDr+bJ/20+yzQUJb+CWtWErbOm/iGS4ECH8puDornQ7PfvdzxjyDaFvJ9Pe3EHpBG pJsw== 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 g69si20591014plb.70.2019.06.03.08.51.10; Mon, 03 Jun 2019 08:51:10 -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 S1728435AbfFCPvJ (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:09 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53556 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728373AbfFCPvG (ORCPT ); Mon, 3 Jun 2019 11:51: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 3F0A715AB; Mon, 3 Jun 2019 08:51:06 -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 8CD0C3F246; Mon, 3 Jun 2019 08:51:04 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Maarten Lankhorst , Maxime Ripard , dri-devel@lists.freedesktop.org, David Airlie , Daniel Vetter Subject: [RFC PATCH 05/57] drm: mipi_dsi: Use bus_find_device_by_of_node() helper Date: Mon, 3 Jun 2019 16:49:31 +0100 Message-Id: <1559577023-558-6-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 Switch to using the bus_find_device_by_of_node() helper. Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: dri-devel@lists.freedesktop.org Cc: David Airlie Cc: Daniel Vetter Signed-off-by: Suzuki K Poulose --- drivers/gpu/drm/drm_mipi_dsi.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 80b7550..4c5a397 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -93,11 +93,6 @@ static struct bus_type mipi_dsi_bus_type = { .pm = &mipi_dsi_device_pm_ops, }; -static int of_device_match(struct device *dev, void *data) -{ - return dev->of_node == data; -} - /** * of_find_mipi_dsi_device_by_node() - find the MIPI DSI device matching a * device tree node @@ -110,7 +105,7 @@ struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np) { struct device *dev; - dev = bus_find_device(&mipi_dsi_bus_type, NULL, np, of_device_match); + dev = bus_find_device_by_of_node(&mipi_dsi_bus_type, NULL, np); return dev ? to_mipi_dsi_device(dev) : NULL; } From patchwork Mon Jun 3 15:49:32 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: 165657 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4647860ili; Mon, 3 Jun 2019 08:54:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNS2E5lHo8C5VJuEi6tp4Huytc2HVYNTUqkYBmVLyhKrN2D90MS9Jf8A+PJ3/Nd91EzFFx X-Received: by 2002:a63:231c:: with SMTP id j28mr28878134pgj.430.1559577298595; Mon, 03 Jun 2019 08:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577298; cv=none; d=google.com; s=arc-20160816; b=tUaQMf0yUOipqR1Rk7p/fxnJ/L8/ROErHSa3ueBHt+pFQZXDeTwMmui05JZf/2QtGh ZMk+Yd/PDPQsw3jKVgFIlXy4Sfe/RXcL23co5vlfiSLuBBEAl7/srOoYfb0YFBzndCaP I4VGXggR3Y5ag29xLkSlPdgV8zwpk4pPgIJGQ2Xtknid2jC0DsgZs5EMjzpbmbiVebB8 bRokSCzY4qy033xgTBTOy8ApDZAJbxioZkjoWfTPFe2ZGCxIyVtAhUVidmgvbzhMIZb6 KS0vYzI6EbXhO3F3T3RR6t1ep654rAZESS0OFxTb3P1ubl51kDDWOMaCsp/XGjg5gqkr 4+RQ== 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=kuvu81n3fwKxigh70pLkN3x8UcVaT3uKKlKzptURQ2Y=; b=0AePd+eYRjYRo8LQQuv2N2695SWKVDN4lyKjNCNhfIUsLx5bYzC09X+v5aTwQpDaKQ ctTjL7fy6shO7aBaHhGM/+Bz5j0PntwsmAqiLmK1Ig76ChEJ8q1/G+TF9Jd7JG3ihfXW stQzJef7p9zsm+W3dV9UAKpxuvAgnyWOnpkHwC58wT7D2WyXLMcw4zCPIGOu4SGkt7aH RbR7Am23cbuoJv4LHVEEom6fZhWkFhpXrjh8SDvPhCiww90RJtG1GsZBhMSzYLUePIFm a7bA8aabBap22/mUQEFruuaSSeiyynCe3fmSbrHo0MTMIg8+AMLTIRDmF/DkJe/uw6q4 9h3w== 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 w17si7474704pjn.21.2019.06.03.08.54.58; Mon, 03 Jun 2019 08:54:58 -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 S1728548AbfFCPvM (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:12 -0400 Received: from foss.arm.com ([217.140.101.70]:53578 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728391AbfFCPvI (ORCPT ); Mon, 3 Jun 2019 11:51:08 -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 B7E1E1688; Mon, 3 Jun 2019 08:51:07 -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 7BCFD3F246; Mon, 3 Jun 2019 08:51:06 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Wolfram Sang , linux-i2c@vger.kernel.org Subject: [RFC PATCH 06/57] drivers: i2c: i2c-core: Use bus_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:49:32 +0100 Message-Id: <1559577023-558-7-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 Switch to using the bus_find_device_by_of_node helper. Cc: Wolfram Sang Cc: linux-i2c@vger.kernel.org Signed-off-by: Suzuki K Poulose --- drivers/i2c/i2c-core-of.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c index 406e5f6..b0b3fe1 100644 --- a/drivers/i2c/i2c-core-of.c +++ b/drivers/i2c/i2c-core-of.c @@ -112,11 +112,6 @@ void of_i2c_register_devices(struct i2c_adapter *adap) of_node_put(bus); } -static int of_dev_node_match(struct device *dev, void *data) -{ - return dev->of_node == data; -} - static int of_dev_or_parent_node_match(struct device *dev, void *data) { if (dev->of_node == data) @@ -134,7 +129,7 @@ struct i2c_client *of_find_i2c_device_by_node(struct device_node *node) struct device *dev; struct i2c_client *client; - dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match); + dev = bus_find_device_by_of_node(&i2c_bus_type, NULL, node); if (!dev) return NULL; From patchwork Mon Jun 3 15:49:33 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: 165606 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4643979ili; Mon, 3 Jun 2019 08:51:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVkdTS/o9nZKjZlHune1hpia3eOB60j9ZwQLi8ChoB8Jg959ci6fnCFKm9U7cBIx1Ynmgq X-Received: by 2002:a17:902:2847:: with SMTP id e65mr28916725plb.319.1559577073929; Mon, 03 Jun 2019 08:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577073; cv=none; d=google.com; s=arc-20160816; b=kDXHbzO/NP6hfxZiWR2giqLR+CBYaJkUeQCcDURpx2gAvTEikes2R/Vcp96cDjHvbI pOjLxuWnCYbuueCArcoo2n7DSRqHxDBZVdAfISvfg60pwM4f+bng1/Nr6mGZJfBcclAn aODknJy/XTm3+0O4LNmoFVPCslc0k6lAZTUfWcIdm/ArFce5oVkCW68NJ5+QKsl+6rzi fyOM1JZVRzqFsIdX6joMHD1buUwUwooMRhuvhoUSOkQoOuCgyXE9PXOBX2nSBa6SnJ2h tles04zL+dsyAeqZ3/3fGdrquuLNblZACOLNPaEj+iQlulbpIGX4+83AV8fwolGmffhE 74CA== 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=qW+JWa6tOmZGi+1pMHNYWcrq6F1h81iikDz7HiwwIRo=; b=CbNJyOLIJVVx/TFGXK5RvnbF/fEeSgrVWC6zvIoLwm8rMFgUXMMIxtpUgna2QqiwTu u2kB0PBuMpgbPaa3DMQr0ucLmmt5ZLNLgD0NG64QI9sNnyhI64itnnLe/ubmDodVHq2t siILiuj+CaHSFyEixz/paNkfbS3YI4NkAIpM3EdYmPts7di+sZ9oeU40bQ7CEh5GjFdw bDViiP5EgkaNeTA56XdgXgaHRryXQGdiqZOOnZhhpx6AZ2TQukX84ioExdIVH4zIOS77 YXlim/cnoAE7IVGnAwNzRHB/98DW+njKPYDRCOzxVuN3kU/ihUEueSxZWkgS6wznM8Yc g7KQ== 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 g69si20591014plb.70.2019.06.03.08.51.13; Mon, 03 Jun 2019 08:51:13 -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 S1728579AbfFCPvN (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:13 -0400 Received: from foss.arm.com ([217.140.101.70]:53590 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728412AbfFCPvJ (ORCPT ); Mon, 3 Jun 2019 11:51:09 -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 18B8B15AB; Mon, 3 Jun 2019 08:51:09 -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 0093B3F246; Mon, 3 Jun 2019 08:51:07 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Srinivas Kandagatla Subject: [RFC PATCH 07/57] drivers: nvmem: Use bus_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:49:33 +0100 Message-Id: <1559577023-558-8-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 Switch to using the bus_find_device_by_of_node helper Cc: Srinivas Kandagatla Signed-off-by: Suzuki K Poulose --- drivers/nvmem/core.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index c7892c3..63947d3 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -76,11 +76,6 @@ static struct bus_type nvmem_bus_type = { .name = "nvmem", }; -static int of_nvmem_match(struct device *dev, void *nvmem_np) -{ - return dev->of_node == nvmem_np; -} - static struct nvmem_device *of_nvmem_find(struct device_node *nvmem_np) { struct device *d; @@ -88,7 +83,7 @@ static struct nvmem_device *of_nvmem_find(struct device_node *nvmem_np) if (!nvmem_np) return NULL; - d = bus_find_device(&nvmem_bus_type, NULL, nvmem_np, of_nvmem_match); + d = bus_find_device_by_of_node(&nvmem_bus_type, NULL, nvmem_np); if (!d) return NULL; From patchwork Mon Jun 3 15:49:34 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: 165607 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644022ili; Mon, 3 Jun 2019 08:51:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOGkL5x3sWebMjlxINx+FwkzytC200EUN77K6YdJBVMDmV0SmxHpQ5PiM1zPmEmNJoWT8t X-Received: by 2002:a63:649:: with SMTP id 70mr4855192pgg.445.1559577076311; Mon, 03 Jun 2019 08:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577076; cv=none; d=google.com; s=arc-20160816; b=afjtD1etC8EFTzI46w+X3jwl2NigBc177zOEvbslEmaMjOMXgW3p5DQz3tFnJcBPKZ PJI+TwElXEWMpTUyrckNM3rXA6uOReeAk81vgxd237QVlDiQT+X4RaNtDZKtZAKKRr2N HN89kXHj+fveucKDhQOMs7CkY1rKx2NyE1GUFA7VOp6i6uDym7bYe0Nt5oGDEGM54UWM lOI52uake5G4xm4oNATa7bYb63PUBDvlYqRMAlNdEXPpWc5jsb889Q9JqeQEUZCocwdf 2zEow5rpDQlrlyNeDRV8uu73L6gjPP8vydjaMNUZuFQpeThYfnjXFWLY2sDHQDScKi2A PdrA== 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=ocnRt0bCItZ/Am5HRnK+DH6tyri0NxsG66hzg5kj4wU=; b=ehWykUYCmvVqdbhl31pteDCI8Dly3dHCvt/TJWzMQ6HMu6IlzqjwXPGWInOPOzBneN d2dF06pQkmvHXs1UbtGHbdAhu2Zxi5fh4vi7ooNOARAiTcaC98lVzZC0+LH1SQIuAUK6 quCGmhEE1SgP9okDwxRKLB64TbfzV7r70DpHSDLDMsyuCcJsQdJLHqf9g1PUlsqmc0g2 MdFIkFwBMC/M5aAVuJAyMj9kSOOE6lFI5jASjXbB3Hlgr3oVlL9Gb2w/61S9hbWwT4M1 Y92QxNVhGoDVLXGw0iGsN+pz8t9L7+TKIDuuypykJVyr7+Qn97z62UwktVF3sSJiHzJC e+ug== 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 g69si20591014plb.70.2019.06.03.08.51.16; Mon, 03 Jun 2019 08:51:16 -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 S1728639AbfFCPvP (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:15 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53598 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728473AbfFCPvK (ORCPT ); Mon, 3 Jun 2019 11:51:10 -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 91D9D169E; Mon, 3 Jun 2019 08:51:10 -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 558303F246; Mon, 3 Jun 2019 08:51:09 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Mark Brown , linux-spi@vger.kernel.org Subject: [RFC PATCH 08/57] drivers: spi: Use bus_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:49:34 +0100 Message-Id: <1559577023-558-9-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 Switch to using the bus_find_device_by_of_node helper Cc: Mark Brown Cc: linux-spi@vger.kernel.org Signed-off-by: Suzuki K Poulose --- drivers/spi/spi.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -- 2.7.4 Acked-by: Mark Brown diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 5e75944..ecdd602 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3538,16 +3538,11 @@ EXPORT_SYMBOL_GPL(spi_write_then_read); /*-------------------------------------------------------------------------*/ #if IS_ENABLED(CONFIG_OF) -static int __spi_of_device_match(struct device *dev, void *data) -{ - return dev->of_node == data; -} - /* must call put_device() when done with returned spi_device device */ struct spi_device *of_find_spi_device_by_node(struct device_node *node) { - struct device *dev = bus_find_device(&spi_bus_type, NULL, node, - __spi_of_device_match); + struct device *dev = bus_find_device_by_of_node(&spi_bus_type, NULL, node); + return dev ? to_spi_device(dev) : NULL; } EXPORT_SYMBOL_GPL(of_find_spi_device_by_node); From patchwork Mon Jun 3 15:49:35 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: 165608 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644075ili; Mon, 3 Jun 2019 08:51:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqySX4USZFY+eJX6XT12mKLRorrkiwkW2xnPvqoOEblTYbFD5RQSUfEfXdsAr6eEXSSmWKGb X-Received: by 2002:a63:4147:: with SMTP id o68mr29369265pga.76.1559577079235; Mon, 03 Jun 2019 08:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577079; cv=none; d=google.com; s=arc-20160816; b=uUvmrl0AGB78ynjsO9PkjzUFwkhE7N8OpJRtX+ehIy+pErt793MwviCmSr8uHw+I20 WTTolo5faZkso8MC3jzCG2YxIrYYRDknnwcBM0al5xfzbcw433XS1paZxZf2A/9reRsN fRqnyoiFfxASzj6ZA2HekG3qtc4IpZKSo5CvPOhdsBPaOjm9dcu9+DEC33IFF8Ov89+T AGo3+uPJj5eLtj9C6LIMK2T7LRd2VZPbpvCxs5qOg5dWXE/lc2XV1w5UzYHGl00V9QzN 1OwWZwdfBbxjIuxax26gWAI9RTi+CE4WZ/+hiM8BZI9UiKIPDoe9G1KSr98I/Eg9tiFQ bX8w== 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=ihlDMVJIqFWZNOcj8twZB0vljjqqE3M2rWylTxdDXvs=; b=K0Gj566jFKdlGrA2usu5KEXen0VQPFmUf94a+oOQNiT7c4Hy4JJi7vFe8BvpLMT2et H38TWZwzEnQ6vq7U2YWowpWT3RdgCW/4i0pkbzy18XZvSmFUzDoY8O6yGvtLMWOxOrqv 2O8RUuYoVxmmCrsFk2p5fgUGODGqAnXoObl7EY8m1Q8Y1sx/nfAYXAu/+VgyNUXzNCL6 VxaVusgw8cd/AxJcqCUkVUE+5iO8ZtbhHkQd0PmF888kgbIuuX1fKfbCIlGei/xsvmEH dPc9s1eAFqkXTuRfdF7kmRDJqyoOjQRwEzqRz9uLKYD5himtV3A9WSlNeCN/ftSBdA7m QtGA== 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 g69si20591014plb.70.2019.06.03.08.51.18; Mon, 03 Jun 2019 08:51:19 -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 S1728710AbfFCPvR (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:17 -0400 Received: from foss.arm.com ([217.140.101.70]:53608 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728564AbfFCPvM (ORCPT ); Mon, 3 Jun 2019 11:51:12 -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 823DD15AB; Mon, 3 Jun 2019 08:51:12 -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 CEC803F246; Mon, 3 Jun 2019 08:51:10 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Heiko Stuebner , Takashi Iwai , Mark Brown , Liam Girdwood , linux-rockchip@lists.infradead.org Subject: [RFC PATCH 09/57] drivers: sound: rockchip: rk3399: Use bus_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:49:35 +0100 Message-Id: <1559577023-558-10-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 Switch to using the bus_find_device_by_of_node helper Cc: Heiko Stuebner Cc: Takashi Iwai Cc: Mark Brown Cc: Liam Girdwood Cc: linux-rockchip@lists.infradead.org Signed-off-by: Suzuki K Poulose --- sound/soc/rockchip/rk3399_gru_sound.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -- 2.7.4 Acked-by: Mark Brown diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 3d0cc6e..677c92c 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -405,11 +405,6 @@ static const struct dailink_match_data dailink_match[] = { }, }; -static int of_dev_node_match(struct device *dev, void *data) -{ - return dev->of_node == data; -} - static int rockchip_sound_codec_node_match(struct device_node *np_codec) { struct device *dev; @@ -421,8 +416,8 @@ static int rockchip_sound_codec_node_match(struct device_node *np_codec) continue; if (dailink_match[i].bus_type) { - dev = bus_find_device(dailink_match[i].bus_type, NULL, - np_codec, of_dev_node_match); + dev = bus_find_device_by_of_node(dailink_match[i].bus_type, + NULL, np_codec); if (!dev) continue; put_device(dev); From patchwork Mon Jun 3 15:49:36 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: 165654 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4647571ili; Mon, 3 Jun 2019 08:54:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoJNEU08d1WYQQN5mrPvTGHsZo6/Ji7x/1ebDLGK1jF0VTlZUB4nfXfs3aI7StMpsmkWRg X-Received: by 2002:a17:902:205:: with SMTP id 5mr28850642plc.165.1559577282098; Mon, 03 Jun 2019 08:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577282; cv=none; d=google.com; s=arc-20160816; b=tFn/xKkgeV3KX9WoQNJWlQw+EiNAByH5vZUjdELZuxEFKbsq2uBITg+oTu3wuivfFI C5XUWcJ3F4ytcdk1byH606/E/WcLMaFTqho93YrYgp8Zw3kDtluTbaywdjLp61yo71RJ qz61OCLFnXGe/qvHbqS1dbveR8xpCa8G2Xv3bHo9FBEbKvaeLokIlMvmcAEvUPSWneZg FJrRWrimACcBk4QOrkb1GsK3VOEly0FCfylMdpPqmCANCiD8yD8lRty4Rf8XG8QVlm6v y9L4OWiWLEE5lw9woCoiRS2w8lOZzJr74lBL4ISx2bGdaLmmjjfj9D5hXdeSSn2Pd7+D Rg6g== 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=v6skjzbTU+wQbrUOgsz6jlP9lia/Qx9uX4clcb5SJiM=; b=ea3GLG2r0rrSs2uJRtMo3HDvvl6tWCnS/O4OsLSXQ08s215MPLNGerKvDwrJcqyK23 R5gIYtmzeww/dkk5ptXbmXTXyEA0VNNoyKRMno1l+3j+aiHimK5HL3XQd0r+CUJS/ime 3SOdyVEGBpp1vkrDfvlbl5PLSyU84jXcZVMvlI285IkVQerz5z9kjMgZQQf2Z+t1KBc+ N11TKeLYldZm07HIpCMGKIOFf1EQRGmQyR+vnKSJUcbp+zI9LicUHOjGz0tJmfIO7gwO nRnu3OTk9uXycsT1jLrOmPyPlH9Rp1eT9FP7zUgyckVVUq4CkZDGC7fsGDc1IxnbpZO+ XiCQ== 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 j16si20062568pfn.225.2019.06.03.08.54.41; Mon, 03 Jun 2019 08:54:42 -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 S1728821AbfFCPvV (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:21 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53624 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728589AbfFCPvO (ORCPT ); Mon, 3 Jun 2019 11:51:14 -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 CE1A8169E; Mon, 3 Jun 2019 08:51:13 -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 BEF183F246; Mon, 3 Jun 2019 08:51:12 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Mathieu Poirier Subject: [RFC PATCH 10/57] drivers: coresight: Use bus_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:49:36 +0100 Message-Id: <1559577023-558-11-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 Switch to using the bus_find_device_by_of_node helper Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/of_coresight.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/coresight/of_coresight.c b/drivers/hwtracing/coresight/of_coresight.c index 7045930..9b7a0c0 100644 --- a/drivers/hwtracing/coresight/of_coresight.c +++ b/drivers/hwtracing/coresight/of_coresight.c @@ -18,11 +18,6 @@ #include -static int of_dev_node_match(struct device *dev, void *data) -{ - return dev->of_node == data; -} - static struct device * of_coresight_get_endpoint_device(struct device_node *endpoint) { @@ -32,8 +27,7 @@ of_coresight_get_endpoint_device(struct device_node *endpoint) * If we have a non-configurable replicator, it will be found on the * platform bus. */ - dev = bus_find_device(&platform_bus_type, NULL, - endpoint, of_dev_node_match); + dev = bus_find_device_by_of_node(&platform_bus_type, NULL, endpoint); if (dev) return dev; @@ -41,8 +35,7 @@ of_coresight_get_endpoint_device(struct device_node *endpoint) * We have a configurable component - circle through the AMBA bus * looking for the device that matches the endpoint node. */ - return bus_find_device(&amba_bustype, NULL, - endpoint, of_dev_node_match); + return bus_find_device_by_of_node(&amba_bustype, NULL, endpoint); } static inline bool of_coresight_legacy_ep_is_input(struct device_node *ep) From patchwork Mon Jun 3 15:49:37 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: 165609 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644127ili; Mon, 3 Jun 2019 08:51:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZxtARHTw/ukEMnSisKjwuFgHnEJPjIOSNWhiNhI48n0/SjDGY52ABk05P96VNFupIhj+w X-Received: by 2002:aa7:82d7:: with SMTP id f23mr31652931pfn.138.1559577083045; Mon, 03 Jun 2019 08:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577083; cv=none; d=google.com; s=arc-20160816; b=WusXJZ7gMy5t4lbnmPNHwNyEymqIz4yUPg/k0HABSsK+OFD/0zzjjLfvntT/t+QXcy /3f4bH/c76/L3OizYPZM27Se9Qz+nLl0miAuArDZ0SrHdbjzxA/pXSww4uzl8SEmIys2 s10zS8hZeGhSHsDVfe0tVhxPf3lnWGd19T3enR+vg0ARiQZXKmrAmcA+qzx6NRC9VqJm SGrLg8Na5ftef9New8zzbckOJFITWagIyDtr+15/MCl1GLUI7j8C79MCx2LttY9Umw3C ryUWcHFBY7vL+zQ3no9xCKumXAcQDoD7Rg2fTwabaRssnBokZFQptC90RaKCmX31yinZ M84g== 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=HhM8wxV7mHXh/FL4YPtoV+1hNjiQKLVL5B4EJjcjXEU=; b=FNwc1RzapUvpK4OOENfhYC+MGsQ8XxvNAVeMKvSK+f23AvCb9L41MYilHscjJCBCXK VALQe4U4gQWYgbt/4Y5Zvq9/HP9nkJXQTftBFNLk3yrqnf3QFD+fZ1LVU1Z17evcZTXq U0u5ygxXMm6GZSB/X1eqTL0BDD9EzMjwRCepo/NK8ApQtmP41S/s9d88bsKdfGY4WH8l P80E/gfu8iboxYJctfsYD8dzviRtRm+Ug5fKdmK4LkPPzuiZ6IPllVdMZuK8dGD7B8Ee PZoGw2UEX8SIz73RAgaGczYONC5rU571zPBLaJtkgNI39IkURhTijTvh/kbixSdQPVC4 RMgA== 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 g69si20591014plb.70.2019.06.03.08.51.22; Mon, 03 Jun 2019 08:51:23 -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 S1728902AbfFCPvW (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:22 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53634 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728654AbfFCPvP (ORCPT ); Mon, 3 Jun 2019 11:51:15 -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 99B5615AB; Mon, 3 Jun 2019 08:51:15 -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 170493F246; Mon, 3 Jun 2019 08:51:13 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Andrew Lunn , Florian Fainelli , Rob Herring , Frank Rowand Subject: [RFC PATCH 11/57] of: mdio: Use bus_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:49:37 +0100 Message-Id: <1559577023-558-12-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 Switch to using the bus_find_device_by_of_node helper Cc: Andrew Lunn Cc: Florian Fainelli Cc: Rob Herring Cc: Frank Rowand Signed-off-by: Suzuki K Poulose --- drivers/of/of_mdio.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.7.4 Reviewed-by: Andrew Lunn diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index de61573..f15cf8e 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -281,12 +281,6 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) } EXPORT_SYMBOL(of_mdiobus_register); -/* Helper function for of_phy_find_device */ -static int of_phy_match(struct device *dev, void *phy_np) -{ - return dev->of_node == phy_np; -} - /** * of_phy_find_device - Give a PHY node, find the phy_device * @phy_np: Pointer to the phy's device tree node @@ -302,7 +296,7 @@ struct phy_device *of_phy_find_device(struct device_node *phy_np) if (!phy_np) return NULL; - d = bus_find_device(&mdio_bus_type, NULL, phy_np, of_phy_match); + d = bus_find_device_by_of_node(&mdio_bus_type, NULL, phy_np); if (d) { mdiodev = to_mdio_device(d); if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) From patchwork Mon Jun 3 15:49:38 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: 165652 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4647405ili; Mon, 3 Jun 2019 08:54:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5rTS97TQbZvZ8t/HdBo5QxmHGsWwDxfSgV5l/kHFQpPOqDn3OERMUvLtHG+nYw4A/uWKN X-Received: by 2002:a63:91c4:: with SMTP id l187mr8129618pge.95.1559577272162; Mon, 03 Jun 2019 08:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577272; cv=none; d=google.com; s=arc-20160816; b=jeXg+y4jTpyCmN/slNt3L7eY5uNvkF7k//ZYvIpXkJhrtbGBe5mUTY+iE7JagwjPy4 U3blE8OgWN2y1E9a2EYmp0pii5NENYYeQrC5tGVALqkzpBL1aSW1f7GCHMdsCAFuunGt Qj0p2xSyXx/hqMJQ16FRJahy0NIjY+nhkmQwYOETIGyBZNcWe2eMyt1cB9YEIG72j/uE Wydw07CTUGJ7ZXAMKFPcIE9AjiIBoumOfxhQBjwk4VgQFxBy1hnEKoPbpqXQ1cd2OZVg /SyANvlioRngLyPAXFjgRWVBjTeLsEB3YfAI8bYM25K+XlVGssNduPDpbAfoK6TccOKA /K/A== 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=KWyFs4oa2UGCKFKC5sfTSD4h//1AVZMi1g2vXftxJtQ=; b=fRiBh88J4ZXWzXKzqIngShqx/1n4XrrpQpeM49YraCdKQcCIn6VJh3Tdfpsk7tv5hs 5i/fO6c4SoRQurXIwqWbMqVSdoHtIVc016ItKklHgCIRhZyla7loj6UgzleJ/WpfDll5 rf61vCrMxjJDrW4/kuhYEverfa8EzQsNOBhiN8iFXa5Vs4rn9JTG1Cyn+BcdWOfS0tMl LESeg+n451HMB9djNxck8sudQFLtq2jPtqLsuuIJ4aHw5Afivd7hNRijiAtLGC06vt+R RxG4MrkI9T/w7BXc2T2hq66cUBOj9CAlQfTQPEtNwIQfjq8EyLcz7BHYBZpdTv8PsMsC ISsQ== 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 k93si18106987pjb.33.2019.06.03.08.54.31; Mon, 03 Jun 2019 08:54:32 -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 S1728974AbfFCPvX (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:23 -0400 Received: from foss.arm.com ([217.140.101.70]:53648 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728706AbfFCPvR (ORCPT ); Mon, 3 Jun 2019 11:51:17 -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 41B63169E; Mon, 3 Jun 2019 08:51:17 -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 D6A593F246; Mon, 3 Jun 2019 08:51:15 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Frank Rowand , Rob Herring , devicetree@vger.kernel.org Subject: [RFC PATCH 12/57] of: platform: Use bus_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:49:38 +0100 Message-Id: <1559577023-558-13-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 Switch to using the bus_find_device_by_of_node helper Cc: Frank Rowand Cc: Rob Herring Cc: devicetree@vger.kernel.org Signed-off-by: Suzuki K Poulose --- drivers/of/platform.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 04ad312..b1e3a51 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -37,11 +37,6 @@ static const struct of_device_id of_skipped_node_table[] = { {} /* Empty terminated list */ }; -static int of_dev_node_match(struct device *dev, void *data) -{ - return dev->of_node == data; -} - /** * of_find_device_by_node - Find the platform_device associated with a node * @np: Pointer to device tree node @@ -55,7 +50,7 @@ struct platform_device *of_find_device_by_node(struct device_node *np) { struct device *dev; - dev = bus_find_device(&platform_bus_type, NULL, np, of_dev_node_match); + dev = bus_find_device_by_of_node(&platform_bus_type, NULL, np); return dev ? to_platform_device(dev) : NULL; } EXPORT_SYMBOL(of_find_device_by_node); From patchwork Mon Jun 3 15:49:39 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: 165656 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4647709ili; Mon, 3 Jun 2019 08:54:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGTt944Lhf/PqgAMIqe3II00cwwzz5slYMgMGX4aKOVtohi74TQSkGwODnAzbupS4REjk9 X-Received: by 2002:a17:90a:e17:: with SMTP id v23mr30271479pje.139.1559577290117; Mon, 03 Jun 2019 08:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577290; cv=none; d=google.com; s=arc-20160816; b=q2kTGLJIObPVbd5j2KgTIEdzDaD61QKzbztrtJLrj7k7YpkZ0RR+9YK/dBbEaO645R 3VFXmQeQeAtQlCoD6frG3LnniIgVAlE1jUeyNbq60Grf4C820AFetcd9iTOE652GkfWR YCoE8PROJXo57W8hzdzVcThaCI4ZLcDKOF2pvHJBndtB62FdYpIL8FV7L2mjCr3B2HZt VYPahxi4+czo+WYqg3DULsvSj/xXgUqdBaxv03s/Yy5HXBTZbwEs/pK+EMdTWwRek89t V4GiPhSjNm068YOk76Dr4rq6h5Qr3g/RNx9OT/UaZ9epqcMV17BAfaTqIUVnHI+45HQa 8cRA== 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=LP2RjXruQcI9RvjW+DmrRgZc+4tZ5qnmCkmUTMriLP0=; b=KNc6SeX9FTGa9U9/Snacv7ky54RS9vNFjJVcCXz2KrKaLIDwyDrZZ5hiUBHzonW89y 3UUhM8DO7DP28Nz11e0CeVxCg1RkfR47jC3SImuNBCNiFGOlr+SOpWx/pp0zoQc/uRLS FavYZzvEWkX3hUEpKChlHn2KUGT8NnZKZJbAw6QBIYyvkWAt1tzHxqePsTur3sLTj322 HrvkZ2uFTp+JTxwb41j3Ib2FFi4i2EyNyMQPuvWxmJDo2a2+0SaqluIuN44PQ2pFisJA dnoVp5rLVPm3v7+yZYPlWONObil2wwLgjkZsk5vGr/54SHgCaN0iFecSF0CUR6rHnByP xKIw== 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 w17si7474704pjn.21.2019.06.03.08.54.49; Mon, 03 Jun 2019 08:54:50 -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 S1729734AbfFCPys (ORCPT + 30 others); Mon, 3 Jun 2019 11:54:48 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53654 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728731AbfFCPvT (ORCPT ); Mon, 3 Jun 2019 11:51:19 -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 90E4B15AB; Mon, 3 Jun 2019 08:51:18 -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 817F83F246; Mon, 3 Jun 2019 08:51:17 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Ulf Hansson Subject: [RFC PATCH 13/57] drivers: Add generic helper for matching device by fwnode Date: Mon, 3 Jun 2019 16:49:39 +0100 Message-Id: <1559577023-558-14-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 Instead of spilling the match function to check the device fwnode everywhere, let us add a generic helper which can be reused by all. Also adds a wrapper for bus_find_device to find a device by fwnode. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Ulf Hansson Signed-off-by: Suzuki K Poulose --- drivers/base/core.c | 6 ++++++ include/linux/device.h | 15 +++++++++++++++ 2 files changed, 21 insertions(+) -- 2.7.4 diff --git a/drivers/base/core.c b/drivers/base/core.c index d20699c..141c4f8 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3334,3 +3334,9 @@ int device_match_of_node(struct device *dev, void *np) return dev->of_node == np; } EXPORT_SYMBOL_GPL(device_match_of_node); + +int device_match_fwnode(struct device *dev, void *fwnode) +{ + return dev_fwnode(dev) == fwnode; +} +EXPORT_SYMBOL_GPL(device_match_fwnode); diff --git a/include/linux/device.h b/include/linux/device.h index fe16be4..54be931 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -164,6 +164,7 @@ struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); void subsys_dev_iter_exit(struct subsys_dev_iter *iter); int device_match_of_node(struct device *dev, void *np); +int device_match_fwnode(struct device *dev, void *fwnode); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); @@ -188,6 +189,20 @@ static inline struct device *bus_find_device_by_of_node(struct bus_type *bus, return bus_find_device(bus, start, np, device_match_of_node); } +/** + * bus_find_device_by_fwnode : device iterator for locating a particular device + * matching the fwnode. + * @bus: bus type + * @start: Device to begin with + * @fwnode: fwnode of the device to match. + */ +static inline struct device *bus_find_device_by_fwnode(struct bus_type *bus, + struct device *start, + struct fwnode_handle *fwnode) +{ + return bus_find_device(bus, start, fwnode, device_match_fwnode); +} + struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, struct device *hint); int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, From patchwork Mon Jun 3 15:49:40 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: 165655 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4647627ili; Mon, 3 Jun 2019 08:54:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxZOIdhJwLo/IMNDkanbSJHSelBn/e7vF8YM5J7nHG4XRh2sM66+w2bZHr3KzIlHeIoT9j X-Received: by 2002:a63:c20c:: with SMTP id b12mr14385088pgd.3.1559577284855; Mon, 03 Jun 2019 08:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577284; cv=none; d=google.com; s=arc-20160816; b=ZT0ajda0j70OOydtV1u4GLnNzeN1wQrl2WP1DYpznbe1XwxLENG1U4+x3VepxK5p7h sU9/OcoeFcmfz5n54gsU0v3Af/nP31x5Fn8KYklvGpdexTgY9F9yZZX7Fhu5XUE0KLh2 SmBBQt0WPKNLxT9WVuoh3BDFvtVlaZLNff9sue9svlJAiUFPeyWx0AFGZW3kpbz71Piu XLzQTd4ynjjtsqPeQ1O5nKwCmOlA4KROs29FGJlVCN66m9QL8LXxRyRdS+kL9m0fAqu2 YRmeEgciBB9DFSeWvlTTCLFYDsDVCOAO+WbQ0jIrV0DN0otPEVPHiUscZnKR1fOPbr+i mXHQ== 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=J7+CnAQpAGEZqMKPVkc+vuXNEzMjDORrCZbKCH4kC9Q=; b=Qz6p8faEUnTPwNixeI4gy0m/iTT/8iDt7w74p9aMbadEXwIn7B/hD75GfaJYDBa5Zx MlSN5cvfkQAkOfF4fugh9uOz+go6gKtlMvp5DGGNPyRjUsDj3dPi+EOGoM9MPMA86nHl EnB76i4taK3V6cNgfwfp8OVUB2Yn6pElX+qGy/abyJLQskyvyUqJnBpX8bZrMLs1edTR s56sGGKJs6DCq/8wUIYmWfHLoEzosRvSh3pWM5LEa1d4HXxawLnEjrsnp4WzrRJrvA4N p4wW2rU4AFVCR2vpHX73qoK9YJJD4PrpYB8qQPgbEmr4qP4kWlw0iBjI/3hgAUNSKZnm KxMw== 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 140si20483612pfy.113.2019.06.03.08.54.44; Mon, 03 Jun 2019 08:54:44 -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 S1729726AbfFCPyn (ORCPT + 30 others); Mon, 3 Jun 2019 11:54:43 -0400 Received: from foss.arm.com ([217.140.101.70]:53662 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728750AbfFCPvU (ORCPT ); Mon, 3 Jun 2019 11:51:20 -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 C2C461715; Mon, 3 Jun 2019 08:51:19 -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 CDD5D3F246; Mon, 3 Jun 2019 08:51:18 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [RFC PATCH 14/57] drivers: devcon: Use bus_find_device_by_fwnode helper Date: Mon, 3 Jun 2019 16:49:40 +0100 Message-Id: <1559577023-558-15-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 Switch to using the bus_find_device_by_fwnode helper Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- drivers/base/devcon.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/base/devcon.c b/drivers/base/devcon.c index 04db9ae..d9bcf77 100644 --- a/drivers/base/devcon.c +++ b/drivers/base/devcon.c @@ -107,19 +107,13 @@ static struct bus_type *generic_match_buses[] = { NULL, }; -static int device_fwnode_match(struct device *dev, void *fwnode) -{ - return dev_fwnode(dev) == fwnode; -} - static void *device_connection_fwnode_match(struct device_connection *con) { struct bus_type *bus; struct device *dev; for (bus = generic_match_buses[0]; bus; bus++) { - dev = bus_find_device(bus, NULL, (void *)con->fwnode, - device_fwnode_match); + dev = bus_find_device_by_fwnode(bus, NULL, con->fwnode); if (dev && !strncmp(dev_name(dev), con->id, strlen(con->id))) return dev; From patchwork Mon Jun 3 15:49:41 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: 165653 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4647500ili; Mon, 3 Jun 2019 08:54:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzWaza7G0pYNVHx7qg4rUqjO1vnMMMcRfl//dZJXJMywRSowqPjbGn6Msa+KUVCs4drpZJL X-Received: by 2002:aa7:8ec6:: with SMTP id b6mr32257270pfr.234.1559577277422; Mon, 03 Jun 2019 08:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577277; cv=none; d=google.com; s=arc-20160816; b=XVXBFEaU5nTbq2jTsCZSISal2WQZnGq3zl59pNvnHQ8Id+6s9u6y06zIrhms9IKnfv d7aLHm9K0193Alj2NcdFJekOUO/4fOUcmKUfg/kV5pkPw2xBC6a++gDk2ZZz6WrFnnbO UBVbuej2IRNWVmBb0IzOJID6XL944p5caIoHyTIPJ+XzBRmt9N2Djd1DprVtByiKBhTH aF3vHXdXkAGxtZTW5p574tm8MIm2zel0OdQcfcIJw++Bcp2dEZeqfczIXxoTucwCwagY k6jcTvvLDzlXQQNPv18PgJ4M0CWFT0+lFV872afdl6xAKVqU5sCO0kcb9ouuMSKXSeID GQWA== 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=xqLJLAwyKSrLC8A5FfF/RagZ/La3AVcJQ55lcUGY1/w=; b=S2xbEjRjed011lpR6yNc0FAm3uCU/zZqTDUplZYNLnL+1GfXFAi1jLghhwrT/Zwu/e WnDcNU4/ftuw+BVi64hLDBNBb5N47uJdIfgB3thB1fdm8QzfL9xxxUE68/kDxrERR+ey +aK8mJWMnJ08LXbFCsxSje36UyqdTfDiX+Fb8WZRBue6hdbTZrqSrPjj4arOOeHLzCcL BBWZZ7jUGp4rmdGKNwHyAKLR1GDeupjIMo1avyzN0X4yxX32KrUp/W3LA/WUXOKq4fGS 7Siky4Gk46YUyt0DoKCObVQje7/2rOXGLPx8rjoqitSkJCSz1x25HJicmJ49ZedgSuE+ hEtQ== 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 k93si18106987pjb.33.2019.06.03.08.54.36; Mon, 03 Jun 2019 08:54:37 -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 S1729602AbfFCPyg (ORCPT + 30 others); Mon, 3 Jun 2019 11:54:36 -0400 Received: from foss.arm.com ([217.140.101.70]:53676 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728118AbfFCPvV (ORCPT ); Mon, 3 Jun 2019 11:51:21 -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 254F9169E; Mon, 3 Jun 2019 08:51:21 -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 0BA403F246; Mon, 3 Jun 2019 08:51:19 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, "David S. Miller" Subject: [RFC PATCH 15/57] net: hisilicon: hnfs:Use bus_find_device_by_fwnode helper Date: Mon, 3 Jun 2019 16:49:41 +0100 Message-Id: <1559577023-558-16-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 Switch to using the bus_find_device_by_fwnode helper Cc: "David S. Miller" Signed-off-by: Suzuki K Poulose --- drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c index 09c16d8..b801ab7 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c @@ -754,17 +754,11 @@ struct dsaf_misc_op *hns_misc_op_get(struct dsaf_device *dsaf_dev) return (void *)misc_op; } -static int hns_dsaf_dev_match(struct device *dev, void *fwnode) -{ - return dev->fwnode == fwnode; -} - struct platform_device *hns_dsaf_find_platform_device(struct fwnode_handle *fwnode) { struct device *dev; - dev = bus_find_device(&platform_bus_type, NULL, - fwnode, hns_dsaf_dev_match); + dev = bus_find_device_by_fwnode(&platform_bus_type, NULL, fwnode); return dev ? to_platform_device(dev) : NULL; } From patchwork Mon Jun 3 15:49:42 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: 165610 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644171ili; Mon, 3 Jun 2019 08:51:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4eSH+dPGkiCLwRyGRGFVv1qSrg51ki+1slKzz3toVS7F7CBymSI4dq/mi4uJpUa9Yv/i4 X-Received: by 2002:a65:51c7:: with SMTP id i7mr29431829pgq.211.1559577085740; Mon, 03 Jun 2019 08:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577085; cv=none; d=google.com; s=arc-20160816; b=qjO5zRjycMffAfEeOBCjwIeW8iPKT/Zx4XgXVfWQQSFu1rNbCVIWiSzVx2TceDWaHS B20xKGM/Dk1eg00sxT8Cagzc+DRKBhn8ZimLEOr0OabnbBBGLfQ5kUemIzW7OziPhPuw 5/xYiNyiLu9aW6raRr4b49//dzYXukgakFfBxdLjEL5l4OOxGkQ8y9plDPa8cZouota9 eIaTqx5CMZsjwdvYnnEWMmjpFXsnHpFdvvmgV1zryvTZxFR0RpXxslICj++5B5tDRcLt B4CQ2A6bJigCGvdN05ZtAhdLf0IYCjM1J6OsRy/YzD3zFAcgQCWczb0eQn5F6XTvFvyt iIHw== 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=M3rlUV5Qko2QQEkEhRIFPWppQFciN2J8+SfGdhQuMFk=; b=LE4ePQ4okZVDgNR7ZwvGAyX+IrTB7GVMX9DX83P5lgdAw5yNSpj+Tihh269uDZ3IcQ kpD2UliCp0GNSATlhLjvDuyE3nvNvZJIuNXfLELF+yArN+PKiJQXx0XkJO1SHDv1R1DG 8SFxxFWQbvkZeFnBv1xde76FJMu/l0rdIxjp14Hs88eFQJ3T6FCOXZMLvg7pJyC8Q/2G K4o3xQi1FQ+CREVNUSW56OJwDOA+DRVHIHH/ja/4mdtM8lO/0UN+V3Lq5TbcKc3QOBR2 zL/ls8aq/Sn+/MdAILeazAVjqQWCr7ju+6Ff8ML6P9E0fbM9rhqVcj5zO8//syuVNh+w BlYA== 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 g69si20591014plb.70.2019.06.03.08.51.25; Mon, 03 Jun 2019 08:51:25 -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 S1729011AbfFCPvY (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:24 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53684 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728963AbfFCPvW (ORCPT ); Mon, 3 Jun 2019 11:51:22 -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 9E8B215AB; Mon, 3 Jun 2019 08:51:22 -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 623803F246; Mon, 3 Jun 2019 08:51:21 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Doug Ledford , Jason Gunthorpe Subject: [RFC PATCH 16/57] net: hns_roce: Use bus_find_device_by_fwnode helper Date: Mon, 3 Jun 2019 16:49:42 +0100 Message-Id: <1559577023-558-17-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 Switch to using the bus_find_device_by_fwnode helper Cc: Doug Ledford Cc: Jason Gunthorpe Signed-off-by: Suzuki K Poulose --- drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.7.4 Acked-by: Jason Gunthorpe diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c index 4c5d0f1..0985078 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c @@ -4497,19 +4497,13 @@ static const struct acpi_device_id hns_roce_acpi_match[] = { }; MODULE_DEVICE_TABLE(acpi, hns_roce_acpi_match); -static int hns_roce_node_match(struct device *dev, void *fwnode) -{ - return dev->fwnode == fwnode; -} - static struct platform_device *hns_roce_find_pdev(struct fwnode_handle *fwnode) { struct device *dev; /* get the 'device' corresponding to the matching 'fwnode' */ - dev = bus_find_device(&platform_bus_type, NULL, - fwnode, hns_roce_node_match); + dev = bus_find_device_by_fwnode(&platform_bus_type, NULL, fwnode); /* get the platform device */ return dev ? to_platform_device(dev) : NULL; } From patchwork Mon Jun 3 15:49:43 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: 165614 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644327ili; Mon, 3 Jun 2019 08:51:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqykbIQIAvJmPMkef00oWdAf3HuaL+BKUXSrKnOpzoeaZZa5GbRHjDUnO/Vl3kZ+ozU36y47 X-Received: by 2002:a17:902:7c10:: with SMTP id x16mr29509730pll.4.1559577094750; Mon, 03 Jun 2019 08:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577094; cv=none; d=google.com; s=arc-20160816; b=iRi5a9bFiEbbrSpdgLCg6skbFQtxE2VIOe0bj+y4RWTeBjLDkR7Q2ZmWEP5guS6mqe YXQy9pWKizuEUuag884tsLuVb5OVzpiwsWxHmCpg5iI/ccoetn7A0KhxsI4s9gBwTRUe RCCXH0AhhKPecKmaxNZw4QzABN0uaZlgIFL6tTFMIbdzUoDRSbJPRQjVvdPdXYxOnagG U/TuXVORuzlvAvi9akyldVF15pgsVGpIYHEX3IKNck4GVO0SIfJ4y8/Ml8mT6KP4eAMG goqzcn7atlzIQP4p1MkN5t8b3bwGXgYVSUXuSx85/URkMPBuw+y9OK82jB5ZXklO6L2f dq7Q== 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=WRbgEXhJUtFpxmVmOqLtjjcIAWpmYnb03qgVxxDlgXE=; b=so2Y2lyfIVFgZgBH6RntLXqqNgUrwHkcVllxrjosiRAmcMjo4CQ7rqo77RvcrbGpyd VqROhS2GF073CM7eNdTbNFMa9ezPewGH1YJTnNzKm44PuKSiwfPa0hILWZAhnXNcA5j6 DfgnjkyVTYasykckCaSD9L+F7TChfriqg5zCtsqa/Ic7wlUCG7WLcM519jNV6xDqQ6xl rp4lTFvklvQOQiGLWzysVTMXGDLBKFoETgql5M/GlgtwaliciwVIYnATcTRFyfYul+pj sNK8SUVP6eBy79kzY+jd1Vh2e2MJ+CD3m4T+yzHBD0S6XjmEIUIcZqCYQ3uRKNXeSkNZ nKHQ== 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 ch7si14962581plb.21.2019.06.03.08.51.34; Mon, 03 Jun 2019 08:51:34 -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 S1729202AbfFCPvd (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:33 -0400 Received: from foss.arm.com ([217.140.101.70]:53698 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728994AbfFCPvY (ORCPT ); Mon, 3 Jun 2019 11:51:24 -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 EAB8E1715; Mon, 3 Jun 2019 08:51:23 -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 DB6D83F246; Mon, 3 Jun 2019 08:51:22 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Ulf Hansson Subject: [RFC PATCH 17/57] drivers: Add generic match by device type helper Date: Mon, 3 Jun 2019 16:49:43 +0100 Message-Id: <1559577023-558-18-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 Add a generic helper routine to match the device type of a given device. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Ulf Hansson Signed-off-by: Suzuki K Poulose --- drivers/base/core.c | 6 ++++++ include/linux/device.h | 15 +++++++++++++++ 2 files changed, 21 insertions(+) -- 2.7.4 diff --git a/drivers/base/core.c b/drivers/base/core.c index 141c4f8..9df812f 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3340,3 +3340,9 @@ int device_match_fwnode(struct device *dev, void *fwnode) return dev_fwnode(dev) == fwnode; } EXPORT_SYMBOL_GPL(device_match_fwnode); + +int device_match_devt(struct device *dev, void *pdevt) +{ + return dev->devt == *(dev_t *)pdevt; +} +EXPORT_SYMBOL_GPL(device_match_devt); diff --git a/include/linux/device.h b/include/linux/device.h index 54be931..83c0745 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -165,6 +165,7 @@ void subsys_dev_iter_exit(struct subsys_dev_iter *iter); int device_match_of_node(struct device *dev, void *np); int device_match_fwnode(struct device *dev, void *fwnode); +int device_match_devt(struct device *dev, void *pdevt); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); @@ -203,6 +204,20 @@ static inline struct device *bus_find_device_by_fwnode(struct bus_type *bus, return bus_find_device(bus, start, fwnode, device_match_fwnode); } +/** + * bus_find_device_by_devt : device iterator for locating a particular device + * matching the device type. + * @bus: bus type + * @start: Device to begin with + * @devt: device type of the device to match. + */ +static inline struct device *bus_find_device_by_devt(struct bus_type *bus, + struct device *start, + dev_t devt) +{ + return bus_find_device(bus, start, &devt, device_match_devt); +} + struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, struct device *hint); int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, From patchwork Mon Jun 3 15:49:44 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: 165611 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644257ili; Mon, 3 Jun 2019 08:51:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTkntB/PlsUn4EKcC4CoqOMeCy+Cy/0JNbCjLjsMzVHaBZyjPeQ3QJt1+tUWp7sbgAOFLG X-Received: by 2002:a17:90a:654b:: with SMTP id f11mr31253524pjs.34.1559577089990; Mon, 03 Jun 2019 08:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577089; cv=none; d=google.com; s=arc-20160816; b=0S35KmC/s3ZWhPSEktAaa9/FSejhhVFtw8URroIL1hmw+4qmi3zyzSEj4cWwgedcBh YKZngPcdD7oE1+behPd0YukDJ+oeTlT33MWKBsZKXWZjwVOpRTSbVGbPaXpqWxIh0Tns m1ymxxpth2mea5wY+ageTVohAyxkZBJCh3cGLjqRk6Z8/eHX0LV0UID2NVYlGIFaySCU DxzynzkqBr7LBTNSNda4iJMcpj3n+PqtMn0IUBATUQrco+zjs6MKsjed7Mh7XBsRVHbv brJ7rL0qB18TrkjZumOhzEkieZZqsTVzOuKKN6Hl1XPR7fx0B81i20zFmGLbD+OT/j4S JkXw== 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=qyhPrXjOxzDCJZ3hCmforHZ0TOXw4KhLSoc+quNQzkY=; b=ZjOckkUbUNNRcbtTN/fGmq731KGWywJM4Tf7+ha7YiqW6PEHfwoyqbjloDsQF/xXaV Tx2l9zE5/j9pwp/1jK7RXb+8C8/390ekOf6nE0EU9fz3HR4Cj0+W9PI54wiBbYEIBAeq YQ9xarJvH0Q4dJ40WHaE7SDDbFLPd0Erq2IbXDqd6eRhQjuVweayqRQN68YQ1Zp2DWBk HL5AoEVeagA4r6SPf8K3qGPq7n5hKbbZuJSDM9r2TjDQloejEQIKOJXtxjT4uT+oS5GL wyBc97DW5Jy0T+fY93y7pup4mpmmCDATj3ri4O9LsSZZBMPdXWZ3AIAVCefiXr/URqqM Rn0Q== 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 a3si19481007pff.117.2019.06.03.08.51.29; Mon, 03 Jun 2019 08:51:29 -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 S1729081AbfFCPv2 (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:28 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53706 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728963AbfFCPvZ (ORCPT ); Mon, 3 Jun 2019 11:51:25 -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 4C7AD169E; Mon, 3 Jun 2019 08:51:25 -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 3375A3F246; Mon, 3 Jun 2019 08:51:24 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Alexander Shishkin Subject: [RFC PATCH 18/57] drivers: intel_th: Use bus_find_device_by_devt helper Date: Mon, 3 Jun 2019 16:49:44 +0100 Message-Id: <1559577023-558-19-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 Switch to using the bus_find_device_by_devt helper Cc: Alexander Shishkin Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/intel_th/core.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c index 033dce5..a85e236 100644 --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c @@ -789,13 +789,6 @@ static int intel_th_populate(struct intel_th *th) return 0; } -static int match_devt(struct device *dev, void *data) -{ - dev_t devt = (dev_t)(unsigned long)data; - - return dev->devt == devt; -} - static int intel_th_output_open(struct inode *inode, struct file *file) { const struct file_operations *fops; @@ -803,9 +796,7 @@ static int intel_th_output_open(struct inode *inode, struct file *file) struct device *dev; int err; - dev = bus_find_device(&intel_th_bus, NULL, - (void *)(unsigned long)inode->i_rdev, - match_devt); + dev = bus_find_device_by_devt(&intel_th_bus, NULL, inode->i_rdev); if (!dev || !dev->driver) return -ENODEV; From patchwork Mon Jun 3 15:49:45 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: 165612 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644291ili; Mon, 3 Jun 2019 08:51:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQeHqLMtmKY8IXAlBcWhGAcLfUP5tAwXDaMIq3IGYJbRRu/2q9kR3CaaXhhbcU05SWv5cS X-Received: by 2002:a17:902:20e2:: with SMTP id v31mr30627384plg.138.1559577092332; Mon, 03 Jun 2019 08:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577092; cv=none; d=google.com; s=arc-20160816; b=0UhyqqBqc6sViYQmsK1yUcGL/xbqdj6Fv/nnY3+wz5nsVx4bBVsctWvsppMpwlqpd0 L+XiCKDXLGTRthxINZUHckPIFXQwdPXylsXBoFPszVTpZ0EqDbvZ9UxnlgGTdqmVW/ce GW1piekD8TM1kXbewtC3oqptLuapriYFYl268br41+aHTWYGA5Po1R9Ym5FARMpOSimM AXLu5/N4TkkD+k3f95vXB/pQPbMWUFUYCRTcEQZyD37lFViMivKX9H5aTbdQsDCcBDdg bkf+VpHhIsuGmzqUICPwFhnjqlpJT+7+cukpmwweNAedqhggLujZxsGM1e1DuPp8MlY6 2fEg== 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=imJIjri/YnCYfeFNwMLlfub7Tw7MWfP1cAfB0Wjijn0=; b=Idriug3kJVgHX6Mv5IExRAvZ4ofmUltocMtC9TVq61zCWLTO1MCrahurXUFp/8JQVw nZaf9IdP5Z23abCdv5mOg2y/8VVK6rujaZ7A+m/4MvK0maQmw8CGPabTVPuyNcSBSzDs g1TxrPrwzU17jz9KkJnpK7YtvJi/VDi96mLVFwOmgvacQnNAvunPkhMysctYRKK8anZK tTRLOAZ3AADVDKXd9MqsrcxUZfQMnoPHcV78LqAk/lAWf1oVDzqnBn93Gm0appBdHVg7 qu4FNPSjj7sFMl281PfS4P2KTqKI2Sy2sGmuGk1MSi/VvfxA+w9g5DZcET0QRoJBX/UB QZ2g== 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 ch7si14962581plb.21.2019.06.03.08.51.32; Mon, 03 Jun 2019 08:51:32 -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 S1729133AbfFCPvb (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:31 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53714 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729012AbfFCPv1 (ORCPT ); Mon, 3 Jun 2019 11:51:27 -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 E90101715; Mon, 3 Jun 2019 08:51:26 -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 8984C3F246; Mon, 3 Jun 2019 08:51:25 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Oliver Neukum , Sebastian Andrzej Siewior , linux-usb@vger.kernel.org Subject: [RFC PATCH 19/57] drivers: usb: core: Use bus_find_device_by_devt helper Date: Mon, 3 Jun 2019 16:49:45 +0100 Message-Id: <1559577023-558-20-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 Switch to using the bus_find_device_by_devt helper Cc: Greg Kroah-Hartman Cc: Oliver Neukum Cc: Sebastian Andrzej Siewior Cc: linux-usb@vger.kernel.org Signed-off-by: Suzuki K Poulose --- drivers/usb/core/devio.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index fa783531..28358a3 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -947,17 +947,11 @@ static int parse_usbdevfs_streams(struct usb_dev_state *ps, return ret; } -static int match_devt(struct device *dev, void *data) -{ - return dev->devt == (dev_t) (unsigned long) data; -} - static struct usb_device *usbdev_lookup_by_devt(dev_t devt) { struct device *dev; - dev = bus_find_device(&usb_bus_type, NULL, - (void *) (unsigned long) devt, match_devt); + dev = bus_find_device_by_devt(&usb_bus_type, NULL, devt); if (!dev) return NULL; return to_usb_device(dev); From patchwork Mon Jun 3 15:49:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 165648 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646887ili; Mon, 3 Jun 2019 08:54:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRKhxsKko16R23ssevQLZu6i/s+UmjaDeLkWPhoNXWewwhUbrLf5G0eDsWCwrkaWOFg4bT X-Received: by 2002:a63:4045:: with SMTP id n66mr1253417pga.386.1559577244788; Mon, 03 Jun 2019 08:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577244; cv=none; d=google.com; s=arc-20160816; b=KmdMG4UEfAE3DlYjpvN3wq1aEIrHuZxYLvwpDkwykL6mycjljyIdS4PvnIYEOUtx6A 8fRzvFaKbsInisypI9GrXpDXMgvBJ24/tl3KXKyPiui+fQB71mCEjnk1+IEHdD2d2ab9 hxfYcKWzM5UOeF0kQK1a/JBPHhTUETsEwCC6YG634XfrJ3tpNhOgbV2XYddhGeLHx0q1 4JdduFrLqEr4FjcCDju/oaT34uFkct7zXfythV2nEHm2g7FR3N57AOzqOePOAQWc2+l2 dQLJjehCEd+LU1clxdQksr57K02C5VUgxHXBk6MYFnowIcAS8zdKB7HT04U36t1Nf4lt txoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=af6She6IJAV5l/88Wa5gKZPByxQdtf0ENhtouIPAnOo=; b=N2DEli67s/xQadzLCMb87M7YztQLfed+u6Xoxte9HW4bJNHnzY8udUR0fin83ahDeT sWWaF2RG1nqsjD+hYIbNkLcdeP1pVqa1FZ0wWwxMrS6CR8GBtWdqI21bMAHBD2qi/QDw vlyJMp3kquc8AWtCdSASAgup4fBKUn+tp6F8KUg/OiTTo1cYx2zjSyBBV/eQ3tl9U9EK hfYwQWJtDBfUDBcv2Li5oHxoKlDLstQDFpoEJdC20SQmMpOiRebdWcZuP8Vv5qkGB/Fu LH1R8EM4Q/wcwDWLDE31PazrQNOlmrhog3Aznl2RMB2TKReSX99ibfZTcocOfTWh2DTu 7CTA== 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 u126si15462989pgu.117.2019.06.03.08.54.04; Mon, 03 Jun 2019 08:54:04 -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 S1729233AbfFCPvf (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:35 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53724 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728963AbfFCPv3 (ORCPT ); Mon, 3 Jun 2019 11:51:29 -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 CF225174E; Mon, 3 Jun 2019 08:51:28 -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 322BE3F246; Mon, 3 Jun 2019 08:51:27 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Inki Dae , Seung-Woo Kim , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Eric Anholt Subject: [RFC PATCH 20/57] platform: Add a helper to find device by driver Date: Mon, 3 Jun 2019 16:49:46 +0100 Message-Id: <1559577023-558-21-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> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are a couple of places where we reuse platform specific match to find a device. Instead of spilling the global varilable everywhere, let us provide a helper to do the same. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Inki Dae Cc: Seung-Woo Kim Cc: Sandy Huang Cc: "Heiko Stübner" Cc: Eric Anholt Signed-off-by: Suzuki K Poulose --- drivers/base/platform.c | 14 ++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.c | 9 +++------ drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 3 +-- drivers/gpu/drm/vc4/vc4_drv.c | 3 +-- include/linux/platform_device.h | 3 +++ 5 files changed, 22 insertions(+), 10 deletions(-) -- 2.7.4 Tested-by: Heiko Stuebner diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 4d17298..daca44f 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -1197,6 +1197,20 @@ struct bus_type platform_bus_type = { }; EXPORT_SYMBOL_GPL(platform_bus_type); +/** + * platform_find_device_by_driver - Find a platform device with a given + * driver. + * @start: The device to start the search from. + * @drv: The device driver to look for. + */ +struct device *platform_find_device_by_driver(struct device *start, + const struct device_driver *drv) +{ + return bus_find_device(&platform_bus_type, start, (void *)drv, + (int (*)(struct device *, void *))platform_match); +} +EXPORT_SYMBOL_GPL(platform_find_device_by_driver); + int __init platform_bus_init(void) { int error; diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index ba8932a..b357e0d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -244,9 +244,7 @@ static struct component_match *exynos_drm_match_add(struct device *dev) if (!info->driver || !(info->flags & DRM_COMPONENT_DRIVER)) continue; - while ((d = bus_find_device(&platform_bus_type, p, - &info->driver->driver, - (void *)platform_bus_type.match))) { + while ((d = platform_find_device_by_driver(p, &info->driver->driver))) { put_device(p); if (!(info->flags & DRM_FIMC_DEVICE) || @@ -414,9 +412,8 @@ static void exynos_drm_unregister_devices(void) if (!info->driver || !(info->flags & DRM_VIRTUAL_DEVICE)) continue; - while ((dev = bus_find_device(&platform_bus_type, NULL, - &info->driver->driver, - (void *)platform_bus_type.match))) { + while ((dev = platform_find_device_by_driver(NULL, + &info->driver->driver))) { put_device(dev); platform_device_unregister(to_platform_device(dev)); } diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index cb938d3..4eb4fb8 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -338,8 +338,7 @@ static struct component_match *rockchip_drm_match_add(struct device *dev) struct device *p = NULL, *d; do { - d = bus_find_device(&platform_bus_type, p, &drv->driver, - (void *)platform_bus_type.match); + d = platform_find_device_by_driver(p, &drv->driver); put_device(p); p = d; diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 6d9be20..d159eb5 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -236,8 +236,7 @@ static void vc4_match_add_drivers(struct device *dev, struct device_driver *drv = &drivers[i]->driver; struct device *p = NULL, *d; - while ((d = bus_find_device(&platform_bus_type, p, drv, - (void *)platform_bus_type.match))) { + while ((d = platform_find_device_by_driver(p, drv))) { put_device(p); component_match_add(dev, match, compare_dev, d); p = d; diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index cc46485..a82b3ec 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -52,6 +52,9 @@ extern struct device platform_bus; extern void arch_setup_pdev_archdata(struct platform_device *); extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); +extern struct device * +platform_find_device_by_driver(struct device dev*, + const struct device_driver *drv); extern void __iomem * devm_platform_ioremap_resource(struct platform_device *pdev, unsigned int index); From patchwork Mon Jun 3 15:49:47 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: 165615 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644374ili; Mon, 3 Jun 2019 08:51:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/bULgnEmpYh7ORyJdR9I/wT6W6GwpvBXuX70ImAowbR9mf2RGjilZBC4bkFyoUlDWx5yd X-Received: by 2002:a17:902:f204:: with SMTP id gn4mr12108960plb.3.1559577097362; Mon, 03 Jun 2019 08:51:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577097; cv=none; d=google.com; s=arc-20160816; b=hiYfLnINUL6uuLrc34H8/HxwC5nEo9VNXr4XU1u+07cy4COOc02Aiy3p6Z1fCH6DFm YdzeABw1KauWlBN4StGim5fhOX848dkpsrU8Q7tL5zyl47cXG//34GNLrL66ZDs47O/0 tpR+RlktqrqO8olYXClZbC5+ZJ3OCQcU6ouz9ptx9MjzVXQILt7N1EdMvRZA2yu2Gdyf bfQi+ddHGgt7xO9dm3fnd4RIJOlTeEK5NOXDzwG3TWFjVXsTbx0py7uCNN95T1OqvWp+ 85WMWzMjot1ZzkuwFaLSODi1K3zbfPVEAJM0d0f81TDgqLUpW9P0OSrc20nShbOuqR+j 5Alw== 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=F2scviFIw6wJyj8zPpKEx7Qxe82QjyMwJGspHdw4jJY=; b=b0U8/15P7bpdzL8nMWw4Mvzfhwg2jpUGA9Q3ou1ts5IhDb8vwQ7zf4x+J8U21h7LgJ VMX43gtKe6nEM7UHu+ITzef8BIN6Qrme3tw9ICsqZ43n198669BfKSsDC+xzKpcnPFch +xuqulaNF7r31qO4jZ3yzPPJimqwUpGQkFfVctecxNRdG649WRNihOI/D4tCCtmf4BZx HzRzIXgj3sMtRRRw8I1gUEpm3RRFLkYxY9XzeeoDdOtKE502qQOgDXBXloqgpaJ9/bKB SExfUjehkUl8Dbm11gw52qESLJc7iLojArnTnSrzUMM68uLbZ+nkBJs0zKrBfSEBLZFn MDKQ== 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 ch7si14962581plb.21.2019.06.03.08.51.37; Mon, 03 Jun 2019 08:51:37 -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 S1729276AbfFCPvg (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:36 -0400 Received: from foss.arm.com ([217.140.101.70]:53740 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729112AbfFCPva (ORCPT ); Mon, 3 Jun 2019 11:51:30 -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 03A461A25; Mon, 3 Jun 2019 08:51:30 -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 17D1A3F246; Mon, 3 Jun 2019 08:51:28 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [RFC PATCH 21/57] drivers: Add generic match helper by ACPI_COMPANION device Date: Mon, 3 Jun 2019 16:49:47 +0100 Message-Id: <1559577023-558-22-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 Add a generic helper to match a device by the acpi device. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- drivers/base/core.c | 6 ++++++ include/linux/device.h | 1 + 2 files changed, 7 insertions(+) -- 2.7.4 diff --git a/drivers/base/core.c b/drivers/base/core.c index 9df812f..db19185 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3335,6 +3335,12 @@ int device_match_of_node(struct device *dev, void *np) } EXPORT_SYMBOL_GPL(device_match_of_node); +int device_match_acpi_dev(struct device *dev, void *adev) +{ + return ACPI_COMPANION(dev) == adev; +} +EXPORT_SYMBOL(device_match_acpi_dev); + int device_match_fwnode(struct device *dev, void *fwnode) { return dev_fwnode(dev) == fwnode; diff --git a/include/linux/device.h b/include/linux/device.h index 83c0745..6ad1a27 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -164,6 +164,7 @@ struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); void subsys_dev_iter_exit(struct subsys_dev_iter *iter); int device_match_of_node(struct device *dev, void *np); +int device_match_acpi_dev(struct device *dev, void *adev); int device_match_fwnode(struct device *dev, void *fwnode); int device_match_devt(struct device *dev, void *pdevt); From patchwork Mon Jun 3 15:49:50 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: 165650 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4647040ili; Mon, 3 Jun 2019 08:54:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyg1ytQ+dS8FxxSTPnV/MkSG636s1IMy+IGbUyNJbuTVjC5QEICYYjHq48QzQf5sE1O3jot X-Received: by 2002:a17:90a:7146:: with SMTP id g6mr30542321pjs.45.1559577252303; Mon, 03 Jun 2019 08:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577252; cv=none; d=google.com; s=arc-20160816; b=Wfajfuv2lvbBI48KW737N0d/tyaCIHdAG2DxXyxWf8klx/HrUvRd1vRUoAMkfHnzOP nRS1z3pPrFLXVbL6u7bIF75UFOSKBft+eSHD/PLgXqRM1lNFwMUwAJWCU6rVqnPe3eUJ dSkF3fL2IhXpjYJThsPMeI3zPhFRdQTW5BKKCfmV6C3oorCqZpQ63EYDJr5Dq2w5qJtS MZk1xVFBDNUyMlQ2NVezyNQRX7mg+MvJhcfvIBQgNwvUZt4wiMPmiUF/Vzhlcw8Oxf94 4LhelBYFyGYeqIlGmFF4RuCAfrX6d4GiKjPVWEr5me9FOCIwYJxjHUj6GQVFxwlikLDA 1Few== 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=HHT1i36tdOpkRbOol0DkgsOJzkmh4aJc0S//oAfH+0A=; b=PDyfIO359uEnJg0a3m3oS4POCe705xfN8VlQo1CzyoW+MsH1YIG2w6Ia/YN30dP0x1 QY5q2dgHV/hmwPhlD/Kp0PhPtbNd20TiSfI2W/eGepY66YFeChLuOiDFRds9o+AIyofj qza13A0pO7CU+Bx6NKAU2b4tY0qY+eoZlgWoLd8NRa1VY1dJpgiu8FIhpIM08f9IfgRr ZPR29Ca3B8I/jsDx+R4OZSfdpTexz2y9HiiB93EUUW/Ge5b8jCkpZbbNTpEjdLwMaDIH 5h21XFZsV9OcTbvKTt8fJNGHklMM4SStUJothTxUO79suuq2FhVufc5vzauVFf+AgdjE HpBQ== 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 u126si15462989pgu.117.2019.06.03.08.54.11; Mon, 03 Jun 2019 08:54:12 -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 S1729713AbfFCPyL (ORCPT + 30 others); Mon, 3 Jun 2019 11:54:11 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53766 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729210AbfFCPve (ORCPT ); Mon, 3 Jun 2019 11:51:34 -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 573D11A25; Mon, 3 Jun 2019 08:51:34 -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 620843F246; Mon, 3 Jun 2019 08:51:33 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [RFC PATCH 24/57] drivers: staging: most-core: Use bus_find_device_by_name Date: Mon, 3 Jun 2019 16:49:50 +0100 Message-Id: <1559577023-558-25-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 Use bus_find_device_by_name() helper. Signed-off-by: Suzuki K Poulose --- drivers/staging/most/core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c index 86a8545..b9841adb 100644 --- a/drivers/staging/most/core.c +++ b/drivers/staging/most/core.c @@ -561,13 +561,6 @@ static int split_string(char *buf, char **a, char **b, char **c, char **d) return 0; } -static int match_bus_dev(struct device *dev, void *data) -{ - char *mdev_name = data; - - return !strcmp(dev_name(dev), mdev_name); -} - /** * get_channel - get pointer to channel * @mdev: name of the device interface @@ -579,7 +572,7 @@ static struct most_channel *get_channel(char *mdev, char *mdev_ch) struct most_interface *iface; struct most_channel *c, *tmp; - dev = bus_find_device(&mc.bus, NULL, mdev, match_bus_dev); + dev = bus_find_device_by_name(&mc.bus, NULL, mdev); if (!dev) return NULL; iface = to_most_interface(dev); From patchwork Mon Jun 3 15:49:51 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: 165649 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646917ili; Mon, 3 Jun 2019 08:54:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdlyZATeuvvsTXSFLpWUmS3/A1rj7CWwIIjRr+1f9fi8cVFJznlH3MNP+Q/F36v9qQoB/O X-Received: by 2002:a17:90a:898e:: with SMTP id v14mr4892028pjn.119.1559577246268; Mon, 03 Jun 2019 08:54:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577246; cv=none; d=google.com; s=arc-20160816; b=b2WyeMlKrvi2FaJ9oEz7t8SP+9lNLH1WBQ3xT5yJQHakyn3473Blp5vvQoA59L3cXF dKahhmD2JzNYHp3RK2UYAKyQSOrCZRbEPzjc3ZcubdJNVKMoDKSMq4MiudjDWGJgS6fY 0LmmjQF4f2d5gj2HAWvEIWrPftYXpP2754Mt0UDmkgvJUamF5P5BF6ct66ZPa/RZ/MSv Ye6R9AWzOuNgMPotKODxDy8MdD+opGlEUyZdYcOH3vVzd/7QeU0VAH5tWg5sEWwMHJsj Q/mkWEuqVrmRgUr6TlH3BDKDQ6cAbWsaU8zAOYLjPSpFDYGEHzlTV+pEMSYbtv5kDHax BZUw== 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=O7ISRCXzymDpF64+4Ey3SWB2dAYGuKtYlOL4EnWaatg=; b=j8IArHDA9o80UyUvPpJBPU0V2UMMPyDPKj6Kpno4uvYrgVUi+xxuAMJorq9rfm8Z4K CNlcVNJBPVUL0tsoaikzLLjDfh6GC7y1okEuSf10SC0PmQewW106V+QdUJYNWWneUolP 07uWnRWPs23yu/T6/rOQ2DvZ2y5McNPxA5xGJJOQyNbqrIyz2KRwYqWlO3PSArQc7GHg lMTEFjwKvwgiG6vey3bFjfeoHyrap//xB2rBTvUBU2fNmdzmkMeBzWjSirDOIWcjdeID t9VbCOW+vb/hTwiG5AS4w8oNF0UK0rV7WkUgUYt+p0rfO3YmsulmEiifKpzXKl2zYh6B Xo6A== 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 u126si15462989pgu.117.2019.06.03.08.54.05; Mon, 03 Jun 2019 08:54:06 -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 S1729708AbfFCPyF (ORCPT + 30 others); Mon, 3 Jun 2019 11:54:05 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53770 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729229AbfFCPvf (ORCPT ); Mon, 3 Jun 2019 11:51:35 -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 80ADD1715; Mon, 3 Jun 2019 08:51:35 -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 94DA63F246; Mon, 3 Jun 2019 08:51:34 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [RFC PATCH 25/57] drivers: Add generic match by name helper Date: Mon, 3 Jun 2019 16:49:51 +0100 Message-Id: <1559577023-558-26-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 Add a generic helper to match a device by its name. Also use the generic match by device name helper for bus_find_device_by_name. Since the new match function is also exported, let us convert this to a static inline function. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- drivers/base/bus.c | 24 ------------------------ drivers/base/core.c | 6 ++++++ include/linux/device.h | 21 ++++++++++++++++++--- 3 files changed, 24 insertions(+), 27 deletions(-) -- 2.7.4 diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 0a58e96..229e83ee 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -342,30 +342,6 @@ struct device *bus_find_device(struct bus_type *bus, } EXPORT_SYMBOL_GPL(bus_find_device); -static int match_name(struct device *dev, void *data) -{ - const char *name = data; - - return sysfs_streq(name, dev_name(dev)); -} - -/** - * bus_find_device_by_name - device iterator for locating a particular device of a specific name - * @bus: bus type - * @start: Device to begin with - * @name: name of the device to match - * - * This is similar to the bus_find_device() function above, but it handles - * searching by a name automatically, no need to write another strcmp matching - * function. - */ -struct device *bus_find_device_by_name(struct bus_type *bus, - struct device *start, const char *name) -{ - return bus_find_device(bus, start, (void *)name, match_name); -} -EXPORT_SYMBOL_GPL(bus_find_device_by_name); - /** * subsys_find_device_by_id - find a device with a specific enumeration number * @subsys: subsystem diff --git a/drivers/base/core.c b/drivers/base/core.c index db19185..88fa037 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3352,3 +3352,9 @@ int device_match_devt(struct device *dev, void *pdevt) return dev->devt == *(dev_t *)pdevt; } EXPORT_SYMBOL_GPL(device_match_devt); + +int device_match_name(struct device *dev, void *name) +{ + return sysfs_streq(dev_name(dev), name); +} +EXPORT_SYMBOL_GPL(device_match_name); diff --git a/include/linux/device.h b/include/linux/device.h index 6ad1a27..b4a9cd2 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -167,15 +167,30 @@ int device_match_of_node(struct device *dev, void *np); int device_match_acpi_dev(struct device *dev, void *adev); int device_match_fwnode(struct device *dev, void *fwnode); int device_match_devt(struct device *dev, void *pdevt); +int device_match_name(struct device *dev, void *name); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); struct device *bus_find_device(struct bus_type *bus, struct device *start, void *data, int (*match)(struct device *dev, void *data)); -struct device *bus_find_device_by_name(struct bus_type *bus, - struct device *start, - const char *name); + +/** + * bus_find_device_by_name - device iterator for locating a particular device + * of a specific name. + * @bus: bus type + * @start: Device to begin with + * @name: name of the device to match + * + * This is similar to the bus_find_device() function, but it handles + * searching by a name automatically. + */ +static inline struct device *bus_find_device_by_name(struct bus_type *bus, + struct device *start, + const char *name) +{ + return bus_find_device(bus, start, (void *)name, device_match_name); +} /** * bus_find_device_by_of_node : device iterator for locating a particular device From patchwork Mon Jun 3 15:49:52 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: 165616 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644460ili; Mon, 3 Jun 2019 08:51:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiqP8ehbhC1yJ0hTDr+V8n7Nn/Kh9XeA42rScwYHKz2XAuILpeZT+Sj5wxMmz095oIRJ/g X-Received: by 2002:aa7:8296:: with SMTP id s22mr31979868pfm.52.1559577102550; Mon, 03 Jun 2019 08:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577102; cv=none; d=google.com; s=arc-20160816; b=iFEkWIZw1/zcY24iBP4s50h0DqrQpOJLFeofss6cDRgO2dL5p4vLA3CB0GHKRNm7dR EzFqp0Yx+01Tfz3AtxMUF7uXxjaF+aymTujI2+RYuHx9HmmD/VumV/jt35KI9YJfPFXf Fy5iPLyaexlPI9C4zBzrQ6iqZj58V95utb4fEtK5dbR9riA98pw481RqEmOJkufQj73y 2K9uVYCJ/s9BlZTuXUFGCUaQlNW1+z54mv3/riZaJIqPbRPwgLKi3UaRWszqDQZFZX1j BT1FzpqaIhu+8o1sVPp2FO3oSfOxYvU+bWa/UMIlvfn6HijZi2mZrUUafQGxzYXezm6R o2og== 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=g2Vzl84NcQ49tv5c7zwRIv+4dtN+kHd9o2wAEcFYHJI=; b=RK2TPk4amd/eRi7gDQwMlpLJIls/GHMC986Eqgwi7FFoKBFo5moDG5QrL2m0oLN11e kfooeqUY7OADBaQni+pdhMzAW/kQaIOftiLwGriHPii6so0cm72psUxUJkRdigRXpqd2 LRgiUyVqBmz6ryn/2Fd5HYoGvKshgGvJmJK1NfYbn/n3ZVIVVn7wWyiT6zBS/rouZgAV QawfoBV4SIY10MYrpi9aPW+Z5YLOtCOQR++mUtHSBsiHNx9r6brjz2BojRGpyW7yZ8Ot g16gRlv3o9ynvpuXQGhKs8WfamV1kJLm+dae/ULd8v/Cl5Lm9ceyAg0na4Y8lcrjKHLt omsQ== 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 n2si13824126pgq.129.2019.06.03.08.51.42; Mon, 03 Jun 2019 08:51:42 -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 S1729329AbfFCPvl (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:41 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53778 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729282AbfFCPvh (ORCPT ); Mon, 3 Jun 2019 11:51:37 -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 1FE811A25; Mon, 3 Jun 2019 08:51:37 -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 BDC213F246; Mon, 3 Jun 2019 08:51:35 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org Subject: [RFC PATCH 26/57] drivers: acpi: Clean up acpi_dev_match_cb Date: Mon, 3 Jun 2019 16:49:52 +0100 Message-Id: <1559577023-558-27-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 acpi_dev_match_cb match function modifies the "data" argument to pass on a result which could be easily deduced from the result of the bus_find_device() call at the caller site. Clean this up in preparation to convert the "match" argument for bus_find_device. Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: linux-acpi@vger.kernel.org Signed-off-by: Suzuki K Poulose --- drivers/acpi/utils.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 7def63a..1391b63 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -725,8 +725,6 @@ bool acpi_dev_found(const char *hid) EXPORT_SYMBOL(acpi_dev_found); struct acpi_dev_match_info { - const char *dev_name; - struct acpi_device *adev; struct acpi_device_id hid[2]; const char *uid; s64 hrv; @@ -746,9 +744,6 @@ static int acpi_dev_match_cb(struct device *dev, void *data) strcmp(adev->pnp.unique_id, match->uid))) return 0; - match->dev_name = acpi_dev_name(adev); - match->adev = adev; - if (match->hrv == -1) return 1; @@ -818,7 +813,7 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv) match.hrv = hrv; dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb); - return dev ? match.adev : NULL; + return dev ? to_acpi_device(dev) : NULL; } EXPORT_SYMBOL(acpi_dev_get_first_match_dev); From patchwork Mon Jun 3 15:49:53 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: 165646 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646707ili; Mon, 3 Jun 2019 08:53:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyodquH8WuQejNZHABSzGqIGB/+/wswR/xBUCgCV4+mcUS2td62O8+v6DbWzbHGGnmCWwqp X-Received: by 2002:a65:56c2:: with SMTP id w2mr8361810pgs.49.1559577234010; Mon, 03 Jun 2019 08:53:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577234; cv=none; d=google.com; s=arc-20160816; b=CM5OwzSOvuogPzu+arJKrb7lGkCc9ffLNu+lqRFJIwa69aDTVIcbDWkFrl6LRP0gbX SvWrgjSBDhJ3uvSMVUUTrxtlllOYNMX8IaTW5998thw8lC4fRjb9iF4FmFJRxja6kU6w IfWz/qCMR1aGZIDViLPOdJmoWgG8xl4VAruw3XNgWogBUvUImOHJYac3kiUW9nSfuVFj B/Z+h4qISItUvo+aFx/tG5fI2euEi4QD9vR57p6dJszJk/EUuQSMa5OXBsZzzu/LWf4V ZfUtiHo2WpnMuv9dBiy4r7Dv/iR0ZW0GFbl6CT0T7FfAhog5Gvx8Jd2Q+BcWNjv5gETJ 9k/g== 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=hoccwIi/VbFCwE/m4Py0jJs3DI9WuB5Kd0IGvrIcG1k=; b=FDtQXLPfEZz8hknS9LecIUNogABIzhOM6M9/oqXJV0j400XYTqRXwgor6zPmvKZIhM Ws5WJXrx5ZWs+yQgDW1m3xbgZEPT+jGD0Psks2m0j0FjNCRGGuLZYlw6W/IdSqB007Nu +Q1i5PP72f0o25/+39HjDZ5V7u018U3x6/Y8Rclrs7k5n7+W+XHDYBOdafvdwT4ivEEE KL/3+XT+cBmS5h2DiGJ/gpPKuVi58S70lnhlGMSlb5Bth4Y1bR7+S+sUCge7xAc8Eqaj 22+P8jdbHhs+XrQP2Y7tVKOHMOKXPc+upOPrGbMQUDoDP9wq9PPtwmRN+DAj4wJpN/OC 684g== 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 b1si21140444pjb.92.2019.06.03.08.53.53; Mon, 03 Jun 2019 08:53:54 -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 S1729347AbfFCPvo (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:44 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53784 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729324AbfFCPvl (ORCPT ); Mon, 3 Jun 2019 11:51:41 -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 BC5D31715; Mon, 3 Jun 2019 08:51:40 -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 5DDC33F246; Mon, 3 Jun 2019 08:51:37 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Alexander Shishkin , Wolfram Sang , Jonathan Cameron , Hartmut Knaack , Grygorii Strashko , "David S. Miller" , Bjorn Helgaas , Sebastian Ott , Peter Oberparleiter , Harald Freudenberger , "James E.J. Bottomley" , "Martin K. Petersen" , Andreas Noever , Michael Jamet , Felipe Balbi , David Kershner Subject: [RFC PATCH 27/57] drivers: Unify the match prototype for bus_find_device with class_find_device Date: Mon, 3 Jun 2019 16:49:53 +0100 Message-Id: <1559577023-558-28-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 We have iterators for devices by bus and class, with a supplied "match" function to do the comparison. However, both of the helper function have slightly different prototype for the "match" argument. int (*) (struct device *dev, void *data) // bus_find_device vs int (*) (struct device *dev, const void *data) // class_find_device Unify the prototype by promoting the match function to use that of the class_find_device(). This will allow us to share the generic match helpers with class_find_device() users. Cc: Alexander Shishkin Cc: Wolfram Sang Cc: Jonathan Cameron Cc: Hartmut Knaack Cc: Grygorii Strashko Cc: "David S. Miller" Cc: Bjorn Helgaas Cc: Sebastian Ott Cc: Peter Oberparleiter Cc: Harald Freudenberger Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: Andreas Noever Cc: Michael Jamet Cc: Felipe Balbi Cc: David Kershner Signed-off-by: Suzuki K Poulose --- arch/powerpc/platforms/pseries/ibmebus.c | 4 ++-- drivers/acpi/acpi_lpss.c | 4 ++-- drivers/acpi/sleep.c | 2 +- drivers/acpi/utils.c | 4 ++-- drivers/base/bus.c | 2 +- drivers/base/core.c | 10 +++++----- drivers/base/platform.c | 2 +- drivers/char/ipmi/ipmi_si_platform.c | 2 +- drivers/firmware/efi/dev-path-parser.c | 4 ++-- drivers/hwtracing/coresight/coresight.c | 6 +++--- drivers/i2c/i2c-core-acpi.c | 2 +- drivers/i2c/i2c-core-of.c | 2 +- drivers/iio/inkern.c | 2 +- drivers/net/ethernet/ti/cpsw-phy-sel.c | 4 ++-- drivers/net/ethernet/ti/davinci_emac.c | 2 +- drivers/net/ethernet/toshiba/tc35815.c | 4 ++-- drivers/pci/probe.c | 2 +- drivers/pci/search.c | 4 ++-- drivers/s390/cio/css.c | 4 ++-- drivers/s390/cio/device.c | 4 ++-- drivers/s390/crypto/ap_bus.c | 4 ++-- drivers/scsi/scsi_proc.c | 2 +- drivers/thunderbolt/switch.c | 4 ++-- drivers/usb/core/usb.c | 4 ++-- drivers/usb/phy/phy-am335x-control.c | 4 ++-- drivers/usb/phy/phy-isp1301.c | 4 ++-- drivers/visorbus/visorbus_main.c | 4 ++-- include/linux/device.h | 13 ++++++------- 28 files changed, 54 insertions(+), 55 deletions(-) -- 2.7.4 acked-by: Harald Freudenberger diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c index 84e8ec4..b91eb09 100644 --- a/arch/powerpc/platforms/pseries/ibmebus.c +++ b/arch/powerpc/platforms/pseries/ibmebus.c @@ -147,13 +147,13 @@ static const struct dma_map_ops ibmebus_dma_ops = { .unmap_page = ibmebus_unmap_page, }; -static int ibmebus_match_path(struct device *dev, void *data) +static int ibmebus_match_path(struct device *dev, const void *data) { struct device_node *dn = to_platform_device(dev)->dev.of_node; return (of_find_node_by_path(data) == dn); } -static int ibmebus_match_node(struct device *dev, void *data) +static int ibmebus_match_node(struct device *dev, const void *data) { return to_platform_device(dev)->dev.of_node == data; } diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index cf76860..dc2ca78 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c @@ -511,10 +511,10 @@ struct hid_uid { const char *uid; }; -static int match_hid_uid(struct device *dev, void *data) +static int match_hid_uid(struct device *dev, const void *data) { struct acpi_device *adev = ACPI_COMPANION(dev); - struct hid_uid *id = data; + const struct hid_uid *id = data; if (!adev) return 0; diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index a34decc..fcf4386 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -454,7 +454,7 @@ static int acpi_pm_prepare(void) return error; } -static int find_powerf_dev(struct device *dev, void *data) +static int find_powerf_dev(struct device *dev, const void *data) { struct acpi_device *device = to_acpi_device(dev); const char *hid = acpi_device_hid(device); diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 1391b63..e3974a8 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -730,10 +730,10 @@ struct acpi_dev_match_info { s64 hrv; }; -static int acpi_dev_match_cb(struct device *dev, void *data) +static int acpi_dev_match_cb(struct device *dev, const void *data) { struct acpi_device *adev = to_acpi_device(dev); - struct acpi_dev_match_info *match = data; + const struct acpi_dev_match_info *match = data; unsigned long long hrv; acpi_status status; diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 229e83ee..abe32b6 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -324,7 +324,7 @@ EXPORT_SYMBOL_GPL(bus_for_each_dev); */ struct device *bus_find_device(struct bus_type *bus, struct device *start, void *data, - int (*match)(struct device *dev, void *data)) + int (*match)(struct device *dev, const void *data)) { struct klist_iter i; struct device *dev; diff --git a/drivers/base/core.c b/drivers/base/core.c index 88fa037..731baac 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3329,31 +3329,31 @@ void device_set_of_node_from_dev(struct device *dev, const struct device *dev2) } EXPORT_SYMBOL_GPL(device_set_of_node_from_dev); -int device_match_of_node(struct device *dev, void *np) +int device_match_of_node(struct device *dev, const void *np) { return dev->of_node == np; } EXPORT_SYMBOL_GPL(device_match_of_node); -int device_match_acpi_dev(struct device *dev, void *adev) +int device_match_acpi_dev(struct device *dev, const void *adev) { return ACPI_COMPANION(dev) == adev; } EXPORT_SYMBOL(device_match_acpi_dev); -int device_match_fwnode(struct device *dev, void *fwnode) +int device_match_fwnode(struct device *dev, const void *fwnode) { return dev_fwnode(dev) == fwnode; } EXPORT_SYMBOL_GPL(device_match_fwnode); -int device_match_devt(struct device *dev, void *pdevt) +int device_match_devt(struct device *dev, const void *pdevt) { return dev->devt == *(dev_t *)pdevt; } EXPORT_SYMBOL_GPL(device_match_devt); -int device_match_name(struct device *dev, void *name) +int device_match_name(struct device *dev, const void *name) { return sysfs_streq(dev_name(dev), name); } diff --git a/drivers/base/platform.c b/drivers/base/platform.c index daca44f..55ce86f 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -1207,7 +1207,7 @@ struct device *platform_find_device_by_driver(struct device *start, const struct device_driver *drv) { return bus_find_device(&platform_bus_type, start, (void *)drv, - (int (*)(struct device *, void *))platform_match); + (int (*)(struct device *, const void *))platform_match); } EXPORT_SYMBOL_GPL(platform_find_device_by_driver); diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c index ff82353..99233f3 100644 --- a/drivers/char/ipmi/ipmi_si_platform.c +++ b/drivers/char/ipmi/ipmi_si_platform.c @@ -426,7 +426,7 @@ static int ipmi_remove(struct platform_device *pdev) return ipmi_si_remove_by_dev(&pdev->dev); } -static int pdev_match_name(struct device *dev, void *data) +static int pdev_match_name(struct device *dev, const void *data) { struct platform_device *pdev = to_platform_device(dev); const char *name = data; diff --git a/drivers/firmware/efi/dev-path-parser.c b/drivers/firmware/efi/dev-path-parser.c index 85ec99f..2012338 100644 --- a/drivers/firmware/efi/dev-path-parser.c +++ b/drivers/firmware/efi/dev-path-parser.c @@ -17,9 +17,9 @@ struct acpi_hid_uid { char uid[11]; /* UINT_MAX + null byte */ }; -static int __init match_acpi_dev(struct device *dev, void *data) +static int __init match_acpi_dev(struct device *dev, const void *data) { - struct acpi_hid_uid hid_uid = *(struct acpi_hid_uid *)data; + struct acpi_hid_uid hid_uid = *(const struct acpi_hid_uid *)data; struct acpi_device *adev = to_acpi_device(dev); if (acpi_match_device_ids(adev, hid_uid.hid)) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 37ccd67..8231a0e 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -498,9 +498,9 @@ struct coresight_device *coresight_get_sink(struct list_head *path) return csdev; } -static int coresight_enabled_sink(struct device *dev, void *data) +static int coresight_enabled_sink(struct device *dev, const void *data) { - bool *reset = data; + const bool *reset = data; struct coresight_device *csdev = to_coresight_device(dev); if ((csdev->type == CORESIGHT_DEV_TYPE_SINK || @@ -544,7 +544,7 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) return dev ? to_coresight_device(dev) : NULL; } -static int coresight_sink_by_id(struct device *dev, void *data) +static int coresight_sink_by_id(struct device *dev, const void *data) { struct coresight_device *csdev = to_coresight_device(dev); unsigned long hash; diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index e28165b..cd6ff7a 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -318,7 +318,7 @@ u32 i2c_acpi_find_bus_speed(struct device *dev) } EXPORT_SYMBOL_GPL(i2c_acpi_find_bus_speed); -static int i2c_acpi_find_match_adapter(struct device *dev, void *data) +static int i2c_acpi_find_match_adapter(struct device *dev, const void *data) { struct i2c_adapter *adapter = i2c_verify_adapter(dev); diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c index b0b3fe1..e7f84d8 100644 --- a/drivers/i2c/i2c-core-of.c +++ b/drivers/i2c/i2c-core-of.c @@ -112,7 +112,7 @@ void of_i2c_register_devices(struct i2c_adapter *adap) of_node_put(bus); } -static int of_dev_or_parent_node_match(struct device *dev, void *data) +static int of_dev_or_parent_node_match(struct device *dev, const void *data) { if (dev->of_node == data) return 1; diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index 4a5eff3..c46fb59 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -93,7 +93,7 @@ static const struct iio_chan_spec #ifdef CONFIG_OF -static int iio_dev_node_match(struct device *dev, void *data) +static int iio_dev_node_match(struct device *dev, const void *data) { return dev->of_node == data && dev->type == &iio_device_type; } diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c index 48e0924..4e184ee 100644 --- a/drivers/net/ethernet/ti/cpsw-phy-sel.c +++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c @@ -151,9 +151,9 @@ static void cpsw_gmii_sel_dra7xx(struct cpsw_phy_sel_priv *priv, } static struct platform_driver cpsw_phy_sel_driver; -static int match(struct device *dev, void *data) +static int match(struct device *dev, const void *data) { - struct device_node *node = (struct device_node *)data; + const struct device_node *node = (const struct device_node *)data; return dev->of_node == node && dev->driver == &cpsw_phy_sel_driver.driver; } diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 4bf65ca..57d131a 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c @@ -1371,7 +1371,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) return -EOPNOTSUPP; } -static int match_first_device(struct device *dev, void *data) +static int match_first_device(struct device *dev, const void *data) { if (dev->parent && dev->parent->of_node) return of_device_is_compatible(dev->parent->of_node, diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c index c50a977..8479a44 100644 --- a/drivers/net/ethernet/toshiba/tc35815.c +++ b/drivers/net/ethernet/toshiba/tc35815.c @@ -694,10 +694,10 @@ static int tc_mii_init(struct net_device *dev) * should provide a "tc35815-mac" device with a MAC address in its * platform_data. */ -static int tc35815_mac_match(struct device *dev, void *data) +static int tc35815_mac_match(struct device *dev, const void *data) { struct platform_device *plat_dev = to_platform_device(dev); - struct pci_dev *pci_dev = data; + const struct pci_dev *pci_dev = data; unsigned int id = pci_dev->irq; return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; } diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 0e8e2c1..f9ef7ad 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -64,7 +64,7 @@ static struct resource *get_pci_domain_busn_res(int domain_nr) return &r->res; } -static int find_anything(struct device *dev, void *data) +static int find_anything(struct device *dev, const void *data) { return 1; } diff --git a/drivers/pci/search.c b/drivers/pci/search.c index 5c79226..7f4e658 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c @@ -236,10 +236,10 @@ struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, } EXPORT_SYMBOL(pci_get_domain_bus_and_slot); -static int match_pci_dev_by_id(struct device *dev, void *data) +static int match_pci_dev_by_id(struct device *dev, const void *data) { struct pci_dev *pdev = to_pci_dev(dev); - struct pci_device_id *id = data; + const struct pci_device_id *id = data; if (pci_match_one_device(id, pdev)) return 1; diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index aea5029..7b8488d 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -434,10 +434,10 @@ static int css_probe_device(struct subchannel_id schid, struct schib *schib) } static int -check_subchannel(struct device * dev, void * data) +check_subchannel(struct device *dev, const void *data) { struct subchannel *sch; - struct subchannel_id *schid = data; + const struct subchannel_id *schid = data; sch = to_subchannel(dev); return schid_equal(&sch->schid, schid); diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 1540229..6ca9a3a 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -642,10 +642,10 @@ static int ccw_device_add(struct ccw_device *cdev) return device_add(dev); } -static int match_dev_id(struct device *dev, void *data) +static int match_dev_id(struct device *dev, const void *data) { struct ccw_device *cdev = to_ccwdev(dev); - struct ccw_dev_id *dev_id = data; + const struct ccw_dev_id *dev_id = data; return ccw_dev_id_is_equal(&cdev->private->dev_id, dev_id); } diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index b9fc502..e440682 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c @@ -1365,7 +1365,7 @@ static int __match_card_device_with_id(struct device *dev, void *data) * Helper function to be used with bus_find_dev * matches for the queue device with a given qid */ -static int __match_queue_device_with_qid(struct device *dev, void *data) +static int __match_queue_device_with_qid(struct device *dev, const void *data) { return is_queue_dev(dev) && to_ap_queue(dev)->qid == (int)(long) data; } @@ -1374,7 +1374,7 @@ static int __match_queue_device_with_qid(struct device *dev, void *data) * Helper function to be used with bus_find_dev * matches any queue device with given queue id */ -static int __match_queue_device_with_queue_id(struct device *dev, void *data) +static int __match_queue_device_with_queue_id(struct device *dev, const void *data) { return is_queue_dev(dev) && AP_QID_QUEUE(to_ap_queue(dev)->qid) == (int)(long) data; diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index 7f0ceb6..c074631 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c @@ -372,7 +372,7 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf, return err; } -static int always_match(struct device *dev, void *data) +static int always_match(struct device *dev, const void *data) { return 1; } diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index c1b0165..c9a7e4a 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -1946,10 +1946,10 @@ struct tb_sw_lookup { u64 route; }; -static int tb_switch_match(struct device *dev, void *data) +static int tb_switch_match(struct device *dev, const void *data) { struct tb_switch *sw = tb_to_switch(dev); - struct tb_sw_lookup *lookup = data; + const struct tb_sw_lookup *lookup = data; if (!sw) return 0; diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 7fcb9f7..1678e30 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -325,9 +325,9 @@ struct find_interface_arg { struct device_driver *drv; }; -static int __find_interface(struct device *dev, void *data) +static int __find_interface(struct device *dev, const void *data) { - struct find_interface_arg *arg = data; + const struct find_interface_arg *arg = data; struct usb_interface *intf; if (!is_usb_interface(dev)) diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index a3cb25c..d16dfc3 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c @@ -118,9 +118,9 @@ static const struct of_device_id omap_control_usb_id_table[] = { MODULE_DEVICE_TABLE(of, omap_control_usb_id_table); static struct platform_driver am335x_control_driver; -static int match(struct device *dev, void *data) +static int match(struct device *dev, const void *data) { - struct device_node *node = (struct device_node *)data; + const struct device_node *node = (const struct device_node *)data; return dev->of_node == node && dev->driver == &am335x_control_driver.driver; } diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c index 93b7d6a..6cf6fbd 100644 --- a/drivers/usb/phy/phy-isp1301.c +++ b/drivers/usb/phy/phy-isp1301.c @@ -142,9 +142,9 @@ static struct i2c_driver isp1301_driver = { module_i2c_driver(isp1301_driver); -static int match(struct device *dev, void *data) +static int match(struct device *dev, const void *data) { - struct device_node *node = (struct device_node *)data; + const struct device_node *node = (const struct device_node *)data; return (dev->of_node == node) && (dev->driver == &isp1301_driver.driver); } diff --git a/drivers/visorbus/visorbus_main.c b/drivers/visorbus/visorbus_main.c index 0b2434c..152fd29 100644 --- a/drivers/visorbus/visorbus_main.c +++ b/drivers/visorbus/visorbus_main.c @@ -171,10 +171,10 @@ struct visor_busdev { u32 dev_no; }; -static int match_visorbus_dev_by_id(struct device *dev, void *data) +static int match_visorbus_dev_by_id(struct device *dev, const void *data) { struct visor_device *vdev = to_visor_device(dev); - struct visor_busdev *id = data; + const struct visor_busdev *id = data; if (vdev->chipset_bus_no == id->bus_no && vdev->chipset_dev_no == id->dev_no) diff --git a/include/linux/device.h b/include/linux/device.h index b4a9cd2..e8d1267 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -163,18 +163,17 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); void subsys_dev_iter_exit(struct subsys_dev_iter *iter); -int device_match_of_node(struct device *dev, void *np); -int device_match_acpi_dev(struct device *dev, void *adev); -int device_match_fwnode(struct device *dev, void *fwnode); -int device_match_devt(struct device *dev, void *pdevt); -int device_match_name(struct device *dev, void *name); +int device_match_of_node(struct device *dev, const void *np); +int device_match_acpi_dev(struct device *dev, const void *adev); +int device_match_fwnode(struct device *dev, const void *fwnode); +int device_match_devt(struct device *dev, const void *pdevt); +int device_match_name(struct device *dev, const void *name); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); struct device *bus_find_device(struct bus_type *bus, struct device *start, void *data, - int (*match)(struct device *dev, void *data)); - + int (*match)(struct device *dev, const void *data)); /** * bus_find_device_by_name - device iterator for locating a particular device * of a specific name. From patchwork Mon Jun 3 15:49:54 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: 165617 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644533ili; Mon, 3 Jun 2019 08:51:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwHXmiZSZ1Z6RJg125bmoZFoh9357kNfe2RbSWkag/5ucvpNxoS+9z+G4QydezMmU1RVHh0 X-Received: by 2002:a63:e616:: with SMTP id g22mr30411137pgh.61.1559577106161; Mon, 03 Jun 2019 08:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577106; cv=none; d=google.com; s=arc-20160816; b=p7fPx4udrF74PerLlRV53K9pNcPF2qkZMukWgDNIiXqXTg5jiJYDlkl+a8ZpxCv4Rf 3b7EjvFbIsEitBfJi9lgHv4lzRqZ5o+znADSBXI9Eb77BtWc/jPMeH8frpc8XO51vUA4 SOMTJK8/d4TNOr9OJEi5gMf26gEgQK2fjPNHhtyVsE1NRffeqj06r41Lc9GJx1PcnVor fFSExxHrzcxZNy11nXDVLmnkyXi3Pi36uQlFwKXrj8xLsbpqkMAP6IGGkTApuOnJiVpo VyWMP3syOgeitWn6qYiD8FMQ7w08OIf0dlgUxIOKZj2qItDBx6Xx7BpP0ilNetCABAPk mz0A== 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=zmXZa2q3AZMEPh9RGYa+UwIAdiJW6+y7+BWrXktHK44=; b=qEIeRL+brf6QzAHD7vCiaK8gm1Z7giluqYx1Iya3fh/UwwLFn1AwCvB4Yh6x/3xbnS kHHKfLTwGEkHpg08D+8VtaqwIccmBn29Ku24M3+25aimDLyVZ9NY1ARPolFTVb7VPIeA uM7S2BkyK3Lcw+IO0QvtVJ3IxEbbVk6H+3po8KXXrogdzfXasE4HLmLFRRy3ItnkzNWc ZzvUQCBZur0Ffg3O5rDTDe1WuNRRvEH9QgetBq8M7LZoK2LnHaOchyQKHYCE/+VuB7z7 kpYe9k1Ltj8tbptRbHeLwPKKNZC40NBYdkDlP68EX9x/6GRpmjApp7IGInyJw1dsCg5E 01sg== 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 n2si13824126pgq.129.2019.06.03.08.51.45; Mon, 03 Jun 2019 08:51:46 -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 S1729370AbfFCPvp (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:45 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53816 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729282AbfFCPvm (ORCPT ); Mon, 3 Jun 2019 11:51:42 -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 E50551A25; Mon, 3 Jun 2019 08:51:41 -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 04E1A3F246; Mon, 3 Jun 2019 08:51:40 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [RFC PATCH 28/57] drivers: class: Add variants of class_find_device() Date: Mon, 3 Jun 2019 16:49:54 +0100 Message-Id: <1559577023-558-29-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 Similar to the bus_find_device_by_*() helpers add wrappers for class_find_device() to find devices by generic attributes. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- include/linux/device.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) -- 2.7.4 diff --git a/include/linux/device.h b/include/linux/device.h index e8d1267..1945c3d 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -528,6 +528,64 @@ extern int class_for_each_device(struct class *class, struct device *start, extern struct device *class_find_device(struct class *class, struct device *start, const void *data, int (*match)(struct device *, const void *)); +/** + * class_find_device_by_name - device iterator for locating a particular device + * of a specific name. + * @class: the class we're iterating + * @start: Device to begin with + * @name: name of the device to match + * + * This is similar to the class_find_device() above, but it handles searching + * by a name automatically. + */ +static inline struct device *class_find_device_by_name(struct class *class, + struct device *start, + const void *name) +{ + return class_find_device(class, start, name, device_match_name); +} + +/** + * class_find_device_by_devt - device iterator for locating a particular device + * by devt. + * @class: the class we're iterating + * @start: Device to begin with + * @devt: devt of the device to match + */ +static inline struct device *class_find_device_by_devt(struct class *class, + struct device *start, + dev_t devt) +{ + return class_find_device(class, start, &devt, device_match_devt); +} + +/** + * class_find_device_by_of_node - device iterator for locating a particular device + * by of_node. + * @class: the class we're iterating + * @start: Device to begin with + * @np: of_node of the device to match + */ +static inline struct device *class_find_device_by_of_node(struct class *class, + struct device *start, + struct device_node *np) +{ + return class_find_device(class, start, np, device_match_of_node); +} + +/** + * class_find_device_by_fwnode - device iterator for locating a particular device + * by fwnode. + * @class: the class we're iterating + * @start: Device to begin with + * @fwnode: fwnode of the device to match + */ +static inline struct device *class_find_device_by_fwnode(struct class *class, + struct device *start, + struct fwnode_handle *fwnode) +{ + return class_find_device(class, start, fwnode, device_match_fwnode); +} struct class_attribute { struct attribute attr; From patchwork Mon Jun 3 15:49:55 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: 165647 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646754ili; Mon, 3 Jun 2019 08:53:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8qWpY4SBIG7JtNSW1MDb8TM/oq63WEaWj9kojKoc4p6Tb56UgMW7LHPwn/akwB5VsX+cw X-Received: by 2002:a17:902:294a:: with SMTP id g68mr31412581plb.169.1559577237235; Mon, 03 Jun 2019 08:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577237; cv=none; d=google.com; s=arc-20160816; b=bSMznxkRXUAyvdf68tAvipxvXk5fR+xpF2MsDvA/wPWjP63KUBxp7gChiJ4W5m9x2o OHZapS46JIHC7IWY1jW6D5duwg/xCoSA78YmNyBIUP6adzbXFhwJaqwRRx954p11F3Kx qheE+PDm+TLwpYYCv9HksmfCSH4K31RVZ+oGtyD+kqA0sdG43ueKrJlAwkZhcQhqM6CL +61CHCsD0Zo7BVWfaVB6jCxVrbGcaY1Ody9CDQ6EjNWlrp3E984i3pZCNEHlgLoV3GbS sm8vRscrchpd42jkBwZ9mtTmbH9Quxp8v58noXAbcMTzM2jYShd3Y9UaNhIwTmVdHe3f bcQA== 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=u+PPgnXN5Lzrlm9TCw7Gy4cipom2V4cFXyK2ztO81eQ=; b=0+Nvv9o5t79YFMqve8UbSCa/xD/OTy42UK8KbeI0CkClyeeVjuipcB5vR5vxdiOCbO nZqOnbBm8nzPcxLuwTpchkFSRliSMYC5onKPsDlcxgMLo+TPpxdIER6YjM/DKKoh7tCn 05oW8FWnW4anct5YBwQ8JRZv7Jan8Qd8/5XWdmvJyygsf5o9PHWeaNc9mP4lcAY6bf8Z jKRn7i9g6JoXeX1weSWlkcG010pHAMxbse4jM4HpMDNDHjGVWs7uLwGosumB20kfwYkf g5fVB5Sj9ShL7m0O+YI4pAEC2KIrySkncjKdR0yku8s9Krme2qt3Nj6LoJ8oVIv+OJ23 96aw== 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 u126si15462989pgu.117.2019.06.03.08.53.56; Mon, 03 Jun 2019 08:53:57 -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 S1729664AbfFCPxz (ORCPT + 30 others); Mon, 3 Jun 2019 11:53:55 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53824 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729339AbfFCPvn (ORCPT ); Mon, 3 Jun 2019 11:51:43 -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 69BF31AED; Mon, 3 Jun 2019 08:51:43 -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 2DCE63F246; Mon, 3 Jun 2019 08:51:42 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Alexander Shishkin , Maxime Coquelin Subject: [RFC PATCH 29/57] drivers: stm: Use class_find_device_by_name() helper Date: Mon, 3 Jun 2019 16:49:55 +0100 Message-Id: <1559577023-558-30-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 Use the new class_find_device_by_name() helper. Cc: Alexander Shishkin Cc: Maxime Coquelin Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/stm/core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index e55b902..e110958 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -89,13 +89,6 @@ static struct class stm_class = { .dev_groups = stm_groups, }; -static int stm_dev_match(struct device *dev, const void *data) -{ - const char *name = data; - - return sysfs_streq(name, dev_name(dev)); -} - /** * stm_find_device() - find stm device by name * @buf: character buffer containing the name @@ -116,7 +109,7 @@ struct stm_device *stm_find_device(const char *buf) if (!stm_core_up) return NULL; - dev = class_find_device(&stm_class, NULL, buf, stm_dev_match); + dev = class_find_device_by_name(&stm_class, NULL, buf); if (!dev) return NULL; From patchwork Mon Jun 3 15:49:57 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: 165643 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646464ili; Mon, 3 Jun 2019 08:53:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxReZ12Uyx/aIVGACk9KU9t4qUZ+QWL86bQQWI0aXg/dIzBHv1sNAB4JklyEiAescbSqTpC X-Received: by 2002:aa7:8e45:: with SMTP id d5mr23064382pfr.172.1559577218371; Mon, 03 Jun 2019 08:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577218; cv=none; d=google.com; s=arc-20160816; b=alsdbFFF6LvjujDpHXQ1Pbi2vUinhDPA8WyzaoNksz97Ojlp5JdyOomkZSMJgGNinq FZ80pwhqW6dgriQ2HLHoSmWhXbzjDWBHBtflOZsXBNNyALNknBVx5UJkkfjNKY/HUS0y oLfDVBt8N800nHKp9N+07RKrlQuKrELvQ+CXXmyuEzloBPdWw6f3zwOVERvrqrf5tJ1F M/BdTqVBG+64RiPpY7tcnIuZf7HHjwHJ/yjWakXqaYgMEySZpDKEzflpNTWPslfUeupc NafbeMRuIeKntboyR84chsFH/BOh68kPcxtEeGNTp810T22NZqRA2RwlWcYlCPG+SacN fLDA== 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=bO+hKXwk+0zpIgwLn2P/RBuc0O4zpUI9MnzCyaQiKis=; b=EjIICg2HR1REhj3/GYpk1rZKZeeOEdF+qbPcRVkoq3MHTTOm3h1rDbeRUV35GfXONA guqD4rShPZ4P9W8bHM2S4dJT8FjykSq/+dC47P9NaNUrj9I7omSAiSxtTRty4x6OJeZn s44Th0j9vhLp4kZBuLMxoB2TmvQJIRSHg4SkeePfUYBzMfEoOhqq8P4Jj6Ny+53wLtQl CWSTMHN3wO5ma2Dlw6dOt1mFeMRKWgNv3z0jkwccGTEgtVz0wfHJcmidi/9HT4iUMIIe iRYGwTsf8VrsGMS0C9uXkUupHMiN83f7rhpkvJ5hITkjvLsh6A1+amVs4pQz7ivEN26l HXJQ== 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 h187si21804126pfb.129.2019.06.03.08.53.38; Mon, 03 Jun 2019 08:53:38 -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 S1729413AbfFCPvu (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:50 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53852 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729375AbfFCPvr (ORCPT ); Mon, 3 Jun 2019 11:51:47 -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 D424915AB; Mon, 3 Jun 2019 08:51:46 -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 720923F246; Mon, 3 Jun 2019 08:51:45 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org Subject: [RFC PATCH 31/57] drivers: rtc: Use class_find_device_by_name() helper Date: Mon, 3 Jun 2019 16:49:57 +0100 Message-Id: <1559577023-558-32-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 Use the new class_find_device_by_name() helper. Cc: Alessandro Zummo Cc: Alexandre Belloni Cc: linux-rtc@vger.kernel.org Signed-off-by: Suzuki K Poulose --- drivers/rtc/interface.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) -- 2.7.4 diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 4124f4d..307dbc6 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -663,21 +663,12 @@ void rtc_update_irq(struct rtc_device *rtc, } EXPORT_SYMBOL_GPL(rtc_update_irq); -static int __rtc_match(struct device *dev, const void *data) -{ - const char *name = data; - - if (strcmp(dev_name(dev), name) == 0) - return 1; - return 0; -} - struct rtc_device *rtc_class_open(const char *name) { struct device *dev; struct rtc_device *rtc = NULL; - dev = class_find_device(rtc_class, NULL, name, __rtc_match); + dev = class_find_device_by_name(rtc_class, NULL, name); if (dev) rtc = to_rtc_device(dev); From patchwork Mon Jun 3 15:49:58 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: 165619 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644667ili; Mon, 3 Jun 2019 08:51:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEFfqWXSX6GpQK+oGK+0a0o0OL7T5ACbKNnRr45/EMhRcGX7kRYdwoW/t1g2+dC/c8ag8/ X-Received: by 2002:a17:902:8f87:: with SMTP id z7mr5304437plo.65.1559577113291; Mon, 03 Jun 2019 08:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577113; cv=none; d=google.com; s=arc-20160816; b=dK7HaYrOMqEj0sTfPqVjRmbacjCYCQgqIcIOLNdz4gtJR8K8VIYI+fmsLkdssOtZMy 5XK3Um/BgG0Id4gaiYr9PtslQIMyxHzd55FizJSbj5f9tMBVZe61OJhfE3vOFmPDMS3R ruHDW8Z+rSZUuzv6TKVIIZ8ucXrCwSQf6y9cSQyl1qMjgtbJlgdPEhxxvOasD3rLnMVJ OgkvpQMU+RC+Tr5J2JxyoLod4Tzqi7x8xhK0Nqno1S0pbzb/sGA1BCgGTOD06qJY1hhV yZQQ7mZPFY/tildfMz0dZWXr5F+r9JfrS+yV6nZBPp12NjRCYQUjbw7jqx/nGcFXDO1o SeFQ== 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=dI5Ctw3NuVmRcdBkI8t6OeZVtdXYHroq0OYDfMezdBs=; b=VaXMGcnAfA9fL+kjsMHkeKQAEPml/YZJ1Lgo/bCnCsMGkX22z4eQ66M5otiHlLwhkP IXyu66dJstShLuXaFrcq065AClGrhZT7w5rrWAvKp6JU0+LUlb74zcZAhlf5JRH65sF1 QUdAG6T2Bde5Dwwz8ii962P3s6jbuK31VOpL4qMKS7ZIW9CSYq7sqbs3t9nbijamJgG2 PkID0SJifBMQRa1p8XlGCu59ijgDr5JQX/HfYBYNKiKAsEKGor5hN+/PerZE7QBHMnbI s8KDx+uRdPZtfSk8LAKVU9VaXh2AcRPwALrLiLtlNlPnYWnzg8CC5rkbXz7h0LJ1x52U cIKQ== 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 d27si19408244pgl.202.2019.06.03.08.51.52; Mon, 03 Jun 2019 08:51:53 -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 S1729424AbfFCPvw (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:52 -0400 Received: from foss.arm.com ([217.140.101.70]:53866 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729400AbfFCPvs (ORCPT ); Mon, 3 Jun 2019 11:51:48 -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 732721A25; Mon, 3 Jun 2019 08:51:48 -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 1CEF83F246; Mon, 3 Jun 2019 08:51:46 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Harald Freudenberger , Martin Schwidefsky , Heiko Carstens Subject: [RFC PATCH 32/57] drivers: s390-crypto: Use class_device_find_by_name() helper Date: Mon, 3 Jun 2019 16:49:58 +0100 Message-Id: <1559577023-558-33-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 Use the new class_find_device_by_name() helper. Cc: Harald Freudenberger Cc: Martin Schwidefsky Cc: Heiko Carstens Signed-off-by: Suzuki K Poulose --- drivers/s390/crypto/zcrypt_api.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) -- 2.7.4 acked-by: Harald Freudenberger diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 1058b4b..16cad8e 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c @@ -133,12 +133,6 @@ struct zcdn_device { static int zcdn_create(const char *name); static int zcdn_destroy(const char *name); -/* helper function, matches the name for find_zcdndev_by_name() */ -static int __match_zcdn_name(struct device *dev, const void *data) -{ - return strcmp(dev_name(dev), (const char *)data) == 0; -} - /* helper function, matches the devt value for find_zcdndev_by_devt() */ static int __match_zcdn_devt(struct device *dev, const void *data) { @@ -152,10 +146,8 @@ static int __match_zcdn_devt(struct device *dev, const void *data) */ static inline struct zcdn_device *find_zcdndev_by_name(const char *name) { - struct device *dev = - class_find_device(zcrypt_class, NULL, - (void *) name, - __match_zcdn_name); + struct device *dev = class_find_device_by_name(zcrypt_class, + NULL, (void *) name); return dev ? to_zcdn_dev(dev) : NULL; } From patchwork Mon Jun 3 15:50:00 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: 165620 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644764ili; Mon, 3 Jun 2019 08:51:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5ijeK+DIaKXCN2tLKyeBMtr6ixRBP8K697hUNQTKxdTnX7Heevp5e8Lu3r0VthnUDh4Eh X-Received: by 2002:a62:65c7:: with SMTP id z190mr32233249pfb.73.1559577119794; Mon, 03 Jun 2019 08:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577119; cv=none; d=google.com; s=arc-20160816; b=xv9j3EOeF1mVFay1WU1QP5AAI5bTSgOFjvzAAqHNVkBnlI/pzk7ZAIIWh3ohLhN8eE JMW8LB4jcH0oL2WM92CZgWyFMFouBjxIYsbIPQi+p1emN2IjihuVguqNdpuSrRZQPAk1 uVjunEItMv+H1TISALneqmHRSxw8VSTmmNi9zZq4bsMBrL+PijDa2u0SeYhT1xUWzlOS Zln/XrFjtjpDxxYQ+OG/XAmKlLU240idHWYZjWWeIUFyEfda6A2EKbqkkDGUOONbWaRp 1j1yXtMADHe4ctkd2UigRMCzUVIP65WXAHyBOe+a6vToFymWvdwgfRQvBK5tKwoJLnqm EA3g== 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=3lJFDfD0a4hD1QRzwyvzWs4Hr/If6NmQW4/kfQJjgns=; b=PhmRhteRRePZb9oOXz/Gou4+eqQgj/iaohHAYloBeOZzImRnVfqDyjDeF43nMfgb14 F+oYI9yU9SC2iDopjbmt3mD5jeQ5/LmSxBVLnKV63wd3OHRs6rT/7Suyh6Lh5URLYWFV cLNlQMcAJQOuG8fqx5nhA7bXgC29FKJBhxA/NpXwkh8LYiJjLye1U8Lb/uhw+wViN4yW LP5Q+4gzQNRQSKtrqOyUtvvGPzQSb+2x29OvzGS8S6yNInvJ15V76K/F2fpNDaP57qE3 HFx5T8tMCAzKiEA2AJezObxsX3VHRESZhlpJhXhaNMwknm01laB9+5DiIKedH1oaFfmB s9Fg== 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 v20si19320578pgk.58.2019.06.03.08.51.59; Mon, 03 Jun 2019 08:51:59 -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 S1729454AbfFCPv6 (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:58 -0400 Received: from foss.arm.com ([217.140.101.70]:53886 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729419AbfFCPvv (ORCPT ); Mon, 3 Jun 2019 11:51:51 -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 8C60F1B4B; Mon, 3 Jun 2019 08:51:51 -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 2C1783F246; Mon, 3 Jun 2019 08:51:50 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Subject: [RFC PATCH 34/57] drivers: ieee802154: Use class_find_device_by_name() helper Date: Mon, 3 Jun 2019 16:50:00 +0100 Message-Id: <1559577023-558-35-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 Use the new class_find_device_by_name() helper. Cc: Alexander Aring Cc: Stefan Schmidt Cc: linux-wpan@vger.kernel.org Signed-off-by: Suzuki K Poulose --- net/ieee802154/core.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.7.4 diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c index 60b7ac5..26fe751 100644 --- a/net/ieee802154/core.c +++ b/net/ieee802154/core.c @@ -23,11 +23,6 @@ LIST_HEAD(cfg802154_rdev_list); int cfg802154_rdev_list_generation; -static int wpan_phy_match(struct device *dev, const void *data) -{ - return !strcmp(dev_name(dev), (const char *)data); -} - struct wpan_phy *wpan_phy_find(const char *str) { struct device *dev; @@ -35,7 +30,7 @@ struct wpan_phy *wpan_phy_find(const char *str) if (WARN_ON(!str)) return NULL; - dev = class_find_device(&wpan_phy_class, NULL, str, wpan_phy_match); + dev = class_find_device_by_name(&wpan_phy_class, NULL, str); if (!dev) return NULL; From patchwork Mon Jun 3 15:50:01 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: 165642 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646420ili; Mon, 3 Jun 2019 08:53:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7fcL167iRBAYDhc64KD701Vif3ZkNC9r9Wgj9LbVe+YUtBx+d3SP4a1dyqbVOXyBusXvQ X-Received: by 2002:a62:fb0a:: with SMTP id x10mr9371544pfm.224.1559577215866; Mon, 03 Jun 2019 08:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577215; cv=none; d=google.com; s=arc-20160816; b=fEv4bNbYpVjvliItdyshaGD0Dd97A6EV5hHhgpgUPq8kt+4cmRuEraQZmNdvJf4rMa bdTPjT3e8NBSyxI65mgm6v/ooK5PuXaQbaWOcv+i3oVa8GIOTkCN+G9jkSLkoLcR++F0 UuBMUwoRaqcC11fcHNqaNsKEUH41hE+U2whhqAmdwNnFAi+YZbemA6NlopJit0JMoKAB w1nIqJ+GYih0UFUCXm3S/M0Idl4qxjLSjEyk3mcAATbnYSbwadvuw2p8XJ35+0BU5AMV D0OYuR7aG1sRGytbz9wDGsanT2CPHKW7APp9Po17gju7NJhQTF40ttNzTu8tuBlZbba3 ovhA== 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=11QtoEOFz87RuSj89nBcIUOrDHztUbI8qjUp2dMoYcM=; b=zOX0YPg/kTwj7mNKfYJNMxsO3XarKo/m1Wr671WWxndSYoZnpm7aVKCoJL2eum80VR t7HiJIPRRRGkOx2sUZEDtH410Ku+yYJ0Zp2k3VtjTGgVt9FTGUECoDClfP2dND+j9/QE X1GpCmt4SeHun7FMYIz1uOjMLeko/zuP7IvbU2Ey5+1U10dNNbJPSJb0bWlmUhHeR3ei +MZdPL73QjMIA5Hyqd3bMrrrPp7FMGYwsXQ5gXznkO/o+H4DROQ/b2OTh2pZ7zSPro77 Tca/Ie3J0qV1NeV8abQ2NnYOv6Gpw7BQyGiT0orb5CvOz+s4kv6iiNJelSRAH2pOwG6M eIFg== 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 h187si21804126pfb.129.2019.06.03.08.53.35; Mon, 03 Jun 2019 08:53:35 -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 S1729441AbfFCPvz (ORCPT + 30 others); Mon, 3 Jun 2019 11:51:55 -0400 Received: from foss.arm.com ([217.140.101.70]:53900 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729400AbfFCPvx (ORCPT ); Mon, 3 Jun 2019 11:51:53 -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 BDB521A25; Mon, 3 Jun 2019 08:51:52 -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 C8F323F246; Mon, 3 Jun 2019 08:51:51 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [RFC PATCH 35/57] drivers: core: Reuse generic match by device type helper Date: Mon, 3 Jun 2019 16:50:01 +0100 Message-Id: <1559577023-558-36-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 Use the generic helper to match the device type of a given device. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- drivers/base/core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/base/core.c b/drivers/base/core.c index 731baac..69cba57 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2839,13 +2839,6 @@ struct device *device_create_with_groups(struct class *class, } EXPORT_SYMBOL_GPL(device_create_with_groups); -static int __match_devt(struct device *dev, const void *data) -{ - const dev_t *devt = data; - - return dev->devt == *devt; -} - /** * device_destroy - removes a device that was created with device_create() * @class: pointer to the struct class that this device was registered with @@ -2858,7 +2851,7 @@ void device_destroy(struct class *class, dev_t devt) { struct device *dev; - dev = class_find_device(class, NULL, &devt, __match_devt); + dev = class_find_device_by_devt(class, NULL, devt); if (dev) { put_device(dev); device_unregister(dev); From patchwork Mon Jun 3 15:50:02 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: 165644 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646508ili; Mon, 3 Jun 2019 08:53:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNkekMfJ56MO7QhXRXoQsrQ2ERmB6U1pmVyqDBltOz2t2KDwYqQGVN2xTRqNJfensk0PiF X-Received: by 2002:a17:902:24b:: with SMTP id 69mr30640616plc.255.1559577221515; Mon, 03 Jun 2019 08:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577221; cv=none; d=google.com; s=arc-20160816; b=RD0jTf50v9IXcMXNuWBCdZrLPk8C70lAzCJMQdPB05P3N5PGHHPQpVZvIhSAVgNHIK B3bk8NXcgBdvXWBQoP4f7/EhSUhc+I6y7b4cauj1zhrJyCGPwh5nzsHz1uQiJe5Pf+Fn tX0iYwWmZueItNQ1M42er75FY8styG4ZSo7rh0XBxl+VtDEuTwp/wvCfXA6W3hI2z4Vm K7FhJw8t104s9b7ZthfWlK/0zmgVqY/uZskla985/4qKcotezQ6j+NPDQgegL103Vtmz 4ZoGIQLTjjP2/wpdXdy2X+hG+ULJJLyN6U3gOAMBMrGaH8M8vkejxSzVxYHXAAlrzjWb BUNw== 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=/V2EVnxYD7YVqjJ8oELaZhlqmh5BZiS//pdTTDVuccg=; b=qLAgvT+dFjSyIh+2ETPOq/lEucz7HbuuT2EFhrQNLpCyMESP1gn+2P6bZBoIV2mBMa jTwMQN9Z2f4FeJmPhb3YwZPTcyXk9tvNDvu4FLuh/ibMr9vhPqLna71BJLQlf6LzUcGi b2386iDDIUpld8h3eVCvy5Rm2xKFu6NVdbrL6j3mgrGkqKlFyyquMDJBETqPVe7OlBQf druPwJSvtRx1hV9N+9HCYReTq2W8yxyFQ+3hQjcnUxEBbeHchVcIh1GA7xkphIhaRUYQ J5Xr0aPmpi3qFyglEv4BWm9CuWHNc4cWK/vIXP4kWwX+oiIPWhDLFX4kjIGLFWLVrQpL uVCg== 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 h187si21804126pfb.129.2019.06.03.08.53.41; Mon, 03 Jun 2019 08:53:41 -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 S1729700AbfFCPxk (ORCPT + 30 others); Mon, 3 Jun 2019 11:53:40 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53906 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729426AbfFCPvy (ORCPT ); Mon, 3 Jun 2019 11:51:54 -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 42D101AED; Mon, 3 Jun 2019 08:51:54 -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 06C723F246; Mon, 3 Jun 2019 08:51:52 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Tomas Winkler , Arnd Bergmann Subject: [RFC PATCH 36/57] drivers: mei: Use class_find_device_by_devt match helper Date: Mon, 3 Jun 2019 16:50:02 +0100 Message-Id: <1559577023-558-37-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 Switch to the generic helper class_find_device_by_devt. Cc: Tomas Winkler Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Signed-off-by: Suzuki K Poulose --- drivers/misc/mei/main.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index ad02097..243b481 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c @@ -858,13 +858,6 @@ static ssize_t dev_state_show(struct device *device, } static DEVICE_ATTR_RO(dev_state); -static int match_devt(struct device *dev, const void *data) -{ - const dev_t *devt = data; - - return dev->devt == *devt; -} - /** * dev_set_devstate: set to new device state and notify sysfs file. * @@ -880,7 +873,7 @@ void mei_set_devstate(struct mei_device *dev, enum mei_dev_state state) dev->dev_state = state; - clsdev = class_find_device(mei_class, NULL, &dev->cdev.dev, match_devt); + clsdev = class_find_device_by_devt(mei_class, NULL, dev->cdev.dev); if (clsdev) { sysfs_notify(&clsdev->kobj, NULL, "dev_state"); put_device(clsdev); From patchwork Mon Jun 3 15:50:03 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: 165639 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646288ili; Mon, 3 Jun 2019 08:53:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEEw8VIp6ekDPGd4DF0gr/FNO4/KYfAH5ujIuLMBlLfUD7WIw9jiKHnrHQdTfthEU+Ezw8 X-Received: by 2002:a65:60d2:: with SMTP id r18mr29137962pgv.217.1559577207646; Mon, 03 Jun 2019 08:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577207; cv=none; d=google.com; s=arc-20160816; b=kTt/ENNWxyA3wT2obaDinljB0p1F6EFDDZ4n0iBk7BArevXtJIPPvbeLpL5aVIDfK4 jQzaqcvKt0aMgbSIbiBCJLX3bTSwNmeeG5axa7V2MJHBkpd2BdStdoJLPHQIQjqeL+VN 0hxDnbIABb5B1NmefHXrC8m3U2JVa0OZlTX0DyfiZa+VQH0D8TXP6GUlx4m1x8ueihok yCY6yKZ+gjjiJcDHHKV6CLbHA1zY1njFZKkR4RkC3Az+E4WsgUEXYgiGs65bdovB9dKd Ew+UQgnlMh4PHmN5rIKH5rXJBmve6utASlyuie5FAw46f8DXHXAMF3fxWRL3ywhQSGtD Rvkg== 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=K+4tZquMCc4TbINLmytATDuZLBSZX6KZRG+TI08EOuI=; b=QWikMtDfzy1St1IISZWSFbrG73zhMf6V5dbFAFU/1HND8teTazAE6vns//GJJQDZAx +NaOLdaTKvP4O9bvmrdqE1Q6o2IfiGYq/uwOjMcH+Pw+D5BbV7DmFERmbX1Q8s0Tllf3 CxH5Yv+KhtQ4s87eAKvRFp2XkCl8vMh6xdM+1SgJ8lHGL8eMueIOi996z5JVadLaIYdQ SbKS9i9tjvCxEBnJ89KFDz+4/MAIZRDOjdbSEb/q+wMD15kWzQLsmITvF3QNvTkA279K brU9GccNK7fezNPmeQDp3bzmbBKB6e4GycxHx7MFg+GlCQvwfDDzEtvhDPxeqNgSyXjn g8+Q== 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 h187si21804126pfb.129.2019.06.03.08.53.27; Mon, 03 Jun 2019 08:53:27 -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 S1729467AbfFCPwA (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:00 -0400 Received: from foss.arm.com ([217.140.101.70]:53920 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729440AbfFCPv4 (ORCPT ); Mon, 3 Jun 2019 11:51:56 -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 B31AC169E; Mon, 3 Jun 2019 08:51:55 -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 7FFA53F246; Mon, 3 Jun 2019 08:51:54 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Harald Freudenberger , Heiko Carstens Subject: [RFC PATCH 37/57] drivers: s390: zcrypt: Use class_find_device_by_devt helper Date: Mon, 3 Jun 2019 16:50:03 +0100 Message-Id: <1559577023-558-38-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 Use the generic helper to find a device matching the devt. Cc: Harald Freudenberger Cc: Heiko Carstens Signed-off-by: Suzuki K Poulose --- drivers/s390/crypto/zcrypt_api.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) -- 2.7.4 acked-by: Harald Freudenberger diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 16cad8e..99c9b77 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c @@ -133,12 +133,6 @@ struct zcdn_device { static int zcdn_create(const char *name); static int zcdn_destroy(const char *name); -/* helper function, matches the devt value for find_zcdndev_by_devt() */ -static int __match_zcdn_devt(struct device *dev, const void *data) -{ - return dev->devt == *((dev_t *) data); -} - /* * Find zcdn device by name. * Returns reference to the zcdn device which needs to be released @@ -159,10 +153,7 @@ static inline struct zcdn_device *find_zcdndev_by_name(const char *name) */ static inline struct zcdn_device *find_zcdndev_by_devt(dev_t devt) { - struct device *dev = - class_find_device(zcrypt_class, NULL, - (void *) &devt, - __match_zcdn_devt); + struct device *dev = class_find_device_by_devt(zcrypt_class, NULL, devt); return dev ? to_zcdn_dev(dev) : NULL; } From patchwork Mon Jun 3 15:50:04 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: 165641 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646397ili; Mon, 3 Jun 2019 08:53:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIHORIYpCo1zD3BNG9iYhAkL8UThhhWFnrIMq7wYDwjAqdIrDKgpY2PpFkYBxu/Jx4ffY9 X-Received: by 2002:a17:90a:aa85:: with SMTP id l5mr29606209pjq.69.1559577213690; Mon, 03 Jun 2019 08:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577213; cv=none; d=google.com; s=arc-20160816; b=r3e6ACAmIvbtvSRU5iyzGCpFi+wvLwJnKitkOI49FutBH8LRiBm8TLuTZaT6+cNYKx mTjJClVjtn8Auz4kRO2SIkkz5RZLGNu9urw7cyuxaIq9WYe1blOtMoDQ2Lk+5HfF1NXn G7zPxrfSTnFiHxFVGLcUhgcxZJT0foa+kDcBHiiIdAHCoYPyu1Tk3J2Eo7zz/cl/ApEu 6cBqGoyksZQDy3owVWQwdMYF56WjddumpktlRcCDq4/l3v0qHTDW+ja+29irlsrD9m6T djct5Zo0Ywu+JHCfyVybceU9Wnt01shnNg+NoanZ0n0GWXvm8RvAQQnw70LoPC4lH/9T Xjyw== 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=iJRqEw8Lk354Ey4o2YvBPcuEOe4iAFBfPyNOAdNYd/w=; b=Y9Kwna1y4gdjW0syRosJu8eZFSTnLTZavgSuhpUFXNidWtoo9b/q/WwNqOVUUS7JQx JnxD0yNyf0IS5fqPUUkKxQmm7vZNxlZH54OFAseCqsZWCVrOyjkpNyjKWvAsPsPwXYnK WztuV3y/BTBVnOOqmIrLUAIF5esWI5Vqumzw7rJOAkO7/dkVnFuiDqE2tOBAQ+P38YBC f9YkSmFdhB6+mfrjLhHGGo+JX0BNJZRB3hOBvYpGAFhTd1LEBYW6/gJGWstKuAAIGQ/+ f1QYoiHqnUle66u62grtK94mkJYLUEhdgu2dnRIXr4G3pkxmevOWvBYDpqEDERR3n/9o fA+g== 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 h187si21804126pfb.129.2019.06.03.08.53.33; Mon, 03 Jun 2019 08:53:33 -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 S1729332AbfFCPxb (ORCPT + 30 others); Mon, 3 Jun 2019 11:53:31 -0400 Received: from foss.arm.com ([217.140.101.70]:53938 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729447AbfFCPv5 (ORCPT ); Mon, 3 Jun 2019 11:51:57 -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 520A91B4B; Mon, 3 Jun 2019 08:51:57 -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 F017E3F246; Mon, 3 Jun 2019 08:51:55 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Alan Tull , Moritz Fischer , linux-fpga@vger.kernel.org Subject: [RFC PATCH 38/57] drivers: fpga: Use generic helpers to match by of_node Date: Mon, 3 Jun 2019 16:50:04 +0100 Message-Id: <1559577023-558-39-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 Use the generic helpers available to find device matching of_node. Cc: Alan Tull Cc: Moritz Fischer Cc: linux-fpga@vger.kernel.org Signed-off-by: Suzuki K Poulose --- drivers/fpga/fpga-bridge.c | 8 +------- drivers/fpga/fpga-mgr.c | 8 +------- drivers/fpga/of-fpga-region.c | 7 +------ 3 files changed, 3 insertions(+), 20 deletions(-) -- 2.7.4 diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c index 80bd8f1..f1222a9 100644 --- a/drivers/fpga/fpga-bridge.c +++ b/drivers/fpga/fpga-bridge.c @@ -19,11 +19,6 @@ static struct class *fpga_bridge_class; /* Lock for adding/removing bridges to linked lists*/ static spinlock_t bridge_list_lock; -static int fpga_bridge_of_node_match(struct device *dev, const void *data) -{ - return dev->of_node == data; -} - /** * fpga_bridge_enable - Enable transactions on the bridge * @@ -104,8 +99,7 @@ struct fpga_bridge *of_fpga_bridge_get(struct device_node *np, { struct device *dev; - dev = class_find_device(fpga_bridge_class, NULL, np, - fpga_bridge_of_node_match); + dev = class_find_device_by_of_node(fpga_bridge_class, NULL, np); if (!dev) return ERR_PTR(-ENODEV); diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c index c386681..78d2ddb1 100644 --- a/drivers/fpga/fpga-mgr.c +++ b/drivers/fpga/fpga-mgr.c @@ -482,11 +482,6 @@ struct fpga_manager *fpga_mgr_get(struct device *dev) } EXPORT_SYMBOL_GPL(fpga_mgr_get); -static int fpga_mgr_of_node_match(struct device *dev, const void *data) -{ - return dev->of_node == data; -} - /** * of_fpga_mgr_get - Given a device node, get a reference to a fpga mgr. * @@ -498,8 +493,7 @@ struct fpga_manager *of_fpga_mgr_get(struct device_node *node) { struct device *dev; - dev = class_find_device(fpga_mgr_class, NULL, node, - fpga_mgr_of_node_match); + dev = class_find_device_by_of_node(fpga_mgr_class, NULL, node); if (!dev) return ERR_PTR(-ENODEV); diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c index 75f64ab..e405309 100644 --- a/drivers/fpga/of-fpga-region.c +++ b/drivers/fpga/of-fpga-region.c @@ -22,11 +22,6 @@ static const struct of_device_id fpga_region_of_match[] = { }; MODULE_DEVICE_TABLE(of, fpga_region_of_match); -static int fpga_region_of_node_match(struct device *dev, const void *data) -{ - return dev->of_node == data; -} - /** * of_fpga_region_find - find FPGA region * @np: device node of FPGA Region @@ -37,7 +32,7 @@ static int fpga_region_of_node_match(struct device *dev, const void *data) */ static struct fpga_region *of_fpga_region_find(struct device_node *np) { - return fpga_region_class_find(NULL, np, fpga_region_of_node_match); + return fpga_region_class_find(NULL, np, device_match_of_node); } /** From patchwork Mon Jun 3 15:50:05 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: 165621 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644810ili; Mon, 3 Jun 2019 08:52:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuk6lQ3VL42t4qsNMUDJPDV5Ounued99wLZI8r+d47O6kNYjHq+VDEuFGIpCiJrWw0dXnM X-Received: by 2002:a63:6603:: with SMTP id a3mr22057724pgc.239.1559577123066; Mon, 03 Jun 2019 08:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577123; cv=none; d=google.com; s=arc-20160816; b=VJZf4PI0Q9O3FhLdun6oqoD8jV3m0H8VofFO2nobU14EzeGfi/AbAZzfcLrxGrtLsJ b6seTDkMfmP4GoZP1G3ijJCnJDcwqV/Z06yaUA6K+V8YSgTAtyLSevq7liX+5UIsB64t 6ciW8s+HPhWvqsLDyj+0zk/8ACi96WbGQxTpcbQY/MNQFIDgOrKmvexUwYlckrIC2pkU Xq0Bvz69N4AtuhdkCxdN+TtI4dm9JEa23ng/3/dPhvX6888Ersqv75kvwpuuPuT2kevS Ijc2MBQgqdRP2XakNRz6ZyFnBtH3CUbVHe71kXGKuBr94OklssNKrTSkRv7f858VmYtW sXTw== 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=G4+WSz9jzJ5Qp71EIKD9JlLG4WOe0b82KGCoGgQzwEc=; b=j7SiYhDV+neCE3CCc5B/pJ8iq43u26RBXF9d3HCsYp64c+ZL/oSeFtK5oO76xbaHCA wGD+yMACRwXUgLyqT3FnmlZM0qtTscUwKF6x7v47bl7PTeTLa+pV3pNQ1wXm2dqj+BZ8 HPpT/JgWFwaBBTqsG67o2y2WG+DPq/TIimOEe5dStBnqRjpuZsC6zIMY5jIJzNdv8Zoy L2Ji1zqZ1YLloHFjyChRVdY0wt70ynapij2EKHkmvdd1ioLc9fck7wPv1uZ8v6SDAoYp jn1r01v/jqS2AG7MJFwYPp9peYNnJyVwPJzJ+5cAgCGQmNeoT9cNzqDs17UfvkjRDYeU U4Jw== 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 v20si19320578pgk.58.2019.06.03.08.52.02; Mon, 03 Jun 2019 08:52:03 -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 S1729481AbfFCPwC (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:02 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53946 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729455AbfFCPv7 (ORCPT ); Mon, 3 Jun 2019 11:51:59 -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 A74A51A25; Mon, 3 Jun 2019 08:51:58 -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 8F18E3F246; Mon, 3 Jun 2019 08:51:57 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Peter Rosin Subject: [RFC PATCH 39/57] drivers: mux: Use class_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:50:05 +0100 Message-Id: <1559577023-558-40-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 Use the generic helper to find a device matching the of_node. Cc: Peter Rosin Signed-off-by: Suzuki K Poulose --- drivers/mux/core.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.7.4 Reviewed-by: Peter Rosin diff --git a/drivers/mux/core.c b/drivers/mux/core.c index d1271c1..3591e40 100644 --- a/drivers/mux/core.c +++ b/drivers/mux/core.c @@ -405,18 +405,12 @@ int mux_control_deselect(struct mux_control *mux) } EXPORT_SYMBOL_GPL(mux_control_deselect); -static int of_dev_node_match(struct device *dev, const void *data) -{ - return dev->of_node == data; -} - /* Note this function returns a reference to the mux_chip dev. */ static struct mux_chip *of_find_mux_chip_by_node(struct device_node *np) { struct device *dev; - dev = class_find_device(&mux_class, NULL, np, of_dev_node_match); - + dev = class_find_device_by_of_node(&mux_class, NULL, np); return dev ? to_mux_chip(dev) : NULL; } From patchwork Mon Jun 3 15:50:06 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: 165640 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646297ili; Mon, 3 Jun 2019 08:53:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBx+lywgaJZQ1YvU34olss0hNocNL6CtAtRTxn/AsQ2+RIFXvF8E9PUBSU9UC7XVnpB/g3 X-Received: by 2002:a17:90a:b909:: with SMTP id p9mr10181682pjr.74.1559577208037; Mon, 03 Jun 2019 08:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577208; cv=none; d=google.com; s=arc-20160816; b=UuFjMrTnn8709Nn3cg+BpRkwhgcPBNY2+gPpximlfZH/TlByv4WjB2wXNPTGduoBW4 RXG39AWD75ofCZJAVd9iKbG/gVheoPZL1TcTYujf3AfXYZ3wC9+1qWV8G0GCEkfRJGIL WbzoZ2ULVdUMtRGkYW6SJF0rKh4+SX/z1ewc7xhkgoIfSKIhpi35ZlM4dqbrmd8cikkW xbbzYB7EusHM32WzyOm3eJfWQ49ISfcTfBV3C8C8/GAjjKZgwwmir5tlnQfvf8rfYhSB 2qVT8f6ZgGmoCHZqBHPpjOEV9w5KV/eByH7y3YmiqAH/nRZkh0Rx/lf+ZJ27vsZkXi8z HgDw== 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=oDH6+psSYbbFZHkkzcDWu/GMuFXrcRVOA6fC2NbfmHk=; b=wQAnnv1B43u6IB67vw8/+6k2ibPe64BrsQyCMH/Y+IwLmHfjRztWedK7xUY9Sg8onj mtF9S9sALqyVyingtpUs0z/M0JVyppXYXqsKIsqZYmrAjbzL8+BuXQRa7K0dEKQYVZa9 QyGlRB3th71n2i34/8zC8E4J5yEwguav8FupN9pl/4vnynsZX/IISE8toJCFtuK1jAzG shreWSball9I7xObeenopRPysrjUcy6LyDi1RkVwfc9AriGSiZpnryY3X6hl2ZxiXzy9 GHtlf1N0hfbcVYWFq2uPVMCEOo6lNV//FB5hsfzB9iTAE49xOSOI3cu6t1izls+31IdZ E+8g== 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 h187si21804126pfb.129.2019.06.03.08.53.27; Mon, 03 Jun 2019 08:53:28 -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 S1729683AbfFCPxZ (ORCPT + 30 others); Mon, 3 Jun 2019 11:53:25 -0400 Received: from foss.arm.com ([217.140.101.70]:53956 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729463AbfFCPwA (ORCPT ); Mon, 3 Jun 2019 11:52:00 -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 D92D8169E; Mon, 3 Jun 2019 08:51:59 -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 E43D93F246; Mon, 3 Jun 2019 08:51:58 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [RFC PATCH 40/57] drivers: spi: Use class_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:50:06 +0100 Message-Id: <1559577023-558-41-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 Use the generic helper to find a device matching the of_node. Signed-off-by: Suzuki K Poulose --- drivers/spi/spi.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 5224ded..e1295e9 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3549,21 +3549,14 @@ EXPORT_SYMBOL_GPL(of_find_spi_device_by_node); #endif /* IS_ENABLED(CONFIG_OF) */ #if IS_ENABLED(CONFIG_OF_DYNAMIC) -static int __spi_of_controller_match(struct device *dev, const void *data) -{ - return dev->of_node == data; -} - /* the spi controllers are not using spi_bus, so we find it with another way */ static struct spi_controller *of_find_spi_controller_by_node(struct device_node *node) { struct device *dev; - dev = class_find_device(&spi_master_class, NULL, node, - __spi_of_controller_match); + dev = class_find_device_by_of_node(&spi_master_class, NULL, node); if (!dev && IS_ENABLED(CONFIG_SPI_SLAVE)) - dev = class_find_device(&spi_slave_class, NULL, node, - __spi_of_controller_match); + dev = class_find_device_by_of_node(&spi_slave_class, NULL, node); if (!dev) return NULL; From patchwork Mon Jun 3 15:50:07 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: 165637 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646267ili; Mon, 3 Jun 2019 08:53:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxcDlZdi0P+D2KlXpxzSQIvdEryQCuxAr0KD5x77LiL3zlqxRxlxFWhfaOscAe3ANpQPYr X-Received: by 2002:a63:ed09:: with SMTP id d9mr29797324pgi.419.1559577206835; Mon, 03 Jun 2019 08:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577206; cv=none; d=google.com; s=arc-20160816; b=wlUDObcQ51b5tCtwZFW8c+HaFEfeM9vlt4MqL6W5od7kdoz5jgL4CYvkgbmGKRpelK ndD+xWa/IkYogZtbL8Pk7wdcSbyjzr2ZjJShCukdK4ZLW169k6r+FIFydztJTLWr/h73 pTlI/0H9NJ3RTp6ooym8/c9W2v9X2+hqUzouizZx7wc01hSijQBXQNamuEzGQGX3nwgD J2K+D8Q0VKT+yNduhPoW5ZoFY1lg3q/pbdDCCk80PJ5Qt948mquh/JgYYhf9ueZ1JzHB C2aI58152QMxTRSFqGcKSrnTvei6IQ5KE+zlu8B0jocPSGj2G+Nal/uvR5zFsW+z236I k2aw== 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=m4ddIhx/PlwKCVPpXRtJFqorhefXpJIMo9lco5/6poA=; b=IuSuTEtZLOW7lWUkxAFYkDVSJ+i1aiTP3ytVNl1Xy0+noKCQW2DbGeOz0xc9G0ukMy tRsbO0HPuoF6Dt+gtrewOEgi+Xt8UpdhK4SI5eFp9K4TWZpDkjkoJVpkNYz0ivemgWgl ej0ZalkMBEsBGwH3CnNTFkTFyF15UQngnt/moWHGcmC3/nR9ZZC6icOYGr6uyXQ35fzd PKVaJx7F1CS27yMHgLWDjVNK1mPgHzYUYpMiw6uBaErRvwfcwdv/V+B2BmCEq2HELcFK 38b/c2Rv4V+gCimdlGOFiO/ynZIWMqzwDkQNz9RWuxFwK+GXiTofS51dNwxlIJ8u7vCk T0Qg== 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 h187si21804126pfb.129.2019.06.03.08.53.26; Mon, 03 Jun 2019 08:53:26 -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 S1729497AbfFCPwF (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:05 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53962 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729477AbfFCPwC (ORCPT ); Mon, 3 Jun 2019 11:52:02 -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 A565215AB; Mon, 3 Jun 2019 08:52:01 -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 2241C3F246; Mon, 3 Jun 2019 08:51:59 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Andrew Lunn , Florian Fainelli , Heiner Kallweit , "David S. Miller" Subject: [RFC PATCH 41/57] drivers: net: phy: Use class_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:50:07 +0100 Message-Id: <1559577023-558-42-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 Use the generic helper to find a device matching the of_node. Cc: Andrew Lunn Cc: Florian Fainelli Cc: Heiner Kallweit Cc: "David S. Miller" Signed-off-by: Suzuki K Poulose --- drivers/net/phy/mdio_bus.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.7.4 Reviewed-by: Andrew Lunn diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index bd04fe7..c868a40 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -262,11 +262,6 @@ static struct class mdio_bus_class = { }; #if IS_ENABLED(CONFIG_OF_MDIO) -/* Helper function for of_mdio_find_bus */ -static int of_mdio_bus_match(struct device *dev, const void *mdio_bus_np) -{ - return dev->of_node == mdio_bus_np; -} /** * of_mdio_find_bus - Given an mii_bus node, find the mii_bus. * @mdio_bus_np: Pointer to the mii_bus. @@ -287,9 +282,7 @@ struct mii_bus *of_mdio_find_bus(struct device_node *mdio_bus_np) if (!mdio_bus_np) return NULL; - d = class_find_device(&mdio_bus_class, NULL, mdio_bus_np, - of_mdio_bus_match); - + d = class_find_device_by_of_node(&mdio_bus_class, NULL, mdio_bus_np); return d ? to_mii_bus(d) : NULL; } EXPORT_SYMBOL(of_mdio_find_bus); From patchwork Mon Jun 3 15:50:08 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: 165622 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644870ili; Mon, 3 Jun 2019 08:52:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXlJUe7Ld0xirCjbAe5v1AcA/T4d90UqdJ4LtS7nG8iTJwNvHDvY+0ZiuDwXBEgWjbBEk8 X-Received: by 2002:a17:902:2aa6:: with SMTP id j35mr31611785plb.189.1559577126582; Mon, 03 Jun 2019 08:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577126; cv=none; d=google.com; s=arc-20160816; b=ErSf/Qz3TaHywu1ozFo8ImN1k7glb6zAAlyznw6xQgKQNw1akqgg2j/kOLkptzOV9v n2WJZqOvoIIGGJMLpmu1MfziM4npuzqQC9w/mFAForW/sTkfXMeNo3HwNFoOM7reGjOH 6ryXXsLhsUMNnwXpmqyW0skZKOt3oxopdddk0GXUhX/D8D5puor6Z7h8ZMycaWZ8oihT 4aTPCncQV8Jkga6L2msEwrNhA5j/eW1OeatGcWbxA9ixlUKwVeDwMjFdqJ6JJ8Qsb0B8 7MyzRDPBDPJU46CBb3NUm0GmRPkmiSkDlXdtAEQjSoPJm8kKYz0JmmVJwnLbiPunyhkW UsFQ== 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=3RHjltd/3Vt2ggfwF0P69vFaoYknmgUjuser8cp6LOk=; b=kihSKIx/gSgGbGD3Ba8VDNYG7s0vPoABj7z9r7d8er1iTe4mVDaDo9lJnsmihAoqsN 8D5QQzp7qVtKo0lY3KvMhoktourc6fuULLSYzU4gpLr9cze8yhrJn1CGNSo4furvr5HB bBVUfKTY+m9uuW1tgdM1xs7P0bTpr+fv2JfEReuy6dCD9amZDuU1VRqYuKPi1AaPPwkv VoBKqjic+8p5f7wbmyObBfoY5Uil+A5NsUqebgxnlAqwfiBofH+aehBtzSAX2evuUOvj QvH29nSYK/eosG32wQtoeULjiitr3nTNYOJGgLS1fPT9A/aBv2+d3AUsCzCXZHyy1m2V zaUg== 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 v20si19320578pgk.58.2019.06.03.08.52.06; Mon, 03 Jun 2019 08:52:06 -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 S1729508AbfFCPwF (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:05 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53974 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729486AbfFCPwD (ORCPT ); Mon, 3 Jun 2019 11:52:03 -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 2A5AB169E; Mon, 3 Jun 2019 08:52:03 -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 E25863F246; Mon, 3 Jun 2019 08:52:01 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Liam Girdwood , Mark Brown Subject: [RFC PATCH 42/57] drivers: regulator: Use class_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:50:08 +0100 Message-Id: <1559577023-558-43-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 Use the generic helper to find a device matching the of_node. Cc: Liam Girdwood Cc: Mark Brown Signed-off-by: Suzuki K Poulose --- drivers/regulator/of_regulator.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.7.4 Acked-by: Mark Brown diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 0ead116..1485f6e 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -442,16 +442,11 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev, return NULL; } -static int of_node_match(struct device *dev, const void *data) -{ - return dev->of_node == data; -} - struct regulator_dev *of_find_regulator_by_node(struct device_node *np) { struct device *dev; - dev = class_find_device(®ulator_class, NULL, np, of_node_match); + dev = class_find_device_by_of_node(®ulator_class, NULL, np); return dev ? dev_to_rdev(dev) : NULL; } From patchwork Mon Jun 3 15:50:09 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: 165638 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646275ili; Mon, 3 Jun 2019 08:53:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvV9xXipVySPvJrNR7qxbRkCporxq2/wkY+aMI4KvG4s19gBI8RUPVLVOe+ifZbS7kIaxh X-Received: by 2002:aa7:8219:: with SMTP id k25mr33045796pfi.38.1559577207248; Mon, 03 Jun 2019 08:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577207; cv=none; d=google.com; s=arc-20160816; b=kXbEK8YdCKANp9CIavPssn/GKvMG2yoJCVIeky5YfbdZE8YYy725DrrCd16J6l3ji6 V6Lt3+DC8yS4Us1lQbcXNI27f3TxR7q/lMXIiJsc+1qv7fWteYDmhhaEs3+LJBFvfK2A M5zZfMcyMBI5TieN0V18qsBaSy6QqHbLC0tbEywT2vXMEBXuG7EnujuE8BpJR1XitRtC ie88YRsOf34pY1JK5IpDn7bGppwuH8A4AyvZsZ0Ex95EHrsrmXB5VZcKK8EAJGnKUulK S3uDJBVoqnEzUizIqtY5MmL0nyBoy4n/6Yte7zOLpWGMnP3J5eA7xdiWRf45YD6pM/sR EBNw== 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=V7aSinaUk9mv/uEQF+0uvsfEa14bituZqCOj8Ew3EJs=; b=OBx7pSnmbODyl/nTZFy84ApeoPh6Ph5xFhOTqZZiFqvr25wqysTYrcAPntcrYWhtnL /W2cteVBe8JSJ+yd0PbOtG8qhBKXjsa3UGa/SqXwMK5+caYUTYXqKZySWGZ7C/TtSMti cimWYURB1NA0u60nnNjfhz0UnO3g1Bmym1qCORU9Z8jrhMW6W0FlCVeYDunRf3p9udV6 6V/Zvt3WPa1JglKxprOiAeM8btnYZSf9uArWx+PDQyJvfaMO81fmqqIAm7IhO0fk51pp WjCAFinhKTheLZB8XbkvMhpfXHA8txvhKkcTeSaihUDouIlwGJyb+WgSo2NzWVplT+JN S4Mw== 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 h187si21804126pfb.129.2019.06.03.08.53.26; Mon, 03 Jun 2019 08:53:27 -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 S1729211AbfFCPxO (ORCPT + 30 others); Mon, 3 Jun 2019 11:53:14 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53986 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729491AbfFCPwE (ORCPT ); Mon, 3 Jun 2019 11:52:04 -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 804261A25; Mon, 3 Jun 2019 08:52:04 -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 672DB3F246; Mon, 3 Jun 2019 08:52:03 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Jiri Slaby Subject: [RFC PATCH 43/57] drivers: tty : Use class_find_device_by_of_node helper Date: Mon, 3 Jun 2019 16:50:09 +0100 Message-Id: <1559577023-558-44-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 Use the generic helper to find a device matching the of_node. Cc: Greg Kroah-Hartman Cc: Jiri Slaby Signed-off-by: Suzuki K Poulose --- drivers/tty/tty_io.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 033ac7e..b078fdb 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2950,17 +2950,11 @@ void do_SAK(struct tty_struct *tty) EXPORT_SYMBOL(do_SAK); -static int dev_match_devt(struct device *dev, const void *data) -{ - const dev_t *devt = data; - return dev->devt == *devt; -} - /* Must put_device() after it's unused! */ static struct device *tty_get_device(struct tty_struct *tty) { dev_t devt = tty_devnum(tty); - return class_find_device(tty_class, NULL, &devt, dev_match_devt); + return class_find_device_by_devt(tty_class, NULL, devt); } 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]); From patchwork Mon Jun 3 15:50:11 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: 165624 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4644956ili; Mon, 3 Jun 2019 08:52:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+NR1Z+aou10tOLxDuxxUt081x7KZ/z89+vd3GEQtUG6Q8NlcFi92ikjBqndyOqqBm3RjW X-Received: by 2002:a17:902:54f:: with SMTP id 73mr30356673plf.246.1559577131804; Mon, 03 Jun 2019 08:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577131; cv=none; d=google.com; s=arc-20160816; b=olSjMZHGShdIeysRD2uO1BUIhdBnh8y7lmztWJRxARTSdJeS/7iJKYKWCAzO30x7qT 6/C1kU2COB80d7mQdtz5o1DjM81qcVmtjUzQcny7EU5kXf+uGRIfaWIQ0Z7NU6UY8XuX 28QOMrmxZKARPRUWy4y2aegH3pqDvYFjqEmI580+rFqQtyg7AvzjaweWv8KXtKxcxaWS U44l+92FY7DV8Gd6rJAQOJQ2XJveEBnxgYg91cqvAr4B+gWGO8CkoMhw7rptjG3qPsXQ yas4GWA+aiv1fwiPYQdICXIMXP9jV9Y5KRvcRBEbRk9fu+BmRzOSlhyW+xXjJHRnW4HZ 4cCg== 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=kA/Ri+DjsHFcobnYCr89dbbmojjLXYKlC+N8jAgUlCU=; b=IivTyGv8C8xrZgYt5LMINTYT+9z1jaZUVszMIRwZRNCHaVNDrOfNNbpaRwC1ntfLq4 lxRUWtvYvVrMfPo7h7Uwn3CaC6mVrj1uagK8eROryS7riCh0EGuF8Pfp3XIPdnS2LMOQ RB7QhQGnhFowX0uHU/BXrQnDLZpi3VuAsRdo4KeHi+PDP0BFbvG9XVbVldYARRlxg20G V3gtp2zH291vErHD4C9IYVmbe7cl0JRzYdk9CHIhSlL5tdb/aFKUDBw5bz4wCge9Y+bw x3FCxOnQhPMXIxBrrj0zmQMC3OAoPHtJ3eO4vJdGUclM5yVxse9etCgujvq1LEMBHyf6 Twag== 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.11; Mon, 03 Jun 2019 08:52:11 -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 S1729538AbfFCPwK (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:10 -0400 Received: from foss.arm.com ([217.140.101.70]:54008 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729486AbfFCPwJ (ORCPT ); Mon, 3 Jun 2019 11:52:09 -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 B88AE169E; Mon, 3 Jun 2019 08:52:08 -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 3A2103F246; Mon, 3 Jun 2019 08:52:06 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Russell King , Thierry Reding , Will Deacon , Joerg Roedel , Peter Oberparleiter , Sebastian Ott , David Airlie , Daniel Vetter , Nehal Shah , Shyam Sundar S K , Lee Jones Subject: [RFC PATCH 45/57] drivers: driver_find_device: Unify the match function Date: Mon, 3 Jun 2019 16:50:11 +0100 Message-Id: <1559577023-558-46-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 Unify the match function parameter for driver_find_device with that of the {bus,class}_find_device helpers, to allow us to reuse the generic helpers. Cc: Russell King Cc: Thierry Reding Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Will Deacon Cc: Joerg Roedel Cc: Peter Oberparleiter Cc: Sebastian Ott Cc: David Airlie Cc: Daniel Vetter Cc: Nehal Shah Cc: Shyam Sundar S K Cc: Lee Jones Signed-off-by: Suzuki K Poulose --- drivers/amba/tegra-ahb.c | 4 ++-- drivers/base/driver.c | 2 +- drivers/char/ipmi/ipmi_msghandler.c | 8 ++++---- drivers/gpu/drm/tegra/dc.c | 4 ++-- drivers/i2c/busses/i2c-amd-mp2-pci.c | 2 +- drivers/iommu/arm-smmu-v3.c | 2 +- drivers/iommu/arm-smmu.c | 2 +- drivers/mfd/altera-sysmgr.c | 4 ++-- drivers/mfd/syscon.c | 2 +- drivers/s390/cio/ccwgroup.c | 2 +- drivers/s390/cio/chsc_sch.c | 2 +- drivers/s390/cio/device.c | 2 +- include/linux/device.h | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) -- 2.7.4 diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c index 3751d81..42175a6 100644 --- a/drivers/amba/tegra-ahb.c +++ b/drivers/amba/tegra-ahb.c @@ -143,10 +143,10 @@ static inline void gizmo_writel(struct tegra_ahb *ahb, u32 value, u32 offset) } #ifdef CONFIG_TEGRA_IOMMU_SMMU -static int tegra_ahb_match_by_smmu(struct device *dev, void *data) +static int tegra_ahb_match_by_smmu(struct device *dev, const void *data) { struct tegra_ahb *ahb = dev_get_drvdata(dev); - struct device_node *dn = data; + const struct device_node *dn = data; return (ahb->dev->of_node == dn) ? 1 : 0; } diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 857c8f1..a10e9da 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -74,7 +74,7 @@ EXPORT_SYMBOL_GPL(driver_for_each_device); */ struct device *driver_find_device(struct device_driver *drv, struct device *start, void *data, - int (*match)(struct device *dev, void *data)) + int (*match)(struct device *dev, const void *data)) { struct klist_iter i; struct device *dev; diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 1dc1074..6707659 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -2819,9 +2819,9 @@ static const struct device_type bmc_device_type = { .groups = bmc_dev_attr_groups, }; -static int __find_bmc_guid(struct device *dev, void *data) +static int __find_bmc_guid(struct device *dev, const void *data) { - guid_t *guid = data; + const guid_t *guid = data; struct bmc_device *bmc; int rv; @@ -2857,9 +2857,9 @@ struct prod_dev_id { unsigned char device_id; }; -static int __find_bmc_prod_dev_id(struct device *dev, void *data) +static int __find_bmc_prod_dev_id(struct device *dev, const void *data) { - struct prod_dev_id *cid = data; + const struct prod_dev_id *cid = data; struct bmc_device *bmc; int rv; diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 607a6ea1..52109a6 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -2375,10 +2375,10 @@ static int tegra_dc_parse_dt(struct tegra_dc *dc) return 0; } -static int tegra_dc_match_by_pipe(struct device *dev, void *data) +static int tegra_dc_match_by_pipe(struct device *dev, const void *data) { struct tegra_dc *dc = dev_get_drvdata(dev); - unsigned int pipe = (unsigned long)data; + unsigned int pipe = (unsigned long)(void *)data; return dc->pipe == pipe; } diff --git a/drivers/i2c/busses/i2c-amd-mp2-pci.c b/drivers/i2c/busses/i2c-amd-mp2-pci.c index 455e1f3..c7fe3b4 100644 --- a/drivers/i2c/busses/i2c-amd-mp2-pci.c +++ b/drivers/i2c/busses/i2c-amd-mp2-pci.c @@ -457,7 +457,7 @@ static struct pci_driver amd_mp2_pci_driver = { }; module_pci_driver(amd_mp2_pci_driver); -static int amd_mp2_device_match(struct device *dev, void *data) +static int amd_mp2_device_match(struct device *dev, const void *data) { return 1; } diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 4d5a694..d787856 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -2023,7 +2023,7 @@ arm_smmu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova) static struct platform_driver arm_smmu_driver; -static int arm_smmu_match_node(struct device *dev, void *data) +static int arm_smmu_match_node(struct device *dev, const void *data) { return dev->fwnode == data; } diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 5e54cc0..4ce429b 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1431,7 +1431,7 @@ static bool arm_smmu_capable(enum iommu_cap cap) } } -static int arm_smmu_match_node(struct device *dev, void *data) +static int arm_smmu_match_node(struct device *dev, const void *data) { return dev->fwnode == data; } diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c index 8976f82..2ee14d8 100644 --- a/drivers/mfd/altera-sysmgr.c +++ b/drivers/mfd/altera-sysmgr.c @@ -92,9 +92,9 @@ static struct regmap_config altr_sysmgr_regmap_cfg = { * Matching function used by driver_find_device(). * Return: True if match is found, otherwise false. */ -static int sysmgr_match_phandle(struct device *dev, void *data) +static int sysmgr_match_phandle(struct device *dev, const void *data) { - return dev->of_node == (struct device_node *)data; + return dev->of_node == (const struct device_node *)data; } /** diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index 8ce1e41..4f39ba5 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -190,7 +190,7 @@ struct regmap *syscon_regmap_lookup_by_compatible(const char *s) } EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_compatible); -static int syscon_match_pdevname(struct device *dev, void *data) +static int syscon_match_pdevname(struct device *dev, const void *data) { return !strcmp(dev_name(dev), (const char *)data); } diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index a006945..c554f16 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c @@ -606,7 +606,7 @@ void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver) } EXPORT_SYMBOL(ccwgroup_driver_unregister); -static int __ccwgroupdev_check_busid(struct device *dev, void *id) +static int __ccwgroupdev_check_busid(struct device *dev, const void *id) { char *bus_id = id; diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c index 8d9f366..8f080d3 100644 --- a/drivers/s390/cio/chsc_sch.c +++ b/drivers/s390/cio/chsc_sch.c @@ -203,7 +203,7 @@ static void chsc_cleanup_sch_driver(void) static DEFINE_SPINLOCK(chsc_lock); -static int chsc_subchannel_match_next_free(struct device *dev, void *data) +static int chsc_subchannel_match_next_free(struct device *dev, const void *data) { struct subchannel *sch = to_subchannel(dev); diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 6ca9a3a..a5c2765 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -1653,7 +1653,7 @@ EXPORT_SYMBOL_GPL(ccw_device_force_console); * get ccw_device matching the busid, but only if owned by cdrv */ static int -__ccwdev_check_busid(struct device *dev, void *id) +__ccwdev_check_busid(struct device *dev, const void *id) { char *bus_id; diff --git a/include/linux/device.h b/include/linux/device.h index 1945c3d..52d59d5 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -399,7 +399,7 @@ extern int __must_check driver_for_each_device(struct device_driver *drv, void *)); struct device *driver_find_device(struct device_driver *drv, struct device *start, void *data, - int (*match)(struct device *dev, void *data)); + int (*match)(struct device *dev, const void *data)); void driver_deferred_probe_add(struct device *dev); int driver_deferred_probe_check_state(struct device *dev); From patchwork Mon Jun 3 15:50:12 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: 165625 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645001ili; Mon, 3 Jun 2019 08:52:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzj/NV84jEkeJipEXyFftqsJN7Cw52T/BeJVJ9jq16GiMUAed00guL3JTZvli77yPHcFVAX X-Received: by 2002:aa7:989b:: with SMTP id r27mr30983287pfl.108.1559577135056; Mon, 03 Jun 2019 08:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577135; cv=none; d=google.com; s=arc-20160816; b=Hir+WiiTPdFwJwmXhPRX1iHd/usvF8mFdtEzb4VfYhQP7cOsCg5nBSoXrRPM80xURq dxMLf/65hFfJZoedcvTRj87EzX9UiOKbrKM+c8rNiJGmJcpE2IC6H2avWpoPF/YevQ9z XlN/R88mSWpBVxheXODfDaFr7qehblGWR0nAidxqrNAtdV1pZexOAZEh0Nf9ni5fR3uc PPdJGYJ0qYfjnfno8avMS0vxyDTLx7eZNlVrKQPFJs03oI6MXUCBLexDWcxfkA6gmIVM EWLI1AfWNc8rtioTmKlnD0z8IiUVNXhVa1Cwb0sa//ymeGkk15rv0veUabhQIotVgmYZ EaQA== 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=drvsc7DDi0Ibvj/dvBIQdCySXJOyVjrQ/9vK8EFf25w=; b=DT5cd+ScYhnP5CziMQWVoCXJSSe94teD/PSMlIqZJWKhAf6TqYmQKXKcpOCWKEV+yF 96k8yQYmfdgMqx76gb6nqTQrBGGOu1OT1JHhNIE7SBuJ3RBn7B2EL0b07GOKQy4XQZRj TIBE+/IGZUNqsveH1k/HfaPD0bB/NbAbbj4yWMliDI2uDtAFT+IlD5L5Z/hF/9WfkLxY FCcF+bZ5uEsRcXjtRpLVJ0GRy87vzDvYhGFk15sCf0SLfiL0GJxcVbCBBKjB7wd7BIAJ spME6FXnLfRTmimq1KW2GPI2qC9m3Hb4xAcNzPF3usn93QReBTY5Ba+8G2xtO9Y3Y4iR NIuQ== 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 x2si10797868pju.24.2019.06.03.08.52.14; Mon, 03 Jun 2019 08:52:15 -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 S1729550AbfFCPwN (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:13 -0400 Received: from foss.arm.com ([217.140.101.70]:54030 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729531AbfFCPwK (ORCPT ); Mon, 3 Jun 2019 11:52:10 -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 E1BD515AB; Mon, 3 Jun 2019 08:52:09 -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 01AF63F246; Mon, 3 Jun 2019 08:52:08 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [RFC PATCH 46/57] driver: Add variants of driver_find_device() Date: Mon, 3 Jun 2019 16:50:12 +0100 Message-Id: <1559577023-558-47-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 Add a wrappers to lookup a device by name for a given driver, by various generic properties of a device. This can avoid the proliferation of custom match functions throughout the drivers. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- include/linux/device.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) -- 2.7.4 diff --git a/include/linux/device.h b/include/linux/device.h index 52d59d5..68d6e04 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -401,6 +401,50 @@ struct device *driver_find_device(struct device_driver *drv, struct device *start, void *data, int (*match)(struct device *dev, const void *data)); +/** + * driver_find_device_by_name - device iterator for locating a particular device + * of a specific name. + * @driver: the driver we're iterating + * @start: Device to begin with + * @name: name of the device to match + */ +static inline struct device *driver_find_device_by_name(struct device_driver *drv, + struct device *start, + const char *name) +{ + return driver_find_device(drv, start, (void *)name, device_match_name); +} + +/** + * driver_find_device_by_of_node- device iterator for locating a particular device + * by of_node pointer. + * @driver: the driver we're iterating + * @start: Device to begin with + * @np: of_node pointer to match. + */ +static inline struct device * +driver_find_device_by_of_node(struct device_driver *drv, + struct device *start, + const struct device_node *np) +{ + return driver_find_device(drv, start, (void *)np, device_match_of_node); +} + +/** + * driver_find_device_by_fwnode- device iterator for locating a particular device + * by fwnode pointer. + * @driver: the driver we're iterating + * @start: Device to begin with + * @fwnode: fwnode pointer to match. + */ +static inline struct device * +driver_find_device_by_fwnode(struct device_driver *drv, + struct device *start, + const struct fwnode_handle *fwnode) +{ + return driver_find_device(drv, start, (void *)fwnode, device_match_fwnode); +} + void driver_deferred_probe_add(struct device *dev); int driver_deferred_probe_check_state(struct device *dev); From patchwork Mon Jun 3 15:50:13 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: 165636 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4646258ili; Mon, 3 Jun 2019 08:53:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzg5nee4bq5+Th9DVq1QSkCWB7ZV9VBDUbG3h2UDmmX9EGIN+sayORDXSF6oxd8VKHA0IZp X-Received: by 2002:a62:3006:: with SMTP id w6mr30370200pfw.159.1559577206217; Mon, 03 Jun 2019 08:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577206; cv=none; d=google.com; s=arc-20160816; b=GrkmjKluVwU/qPWgNmgXrht8EAYC36NRV/8KoDK7BcuynI2E24Fc8P7LXmTkkeIW0r aIHhLDbuozwKneZT7oiJ8RgMxU7khQDLnHPbeO4DMrHvLCT9pCdigZ4aBDJMps07g9E1 nC6uG09vW+w9pxGgw4H2sqV1PBry4IHEN8wXdv4mQ1eaiIAgT2Hoh2oXaOZmzawg88Xs f4t/M49a1mSgQEZ7wEsXUU0eBe8rDlEWAYbiMn4hHROxcMewj1ipdUxop9IXEOWciTC4 k6C3aBrAvEu4SAMqqlv3r+u0BpLmLrhTL9CFsab4J+4hmJUWcy2XrgCD0sP/y2DIbOWL V5Og== 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=wSQd2e0rBQQ2YuN27eEE9RlI9utljkLYVzXL+YtThSE=; b=UzOB2K/a3TMvIfrsGA+6M7SgDhKZJp3bQ3Kp96X+2tugA7pV4shk4B2rc5GOTeoZgQ xyrGcQ5d28MKV3iGK6SUqmGx0GoB09ij9uErdq3ViRNUG3Ssm6/ENgvgSvRrGNvMwGh1 OZMLsLdsrXkbWqKXaJN1wBXN5GTajk7aigALywjB51HU75LVqdZHHOr3gWAQZFjY9oHF nMWxRXMBFO5wU972XpGJ3Rspci7wnFNScPjoudEviE7p56cg/NCOxK9BMYct2KIXVQKp XoEljS5fTm3kysRG8QNd144ElGgZIt+NHprxVizkTE7ufkzEEycuh4K+EPbX02u7ZLg+ XuCg== 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 h187si21804126pfb.129.2019.06.03.08.53.25; Mon, 03 Jun 2019 08:53:26 -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 S1729679AbfFCPxD (ORCPT + 30 others); Mon, 3 Jun 2019 11:53:03 -0400 Received: from foss.arm.com ([217.140.101.70]:54036 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729486AbfFCPwL (ORCPT ); Mon, 3 Jun 2019 11:52:11 -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 66D651A25; Mon, 3 Jun 2019 08:52:11 -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 2AB413F246; Mon, 3 Jun 2019 08:52:10 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Lee Jones , Arnd Bergmann Subject: [RFC PATCH 47/57] drivers: mfd: Use driver_find_device_by_name helper Date: Mon, 3 Jun 2019 16:50:13 +0100 Message-Id: <1559577023-558-48-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 Use the new driver_find_device_by_name() helper. Cc: Lee Jones Cc: Arnd Bergmann Signed-off-by: Suzuki K Poulose --- drivers/mfd/syscon.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index 4f39ba5..e51e39a 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -190,18 +190,12 @@ struct regmap *syscon_regmap_lookup_by_compatible(const char *s) } EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_compatible); -static int syscon_match_pdevname(struct device *dev, const void *data) -{ - return !strcmp(dev_name(dev), (const char *)data); -} - struct regmap *syscon_regmap_lookup_by_pdevname(const char *s) { struct device *dev; struct syscon *syscon; - dev = driver_find_device(&syscon_driver.driver, NULL, (void *)s, - syscon_match_pdevname); + dev = driver_find_device_by_name(&syscon_driver.driver, NULL, s); if (!dev) return ERR_PTR(-EPROBE_DEFER); From patchwork Mon Jun 3 15:50:14 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: 165634 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645616ili; Mon, 3 Jun 2019 08:52:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyC0JAlf3VRUpkbF1EzTFHcaR2BmU2t/ZIsyf+kW+tjko9XDmY0U2XWoFLym2PjN6JW3d8A X-Received: by 2002:a63:81c2:: with SMTP id t185mr29775093pgd.257.1559577168045; Mon, 03 Jun 2019 08:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577168; cv=none; d=google.com; s=arc-20160816; b=BIbIFsVEQN7kcPwBxq/+fL+1znj5hgJR3jhaRORfz3uwExCEugDMvSHJdEAPObYxEp UHafGzBrfPtEdISuo1Ck74dmqMbheN3Ytykg7bEQuJYJQrOmyQLZOEJnt9BS9rm7g5kD 2wMgwS+UjG3xwgaXbah7WgvUFL3i+fT5+OoSySgYSSxtK2xHM81rlUJ7LXBScYeWSQxx XGhxhFrktKnZv4rKajTnT+Rj73kmFMcA2v3nNkPqLPAt8dyxYsbfJdceQj6FcFpQLIrT 3W8acWUwddV8/JK8YDuu3vy7MHBEJezAImg3zmto8nV2SjNEvp8z36ZKi2dNTM485bwp HiHQ== 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=I+cgjBFwJLXgQbap6M5q0m9ioMXcRce5kCGzz/ag/HU=; b=FNBkHcU028eKlcI8j9aO7Z3G1qJwVQI3U4mPhrfJNFNSCePf5qkPi+YSCJ01ldHmnX sqbCvyBNWV3rZHF3wXFGnasShCaOXBgW52fA+BCc3HhOfvN7WttyREIGjsG4nrNsv9EM uNdgLBxh9ix1Oy1vMBiVM+EdXBVvNbMfC529EJ5qw/vWx7wJtIb3u9Hx5XSJOx9Ff8ji hN8EoOHNNjd0N93DYc+asRfxfRUSZiEK6zGk/XAc7a7sbgdjf9dDJPEp68XoA2jKieBw obNgsAIvNQxibA6IB/YnoIXkt/MOM/wZ8mb8UZy201GUOdjEusiP44YRgdLEtlOYWPE9 DSyw== 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 l3si3193510pgl.560.2019.06.03.08.52.47; Mon, 03 Jun 2019 08:52:48 -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 S1729575AbfFCPwS (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:18 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54048 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729544AbfFCPwN (ORCPT ); Mon, 3 Jun 2019 11:52:13 -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 08C7715AB; Mon, 3 Jun 2019 08:52:13 -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 A3FD63F246; Mon, 3 Jun 2019 08:52:11 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Peter Oberparleiter , Martin Schwidefsky , Heiko Carstens Subject: [RFC PATCH 48/57] drivers: s390: cio: Use driver_find_by_name() helper Date: Mon, 3 Jun 2019 16:50:14 +0100 Message-Id: <1559577023-558-49-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 Use the new driver_find_by_name() helper. Cc: Peter Oberparleiter Cc: Martin Schwidefsky Cc: Heiko Carstens Signed-off-by: Suzuki K Poulose --- drivers/s390/cio/ccwgroup.c | 10 +--------- drivers/s390/cio/device.c | 17 +---------------- 2 files changed, 2 insertions(+), 25 deletions(-) -- 2.7.4 diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index c554f16..b1e24fb 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c @@ -606,13 +606,6 @@ void ccwgroup_driver_unregister(struct ccwgroup_driver *cdriver) } EXPORT_SYMBOL(ccwgroup_driver_unregister); -static int __ccwgroupdev_check_busid(struct device *dev, const void *id) -{ - char *bus_id = id; - - return (strcmp(bus_id, dev_name(dev)) == 0); -} - /** * get_ccwgroupdev_by_busid() - obtain device from a bus id * @gdrv: driver the device is owned by @@ -629,8 +622,7 @@ struct ccwgroup_device *get_ccwgroupdev_by_busid(struct ccwgroup_driver *gdrv, { struct device *dev; - dev = driver_find_device(&gdrv->driver, NULL, bus_id, - __ccwgroupdev_check_busid); + dev = driver_find_device_by_name(&gdrv->driver, NULL, bus_id); return dev ? to_ccwgroupdev(dev) : NULL; } diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index a5c2765..262e81c 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -1649,20 +1649,6 @@ int ccw_device_force_console(struct ccw_device *cdev) EXPORT_SYMBOL_GPL(ccw_device_force_console); #endif -/* - * get ccw_device matching the busid, but only if owned by cdrv - */ -static int -__ccwdev_check_busid(struct device *dev, const void *id) -{ - char *bus_id; - - bus_id = id; - - return (strcmp(bus_id, dev_name(dev)) == 0); -} - - /** * get_ccwdev_by_busid() - obtain device from a bus id * @cdrv: driver the device is owned by @@ -1679,8 +1665,7 @@ struct ccw_device *get_ccwdev_by_busid(struct ccw_driver *cdrv, { struct device *dev; - dev = driver_find_device(&cdrv->driver, NULL, (void *)bus_id, - __ccwdev_check_busid); + dev = driver_find_device_by_name(&cdrv->driver, NULL, bus_id); return dev ? to_ccwdev(dev) : NULL; } From patchwork Mon Jun 3 15:50:15 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: 165626 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645058ili; Mon, 3 Jun 2019 08:52:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFcVZ9kRnD2gZv+tLEThvbv967DNyyXSvXROvpOczeFrD+u6qQIIIXnwpxIXOaf/QO5hdC X-Received: by 2002:a62:1483:: with SMTP id 125mr32197089pfu.137.1559577138415; Mon, 03 Jun 2019 08:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577138; cv=none; d=google.com; s=arc-20160816; b=TmjR692AogUiWPqq5TbMfeYxJtecs+AqAkSum2xrplpSTeEnEOSp/8qyYq1KZvm/za HPYtHFmH3cDgotBVfVDxQJvgsISwCxzJakod3DD5vCfjMudJ0Z6sn6aQ1TGtwwMoxKWn ZbIsI8sqjXthGkPX5M9zQuJqlalbgYa4FCVlpULyd0cT38pNSk0W9+XYse3z+TmK3c/4 ZS03TTanKWgHVLzJXAKQ4WbADUx9Mbx8ORc5LFiepFub4hwj/KOLcZaGHT/87nqhtUTl n+r8mWrXlFErEzEfGQaJfhUG9k1+Jc0poveXQqXEuSRuLwkICEQ47arxHs4MplHIZ+ft lvCg== 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=3Vj7ifkAUHf6AEMPNeObfCtHupz4v40NuVs7nu+hhK4=; b=p/A0zzg1F78wGtq0Fc8brCVeoZi+1py1/I/61qwRXk/44laYUhavnzIKAnbLjMAKxu qQ/MJbHXQC8cqLpFiqhFfo2FlvgD2LjukhoLthWNmugy+XOUWcbKnG/70O3O+ju7Nf42 F9tZIyJi5dDubzadhHUNX7v9qtYgGG0Cr1luVf14LDVXzcYB8zbw9nV3/5xvrBzdYdaH KDwN1LoCocCs3P1jbi01lnweIxc3ibIFKrB/8dpit1BD33rvwm6OyxGfyj+W+Pyqh5gp kogHbGl5eMyZ/mTl0QVNg/lJ2zwbLaPwxomimnMFlsbB2e2AHfMiIslAwb88oUDSP1np UpEQ== 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 h4si17718022pgs.269.2019.06.03.08.52.18; Mon, 03 Jun 2019 08:52:18 -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 S1729563AbfFCPwR (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:17 -0400 Received: from foss.arm.com ([217.140.101.70]:54058 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729531AbfFCPwO (ORCPT ); Mon, 3 Jun 2019 11:52:14 -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 78C51169E; Mon, 3 Jun 2019 08:52:14 -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 45D393F246; Mon, 3 Jun 2019 08:52:13 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Thor Thayer , Lee Jones Subject: [RFC PATCH 49/57] drivers: mfd: altera: Use driver_find_device_by_of_node() helper Date: Mon, 3 Jun 2019 16:50:15 +0100 Message-Id: <1559577023-558-50-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 Use the new helper to find device by of_node. Cc: Thor Thayer Cc: Lee Jones Signed-off-by: Suzuki K Poulose --- drivers/mfd/altera-sysmgr.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.7.4 Acked-by: Thor Thayer diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c index 2ee14d8..1fbe06c 100644 --- a/drivers/mfd/altera-sysmgr.c +++ b/drivers/mfd/altera-sysmgr.c @@ -88,16 +88,6 @@ static struct regmap_config altr_sysmgr_regmap_cfg = { }; /** - * sysmgr_match_phandle - * Matching function used by driver_find_device(). - * Return: True if match is found, otherwise false. - */ -static int sysmgr_match_phandle(struct device *dev, const void *data) -{ - return dev->of_node == (const struct device_node *)data; -} - -/** * altr_sysmgr_regmap_lookup_by_phandle * Find the sysmgr previous configured in probe() and return regmap property. * Return: regmap if found or error if not found. @@ -117,8 +107,8 @@ struct regmap *altr_sysmgr_regmap_lookup_by_phandle(struct device_node *np, if (!sysmgr_np) return ERR_PTR(-ENODEV); - dev = driver_find_device(&altr_sysmgr_driver.driver, NULL, - (void *)sysmgr_np, sysmgr_match_phandle); + dev = driver_find_device_by_of_node(&altr_sysmgr_driver.driver, NULL, + (void *)sysmgr_np); of_node_put(sysmgr_np); if (!dev) return ERR_PTR(-EPROBE_DEFER); From patchwork Mon Jun 3 15:50:16 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: 165632 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645501ili; Mon, 3 Jun 2019 08:52:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8ORTHnHCj90pO0gZiyoX3CE6c4oYlh65Ed2ipemdq03rNRwmtZLSYLquT7bv0+kzmzaut X-Received: by 2002:a17:902:868f:: with SMTP id g15mr30592712plo.67.1559577162441; Mon, 03 Jun 2019 08:52:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577162; cv=none; d=google.com; s=arc-20160816; b=xshLG6vQ3w2KJlbb8JY3lGkVmxwfAxEinDM19QG9qqQUzerkPHAbdtvL2t3wDpv9dg unBhkRB+jaLBaGjyXaLGGrWZJPn4p1zz2EVUiKvjaXMZCRRXh/onAow1UKba0DHOJCBi roXUSRniD5xKqmZfYZtgyWdUJNwtECEMKuOQpHFSSNX8KZzCM9rUfaAvEShNncGgzsG/ XWUM0m0Z1LuiPLqGhyoL1aU1Kjzjj52xNDmiQwyQVrEqineG8k8r5wcxgPEo9kft/WyY +kvG6SUgzuowLO/CuqlFOpbbtlPow6w4/gpXIhBDxO/hgIbpM4G5g7VH1I48e2HSq6PC iRaA== 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=XRWKlJED9Lo0lEkJD8RqoGMbvqXKL7qmOJuZ400Zx4w=; b=Tjvt+hhthdr+u9tgb8QcUVKcneKI/U4zJuXm0kkVmJD0+301M3n1YaOPbvJmyj7nI7 zVU098GXPmPwxebLebaDPS09uygvHyY2XHA82+QXXtD5fKGGH+61nR0e5qV4UI8U0Lpv Rmqziq8bX9S3U7wB29ZObsFyvCaMougnOdC+d1Vyrnfz3W8x7Ujq65WST63S5bkzoomT 04iTgZf65s/T0tU7JqA0U+tJ7s7ZagxnRdWP7NEYIGn3o2GgUJ+gY3uz+lLrDU1oJ4pV Y1vD6ylNpsdaRuJ0yV2x9Il3sxTyfXXoonZCqpizZN1SovikIG1u9iJqGsMGdJCqjnMy cGlQ== 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 gn3si8189430plb.321.2019.06.03.08.52.42; Mon, 03 Jun 2019 08:52:42 -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 S1729588AbfFCPwU (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:20 -0400 Received: from foss.arm.com ([217.140.101.70]:54068 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729553AbfFCPwQ (ORCPT ); Mon, 3 Jun 2019 11:52:16 -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 17DDD15AB; Mon, 3 Jun 2019 08:52:16 -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 B58773F246; Mon, 3 Jun 2019 08:52:14 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Will Deacon , Robin Murphy , Joerg Roedel Subject: [RFC PATCH 50/57] drivers: iommu: arm-smmu: Use driver_find_device_by_fwnode() helper Date: Mon, 3 Jun 2019 16:50:16 +0100 Message-Id: <1559577023-558-51-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 driver_find_device_by_fwnode() helper to lookup devices. Cc: Will Deacon Cc: Robin Murphy Cc: Joerg Roedel Signed-off-by: Suzuki K Poulose --- drivers/iommu/arm-smmu-v3.c | 9 ++------- drivers/iommu/arm-smmu.c | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index d787856..1f9851f 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -2023,16 +2023,11 @@ arm_smmu_iova_to_phys(struct iommu_domain *domain, dma_addr_t iova) static struct platform_driver arm_smmu_driver; -static int arm_smmu_match_node(struct device *dev, const void *data) -{ - return dev->fwnode == data; -} - static struct arm_smmu_device *arm_smmu_get_by_fwnode(struct fwnode_handle *fwnode) { - struct device *dev = driver_find_device(&arm_smmu_driver.driver, NULL, - fwnode, arm_smmu_match_node); + struct device *dev = driver_find_device_by_fwnode(&arm_smmu_driver.driver, + NULL, fwnode); put_device(dev); return dev ? dev_get_drvdata(dev) : NULL; } diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 4ce429b..c962e82 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1431,16 +1431,11 @@ static bool arm_smmu_capable(enum iommu_cap cap) } } -static int arm_smmu_match_node(struct device *dev, const void *data) -{ - return dev->fwnode == data; -} - static struct arm_smmu_device *arm_smmu_get_by_fwnode(struct fwnode_handle *fwnode) { - struct device *dev = driver_find_device(&arm_smmu_driver.driver, NULL, - fwnode, arm_smmu_match_node); + struct device *dev = driver_find_device_by_fwnode(&arm_smmu_driver.driver, + NULL, fwnode); put_device(dev); return dev ? dev_get_drvdata(dev) : NULL; } From patchwork Mon Jun 3 15:50:17 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: 165635 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645708ili; Mon, 3 Jun 2019 08:52:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvkZi8asbIH3W59nP9RhzRQbI42Y0iZpY7/ZAogrh3iohN6F0qcMnjqzSm12fpiPh3q9if X-Received: by 2002:a63:134a:: with SMTP id 10mr20790722pgt.242.1559577172243; Mon, 03 Jun 2019 08:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577172; cv=none; d=google.com; s=arc-20160816; b=nEqk3D8npS1TOBxFQyMx/+/3GWgHuaXXgMgwWrMnlF2Eu3qM07jhJ2vFl++OMbEP2h 8e414Jcd0sreTJqYjCg5/7G1g0nB4I+ekNCUr2mqT1GeW/7yJPn5qVYmsTO826mJkQ9O GY8eUfSpxwXsd/pord4z03Za1Bhve2qRP4j7gP6T3qgZXmps5hr7BHg/hgVCg1tRUwnq HfjO7EGpXiwviP18Uff685Y3KTBu1E3ahw27HL7hoVA28aKkWJCGyh1XvRKK/bS7WElD 9LVrhcTcgT+//B6b5iiHGZP9I0dD2IU4SPvDb3QTBzacG6V1woyVl+eCkMwNSHSsc5v3 Mw5Q== 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=pD4Gm2X8OgdpOyKhki1VFuLkjHOFxHLYlAW8xlonSwE=; b=j70l9z0ZMjNPe54kH/AOcvJqoDFWIqQs3znq2L9JT+V/50483P80L0GXFNatGql93t oUO0W0J7d1B3mZ26XcPCcWGZUM14rO2mmNPE/dyJlywBTWtT3o5zLoghJRcLbyZuQGv9 imeNs0Vfx0UZN9XclV4oEgIuG/nBYyAIBB+neM+D//WaeK3i8CDft8XeL7kayJoZdUK3 QSC07SmHJirTKrRagXUxDoSrQCDMR7UcMTSlciDZPNz0Mh32ipo9USIijcADBFh9B6gs Ows1nk92ByeJ2+a/U59Fusqcbre97l2SlJOJegdAWerWXbfoP/Qgvc0RtUS+rLOJ7aow 1knQ== 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 l3si3193510pgl.560.2019.06.03.08.52.51; Mon, 03 Jun 2019 08:52:52 -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 S1729663AbfFCPwv (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:51 -0400 Received: from foss.arm.com ([217.140.101.70]:54074 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729564AbfFCPwR (ORCPT ); Mon, 3 Jun 2019 11:52:17 -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 4A8ED1A25; Mon, 3 Jun 2019 08:52:17 -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 548123F246; Mon, 3 Jun 2019 08:52:16 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com Subject: [RFC PATCH 51/57] drivers: Add generic helper to match all devices Date: Mon, 3 Jun 2019 16:50:17 +0100 Message-Id: <1559577023-558-52-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 Add a generic helper which matches any given device by always returning true. Signed-off-by: Suzuki K Poulose --- drivers/base/core.c | 6 ++++++ include/linux/device.h | 1 + 2 files changed, 7 insertions(+) -- 2.7.4 diff --git a/drivers/base/core.c b/drivers/base/core.c index 69cba57..dd08bf9 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3351,3 +3351,9 @@ int device_match_name(struct device *dev, const void *name) return sysfs_streq(dev_name(dev), name); } EXPORT_SYMBOL_GPL(device_match_name); + +int device_match_any(struct device *dev, const void *unused) +{ + return 1; +} +EXPORT_SYMBOL_GPL(device_match_any); diff --git a/include/linux/device.h b/include/linux/device.h index 68d6e04..7ea15e6 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -168,6 +168,7 @@ int device_match_acpi_dev(struct device *dev, const void *adev); int device_match_fwnode(struct device *dev, const void *fwnode); int device_match_devt(struct device *dev, const void *pdevt); int device_match_name(struct device *dev, const void *name); +int device_match_any(struct device *dev, const void *unused); int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, int (*fn)(struct device *dev, void *data)); From patchwork Mon Jun 3 15:50:18 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: 165627 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645122ili; Mon, 3 Jun 2019 08:52:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQJdOFgcv1vmvLX4OXMLpRqk4BXfs+b6ez12iMexfiyRF1GsYkTwA117ngRfn1eepcL4NC X-Received: by 2002:a17:902:7c08:: with SMTP id x8mr30480353pll.159.1559577142700; Mon, 03 Jun 2019 08:52:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577142; cv=none; d=google.com; s=arc-20160816; b=K0tOZ3g/SfxyFvrVehOMPvgzN4uJ/OvBhbzTL86xxdKpeuzUqHFq7ys5C/u6NqVE+s DiYnEEbfO4SOhXG9TFjmGfMbGxUS3us7PEKs38tfDRtDyvVrgo9NnZobfvuDc0eCEPhS fio7yaJBTlk0hzyGyIp4bF4KiLyS0ervxX97kbGSpLd2RZl0DHJgYYZCO7tM4DuH3A61 NKuT8faSuWxOD7Yt4uXnIRzCK9HfgHuO+FXXLLoNO3NDy6jFULQyAk7uaZlo46cU0h0j vGhnidj5PIyxBeDw96opiizcwYXyayoKm+DOOnYkxM9F9BNz4fFD5nb3OWXQS7GfmI22 pAdg== 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=0bkKekUgA4MfoQU08+q2/0kdsNuL8T303y6zKmR/n3g=; b=tK8jZJZe6c+YDRy6Nd6aGutWshnMFy0W48/olsm2r3p4qnM2PH0ZiuiUNMSGkl0FOc 1B7J+k7y24uXpsj9RznjGwlgPKd6EHoUx4xVwnlECvdWhQbr45IjAMILOIvT8Mdunsxz 6aQyWb78ImraF5rnbpj7AYaESBEwXllKAgF2aiWCIW1I4N+HNOAINdyDE+MdFVcuG36X AGSsjAREzvdNIP6ElipDBOlJJaWzUBDcuMoKvbdAD/M0iViNO7z0KUck24ELEAqWfLzH KaWn3pbLEdWO3MHS27wSqZfVa8qQ5kK+s9tsWZJPkEOuUVJqKFPtpEgXneXUBqDqL2fD KZxQ== 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 h4si17718022pgs.269.2019.06.03.08.52.22; Mon, 03 Jun 2019 08:52:22 -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 S1729601AbfFCPwV (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:21 -0400 Received: from foss.arm.com ([217.140.101.70]:54082 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729576AbfFCPwT (ORCPT ); Mon, 3 Jun 2019 11:52:19 -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 C3ACF15AB; Mon, 3 Jun 2019 08:52:18 -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 877233F246; Mon, 3 Jun 2019 08:52:17 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Thierry Reding , Jonathan Hunter Subject: [RFC PATCH 52/57] drivers: tegra: Use driver_find_device_by_of_node() helper Date: Mon, 3 Jun 2019 16:50:18 +0100 Message-Id: <1559577023-558-53-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 Switch to using the new helper driver_find_device_by_of_node(). Cc: Thierry Reding Cc: Jonathan Hunter Signed-off-by: Suzuki K Poulose --- drivers/amba/tegra-ahb.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) -- 2.7.4 diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c index 42175a6..5ce0f66 100644 --- a/drivers/amba/tegra-ahb.c +++ b/drivers/amba/tegra-ahb.c @@ -143,22 +143,13 @@ static inline void gizmo_writel(struct tegra_ahb *ahb, u32 value, u32 offset) } #ifdef CONFIG_TEGRA_IOMMU_SMMU -static int tegra_ahb_match_by_smmu(struct device *dev, const void *data) -{ - struct tegra_ahb *ahb = dev_get_drvdata(dev); - const struct device_node *dn = data; - - return (ahb->dev->of_node == dn) ? 1 : 0; -} - int tegra_ahb_enable_smmu(struct device_node *dn) { struct device *dev; u32 val; struct tegra_ahb *ahb; - dev = driver_find_device(&tegra_ahb_driver.driver, NULL, dn, - tegra_ahb_match_by_smmu); + dev = driver_find_device_by_of_node(&tegra_ahb_driver.driver, NULL, dn); if (!dev) return -EPROBE_DEFER; ahb = dev_get_drvdata(dev); From patchwork Mon Jun 3 15:50:19 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: 165633 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645563ili; Mon, 3 Jun 2019 08:52:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqznh495TDeTvamf5xmlQtrSBTnyhYIdJPq/Xj8FUEwegowpBr5RO5lasymqzcbbqsgSB5Cx X-Received: by 2002:a17:90a:e17:: with SMTP id v23mr30258284pje.139.1559577165363; Mon, 03 Jun 2019 08:52:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577165; cv=none; d=google.com; s=arc-20160816; b=l6IAej6suFx9CrZqsbu0qNZHBCjqEFAN/Z4b+aB7jruH9uPD+L/1NzqModJAH35e+3 LtlIvMcfQzSXTb1YtvV5rXJzakHi6blbgQ6cbuPank+P71EATQymoH4CkKraeTYfnC1A 0dXKX7oBPnspguRs+W8THdNXYg4K56Il+hTpBxXiWo+0EueqmjzYgEqJpKhv4SMLlzad YrdisPOcYNGmno+eDIpngoaskSmAiBDjocDkItaDu21rf6PQv4FeBBSdoJQw6odVez2Z jSQHBWFpwOw0JRgO86K7yaZPDisjkjYtMT6PfS3QhVGilZHNi/uISwvp/1Ll6E5u6y0h lpBQ== 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=jXzLsbS5PujaA0N/FDc/wG0HSmBOeS8F9E3LkxUAMKo=; b=VqkHrhHX+GVoA3tCHzuH12QT8B48wkYanUiq86ztusBaqDYHzqZcHCQw8bt2cymU0g X9zYAgYo2ciTK0KbsZd5rvwrJVJ5j/UJGSwpmW8et04rTvk3EaCLU85qf/j0yQg4+j3d QgRWH4oNsVWnkfpM2SpuekvhCEuBnwcUDUlKeifXZO8rSEreoA42HGV1lZWeRYvZIUMZ KIf4aaurI1A1X7iC2+RI3INcBgybTdqC1x9wjJB3khJ9wYjg5zWBT+3Y5qWZx/haTK36 CJ7Z6LDoKvsHgQkQ0FiIij5dFZ7O5++2o6QQuWlM3EwMT3aHKxNl25FJySOtKEQD+9Fw POYA== 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 l3si3193510pgl.560.2019.06.03.08.52.45; Mon, 03 Jun 2019 08:52:45 -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 S1729617AbfFCPwo (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:44 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54092 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729585AbfFCPwU (ORCPT ); Mon, 3 Jun 2019 11:52:20 -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 257EC1A25; Mon, 3 Jun 2019 08:52:20 -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 0C5B13F246; Mon, 3 Jun 2019 08:52:18 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, "Rafael J. Wysocki" Subject: [RFC PATCH 53/57] drivers: Introduce bus_find_next_device() helper Date: Mon, 3 Jun 2019 16:50:19 +0100 Message-Id: <1559577023-558-54-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 Add a helper to find the next device on the given bus from a given device iterator position. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- include/linux/device.h | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.7.4 diff --git a/include/linux/device.h b/include/linux/device.h index 7ea15e6..528efc0 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -234,6 +234,16 @@ static inline struct device *bus_find_device_by_devt(struct bus_type *bus, return bus_find_device(bus, start, &devt, device_match_devt); } +/** + * bus_find_next_device - Find the next device after a given device in a + * given bus. + */ +static inline struct device *bus_find_next_device(struct bus_type *bus, + struct device *start) +{ + return bus_find_device(bus, start, NULL, device_match_any); +} + struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, struct device *hint); int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, From patchwork Mon Jun 3 15:50:20 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: 165628 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645166ili; Mon, 3 Jun 2019 08:52:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2tLzyr9taFeM8HNjPoTzaSpSwY+OC8OhMjbXitmi4XCvUU341JRoiol0prbM2yu4YESGM X-Received: by 2002:a17:90b:d8b:: with SMTP id bg11mr2768454pjb.30.1559577145412; Mon, 03 Jun 2019 08:52:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577145; cv=none; d=google.com; s=arc-20160816; b=r4LgX1UnmL1xPomupohbRs3Jwb45S6GvNg3J1uWqSHYShOs867JMQWPRgG50TSMwMr XKp65+YYkQK2EEHzkMjvBtlO/ZXSokIwKcZzK9hkYo9juVrGGtSZrVVqeShkph13Qtl/ NfxkCK3PQysY8poXi9OCnopSlZQU/lj0bDP+mRwDBS7NIqfb/Ekqywpsg6uo2UhcGM6y HAaMAnaMk3JIDN+71LG9iZDTFTnh/nJ9VYamTIeRoEfy0pbz8cRMMTAlmVBCBDVTDWXO oTllIEtgmDMjaWGLL7GAEGw0v88T/nrVWGzGl5o1tBYhDrZx4sTbxRTSAdpl4pS8hB7u iexA== 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=pVTQOWy67fGiSVcv8fxDBHHX+AeQYQY3NmOY4YRfSn0=; b=yrWt+DQ7Lyub9wIAWxJbgCveqGH8vhm9fPlt5MDgoM0CwBHRj44NE4cO1/ubc2Vhwa eGb6cT6UWvwizzxWc9Smb6Jixdxztb4De1oQOwlGGoekehthwoekabk0zi+F5ja8vabT 3IEJThxGo9kcKt0glgcn9ZM+jQbJgiswU1tRGkqh4RSdeN7m3zUtzh/kr88L1pW1yi+O dSOrHBS23qPxX1CcynhQfd0MElzmXCzl1F0BC44GB8WNdkPVuun9A1Ea1AckoNzH/0sP xyPk0zq2NfjjfJG0YgrsLkWoFy8aNKsF/wXXXFTcvWj3tk6wIxrGbX78kFkcLQi4+h3z BcFQ== 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 h4si17718022pgs.269.2019.06.03.08.52.25; Mon, 03 Jun 2019 08:52:25 -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 S1729613AbfFCPwX (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:23 -0400 Received: from foss.arm.com ([217.140.101.70]:54098 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729600AbfFCPwV (ORCPT ); Mon, 3 Jun 2019 11:52:21 -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 7D68A1AED; Mon, 3 Jun 2019 08:52:21 -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 623E43F246; Mon, 3 Jun 2019 08:52:20 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Bjorn Helgaas Subject: [RFC PATCH 54/57] drivers: pci: Use bus_find_next_device() helper Date: Mon, 3 Jun 2019 16:50:20 +0100 Message-Id: <1559577023-558-55-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 the next device on bus. Cc: Bjorn Helgaas Signed-off-by: Suzuki K Poulose --- drivers/pci/probe.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index f9ef7ad..3504695 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -64,11 +64,6 @@ static struct resource *get_pci_domain_busn_res(int domain_nr) return &r->res; } -static int find_anything(struct device *dev, const void *data) -{ - return 1; -} - /* * Some device drivers need know if PCI is initiated. * Basically, we think PCI is not initiated when there @@ -79,7 +74,7 @@ int no_pci_devices(void) struct device *dev; int no_devices; - dev = bus_find_device(&pci_bus_type, NULL, NULL, find_anything); + dev = bus_find_next_device(&pci_bus_type, NULL); no_devices = (dev == NULL); put_device(dev); return no_devices; From patchwork Mon Jun 3 15:50:21 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: 165630 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645355ili; Mon, 3 Jun 2019 08:52:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkYj7e9rVabEXEpSw00vEO1vtS8DKK5SZQwHjeGRrRF4xwra5majHJwPXejuiGBh+C2RQQ X-Received: by 2002:a17:902:2a28:: with SMTP id i37mr30092332plb.52.1559577153679; Mon, 03 Jun 2019 08:52:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577153; cv=none; d=google.com; s=arc-20160816; b=Rta8M5HeM22lafuBsYqtUf+9q69fHhoTxBGML3L5DYORTqmvaRj3uYq56CjQdJ9gUs xcqNwLB9Lj84IZA1Cewujmg/gIMFwHwAUsDTyVc/HZICG5kuTZCIfROO1rqcb60g3jfD ulYDOR7erkoNMe7BWnvFbzar2Avy/OL/6LSTQNVgBfQ6BZowWR6pd+CwDtaRqXSf46gh 7ytJL26ySVIt9Rpw6yZY/uBnr5gVSP1FgQFi/6WxEzbR1o/TShWeSiFVUZ6nM5tbHLJO EiUAKRwGqGoANqjJt/NEAkvQIA/oINj+27oF7vvux3Hq44zogapVmxfaaQ1kg9HlL9d6 IXmA== 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=aw1SpsRbJR/v6Zuyo0LlMNQnBzlfe35DrdWpsEqW79I=; b=e9H6zW7oCk2MI50+Nty8lzmBd16bcxFzZghruVtQ3Nn5LyiQdnA82igKEs5CHsfmGe Govk5/HgETP1Xc71K2+LtwxEyG4QrsslK60Z2S21H5aUGzlHv6J6BzV50oRD2GD5aN2U s12Lb5n0ArFP70MR0POQOZawXUaPghaAMOPBsQIqdXfEh+m0kmEkl751s+c4sxsFgysK zquibChFk/3QZJ0CMX6tUbedzObknPc+/q5Vcp/BBjPZyOr2lYl5ZLMR0edX9rDkv7Dt UA0NVnoWMJ417ACAWFteZDS63o7sldz8ummpMacwpsHKsqLsb7rrcFpbW3xsM8nIjIQc WPCQ== 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 a8si18113998pgm.592.2019.06.03.08.52.33; Mon, 03 Jun 2019 08:52:33 -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 S1729637AbfFCPw2 (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:28 -0400 Received: from foss.arm.com ([217.140.101.70]:54108 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729607AbfFCPwX (ORCPT ); Mon, 3 Jun 2019 11:52:23 -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 0216B15AB; Mon, 3 Jun 2019 08:52:23 -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 BA3583F246; Mon, 3 Jun 2019 08:52:21 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, "James E.J. Bottomley" , "Martin K. Petersen" Subject: [RFC PATCH 55/57] drivers: scsi: Use bus_find_next_device() helper Date: Mon, 3 Jun 2019 16:50:21 +0100 Message-Id: <1559577023-558-56-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 the next device. Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Signed-off-by: Suzuki K Poulose --- drivers/scsi/scsi_proc.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c index c074631..5b31322 100644 --- a/drivers/scsi/scsi_proc.c +++ b/drivers/scsi/scsi_proc.c @@ -372,15 +372,10 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf, return err; } -static int always_match(struct device *dev, const void *data) -{ - return 1; -} - static inline struct device *next_scsi_device(struct device *start) { - struct device *next = bus_find_device(&scsi_bus_type, start, NULL, - always_match); + struct device *next = bus_find_next_device(&scsi_bus_type, start); + put_device(start); return next; } From patchwork Mon Jun 3 15:50:22 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: 165631 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645404ili; Mon, 3 Jun 2019 08:52:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3YhCcMH6Bgze2LPRTC5ZFjOYu1q3wq6JDoD0WyL0wII1+LYM/RbM+YwcKbxAhXcVcnQy5 X-Received: by 2002:a17:902:12f:: with SMTP id 44mr30551167plb.137.1559577156124; Mon, 03 Jun 2019 08:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577156; cv=none; d=google.com; s=arc-20160816; b=D0O7BEPop+RoYhDALGR2Teu4BHwJC+kysGm2EyuccA4EjFPgdgVwrE4pojSK55Rauj J+ZEzMBPJ1evnjM3ppcbyRHjcom/8akyebt6YXzf//C8RT8pbqx0smDGwiYKgDmtjjac /WqlociUUjSCnoeNQa5hfU1T7CaWrtIbkW4PB0caDsG4soALIvqre0QVTP5bRyhCczhM E+b3G2chjkRQFgt7ttY4Oc57Q4OvVSa1TI42XGMjJ6mmgFEb39OxFQR3hIOUEFyp812g a0Z6RiXPZ51PgY4yWNQOO8QtQH7CCm6ft0+5Hrja7izNuBSSRkaz/I08oswJFzKo+DHq +aaw== 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=dCuM8+RKDYjDg/71eQmgsWHS54DTwGQGyuiUJYjO3a4=; b=E9EbnE0GCEVPllR2ELh8HwI/25kIeWsYF5HrCZmXx1KczE2bkPJWtldRbfxba4mGjY luoq4QEoP36T3FmfkLmOf9uaamIZzzu/ZZ/fWGtd7zeYbyNctGJ6vUMpxChI3OPU0Q7U G0Ps2EeEv8OcSOofpzeQT8Owpg88fMePUVFacleTL3deT2romOHNqlyNbMVJWaHVmrTn jXvfgzsOK2014R8tmexsrKODZgnA7kjs9fi5j1aZpsoBEZOAchEoACTaip0450cfr3/e rdLFRzTG2fDyoLE4of0Kp1w1aWnxzO4xQg1LchhCXrmByJ9+YnHf7USEyvvMolMbNzhl QhvA== 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 a8si18113998pgm.592.2019.06.03.08.52.35; Mon, 03 Jun 2019 08:52:36 -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 S1729624AbfFCPw1 (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:27 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54118 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729600AbfFCPwY (ORCPT ); Mon, 3 Jun 2019 11:52:24 -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 58E381A25; Mon, 3 Jun 2019 08:52:24 -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 3EFF23F246; Mon, 3 Jun 2019 08:52:23 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, "Rafael J. Wysocki" Subject: [RFC PATCH 56/57] drivers: Introduce driver_find_next_device() helper Date: Mon, 3 Jun 2019 16:50:22 +0100 Message-Id: <1559577023-558-57-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 Similar to bus_find_next_device(), add a helper to find the next device for the given driver. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Suzuki K Poulose --- include/linux/device.h | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/include/linux/device.h b/include/linux/device.h index 528efc0..39a7755 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -456,6 +456,12 @@ driver_find_device_by_fwnode(struct device_driver *drv, return driver_find_device(drv, start, (void *)fwnode, device_match_fwnode); } +static inline struct device *driver_find_next_device(struct device_driver *drv, + struct device *start) +{ + return driver_find_device(drv, start, NULL, device_match_any); +} + void driver_deferred_probe_add(struct device *dev); int driver_deferred_probe_check_state(struct device *dev); From patchwork Mon Jun 3 15:50:23 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: 165629 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4645264ili; Mon, 3 Jun 2019 08:52:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHHpY+ymYRXcbSSoVDhYLtgenmtEQZuiFfTNdJoCUfWjYz3p58c2w8IrkDPLxgnKpWksYb X-Received: by 2002:aa7:8e50:: with SMTP id d16mr25222501pfr.65.1559577150632; Mon, 03 Jun 2019 08:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559577150; cv=none; d=google.com; s=arc-20160816; b=IOKIkA82wIMapKag79laEl9f0Qoxhcc0EcpgVTfLSkkKBoBGAJFBd26OJS/pHM2VBd 0tVQoP4NdMrvVltFs3Hld+P6j2/HKHKkV0AW873IAHezvwzTwrqOBB47H/9ScXD5MWz0 k9oE1zmz1FmZuZ6893boHF7kOnJMDNgwOiK0nm3AiNGnTC2ps6JD1ekNRhys1Fv87dAe JR1YuU+AWXFsSEEYma4pfrHQauRSp2XqCYH3QRiz9zvYWnYBY4RKmgsYK3mnDbPM4r8e 0rbiaZi2ad0TBhfK/F7j8v6DJN5iqcSaARIu7B4Yt8mF+bdDeo0SIey7LLUcOIXFT4QN 8gLg== 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=ACJx35ijrLFRztU5DOlVipk7Mvw3OEvfjElrQlyVoEo=; b=hCmeYIA1AZ0D8PoAd0rx2AmEndNUR7zW2yJbXTg63iklpb4FMnLMr8Ous/L5X7F3Lw 8TfEG4alth1SX/YJFKsnt4oFAtKgx6sSxofD5RLRJv7pniPUp9AgLg9f5At0zoUzfXkO jtId9ih0d6tu2PLzr/sJTQvFrz1jN9AT8OZ4rVjmgQik9Q891brVJ66HQbCt4Wqlm9t6 LoDSR6cfsMkokEzU+NcCqS0zJUFaa/RDF6AIG4zuFm+EDqnZWiQf8XBa5CJ6E/3JBP6E D+apETpAweU4HZzZ8S6M0FOQ1fQU4IQRagD9xC8fweE9zi/tOgopBvKsQDnAk6tDV+1J JB6Q== 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 h4si17718022pgs.269.2019.06.03.08.52.30; Mon, 03 Jun 2019 08:52:30 -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 S1729651AbfFCPw3 (ORCPT + 30 others); Mon, 3 Jun 2019 11:52:29 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54128 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729615AbfFCPw0 (ORCPT ); Mon, 3 Jun 2019 11:52:26 -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 0107515AB; Mon, 3 Jun 2019 08:52:26 -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 968023F246; Mon, 3 Jun 2019 08:52:24 -0700 (PDT) From: Suzuki K Poulose To: linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, rafael@kernel.org, suzuki.poulose@arm.com, Elie Morisse , Nehal Shah , Shyam Sundar S K Subject: [RFC PATCH 57/57] drivers: i2c-amd: Use driver_find_next_device() helper Date: Mon, 3 Jun 2019 16:50:23 +0100 Message-Id: <1559577023-558-58-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 the first device matching the driver. Cc: Elie Morisse Cc: Nehal Shah Cc: Shyam Sundar S K Signed-off-by: Suzuki K Poulose --- drivers/i2c/busses/i2c-amd-mp2-pci.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/i2c/busses/i2c-amd-mp2-pci.c b/drivers/i2c/busses/i2c-amd-mp2-pci.c index c7fe3b4..5e4800d 100644 --- a/drivers/i2c/busses/i2c-amd-mp2-pci.c +++ b/drivers/i2c/busses/i2c-amd-mp2-pci.c @@ -457,18 +457,12 @@ static struct pci_driver amd_mp2_pci_driver = { }; module_pci_driver(amd_mp2_pci_driver); -static int amd_mp2_device_match(struct device *dev, const void *data) -{ - return 1; -} - struct amd_mp2_dev *amd_mp2_find_device(void) { struct device *dev; struct pci_dev *pci_dev; - dev = driver_find_device(&amd_mp2_pci_driver.driver, NULL, NULL, - amd_mp2_device_match); + dev = driver_find_next_device(&amd_mp2_pci_driver.driver, NULL); if (!dev) return NULL;