Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1923853rwb; Fri, 19 Aug 2022 11:47:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ZOsOAxa5fA2CAdPHBqtB9LwVKIRQKBpUnKdVmY9qPMGDTROCskxscuXTSWHFHifHTPaTr X-Received: by 2002:aa7:d31a:0:b0:445:f4cd:b1c3 with SMTP id p26-20020aa7d31a000000b00445f4cdb1c3mr6959433edq.110.1660934820956; Fri, 19 Aug 2022 11:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660934820; cv=none; d=google.com; s=arc-20160816; b=N5Shki6wS368/5gwjg5/7ALGbHtljb/vjdUaLeeXkNRkQy7o/JVHYnfm+NrDYYxn6G IsN76QkXXN8vZtYSCrdSqYJKLQexSPha8JZTzq5+TE/eGq8HPPUiCKc3XQ5AxUelQyvS tl+FJxOtuc9Rzye3fkELqbFCuBGz9RfGhM/PZf2IToM55s8vwcDbzZy5mq6pnqZtaLZT ogTktz0mI+dTmos5lO8IeEf5VEjrCQTsFYg8kCkNYw6pSVAxQjRZj0u7H/eW2y4l+7uo 2LIZXFsN+oexM4OGtIEVuddUTasGmmosz9X7FUbtbI9Jh8x3q8/MmbhiGKbjI+62XNvs q36w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=wI4ABi54wxkqLNffne/a6FwzZ4fFGPv/qS2kuVDac3Y=; b=cUVjbcBJ8qOPoqLKhfL6SFDsqTCWZWc5a/mU1xgHdKVL7MrhLSmpLsTNPpdAyOI9m6 O9GMxE8AYTl3MEq4XG8/lPBTi/FtxUf3WR7ELyvEcPTgoeN3fJiFh5jFuKHu7ulbfgG4 ujlHZOOjo2ZW6HhnsSME7e2ewCxkqc2O+noUON2WSU2hJLeRyBOtM91jz4nDQLT1EGle J9a7jz413rNNS48dXMAhAVOV0zhek4aYWJDeEjy9qkAkKDltiIGf/2Hw9usyxN15Dh2i xrhwehhW8y4QnwhGqv2brdkM6aYsw9UVKR/v/UvJjIZzq+9KtKqOa5DbEypLpJTDWC+/ Sv2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="F/Q8Qz2l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f16-20020a056402355000b0044622a80b6bsi3091189edd.188.2022.08.19.11.46.34; Fri, 19 Aug 2022 11:47:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="F/Q8Qz2l"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354688AbiHSRo1 (ORCPT + 99 others); Fri, 19 Aug 2022 13:44:27 -0400 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 S1354713AbiHSRn6 (ORCPT ); Fri, 19 Aug 2022 13:43:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E4ABCE0; Fri, 19 Aug 2022 10:05:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DEFD2617D0; Fri, 19 Aug 2022 17:05:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0424C433D6; Fri, 19 Aug 2022 17:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660928724; bh=QqRwdsza8GJAfdhc+fC/YMNne+B8UrtzLFfv6moaMWI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=F/Q8Qz2l7l623HUNNDi1K2lGey3wYZFZ/y8mlbz9Zdrju9l9NrtH9Zxgl/I/FHtuz 0WnZLeTQH11HWANEtMrEKO1+99XwEfcyeEg8YDifsXV1RRLyAp+PCdggDvyLvGpu4X /vrP13c9oqt1ysvQvDn6h2ciSSvGBFZ/eKqZPVYZYp9JtriTeWZRrOccIicLUFBhvZ ydQ8zfjl3jNyA9xWRggkaYGFf7jte9dRgs+gjqR5ELYKTWo+2/xjyJIP5HKA05YlWV IfcdbNxaxgjyVSg189cd1e/0N4Fr8GRSU0hQ85OqivHPbzRB+nV9Ndxt37+OJTZ7qY eBpqwHYKSftjw== Date: Fri, 19 Aug 2022 18:16:00 +0100 From: Jonathan Cameron To: Joe Perches Cc: Joe Simmons-Talbott , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iio: Avoid multiple line dereference for mask Message-ID: <20220819181600.638b82e9@jic23-huawei> In-Reply-To: <72bbd0126162b7f78291d3431d2a8c6730cc4ce7.camel@perches.com> References: <20220818125844.60762-1-joetalbott@gmail.com> <72bbd0126162b7f78291d3431d2a8c6730cc4ce7.camel@perches.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 Aug 2022 20:08:27 -0400 Joe Perches wrote: > On Thu, 2022-08-18 at 08:58 -0400, Joe Simmons-Talbott wrote: > > Add a mask variable to hold dereferences that span multiple lines. > > Found with checkpatch.pl. > [] > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c > [] > > @@ -1301,10 +1302,9 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev, > > return ret; > > attrcount += ret; > > > > + mask = &chan->info_mask_separate_available; > > ret = iio_device_add_info_mask_type_avail(indio_dev, chan, > > - IIO_SEPARATE, > > - &chan-> > > - info_mask_separate_available); > > + IIO_SEPARATE, mask); > > The issue is the conflict between using 30+ character identifiers and 80 column lines. > Perhaps it's better just to use a longer line instead of a temporary. > > ret = iio_device_add_info_mask_type_avail(indio_dev, chan, IIO_SEPARATE, > &chan->info_mask_separate_available); Agreed. Looks nicer to me this way and still under the wider 100 char limit which is appropriate when readability is improved. Some unfortunately long identifiers, that I think got there via evolution. We should consider shortening them that's a job for a separate patch. > [] > > > @@ -1316,10 +1316,9 @@ static int iio_device_add_channel_sysfs(struct iio_dev *indio_dev, > > return ret; > > attrcount += ret; > > > > + mask = &chan->info_mask_shared_by_type_available; > > ret = iio_device_add_info_mask_type_avail(indio_dev, chan, > > - IIO_SHARED_BY_TYPE, > > - &chan-> > > - info_mask_shared_by_type_available); > > + IIO_SHARED_BY_TYPE, mask); > > ret = iio_device_add_info_mask_type_avail(indio_dev, chan, IIO_SHARED_BY_TYPE, > &chan->info_mask_shared_by_type_available); > > etc... > >