All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Joe Perches' <joe@perches.com>,
	Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Cc: Mark Brown <broonie@kernel.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Matti Vaittinen <mazziesaccount@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2 01/12] regmap-irq: Convert bool bitfields to unsigned int
Date: Fri, 24 Jun 2022 14:28:55 +0000	[thread overview]
Message-ID: <b9da7e05ce96443cacc1df9b2672eb51@AcuMS.aculab.com> (raw)
In-Reply-To: <ca26910886a765dd7edc4815ef90bedbd0f99a95.camel@perches.com>

From: Joe Perches 
> Sent: 24 June 2022 14:45
...
> 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.

I can never decide whether:
	bool_c = bool_a & bool_b;
can be compiled to a simple 'and' instruction, or requires a
load of instructions in case bool_a and/or bool_b has a non-zero
value without the bottom bit set.

All other C types are cpu register types - so you know what happens.
IMHO bool is an abomination and should not be used :-)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2022-06-24 14:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 21:14 [PATCH v2 00/12] regmap-irq cleanups and refactoring Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 01/12] regmap-irq: Convert bool bitfields to unsigned int Aidan MacDonald
2022-06-23 21:26   ` Andy Shevchenko
2022-06-24 12:11     ` Mark Brown
2022-06-24 12:46       ` Joe Perches
2022-06-24 12:56         ` Mark Brown
2022-06-24 13:05         ` Aidan MacDonald
2022-06-24 13:45           ` Joe Perches
2022-06-24 14:28             ` David Laight [this message]
2022-06-24 14:31             ` Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 02/12] regmap-irq: Remove unused type_reg_stride field Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 03/12] regmap-irq: Cleanup sizeof(...) use in memory allocation Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 04/12] regmap-irq: Remove an unnecessary restriction on type_in_mask Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 05/12] regmap-irq: Remove inappropriate uses of regmap_irq_update_bits() Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 06/12] regmap-irq: Remove mask_writeonly and regmap_irq_update_bits() Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 07/12] regmap-irq: Refactor checks for status bulk read support Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 08/12] regmap-irq: Introduce config registers for irq types Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 09/12] regmap-irq: Deprecate type registers and virtual registers Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 10/12] regmap-irq: Fix inverted handling of unmask registers Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 11/12] regmap-irq: Add get_irq_reg() callback Aidan MacDonald
     [not found]   ` <CGME20220701163330eucas1p13456e7757d9d2bc8d0aa35c16f143590@eucas1p1.samsung.com>
2022-07-01 16:33     ` Marek Szyprowski
2022-07-03 11:06       ` Aidan MacDonald
2022-06-23 21:14 ` [PATCH v2 12/12] regmap-irq: Deprecate the not_fixed_stride flag Aidan MacDonald
2022-06-30 17:27 ` [PATCH v2 00/12] regmap-irq cleanups and refactoring Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9da7e05ce96443cacc1df9b2672eb51@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=aidanmacdonald.0x0@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.