Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2057615rdb; Mon, 9 Oct 2023 11:02:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWbl2ckQ2nQMBrEjBJ5+D/mQ+idrzxocDOUYHKXcoczZn0mcPfFU0fKO6+4HLAqn4IF8Pi X-Received: by 2002:a17:902:d50c:b0:1c8:75d9:f7dc with SMTP id b12-20020a170902d50c00b001c875d9f7dcmr17621126plg.28.1696874534314; Mon, 09 Oct 2023 11:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696874534; cv=none; d=google.com; s=arc-20160816; b=tFEzmmYz27maze+PxMO5Ed0bQWCtmcvkYx7BpB9OdoibBBABGxw30cbx8j5wj3SUrN IeIeq27pO9HDuPhlbotwRJ1w38c++5pMAtvKGRsBHtO3vm4iiFY0qzHwcdTopjIpmkNC 5ZetuCbxAR/fvIHuAt2SWYa/rCPKG44lZEAhZs0RC2Cv+SODt4x6z6qoRYJouycacVrj jDqsZmYeSHFD+Xakuot94oRWx2SSku7Wb0TS4IRXULkZKFfBmADlh2SQEJk/hPsMNd7i adM2RSC8zszVIdrofLhb6LwVx8Zyqg2kQPQPdNJuBk7xSdcyAW9BuI6Jk7NIKQ47GKNw e20w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=CIBVQXsnA0W0erqiHcGTS0gNQWv81FUdQVlHJTQQf1E=; fh=ycg7NbgcPP0tkByvuKiUeYocNgXbBcKTIeDWzkF+g6s=; b=ehdv8xYtX0IcKs88m8UCoIMEux0O9MjhYfjIHLNyhWzLDtocz3LTETVfU6qdBc/aNt eduLngz7u6XesaVIF5OD+C96J4REoPPkMKBBFGSGdMqhQwt2GiOv//uwEj53b+tldAG4 zz0QM2sntfBOzfjImwCmBN4L4NB90Dat8xI0d1Xa2g+OP/2JxV8JcKDc223QP1lPvFeM X5Uy41dg6RNBsUBwThAMcdl+5YtCGsNI1YhhLIqgMaB4cvsYB0TEWPnePyq1oZ16u1xm nrQcjcnoqjHhrW4j0WQgBA41r5a5OGTNfh865P3d2lXsEtYMGdnDky9iDHcrRulxWqeK 8Itw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=WhCTEDaI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id d63-20020a633642000000b0058988dc95d0si7750620pga.557.2023.10.09.11.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:02:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=WhCTEDaI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id E6BD28051198; Mon, 9 Oct 2023 11:02:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377392AbjJISCA (ORCPT + 99 others); Mon, 9 Oct 2023 14:02:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376857AbjJISB6 (ORCPT ); Mon, 9 Oct 2023 14:01:58 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D67D39D for ; Mon, 9 Oct 2023 11:01:56 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2b95d5ee18dso57919951fa.1 for ; Mon, 09 Oct 2023 11:01:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1696874515; x=1697479315; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CIBVQXsnA0W0erqiHcGTS0gNQWv81FUdQVlHJTQQf1E=; b=WhCTEDaIUqBIMs3KFSQ8yzatL7D+AdVRPsAONP4cowP8Ui9fKLCIr/ZQLFqPos2JiF ubqDrwIKJDfOm+F8oM4Pn2VbzvZnQiOc8/JLzC4rZOz7B6n7P36lmm/y1Yoc/ABgb1Oy dzrxmW+fpv1GMvDZR6JfAYIdEPNdllC1NVYTOfM9Bmk+nIENPj93QggAkhih7qQ+rmJu CRuPXOB8WN1mY/SCu9IQ9RGotKnbsCSvRSmOPhBSeHFIgxm/PPPH4grz8vFkUZRe/7q0 vWQPOCbbBITZzn4tNPW1gp9crvHSIJsl1lTzvN/Pkb0PVe4l1FCDAXyVz/r6tD2J3kO9 4yPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696874515; x=1697479315; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CIBVQXsnA0W0erqiHcGTS0gNQWv81FUdQVlHJTQQf1E=; b=JyqR07JyzoYLw1rS0chigXRcil8pGUHw9SlZsyU6xuDr2imwW4EXZkt9r8b9qMzGRG ILKCftONglxP1WDAxX4Xcg4BxGxhqPqtaT/PoqtSW+UGDn5tOYFSZXyAya+IXna+SM4G ijukMrL7x7/yevfxSIaW6IcK0qhahSEVqYVJNSyVn+nB0kYf3EbcIq6LVloQtj2sJgik 6C1pefum32roXW4BssJXZtzRAFb786FEAjaQiKKyGSSMRQJlrl712z3MbJCRQZ1gcys6 b786kyGfPxQmx9AbJbJoWXvZ2W3VPWUrscWG3vdqzJ50SNGTVu64HPXk5swN92DKsIPN tR4g== X-Gm-Message-State: AOJu0Yz2mq0lQ2hp0J6hmWlIRSQU+hzIkFMocvnF5cLEXNJh0R44yy9u hxX6IbP/xuwfuvEiwos4cwQ5GjsPkNUgfKLOQBKG+A== X-Received: by 2002:a05:651c:10e:b0:2bc:c650:81b with SMTP id a14-20020a05651c010e00b002bcc650081bmr13486770ljb.15.1696874514922; Mon, 09 Oct 2023 11:01:54 -0700 (PDT) MIME-Version: 1.0 References: <20231009165741.746184-1-max.kellermann@ionos.com> <2023100943-anew-choking-5954@gregkh> In-Reply-To: <2023100943-anew-choking-5954@gregkh> From: Max Kellermann Date: Mon, 9 Oct 2023 20:01:43 +0200 Message-ID: Subject: Re: [PATCH 1/7] drivers/rtc/sysfs: move code to count_attribute_groups() To: Greg KH Cc: Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 09 Oct 2023 11:02:12 -0700 (PDT) X-Spam-Level: ** On Mon, Oct 9, 2023 at 7:24=E2=80=AFPM Greg KH = wrote: > What 3 different purposes? The variable gets initialized 3 times with different (unrelated) values: 1. count old rtc->dev.groups 2. count grps 3. allocate new rtc->dev.groups This coding style is confusing and error prone. The code gets simpler with this patch, because the cognitive load of understanding a "count_attribute_groups()" call is lower than reading the "while" loop and figuring out why it's there. But I really wrote this patch because after making "rtc->dev.groups" const, I cannot any longer assign it to "groups", because that variable must remain non-const.