Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: host: fsl-mph-dr-of: use of_property_read_bool

Use of_property_read_bool to check for the existence of a property.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2,x;
@@
- if (of_get_property(e1,e2,NULL))
- x = true;
- else
- x = false;
+ x = of_property_read_bool(e1,e2);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Julia Lawall and committed by
Greg Kroah-Hartman
72cd194f 740a6a17

+6 -12
+6 -12
drivers/usb/host/fsl-mph-dr-of.c
··· 222 222 pdata->controller_ver = usb_get_ver_info(np); 223 223 224 224 /* Activate Erratum by reading property in device tree */ 225 - if (of_get_property(np, "fsl,usb-erratum-a007792", NULL)) 226 - pdata->has_fsl_erratum_a007792 = 1; 227 - else 228 - pdata->has_fsl_erratum_a007792 = 0; 229 - if (of_get_property(np, "fsl,usb-erratum-a005275", NULL)) 230 - pdata->has_fsl_erratum_a005275 = 1; 231 - else 232 - pdata->has_fsl_erratum_a005275 = 0; 225 + pdata->has_fsl_erratum_a007792 = 226 + of_property_read_bool(np, "fsl,usb-erratum-a007792"); 227 + pdata->has_fsl_erratum_a005275 = 228 + of_property_read_bool(np, "fsl,usb-erratum-a005275"); 233 229 234 230 /* 235 231 * Determine whether phy_clk_valid needs to be checked 236 232 * by reading property in device tree 237 233 */ 238 - if (of_get_property(np, "phy-clk-valid", NULL)) 239 - pdata->check_phy_clk_valid = 1; 240 - else 241 - pdata->check_phy_clk_valid = 0; 234 + pdata->check_phy_clk_valid = 235 + of_property_read_bool(np, "phy-clk-valid"); 242 236 243 237 if (pdata->have_sysif_regs) { 244 238 if (pdata->controller_ver == FSL_USB_VER_NONE) {