Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1337330 > unrolled thread

[PATCH 2/2] net, thunderx: Use bool in structs where possible

Started byRobert Richter <rrichter@caviumnetworks.com>
First post2016-02-18 14:00 +0100
Last post2016-02-22 12:10 +0100
Articles 5 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] net, thunderx: Use bool in structs where possible Robert Richter <rrichter@caviumnetworks.com> - 2016-02-18 14:00 +0100
    Re: [PATCH 2/2] net, thunderx: Use bool in structs where possible David Miller <davem@davemloft.net> - 2016-02-18 17:10 +0100
      Re: [PATCH 2/2] net, thunderx: Use bool in structs where possible Robert Richter <robert.richter@caviumnetworks.com> - 2016-02-18 17:50 +0100
        Re: [PATCH 2/2] net, thunderx: Use bool in structs where possible David Miller <davem@davemloft.net> - 2016-02-18 21:10 +0100
    RE: [PATCH 2/2] net, thunderx: Use bool in structs where possible David Laight <David.Laight@ACULAB.COM> - 2016-02-22 12:10 +0100

#1337330 — [PATCH 2/2] net, thunderx: Use bool in structs where possible

FromRobert Richter <rrichter@caviumnetworks.com>
Date2016-02-18 14:00 +0100
Subject[PATCH 2/2] net, thunderx: Use bool in structs where possible
Message-ID<r3wlB-5Cm-5@gated-at.bofh.it>
From: Robert Richter <rrichter@cavium.com>

Looks like the :1 notation was accidentally introduced (this still
uses 1 byte per flag). Using bool instead, which is the common use.

Signed-off-by: Robert Richter <rrichter@cavium.com>
---
 drivers/net/ethernet/cavium/thunder/nic.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
index 688828865c48..fa5b1d2d8e23 100644
--- a/drivers/net/ethernet/cavium/thunder/nic.h
+++ b/drivers/net/ethernet/cavium/thunder/nic.h
@@ -262,9 +262,9 @@ struct nicvf {
 	struct pci_dev		*pdev;
 	u8			vf_id;
 	u8			node;
-	u8			tns_mode:1;
-	u8			sqs_mode:1;
-	u8			loopback_supported:1;
+	bool			tns_mode;
+	bool                    sqs_mode;
+	bool			loopback_supported;
 	bool			hw_tso;
 	u16			mtu;
 	struct queue_set	*qs;
@@ -353,9 +353,9 @@ struct nic_cfg_msg {
 	u8    msg;
 	u8    vf_id;
 	u8    node_id;
-	u8    tns_mode:1;
-	u8    sqs_mode:1;
-	u8    loopback_supported:1;
+	bool  tns_mode;
+	bool  sqs_mode;
+	bool  loopback_supported;
 	u8    mac_addr[ETH_ALEN];
 };
 
-- 
2.7.0.rc3

[toc] | [next] | [standalone]


#1337492

FromDavid Miller <davem@davemloft.net>
Date2016-02-18 17:10 +0100
Message-ID<r3zjs-84l-15@gated-at.bofh.it>
In reply to#1337330
From: Robert Richter <rrichter@caviumnetworks.com>
Date: Thu, 18 Feb 2016 13:39:09 +0100

> From: Robert Richter <rrichter@cavium.com>
> 
> Looks like the :1 notation was accidentally introduced (this still
> uses 1 byte per flag). Using bool instead, which is the common use.
> 
> Signed-off-by: Robert Richter <rrichter@cavium.com>

Such cleanups are not appropriate for 'net'.  Only real bug fixes should
be targetted that.

Respin these patches targetting the correct tree(s).

[toc] | [prev] | [next] | [standalone]


#1337516

FromRobert Richter <robert.richter@caviumnetworks.com>
Date2016-02-18 17:50 +0100
Message-ID<r3zW9-8pq-9@gated-at.bofh.it>
In reply to#1337492
On 18.02.16 11:05:14, David Miller wrote:
> From: Robert Richter <rrichter@caviumnetworks.com>
> Date: Thu, 18 Feb 2016 13:39:09 +0100
> 
> > From: Robert Richter <rrichter@cavium.com>
> > 
> > Looks like the :1 notation was accidentally introduced (this still
> > uses 1 byte per flag). Using bool instead, which is the common use.
> > 
> > Signed-off-by: Robert Richter <rrichter@cavium.com>
> 
> Such cleanups are not appropriate for 'net'.  Only real bug fixes should
> be targetted that.
> 
> Respin these patches targetting the correct tree(s).

Do you mean posting the two as "trivial" patches?

Thanks,

-Robert

[toc] | [prev] | [next] | [standalone]


#1337663

FromDavid Miller <davem@davemloft.net>
Date2016-02-18 21:10 +0100
Message-ID<r3D3J-2sr-33@gated-at.bofh.it>
In reply to#1337516
From: Robert Richter <robert.richter@caviumnetworks.com>
Date: Thu, 18 Feb 2016 17:42:17 +0100

> On 18.02.16 11:05:14, David Miller wrote:
>> From: Robert Richter <rrichter@caviumnetworks.com>
>> Date: Thu, 18 Feb 2016 13:39:09 +0100
>> 
>> > From: Robert Richter <rrichter@cavium.com>
>> > 
>> > Looks like the :1 notation was accidentally introduced (this still
>> > uses 1 byte per flag). Using bool instead, which is the common use.
>> > 
>> > Signed-off-by: Robert Richter <rrichter@cavium.com>
>> 
>> Such cleanups are not appropriate for 'net'.  Only real bug fixes should
>> be targetted that.
>> 
>> Respin these patches targetting the correct tree(s).
> 
> Do you mean posting the two as "trivial" patches?

No I mean posting #1 targetted at my 'net' GIT tree as a bug fix,
and posting #2 targetted separately at my 'net-next' GIT tree as
a cleanup.

This is how we've been doing things for more than a decade.

[toc] | [prev] | [next] | [standalone]


#1339344

FromDavid Laight <David.Laight@ACULAB.COM>
Date2016-02-22 12:10 +0100
Message-ID<r4Wxj-4RK-7@gated-at.bofh.it>
In reply to#1337330
From: Robert Richter
> Sent: 18 February 2016 12:39
> From: Robert Richter <rrichter@cavium.com>
> 
> Looks like the :1 notation was accidentally introduced (this still
> uses 1 byte per flag). Using bool instead, which is the common use.
> 
> Signed-off-by: Robert Richter <rrichter@cavium.com>
> ---
>  drivers/net/ethernet/cavium/thunder/nic.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h
> index 688828865c48..fa5b1d2d8e23 100644
> --- a/drivers/net/ethernet/cavium/thunder/nic.h
> +++ b/drivers/net/ethernet/cavium/thunder/nic.h
> @@ -262,9 +262,9 @@ struct nicvf {
>  	struct pci_dev		*pdev;
>  	u8			vf_id;
>  	u8			node;
> -	u8			tns_mode:1;
> -	u8			sqs_mode:1;
> -	u8			loopback_supported:1;
> +	bool			tns_mode;
> +	bool                    sqs_mode;
> +	bool			loopback_supported;
>  	bool			hw_tso;
>  	u16			mtu;
>  	struct queue_set	*qs;

If the size of the structure matters, you've just made it two bytes larger.
(Although it looks like there is some padding).

	David

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web