Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d796cab0 authored by Mayank Rana's avatar Mayank Rana
Browse files

dwc3-msm: Use __ffs() API instead of ffs() API



commit a247baee ("dwc3-msm: Add __iomem markings where needed")
added usage of ffs() API which results into wrong mask being used
while checking status of USB controller using DWC3_GDBGLTSSM register.
ffs() API always return 1-based bit position. Hence use __ffs() API
instead of ffs() API since we need 0-based bit position of the first
bit set to determine the shift amount.

Also replace other instances of find_first_bit() API by __ffs() API.

CRs-Fixed: 2075351
Change-Id: Ie4d81d52901e0270ca42834874c14a3b211590a6
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent a262fffa
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2015, 2017 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -129,7 +129,7 @@ static inline void msm_dbm_write_ep_reg_field(struct dbm *dbm,
					      enum dbm_reg reg, int ep,
					      const u32 mask, u32 val)
{
	u32 shift = find_first_bit((void *)&mask, 32);
	u32 shift = __ffs(mask);
	u32 offset = dbm->reg_table[reg].offset +
			(dbm->reg_table[reg].ep_mult * ep);
	u32 tmp = ioread32(dbm->base + offset);
+2 −2
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ static inline u32 dwc3_msm_read_reg_field(void __iomem *base,
					  u32 offset,
					  const u32 mask)
{
	u32 shift = ffs(mask);
	u32 shift = __ffs(mask);
	u32 val = ioread32(base + offset);

	val &= mask;		/* clear other bits */
@@ -353,7 +353,7 @@ static inline void dwc3_msm_write_reg(void __iomem *base, u32 offset, u32 val)
static inline void dwc3_msm_write_reg_field(void __iomem *base, u32 offset,
					    const u32 mask, u32 val)
{
	u32 shift = find_first_bit((void *)&mask, 32);
	u32 shift = __ffs(mask);
	u32 tmp = ioread32(base + offset);

	tmp &= ~mask;		/* clear written bits */