Re: [patch] standardising boolean variables in drivers/net (first phase)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert P. J. Day wrote:
  you should include the subsystem against which this patch applies in
the subject, as in:

  [PATCH] NET:  standardizing ...

and you should also CC that mailing list or maintainer of that
subsystem.

  also, if this is to be the first of many related patches, you might
consider doing a multi-part patch.

On Tue, 30 Oct 2007, Lucas Woods wrote:

First patch here, be gentle, please let me know if I've made a mess of this :)


Phase 1 standardised boolean variables in drivers/net

--
diff --git a/drivers/net/ipg.h b/drivers/net/ipg.h
index d5d092c..f67b29b 100644
--- a/drivers/net/ipg.h
+++ b/drivers/net/ipg.h
@@ -491,37 +491,37 @@ enum ipg_regs {
  */

 /* Miscellaneous Constants. */
-#define   TRUE  1
-#define   FALSE 0
+#define   true  1
+#define   false 0

  there should be no need to define the symbols "true" and "false" as
they should be predefined for variables of type "bool".

@@ -7379,7 +7379,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct
pci_device_id *pre)
 	struct s2io_nic *sp;
 	struct net_device *dev;
 	int i, j, ret;
-	int dma_flag = FALSE;
+	int dma_flag = false;

if a variable is truly going to represent just boolean values, you
might consider redeclaring it as "bool" instead of "int".
+ if you are changing the type of the variable/(return of a function), it is a good idea to check all instances of it to secure it as a boolean and not a multi-state variable. Also it gives you the opportunity to see if it still is needed (or only assigned values and never used).

thanks
Richard Knutsson

-
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux