Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5301398ybi; Tue, 4 Jun 2019 04:41:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlnO08VGD+Bg0/XwgLAmquFcy1NO4VsCRLAqlvS8iBKnBW3bUELnc3Na91JlMaebNwOyN3 X-Received: by 2002:a17:90a:898e:: with SMTP id v14mr10407555pjn.119.1559648499085; Tue, 04 Jun 2019 04:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559648499; cv=none; d=google.com; s=arc-20160816; b=pxWxva981fa6D4apfsOxAH5/kjCodqQzDavgvxXbqKoreyp/O5c4RSMiJ7jsjXjVgo Dxac+0IL0fUN0V3x6DC75R//k3JIBRXCd3YE6Zu3gvtAEXvXik7mzSJHjKZ6w8nErZZT WHOZm/VkcvErJHeH8Wz1EpMUcSRoze+T2+LSfzx11M7g/1dHgrcvnsdZLupoSj2c6xpt 0myXyRtD7uIeedroK6j/XZwap5c7u6tOX2DE2aRVXyvaMmRaFJPMfgUnablr8oAqevbw LJQjjSZTw88+6EUekQtma+ezJaMRRa8sL6tw4YzA9DG+6Ml7AVcJgZjwjJAMsWgnvkjW BtRg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=lFYHAiIga08i1F9YEjmrUtESktLbjJipK3Y01Ea1kGU=; b=GjNvIKHLqWQLUdy3BgJewlUEfncSz9gF5RoxcqrNfr+Kzfv80aHD2+74SzJUM54AD/ f7ZuwE3e2sc9ekmDQMsA2Zplb3/sOH5p0r9Zf7Qyc1Qaa3GyNvnK6VBpUF0z8r06sCFz XIvmKtxAf2NY7Jsv+3xFmGwLjpRn5l2GWLyi0Uu1HQTn66ebUbOIdGLIQN9btd1dNIjn EA1agmqz+aM+Lg6FvqS3NO4gi/YKBvaAgXZHXm7oANakfWtstmcuvDnqkTimBoQC1572 xrrIR0D9Vbg/Rxdt/m+dpyxC8Vc3P5Y1UiKnVi/dMZgxIoMqQUukWnZ0h0ATzZPnrArN 08qw== 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 j22si25474991pfe.43.2019.06.04.04.41.22; Tue, 04 Jun 2019 04:41:39 -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 S1727553AbfFDLj6 (ORCPT + 99 others); Tue, 4 Jun 2019 07:39:58 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40890 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727390AbfFDLj4 (ORCPT ); Tue, 4 Jun 2019 07:39: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 15D7380D; Tue, 4 Jun 2019 04:39:56 -0700 (PDT) Received: from [10.1.196.93] (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0A0983F690; Tue, 4 Jun 2019 04:39:51 -0700 (PDT) Subject: Re: [RFC PATCH 27/57] drivers: Unify the match prototype for bus_find_device with class_find_device To: rafael@kernel.org Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, alexander.shishkin@linux.intel.com, wsa@the-dreams.de, jic23@kernel.org, knaack.h@gmx.de, grygorii.strashko@ti.com, davem@davemloft.net, bhelgaas@google.com, sebott@linux.ibm.com, oberpar@linux.ibm.com, freude@linux.ibm.com, jejb@linux.ibm.com, martin.petersen@oracle.com, andreas.noever@gmail.com, michael.jamet@intel.com, balbi@kernel.org, david.kershner@unisys.com References: <1559577023-558-1-git-send-email-suzuki.poulose@arm.com> <1559577023-558-28-git-send-email-suzuki.poulose@arm.com> From: Suzuki K Poulose Message-ID: Date: Tue, 4 Jun 2019 12:39:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/06/2019 12:26, Rafael J. Wysocki wrote: > 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.". Agreed, I will reword the description. > > 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. Sure. I started with the helpers in the hope that, I would need fewer changes to individual subsystems, once I convert them to use the new helpers. i.e, driver A -> use new helper and the change the new helper. rather than change all callers of *_find_device() and then all to switch to new helper. Anyways, looks like the latter is better in terms of splitting the series. I will rework the series. Thanks a lot for your input Cheers Suzuki