From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753844AbdLUMzK (ORCPT ); Thu, 21 Dec 2017 07:55:10 -0500 Received: from mleia.com ([178.79.152.223]:43732 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752311AbdLUMzI (ORCPT ); Thu, 21 Dec 2017 07:55:08 -0500 Subject: Re: [PATCH] gpio: reduce descriptor validation code size To: Rasmus Villemoes , Linus Walleij References: <20171221002704.20824-1-linux@rasmusvillemoes.dk> Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org From: Vladimir Zapolskiy Message-ID: <15498c25-56c6-c914-4cf6-574a45ed696e@mleia.com> Date: Thu, 21 Dec 2017 14:55:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <20171221002704.20824-1-linux@rasmusvillemoes.dk> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20171221_125759_019915_79B4E882 X-CRM114-Status: GOOD ( 11.03 ) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Rasmus, On 12/21/2017 02:27 AM, Rasmus Villemoes wrote: > While we do need macros to be able to return from the "calling" > function, we can still factor the checks done by the VALIDATE_DESC* > macros into a real helper function. This reduces the backslashtitis, > avoids duplicating the logic in the two macros and saves about 1K of > generated code: > > $ scripts/bloat-o-meter drivers/gpio/gpiolib.o.{0,1} > add/remove: 1/0 grow/shrink: 0/15 up/down: 104/-1281 (-1177) > Function old new delta > validate_desc - 104 +104 > gpiod_set_value 192 135 -57 > gpiod_set_raw_value 125 67 -58 > gpiod_direction_output 412 351 -61 > gpiod_set_value_cansleep 150 70 -80 > gpiod_set_raw_value_cansleep 132 52 -80 > gpiod_get_raw_value 139 54 -85 > gpiod_set_debounce 226 140 -86 > gpiod_direction_output_raw 124 38 -86 > gpiod_get_value 161 74 -87 > gpiod_cansleep 126 39 -87 > gpiod_get_raw_value_cansleep 130 39 -91 > gpiod_get_value_cansleep 152 59 -93 > gpiod_is_active_low 128 33 -95 > gpiod_request 299 184 -115 > gpiod_direction_input 386 266 -120 > Total: Before=25460, After=24283, chg -4.62% > > Signed-off-by: Rasmus Villemoes The change looks good from my point of view, thank you for the change. Reviewed-by: Vladimir Zapolskiy -- With best wishes, Vladimir