mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-12 21:44:06 +08:00
misc: lis3lv02d: Use of_property_read_bool() for boolean properties
It is preferred to use typed property access functions (i.e. of_property_read_<type> functions) rather than low-level of_get_property/of_find_property functions for reading properties. Convert reading boolean properties to to of_property_read_bool(). Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20230310144713.1543683-1-robh@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d7d744abc0
commit
536e2fce89
@ -965,19 +965,19 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
|
||||
if (!pdata)
|
||||
return -ENOMEM;
|
||||
|
||||
if (of_get_property(np, "st,click-single-x", NULL))
|
||||
if (of_property_read_bool(np, "st,click-single-x"))
|
||||
pdata->click_flags |= LIS3_CLICK_SINGLE_X;
|
||||
if (of_get_property(np, "st,click-double-x", NULL))
|
||||
if (of_property_read_bool(np, "st,click-double-x"))
|
||||
pdata->click_flags |= LIS3_CLICK_DOUBLE_X;
|
||||
|
||||
if (of_get_property(np, "st,click-single-y", NULL))
|
||||
if (of_property_read_bool(np, "st,click-single-y"))
|
||||
pdata->click_flags |= LIS3_CLICK_SINGLE_Y;
|
||||
if (of_get_property(np, "st,click-double-y", NULL))
|
||||
if (of_property_read_bool(np, "st,click-double-y"))
|
||||
pdata->click_flags |= LIS3_CLICK_DOUBLE_Y;
|
||||
|
||||
if (of_get_property(np, "st,click-single-z", NULL))
|
||||
if (of_property_read_bool(np, "st,click-single-z"))
|
||||
pdata->click_flags |= LIS3_CLICK_SINGLE_Z;
|
||||
if (of_get_property(np, "st,click-double-z", NULL))
|
||||
if (of_property_read_bool(np, "st,click-double-z"))
|
||||
pdata->click_flags |= LIS3_CLICK_DOUBLE_Z;
|
||||
|
||||
if (!of_property_read_u32(np, "st,click-threshold-x", &val))
|
||||
@ -994,31 +994,31 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
|
||||
if (!of_property_read_u32(np, "st,click-window", &val))
|
||||
pdata->click_window = val;
|
||||
|
||||
if (of_get_property(np, "st,irq1-disable", NULL))
|
||||
if (of_property_read_bool(np, "st,irq1-disable"))
|
||||
pdata->irq_cfg |= LIS3_IRQ1_DISABLE;
|
||||
if (of_get_property(np, "st,irq1-ff-wu-1", NULL))
|
||||
if (of_property_read_bool(np, "st,irq1-ff-wu-1"))
|
||||
pdata->irq_cfg |= LIS3_IRQ1_FF_WU_1;
|
||||
if (of_get_property(np, "st,irq1-ff-wu-2", NULL))
|
||||
if (of_property_read_bool(np, "st,irq1-ff-wu-2"))
|
||||
pdata->irq_cfg |= LIS3_IRQ1_FF_WU_2;
|
||||
if (of_get_property(np, "st,irq1-data-ready", NULL))
|
||||
if (of_property_read_bool(np, "st,irq1-data-ready"))
|
||||
pdata->irq_cfg |= LIS3_IRQ1_DATA_READY;
|
||||
if (of_get_property(np, "st,irq1-click", NULL))
|
||||
if (of_property_read_bool(np, "st,irq1-click"))
|
||||
pdata->irq_cfg |= LIS3_IRQ1_CLICK;
|
||||
|
||||
if (of_get_property(np, "st,irq2-disable", NULL))
|
||||
if (of_property_read_bool(np, "st,irq2-disable"))
|
||||
pdata->irq_cfg |= LIS3_IRQ2_DISABLE;
|
||||
if (of_get_property(np, "st,irq2-ff-wu-1", NULL))
|
||||
if (of_property_read_bool(np, "st,irq2-ff-wu-1"))
|
||||
pdata->irq_cfg |= LIS3_IRQ2_FF_WU_1;
|
||||
if (of_get_property(np, "st,irq2-ff-wu-2", NULL))
|
||||
if (of_property_read_bool(np, "st,irq2-ff-wu-2"))
|
||||
pdata->irq_cfg |= LIS3_IRQ2_FF_WU_2;
|
||||
if (of_get_property(np, "st,irq2-data-ready", NULL))
|
||||
if (of_property_read_bool(np, "st,irq2-data-ready"))
|
||||
pdata->irq_cfg |= LIS3_IRQ2_DATA_READY;
|
||||
if (of_get_property(np, "st,irq2-click", NULL))
|
||||
if (of_property_read_bool(np, "st,irq2-click"))
|
||||
pdata->irq_cfg |= LIS3_IRQ2_CLICK;
|
||||
|
||||
if (of_get_property(np, "st,irq-open-drain", NULL))
|
||||
if (of_property_read_bool(np, "st,irq-open-drain"))
|
||||
pdata->irq_cfg |= LIS3_IRQ_OPEN_DRAIN;
|
||||
if (of_get_property(np, "st,irq-active-low", NULL))
|
||||
if (of_property_read_bool(np, "st,irq-active-low"))
|
||||
pdata->irq_cfg |= LIS3_IRQ_ACTIVE_LOW;
|
||||
|
||||
if (!of_property_read_u32(np, "st,wu-duration-1", &val))
|
||||
@ -1026,32 +1026,32 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
|
||||
if (!of_property_read_u32(np, "st,wu-duration-2", &val))
|
||||
pdata->duration2 = val;
|
||||
|
||||
if (of_get_property(np, "st,wakeup-x-lo", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup-x-lo"))
|
||||
pdata->wakeup_flags |= LIS3_WAKEUP_X_LO;
|
||||
if (of_get_property(np, "st,wakeup-x-hi", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup-x-hi"))
|
||||
pdata->wakeup_flags |= LIS3_WAKEUP_X_HI;
|
||||
if (of_get_property(np, "st,wakeup-y-lo", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup-y-lo"))
|
||||
pdata->wakeup_flags |= LIS3_WAKEUP_Y_LO;
|
||||
if (of_get_property(np, "st,wakeup-y-hi", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup-y-hi"))
|
||||
pdata->wakeup_flags |= LIS3_WAKEUP_Y_HI;
|
||||
if (of_get_property(np, "st,wakeup-z-lo", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup-z-lo"))
|
||||
pdata->wakeup_flags |= LIS3_WAKEUP_Z_LO;
|
||||
if (of_get_property(np, "st,wakeup-z-hi", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup-z-hi"))
|
||||
pdata->wakeup_flags |= LIS3_WAKEUP_Z_HI;
|
||||
if (of_get_property(np, "st,wakeup-threshold", &val))
|
||||
pdata->wakeup_thresh = val;
|
||||
|
||||
if (of_get_property(np, "st,wakeup2-x-lo", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup2-x-lo"))
|
||||
pdata->wakeup_flags2 |= LIS3_WAKEUP_X_LO;
|
||||
if (of_get_property(np, "st,wakeup2-x-hi", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup2-x-hi"))
|
||||
pdata->wakeup_flags2 |= LIS3_WAKEUP_X_HI;
|
||||
if (of_get_property(np, "st,wakeup2-y-lo", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup2-y-lo"))
|
||||
pdata->wakeup_flags2 |= LIS3_WAKEUP_Y_LO;
|
||||
if (of_get_property(np, "st,wakeup2-y-hi", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup2-y-hi"))
|
||||
pdata->wakeup_flags2 |= LIS3_WAKEUP_Y_HI;
|
||||
if (of_get_property(np, "st,wakeup2-z-lo", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup2-z-lo"))
|
||||
pdata->wakeup_flags2 |= LIS3_WAKEUP_Z_LO;
|
||||
if (of_get_property(np, "st,wakeup2-z-hi", NULL))
|
||||
if (of_property_read_bool(np, "st,wakeup2-z-hi"))
|
||||
pdata->wakeup_flags2 |= LIS3_WAKEUP_Z_HI;
|
||||
if (of_get_property(np, "st,wakeup2-threshold", &val))
|
||||
pdata->wakeup_thresh2 = val;
|
||||
@ -1073,9 +1073,9 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)
|
||||
}
|
||||
}
|
||||
|
||||
if (of_get_property(np, "st,hipass1-disable", NULL))
|
||||
if (of_property_read_bool(np, "st,hipass1-disable"))
|
||||
pdata->hipass_ctrl |= LIS3_HIPASS1_DISABLE;
|
||||
if (of_get_property(np, "st,hipass2-disable", NULL))
|
||||
if (of_property_read_bool(np, "st,hipass2-disable"))
|
||||
pdata->hipass_ctrl |= LIS3_HIPASS2_DISABLE;
|
||||
|
||||
if (of_property_read_s32(np, "st,axis-x", &sval) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user