All of lore.kernel.org
 help / color / mirror / Atom feed
From: monstr@monstr.eu (Michal Simek)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next] ethernet: Use bool function returns of true/false instead of 1/0
Date: Tue, 31 Mar 2015 13:10:38 +0200	[thread overview]
Message-ID: <551A80AE.7020506@monstr.eu> (raw)
In-Reply-To: <1427678712.2715.52.camel@perches.com>

On 03/30/2015 03:25 AM, Joe Perches wrote:
> Use bool constants as the return values instead of 1 and 0.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>> To be honest I'd might rather get bunches of these, there has to be a ton
>> of them, than a slow trickle of one every few weeks/days.
> 
> There aren't too many...
> 
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +-
>  drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 ++--
>  drivers/net/ethernet/xilinx/xilinx_emaclite.c    | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> index 039b0c1..9980912 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> @@ -11610,7 +11610,7 @@ static bool bnx2x_get_dropless_info(struct bnx2x *bp)
>  	u32 cfg;
>  
>  	if (IS_VF(bp))
> -		return 0;
> +		return false;
>  
>  	if (IS_MF(bp) && !CHIP_IS_E1x(bp)) {
>  		/* Take function: tmp = func */
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> index 02ffb30..ccaecb1 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> @@ -1351,7 +1351,7 @@ static bool reg_pattern_test(struct ixgbe_adapter *adapter, u64 *data, int reg,
>  
>  	if (ixgbe_removed(adapter->hw.hw_addr)) {
>  		*data = 1;
> -		return 1;
> +		return true;
>  	}
>  	for (pat = 0; pat < ARRAY_SIZE(test_pattern); pat++) {
>  		before = ixgbe_read_reg(&adapter->hw, reg);
> @@ -1376,7 +1376,7 @@ static bool reg_set_and_check(struct ixgbe_adapter *adapter, u64 *data, int reg,
>  
>  	if (ixgbe_removed(adapter->hw.hw_addr)) {
>  		*data = 1;
> -		return 1;
> +		return true;
>  	}
>  	before = ixgbe_read_reg(&adapter->hw, reg);
>  	ixgbe_write_reg(&adapter->hw, reg, write & mask);
> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> index 2111b91..6008eee 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> @@ -1062,7 +1062,7 @@ static bool get_bool(struct platform_device *ofdev, const char *s)
>  	} else {
>  		dev_warn(&ofdev->dev, "Parameter %s not found,"
>  			"defaulting to false\n", s);
> -		return 0;
> +		return false;
>  	}
>  }

Kernel-doc should be also fixed in spite of this whole function is just
broken and binding should be fixed to use of_property_read_bool for
these properties.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150331/a20eff93/attachment-0001.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Michal Simek <monstr@monstr.eu>
To: Joe Perches <joe@perches.com>, David Miller <davem@davemloft.net>
Cc: fengguang.wu@intel.com, varun@chelsio.com, kbuild-all@01.org,
	hariprasad@chelsio.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Ariel Elior" <ariel.elior@qlogic.com>,
	"Jeff Kirsher" <jeffrey.t.kirsher@intel.com>,
	"Jesse Brandeburg" <jesse.brandeburg@intel.com>,
	"Bruce Allan" <bruce.w.allan@intel.com>,
	"Carolyn Wyborny" <carolyn.wyborny@intel.com>,
	"Don Skidmore" <donald.c.skidmore@intel.com>,
	"Greg Rose" <gregory.v.rose@intel.com>,
	"Matthew Vick" <matthew.vick@intel.com>,
	"John Ronciak" <john.ronciak@intel.com>,
	"Mitch Williams" <mitch.a.williams@intel.com>,
	"Linux NICS" <linux.nics@intel.com>,
	"Michal Simek" <michal.simek@xilinx.com>,
	"Sören Brinkmann" <soren.brinkmann@xilinx.com>,
	e1000-devel@lists.sourceforge.net,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH net-next] ethernet: Use bool function returns of true/false instead of 1/0
Date: Tue, 31 Mar 2015 13:10:38 +0200	[thread overview]
Message-ID: <551A80AE.7020506@monstr.eu> (raw)
In-Reply-To: <1427678712.2715.52.camel@perches.com>

[-- Attachment #1: Type: text/plain, Size: 2989 bytes --]

On 03/30/2015 03:25 AM, Joe Perches wrote:
> Use bool constants as the return values instead of 1 and 0.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>> To be honest I'd might rather get bunches of these, there has to be a ton
>> of them, than a slow trickle of one every few weeks/days.
> 
> There aren't too many...
> 
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +-
>  drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 ++--
>  drivers/net/ethernet/xilinx/xilinx_emaclite.c    | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> index 039b0c1..9980912 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
> @@ -11610,7 +11610,7 @@ static bool bnx2x_get_dropless_info(struct bnx2x *bp)
>  	u32 cfg;
>  
>  	if (IS_VF(bp))
> -		return 0;
> +		return false;
>  
>  	if (IS_MF(bp) && !CHIP_IS_E1x(bp)) {
>  		/* Take function: tmp = func */
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> index 02ffb30..ccaecb1 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
> @@ -1351,7 +1351,7 @@ static bool reg_pattern_test(struct ixgbe_adapter *adapter, u64 *data, int reg,
>  
>  	if (ixgbe_removed(adapter->hw.hw_addr)) {
>  		*data = 1;
> -		return 1;
> +		return true;
>  	}
>  	for (pat = 0; pat < ARRAY_SIZE(test_pattern); pat++) {
>  		before = ixgbe_read_reg(&adapter->hw, reg);
> @@ -1376,7 +1376,7 @@ static bool reg_set_and_check(struct ixgbe_adapter *adapter, u64 *data, int reg,
>  
>  	if (ixgbe_removed(adapter->hw.hw_addr)) {
>  		*data = 1;
> -		return 1;
> +		return true;
>  	}
>  	before = ixgbe_read_reg(&adapter->hw, reg);
>  	ixgbe_write_reg(&adapter->hw, reg, write & mask);
> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> index 2111b91..6008eee 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> @@ -1062,7 +1062,7 @@ static bool get_bool(struct platform_device *ofdev, const char *s)
>  	} else {
>  		dev_warn(&ofdev->dev, "Parameter %s not found,"
>  			"defaulting to false\n", s);
> -		return 0;
> +		return false;
>  	}
>  }

Kernel-doc should be also fixed in spite of this whole function is just
broken and binding should be fixed to use of_property_read_bool for
these properties.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  parent reply	other threads:[~2015-03-31 11:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201503260524.AdqSbov9%fengguang.wu@intel.com>
2015-03-25 21:55 ` [PATCH] cxgb4: fix boolreturn.cocci warnings kbuild test robot
2015-03-25 22:14   ` Joe Perches
2015-03-29 19:16   ` David Miller
2015-03-30  1:25     ` [PATCH net-next] ethernet: Use bool function returns of true/false instead of 1/0 Joe Perches
2015-03-30  1:25       ` Joe Perches
2015-03-30  1:29       ` [PATCH net-next] wireless: " Joe Perches
2015-03-30  1:46         ` Larry Finger
2015-03-30  1:46           ` Larry Finger
2015-03-30  1:49           ` Joe Perches
2015-03-30  1:49             ` Joe Perches
2015-04-07 17:11         ` [net-next] wireless: Use bool function returns of true/false insteadof 1/0 Kalle Valo
2015-04-07 17:11           ` Kalle Valo
2015-03-30 20:28       ` [PATCH net-next] ethernet: Use bool function returns of true/false instead of 1/0 Jeff Kirsher
2015-03-30 20:28         ` Jeff Kirsher
2015-03-31 11:10       ` Michal Simek [this message]
2015-03-31 11:10         ` Michal Simek
2015-03-31 19:49         ` Joe Perches
2015-03-31 18:10       ` David Miller
2015-03-31 18:10         ` David Miller
2015-03-31 18:10         ` David Miller

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=551A80AE.7020506@monstr.eu \
    --to=monstr@monstr.eu \
    --cc=linux-arm-kernel@lists.infradead.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.