From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA357C4167B for ; Thu, 30 Nov 2023 16:40:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345518AbjK3Qkb (ORCPT ); Thu, 30 Nov 2023 11:40:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232145AbjK3Qk2 (ORCPT ); Thu, 30 Nov 2023 11:40:28 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A581510F1; Thu, 30 Nov 2023 08:40:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701362434; x=1732898434; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=xs55vRQmulcqUyGyX4R2MZh0xpaZmiwWD8Qq17sNE+0=; b=VGekmoV8BCKzpntOHOMSXys/vXLF46HfjWAe1FQIaaaRjgNv2AnEfe1Y pcjLHRTgGFzTL79OLUiC/Bt8yZJgRtao5GINcDmEnH4UksnNR3xoU3zqF RL4NYR+P0Fe2LxlpY+OKMbYYLO+Sy5AMX9bsh847FIywOtnMOhdz7Sju/ iKG097ZICzc/fzHSVmaSoOVYSl0a8c/bal0RqLlqhj/gyeFun84Q8FaZO nsno7+8+KneXKvTXRXybbarbMI2pYJWV32Smf0VTPvawf9/eDCbwktNi1 DA0T0lSG7fmIN9XDhi6Gz4h2ifF9Rm8K8D1vkS1WrCJxRRGamraHZv+zS w==; X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="392217598" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="392217598" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2023 08:40:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="1100992449" X-IronPort-AV: E=Sophos;i="6.04,239,1695711600"; d="scan'208";a="1100992449" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga005.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2023 08:40:32 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1r8k5W-00000000kQi-0Viy; Thu, 30 Nov 2023 18:40:30 +0200 Date: Thu, 30 Nov 2023 18:40:29 +0200 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v2 09/10] gpiolib: use gpiochip_dup_line_label() in for_each helpers Message-ID: References: <20231130134630.18198-1-brgl@bgdev.pl> <20231130134630.18198-10-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231130134630.18198-10-brgl@bgdev.pl> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 30, 2023 at 02:46:29PM +0100, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Rework for_each_requested_gpio_in_range() to use the new helper to > retrieve a dynamically allocated copy of the descriptor label and free > it at the end of each iteration. We need to leverage the CLASS()' > destructor to make sure that the label is freed even when breaking out > of the loop. ... > const char *gpiochip_is_requested(struct gpio_chip *gc, unsigned int offset); > char *gpiochip_dup_line_label(struct gpio_chip *gc, unsigned int offset); > > + One blank line is enough. > +struct _gpiochip_for_each_data { > + const char **label; > + int *i; Why is this a signed? > +}; ... > +DEFINE_CLASS(_gpiochip_for_each_data, > + struct _gpiochip_for_each_data, > + if (*_T.label) kfree(*_T.label), > + ({ struct _gpiochip_for_each_data _data = { label, i }; > + *_data.i = 0; > + _data; }), To me indentation of ({}) is quite weird. Where is this style being used instead of more readable ({ ... }) ? -- With Best Regards, Andy Shevchenko