[PATCH] Staging: drivers: Bool initializations should use true/false

Daniel Baluta daniel.baluta at gmail.com
Wed Mar 4 07:01:43 EET 2015


On Wed, Mar 4, 2015 at 1:39 AM, Cristina Opriceana
<cristina.opriceana at gmail.com> wrote:
> This patch replaces bool initializations of 1/0 with true/false in order
> to increase readability and respect the standards. Warning found by
> coccinelle.
>
> Signed-off-by: Cristina Opriceana <cristina.opriceana at gmail.com>
> ---
>  drivers/staging/ft1000/ft1000-usb/ft1000_debug.c       | 4 ++--
>  drivers/staging/lustre/lustre/llite/llite_mmap.c       | 2 +-
>  drivers/staging/rtl8192u/ieee80211/dot11d.c            | 2 +-
>  drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c      | 2 +-
>  drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 4 ++--
>  drivers/staging/rtl8192u/r8192U_core.c                 | 2 +-
>  drivers/staging/rtl8192u/r8192U_dm.c                   | 4 ++--
>  drivers/staging/vt6655/rxtx.c                          | 4 ++--
>  8 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> index da34257..0f776d0 100644
> --- a/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
> @@ -544,7 +544,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
>                 if (ft1000dev->fProvComplete == 0)
>                         return -EACCES;
>
> -               ft1000dev->fAppMsgPend = 1;
> +               ft1000dev->fAppMsgPend = true;
>
>                 if (info->CardReady) {
>
> @@ -719,7 +719,7 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
>                 result = -ENOTTY;
>                 break;
>         }
> -       ft1000dev->fAppMsgPend = 0;
> +       ft1000dev->fAppMsgPend = false;
>         return result;
>  }
>
> diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c
> index ab07959..a90214b 100644
> --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c
> +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c
> @@ -312,7 +312,7 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf)
>                 vio->u.fault.ft_vmpage    = NULL;
>                 vio->u.fault.fault.ft_vmf = vmf;
>                 vio->u.fault.fault.ft_flags = 0;
> -               vio->u.fault.fault.ft_flags_valid = 0;
> +               vio->u.fault.fault.ft_flags_valid = false;
>
>                 result = cl_io_loop(env, io);
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.c b/drivers/staging/rtl8192u/ieee80211/dot11d.c
> index 90ace79..82d6038 100644
> --- a/drivers/staging/rtl8192u/ieee80211/dot11d.c
> +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.c
> @@ -6,7 +6,7 @@ void Dot11d_Init(struct ieee80211_device *ieee)
>  {
>         PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(ieee);
>
> -       pDot11dInfo->bEnabled = 0;
> +       pDot11dInfo->bEnabled = false;
>
>         pDot11dInfo->State = DOT11D_STATE_NONE;
>         pDot11dInfo->CountryIeLen = 0;
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> index 286b71d..d2c2fb8 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> @@ -943,7 +943,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
>                 if(net_ratelimit())
>                 printk("find HTCControl\n");
>                 hdrlen += 4;
> -               rx_stats->bContainHTC = 1;
> +               rx_stats->bContainHTC = true;
>         }
>
>         //IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> index 3a54071..1cc66a1 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> @@ -1371,7 +1371,7 @@ static void ieee80211_associate_complete_wq(struct work_struct *work)
>         else if(ieee->is_silent_reset == 1)
>         {
>                 printk("==================>silent reset associate\n");
> -               ieee->is_silent_reset = 0;
> +               ieee->is_silent_reset = false;
>         }
>
>         if (ieee->data_hard_resume)
> @@ -2719,7 +2719,7 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
>         ieee->sta_edca_param[2] = 0x005E4342;
>         ieee->sta_edca_param[3] = 0x002F3262;
>         ieee->aggregation = true;
> -       ieee->enable_rx_imm_BA = 1;
> +       ieee->enable_rx_imm_BA = true;
>         ieee->tx_pending.txb = NULL;
>
>         setup_timer(&ieee->associate_timer, ieee80211_associate_abort_cb,
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index 9de4412..7f0ace1 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -2143,7 +2143,7 @@ static void rtl8192_init_priv_variable(struct net_device *dev)
>         //for silent reset
>         priv->IrpPendingCount = 1;
>         priv->ResetProgress = RESET_TYPE_NORESET;
> -       priv->bForcedSilentReset = 0;
> +       priv->bForcedSilentReset = false;
>         priv->bDisableNormalResetCheck = false;
>         priv->force_reset = false;
>
> diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
> index 7199616..167d3b1 100644
> --- a/drivers/staging/rtl8192u/r8192U_dm.c
> +++ b/drivers/staging/rtl8192u/r8192U_dm.c
> @@ -2419,9 +2419,9 @@ void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
>         /* Check Bit 0-3, it means if RF A-D is enabled. */
>         for (i = 0; i < RF90_PATH_MAX; i++) {
>                 if (rfpath & (0x01<<i))
> -                       priv->brfpath_rxenable[i] = 1;
> +                       priv->brfpath_rxenable[i] = true;
>                 else
> -                       priv->brfpath_rxenable[i] = 0;
> +                       priv->brfpath_rxenable[i] = false;
>         }
>         if (!DM_RxPathSelTable.Enable)
>                 return;
> diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
> index ac8c8b5..2b4f005 100644
> --- a/drivers/staging/vt6655/rxtx.c
> +++ b/drivers/staging/vt6655/rxtx.c
> @@ -248,11 +248,11 @@ s_uGetDataDuration(
>         unsigned char byFBOption
>  )
>  {
> -       bool bLastFrag = 0;
> +       bool bLastFrag = false;
>         unsigned int uAckTime = 0, uNextPktTime = 0;
>
>         if (uFragIdx == (uMACfragNum-1))
> -               bLastFrag = 1;
> +               bLastFrag = true;
>
>         switch (byDurType) {
>         case DATADUR_B:    //DATADUR_B


Looks good to me. Make sure you have the latest version of Greg's
staging git tree.

https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/commit/?h=staging-testing


Use staging-testing branch.

thanks,
Daniel.


More information about the firefly mailing list