Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5288333ybi; Tue, 4 Jun 2019 04:29:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvXq31mJZHnOJNWWbvzFPOCkEYZ5j239YSInjEu2wvHK4Wo1DS09s4gmx8UnfcbLcu/YWa X-Received: by 2002:a63:6cc3:: with SMTP id h186mr25140374pgc.292.1559647771726; Tue, 04 Jun 2019 04:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559647771; cv=none; d=google.com; s=arc-20160816; b=ZhZ7+PonGnTuAomiLBG1mWtJOe9BPgAP1Myl4en6vI+fo01a3oascCTqo8WfoKRGGa nyJuOZpv/Ss/K4zgH8mVdumySOvJnwfsJ+HbO5XWW6h3DN68MDwZEZDzv334PjaYrl6o FzbgaFR0MTLiC5BZQMm/68MtcpmOApX9Q1brk60jfV0rbIuDAOlga8LIACF/SUSSWi4H B42JCXQN08OGiNf4vBzCxR9FccTNpR6KpfIO8DyNZQA1VgK6ZAA2taeJfgfgWRrExiQq c4QokM9haT3t41WiEPfpbJd67cFEclz3upeKDUSdKI5OQqfK1pHipUndxwFtp0MZYj2x IPGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=c+bLIXaZ17N12ujpsyYbaNmHRjzt3Mh0NBkU6cPWx/k=; b=A5WaSWpxxEwCMSoWWCnJQRic9EjpRyn80fXgEAlmMUf8tH0LqB19xlSfyoTx2GjJRz m6fHTS+wts+HJ2qQojK0qqlFzFvzOSVDeThW1q1VDkaeSTcTdF4E0GtcuS+2H5RI8PfF G4YIiRIHfVZnVZxR3nK3WGRH9kqbqicq0Zvvz6HaIp7zKGgroIrf1BZ97D292N4MRHaJ TctRo2+UoZbg8WzfxWbZxMMd7CxWcn22wANVoxjXlIW+qeUo1bhojksftZTtZm1IOXE1 I54Ehe1K46YWUoP37J9yVv1Vw/R67ojhuavMoINEZshM9EJuyHiRzn8rFui/+RKB/a+G JWDw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b18si22138183pgm.82.2019.06.04.04.29.13; Tue, 04 Jun 2019 04:29:31 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727328AbfFDL0t (ORCPT + 99 others); Tue, 4 Jun 2019 07:26:49 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:34847 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726508AbfFDL0t (ORCPT ); Tue, 4 Jun 2019 07:26:49 -0400 Received: by mail-ot1-f67.google.com with SMTP id n14so19177101otk.2 for ; Tue, 04 Jun 2019 04:26:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c+bLIXaZ17N12ujpsyYbaNmHRjzt3Mh0NBkU6cPWx/k=; b=ao5Gdw/MCly4LSDpj0v2ThPqkp5IF3jUEbM4zKLBSxOFKabeeEtcSAMnRNhIUdAhdT d3gPhmwfldEMUrqkJXcJ3TbfjukjbEzKiHjQ16ECKXY5A+o2hFJ+vBo/dq9nOJM8BnII FhJhdH8ugJVfwSTY2lPNCLsU8MI0H0zw1F9rMSU/Hdu7VW9cl1RJz/2bQRYTeVA5Egbz cUSGbN1GVkJUnJ+eL/12e27Ur5uJv5LTDXHKGj+FaZ54M92hpto9vrdQ3qNzgQL0+xDG n6HIDsVjBj9gx0FrGDk6qTrHTuQGP9CuMIl+iZit+CtYkHlBlP6hVdbie8ZEoD88edtF i5qg== X-Gm-Message-State: APjAAAUh2jPRJLZuQWEiUPd2I12OVQ4um/U9uTwEPSs7JsEyXD0Pdt1+ IFgyirOsLzUEnCzRbMqxYqM9vGF8cnAwWqdfv3U= X-Received: by 2002:a9d:3285:: with SMTP id u5mr5132565otb.266.1559647608261; Tue, 04 Jun 2019 04:26:48 -0700 (PDT) MIME-Version: 1.0 References: <1559577023-558-1-git-send-email-suzuki.poulose@arm.com> <1559577023-558-28-git-send-email-suzuki.poulose@arm.com> In-Reply-To: <1559577023-558-28-git-send-email-suzuki.poulose@arm.com> From: "Rafael J. Wysocki" Date: Tue, 4 Jun 2019 13:26:37 +0200 Message-ID: Subject: Re: [RFC PATCH 27/57] drivers: Unify the match prototype for bus_find_device with class_find_device To: Suzuki K Poulose Cc: Linux Kernel Mailing List , Greg Kroah-Hartman , "Rafael J. Wysocki" , 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 3, 2019 at 5:51 PM Suzuki K Poulose wrote: > > 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. The patch looks good to me, but the changelog might be a bit better. It seems to be all about the bus_find_device() and class_find_device() prototype consolidation, so that the same pair of data and match() arguments can be passed to both of them, which then will allow some optimizations to be made, so what about the following: "There is an arbitrary difference between the prototypes of bus_find_device() and class_find_device() preventing their callers from passing the same pair of data and match() arguments to both of them, which is the const qualifier used in the prototype of class_find_device(). If that qualifier is also used in the bus_find_device() prototype, it will be possible to pass the same match() callback function to both bus_find_device() and class_find_device(), which will allow some optimizations to be made in order to avoid code duplication going forward. For this reason, change the prototype of bus_find_device() to match the prototype of class_find_device() and adjust its callers to use the const qualifier in accordance with the new prototype of it.". Also, it looks like there is no need to make all of the following changes in the series along with this one in one go and making them separately would be *much* better from the patch review perspective.