From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751385AbbJIXsf (ORCPT ); Fri, 9 Oct 2015 19:48:35 -0400 Received: from unicorn.mansr.com ([81.2.72.234]:39097 "EHLO unicorn.mansr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750779AbbJIXsb convert rfc822-to-8bit (ORCPT ); Fri, 9 Oct 2015 19:48:31 -0400 From: =?iso-8859-1?Q?M=E5ns_Rullg=E5rd?= To: Russell King - ARM Linux Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-cris-kernel@axis.com, linux-mips@linux-mips.org, linux-xtensa@linux-xtensa.org, kernel@stlinux.com, linux-rpi-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: Re: [PATCH] sched_clock: add data pointer argument to read callback References: <1444427858-576-1-git-send-email-mans@mansr.com> <20151009232015.GC32536@n2100.arm.linux.org.uk> Date: Sat, 10 Oct 2015 00:48:22 +0100 In-Reply-To: <20151009232015.GC32536@n2100.arm.linux.org.uk> (Russell King's message of "Sat, 10 Oct 2015 00:20:15 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Russell King - ARM Linux writes: > On Fri, Oct 09, 2015 at 10:57:35PM +0100, Mans Rullgard wrote: >> This passes a data pointer specified in the sched_clock_register() >> call to the read callback allowing simpler implementations thereof. >> >> In this patch, existing uses of this interface are simply updated >> with a null pointer. > > This is a bad description. It tells us what the patch is doing, > (which we can see by reading the patch) but not _why_. Please include > information on why the change is necessary - describe what you are > trying to achieve. Currently most of the callbacks use a global variable to store the address of a counter register. This has several downsides: - Loading the address of a global variable can be more expensive than keeping a pointer next to the function pointer. - It makes it impossible to have multiple instances of a driver call sched_clock_register() since the caller can't know which clock will win in the end. - Many of the existing callbacks are practically identical and could be replaced with a common generic function if it had a pointer argument. If I've missed something that makes this a stupid idea, please tell. -- Måns Rullgård mans@mansr.com