From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751830AbcACQ7u (ORCPT ); Sun, 3 Jan 2016 11:59:50 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:46781 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952AbcACQ7r (ORCPT ); Sun, 3 Jan 2016 11:59:47 -0500 X-IronPort-AV: E=Sophos;i="5.20,516,1444687200"; d="scan'208";a="195356400" Date: Sun, 3 Jan 2016 17:59:45 +0100 (CET) From: Julia Lawall X-X-Sender: jll@localhost6.localdomain6 To: SF Markus Elfring cc: rtc-linux@googlegroups.com, Alessandro Zummo , Alexandre Belloni , LKML , kernel-janitors@vger.kernel.org Subject: Re: [PATCH 7/8] rtc-ab-b5ze-s3: Delete an unnecessary variable in _abb5zes3_rtc_interrupt() In-Reply-To: <56895246.3080302@users.sourceforge.net> Message-ID: References: <566ABCD9.1060404@users.sourceforge.net> <5688DF2D.6090204@users.sourceforge.net> <5688E229.4010400@users.sourceforge.net> <56895246.3080302@users.sourceforge.net> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 3 Jan 2016, SF Markus Elfring wrote: > >> Pass the address of the data structure element "time" directly in calls > >> of the function "rtc_update_irq" instead of an extra initialisation > >> for one local variable at the beginning. > > > > Why is it better? > > I suggest to refer to the data item "rtc_data->rtc" directly because > the variable "rtc" was read only in two if branches. > Does it make sense then to reduce the variable allocation? No. That is the job of the compiler. For a local variable whose address is never taken, the compiler can easily detect its live region, and place the initialization in an optimal way. julia From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr. [192.134.164.83]) by gmr-mx.google.com with ESMTPS id 202si2365188wmf.2.2016.01.03.08.59.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Jan 2016 08:59:46 -0800 (PST) Date: Sun, 3 Jan 2016 17:59:45 +0100 (CET) From: Julia Lawall To: SF Markus Elfring cc: rtc-linux@googlegroups.com, Alessandro Zummo , Alexandre Belloni , LKML , kernel-janitors@vger.kernel.org Subject: [rtc-linux] Re: [PATCH 7/8] rtc-ab-b5ze-s3: Delete an unnecessary variable in _abb5zes3_rtc_interrupt() In-Reply-To: <56895246.3080302@users.sourceforge.net> Message-ID: References: <566ABCD9.1060404@users.sourceforge.net> <5688DF2D.6090204@users.sourceforge.net> <5688E229.4010400@users.sourceforge.net> <56895246.3080302@users.sourceforge.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , On Sun, 3 Jan 2016, SF Markus Elfring wrote: > >> Pass the address of the data structure element "time" directly in calls > >> of the function "rtc_update_irq" instead of an extra initialisation > >> for one local variable at the beginning. > > > > Why is it better? > > I suggest to refer to the data item "rtc_data->rtc" directly because > the variable "rtc" was read only in two if branches. > Does it make sense then to reduce the variable allocation? No. That is the job of the compiler. For a local variable whose address is never taken, the compiler can easily detect its live region, and place the initialization in an optimal way. julia From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julia Lawall Date: Sun, 03 Jan 2016 16:59:45 +0000 Subject: Re: [PATCH 7/8] rtc-ab-b5ze-s3: Delete an unnecessary variable in _abb5zes3_rtc_interrupt() Message-Id: List-Id: References: <566ABCD9.1060404@users.sourceforge.net> <5688DF2D.6090204@users.sourceforge.net> <5688E229.4010400@users.sourceforge.net> <56895246.3080302@users.sourceforge.net> In-Reply-To: <56895246.3080302@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: SF Markus Elfring Cc: rtc-linux@googlegroups.com, Alessandro Zummo , Alexandre Belloni , LKML , kernel-janitors@vger.kernel.org On Sun, 3 Jan 2016, SF Markus Elfring wrote: > >> Pass the address of the data structure element "time" directly in calls > >> of the function "rtc_update_irq" instead of an extra initialisation > >> for one local variable at the beginning. > > > > Why is it better? > > I suggest to refer to the data item "rtc_data->rtc" directly because > the variable "rtc" was read only in two if branches. > Does it make sense then to reduce the variable allocation? No. That is the job of the compiler. For a local variable whose address is never taken, the compiler can easily detect its live region, and place the initialization in an optimal way. julia