From patchwork Mon Jun 6 07:32:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 9157327 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5A16560572 for ; Mon, 6 Jun 2016 07:33:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C241272AA for ; Mon, 6 Jun 2016 07:33:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40C8D281BE; Mon, 6 Jun 2016 07:33:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C800D272AA for ; Mon, 6 Jun 2016 07:33:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751915AbcFFHcp (ORCPT ); Mon, 6 Jun 2016 03:32:45 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36326 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751655AbcFFHco (ORCPT ); Mon, 6 Jun 2016 03:32:44 -0400 Received: by mail-pf0-f195.google.com with SMTP id 62so17403421pfd.3; Mon, 06 Jun 2016 00:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=eVXU2S8qHpWizO9Gm7d6bHOZzG74gPNGNwEAYjLGsHQ=; b=bJpy3yOJi++BMDPmACddFWuBfj6HXqdniU98zPe8++zJ8Gg87l299412ZLC6GMHuP+ A76xPsSBIWLM4N2uaTMjGnXFNBwAu+kKLF8dT75Q0riZivATYqMF91oc9qss4x3344HH +mOSAWpm//L/r4xdVev3k4DtEi4Eeio936s27RHSKABwZ1RFINpbDsv3RhS+u1SHW7Eu jMHtqrNAB6d2dc5CyaLuOUyLwqthaL4/prhjSOWu8LVuKZNXisKFbGGEvnAHGV/pMmcQ IEfmkjJmM20/cMMvpwrjx4cUi4JQV2/baZoJKrQXEnZTBdAJQc0mVLFGyfhv/kTCGQYg ZhUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=eVXU2S8qHpWizO9Gm7d6bHOZzG74gPNGNwEAYjLGsHQ=; b=GXwYeyLLVG+Q6ToUTtFVyFTRyYpCwE4viLX76CYdxedq3w0TKMDyMXyKceZMq6VIns IhIIwL9/xCOlUctq+lXn1IUWQ6mmQQthH3mEzpuBTKAZXpTWdwCgyVVCNYmGQFLX5VBO KzLbCk3EZPUBMKLi0JDioa3SCRUsIBJT4ygPXUD3KJnF5m0wjz74eyOuUsBAnaCyavzo s+5G4GCpluTI5gdw22vHkBjY4F/8Zbh6gyYXnx2aHnfo3/MK+DTfEvia9X7hZgBPWYym m9uotsVPF8SkgY+qwWRv26UdV2Ecu6RaLPwW3Ef9g8IST18kDVbPk79E+ZGp4nhZZdxK Od0A== X-Gm-Message-State: ALyK8tI39QrUD7gZ6YExXPAJ8Cb4ihtfn+Bz1cG3JXuqva8n2RHXTm45z1zwl/H/E6QyLw== X-Received: by 10.98.58.211 with SMTP id v80mr9320192pfj.39.1465198363347; Mon, 06 Jun 2016 00:32:43 -0700 (PDT) Received: from localhost (port-6551.pppoe.wtnet.de. [84.46.25.176]) by smtp.gmail.com with ESMTPSA id s124sm24990536pfb.63.2016.06.06.00.32.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jun 2016 00:32:42 -0700 (PDT) From: Thierry Reding To: Greg Kroah-Hartman Cc: Bjorn Helgaas , "James E . J . Bottomley" , "Martin K . Petersen" , linux-pci@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] driver-core: Implement device_match_always() Date: Mon, 6 Jun 2016 09:32:36 +0200 Message-Id: <20160606073238.1073-1-thierry.reding@gmail.com> X-Mailer: git-send-email 2.8.3 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding This is a helper function that can be used in iterators, such as bus_find_device(), and will always match. This is useful to implement a custom iterator interface on top of bus_find_device() or to check if any devices have been registered at all. Signed-off-by: Thierry Reding --- include/linux/device.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index 38f02814d53a..bea9566cea96 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1031,6 +1031,11 @@ extern int device_online(struct device *dev); extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode); extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode); +static inline int device_match_always(struct device *device, void *data) +{ + return 1; +} + /* * Root device objects for grouping under /sys/devices */