Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp432774iog; Fri, 24 Jun 2022 06:56:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1taj8myWiGpr+wAyUetsgu+FuMonR4nh6s7Z42r429TQSxmqXlsG9I6fzbQP2Jx5BuB5Fkx X-Received: by 2002:a17:90a:d98f:b0:1ec:943c:4fbe with SMTP id d15-20020a17090ad98f00b001ec943c4fbemr4146582pjv.161.1656079016584; Fri, 24 Jun 2022 06:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656079016; cv=none; d=google.com; s=arc-20160816; b=RCTIapN1ah+EfiXEknZq2Z2yFUGz+SNXYyZ6tQqDBaW6H3OY8TrlQyq+J2VcjBzift 0pGhkGlQ1mXqPqEV7GPcOudxEEnO0aK+HlcOuRY/tfIW1ZgCMe/9gGdG2k8Y1mJrUxPr 1xGg+dxeq2x25IfnmAygPMMPSPORpOmGJCJCMYv/bw09bPvNUIIFNbJvSdgqjVpj0XN8 24bRZN0sUom6X6MGKqnBqBbmlsA3Lrzt5b9OD1UIfw9CwyVRrP7h3a/R48dpS5lvgqno b/1e9Gs6sWCuGEq3VaB9XEwQS5Ad7DR39MUPDPWWuTZfUOHD2FF6VZ3tFfaEQRCVGfTT M5gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=uymJ5M03ImDFtlhCgGInBn5IKXUXw3qCV4cVjWQVfNc=; b=zLTit2DZEXKOmrorGudQK9h3vcpgHWl0nc8nc7kbApVBsYiz7PipLFg6vUE8WloCsc PJ9Cdj0Z6X1hF+gj5n6QqzUeZ9mU3NPvx9bXODAFftB9FqYzWblpjUE7XTEd2wAGJrZf noUSZqw9wqr3EAUJ9VJs8eyTSN3JrKuR+TFVBL1b8mfhs2atGV87/Ou3k7wE+WhRYz6P Dk7xJ/cKRorqgLL51viER2qBRBpKumxkMeDguD+/+xbh7DFoDUwQSXZT1S/RFoMR5Koy 3Lrrjvom0Z+RWnQkFwAVfOjKcU2kqbjSWf4cno55PDOj5IXfDTqrDosRUmQ23ACDf/xA odRg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a170902b48600b00163efcfadedsi2979363plr.255.2022.06.24.06.56.44; Fri, 24 Jun 2022 06:56:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232178AbiFXNpY convert rfc822-to-8bit (ORCPT + 99 others); Fri, 24 Jun 2022 09:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbiFXNpU (ORCPT ); Fri, 24 Jun 2022 09:45:20 -0400 Received: from relay5.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42AD72619 for ; Fri, 24 Jun 2022 06:45:18 -0700 (PDT) Received: from omf13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8FBE0348F7; Fri, 24 Jun 2022 13:45:16 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf13.hostedemail.com (Postfix) with ESMTPA id 4145220015; Fri, 24 Jun 2022 13:45:15 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 01/12] regmap-irq: Convert bool bitfields to unsigned int From: Joe Perches To: Aidan MacDonald Cc: Mark Brown , Andy Shevchenko , Greg Kroah-Hartman , "Rafael J. Wysocki" , Matti Vaittinen , Linux Kernel Mailing List Date: Fri, 24 Jun 2022 06:45:14 -0700 In-Reply-To: References: <20220623211420.918875-1-aidanmacdonald.0x0@gmail.com> <20220623211420.918875-2-aidanmacdonald.0x0@gmail.com> <4937c0cc9dbc9d06cb626465bd37cbcf76c80a0b.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.1-0ubuntu1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Stat-Signature: oj1mfyszgctb9y5x9ca7yk88ouwo3wmz X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: 4145220015 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX199JvKTOf4Uzq/iWnRzovqBECkde32PCfU= X-HE-Tag: 1656078315-170775 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 Fri, 2022-06-24 at 14:05 +0100, Aidan MacDonald wrote: > Joe Perches writes: > > > On Fri, 2022-06-24 at 13:11 +0100, Mark Brown wrote: > > > On Thu, Jun 23, 2022 at 11:26:10PM +0200, Andy Shevchenko wrote: > > > > On Thu, Jun 23, 2022 at 11:13 PM Aidan MacDonald > > > > > > > > Use 'unsigned int' for bitfields for consistency with most other > > > > > kernel code. > > > > > > > There is no point to convert the fields you are about to remove. > > > > > > > So, either don't touch them or make this patch closer to the end of the series. > > > > > > It costs us nothing to convert them, this isn't a difficult or hard to > > > understand refactoring - the patch is fine the way it is. > > > > Modulo the defects that might be introduced if an overflow occurs. > > > > struct foo { > > unsigned int a:1; > > bool b:1; > > } > > > > Assign a non-zero int without bit 0 set to each and see if > > a and b differ. > > Bool permits implicit pointer-to-bool conversions, so it isn't free > of pitfalls either. Care to describe some of those pitfalls? I can't think of any off the top of my head. > Overflow is probably more dangerous in general, > but here there's little chance of pointers or overflow getting involved. I don't know _this_ code at all, nor have I read it. If all the conversions are just deleted later, then of course it should not be converted at all. I'm just commenting on the proposed refactoring. I'm trying to show that conversions of bool:1->unsigned int:1 as being trivial are not so trivial after all. It's fairly common to have code like: [bool] foo.bar = some_value & SETTING; where some value is tested for a mask/bit and a non-zero is true. So conversions of foo.bar from bool:1 to unsigned int:1 are not wise unless all possible side effects are known.